Commit Graph

75 Commits

Author SHA1 Message Date
Hajime Hoshi
4bccf9d009 all: use math/rand/v2 2024-09-12 01:17:26 +09:00
bsski
b8df1217c3
all: fix typos (#2864) 2023-12-17 22:42:34 +09:00
Hajime Hoshi
cff64894cc internal/affine: refactoring: use slices instead of array pointers
This doesn't change the performance at the test using ColorM:

```
name           old time/op  new time/op  delta
ColorMScale-8  1.11µs ±43%  1.23µs ±70%   ~     (p=1.000 n=5+5)
```
2022-09-30 22:20:32 +09:00
Hajime Hoshi
298d6488cc internal/affine: add test
Updates #2170
2022-07-01 01:46:37 +09:00
Hajime Hoshi
8cdfa4f66c internal/affine: create a fast path for ChangeHSV
When hue = 0 and saturation = 1, this should be the same as scaling.

Closes #2170
2022-06-30 11:32:12 +09:00
Hajime Hoshi
a9c9e18ff4 internal/graphicscommand: better strings for ColorM 2022-06-30 11:13:02 +09:00
Hajime Hoshi
5cdd2f8bce internal/affine: further optimization to avoid heap allocation
Updates #2119
2022-06-04 15:13:30 +09:00
Hajime Hoshi
ecaa25faba internal/affine: avoid heap allocations by casting a variable to a concrete type
This is a dirty hack but seems efficient.

Closes #2119
2022-06-04 13:18:14 +09:00
r3vit
57c45a13e4
Remove dot imports from tests - Remove dot imports (#1837)
Closes #1824
2021-10-02 19:58:48 +09:00
Hajime Hoshi
64a0577c26 internal/affine: Optimize Scale and Translate 2021-09-13 02:18:07 +09:00
Hajime Hoshi
58ea710a84 internal/affine: Rename UnsafeElements -> Elements as this is no longer unsafe 2021-09-04 18:08:27 +09:00
Hajime Hoshi
8c9ec8fc9f interna/affine: Avoid UnsafeElements at At
Updates #1796
2021-09-04 17:55:51 +09:00
Hajime Hoshi
df710a5c63 internal/affine: Change UnsafeElements to take arguments
This will enable to suppress unnecessary array allocations in the
future.

Updates #1796
2021-09-04 17:38:30 +09:00
Hajime Hoshi
e5c051a437 internal/affine: Refactoring: UnsafeScaleElements -> scaleElements 2021-09-03 23:56:55 +09:00
Hajime Hoshi
59aa41a3c2 internal/affine: Improve ColorM Scale's performance
The benchmark result comparing the previous commit and this commit is this:

```
name           old time/op    new time/op    delta
ColorMScale-8    9.75µs ± 6%    1.30µs ±22%  -86.67%  (p=0.000 n=10+9)

name           old alloc/op   new alloc/op   delta
ColorMScale-8   1.34kB ±100%    1.19kB ±19%     ~     (p=0.421 n=10+8)

name           old allocs/op  new allocs/op  delta
ColorMScale-8      3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=10+10)
```

Updates #1658
2021-07-27 13:45:09 +09:00
Hajime Hoshi
21aa96f9f5 internal/affine: Refactoring: Make ColorM interface 2021-07-27 12:10:22 +09:00
Hajime Hoshi
5f03f4f195 internal/affine: Add coloMImpl interface and colorMImplScale
Closes #1658
2021-07-26 22:18:10 +09:00
Hajime Hoshi
7e5b259dd2 internal/affine: Use a pointer of an array for UnsafeElements 2021-07-26 21:19:53 +09:00
Hajime Hoshi
2c26e85183 internal/affine: Replace isInited with isIdentity 2021-07-26 21:07:51 +09:00
Hajime Hoshi
d0ae73084b internal/affine: Separate ColorM implementation
Updates #1658
2021-07-26 15:21:12 +09:00
Hajime Hoshi
e84506dfc3 internal/affine: Add String 2021-07-26 14:26:59 +09:00
Hajime Hoshi
18757cff16 internal/affine: Refactoring 2021-07-25 22:10:38 +09:00
Hajime Hoshi
040fcd930f Revert "Revert 2 commits using ColorM cache"
This reverts commit dd7a8bc497.

Reason: DrawTriangles worked fine for the reporter's purpose.

Updates #1655
2021-05-30 15:17:11 +09:00
Hajime Hoshi
dd7a8bc497 Revert 2 commits using ColorM cache
This reverts commit 87c8625692.
This reverts commit a6dd6196b4.

Reason: Performance regression (#1655)

Closes #1655
2021-05-30 03:10:00 +09:00
Hajime Hoshi
256adfff9d internal/affine: Add tests
Updates #1474
2021-01-28 02:24:24 +09:00
Hajime Hoshi
a6dd6196b4 internal/affine: Cache scaling ColorM for heuristic optimization
Closes #1474
2021-01-28 02:23:22 +09:00
Hajime Hoshi
14abc28d3a internal/color: Remove Add 2021-01-27 02:37:56 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
6c33ed107f affine: Add more tests for (*ColorM).Invert 2020-07-04 01:58:37 +09:00
Hajime Hoshi
2e8e35750d affine: Refactoring 2020-07-04 01:36:48 +09:00
Gabriel Ochsenhofer
94b5747806
affine: Add functions to invert ColorM (#1233)
Fixes #548
2020-07-04 01:23:47 +09:00
Hajime Hoshi
b65a3d372b affine: Add ColorM.Scale tests 2019-01-23 02:50:30 +09:00
Hajime Hoshi
54019a4735 affine: Improve speed of ScaleOnly 2019-01-23 02:10:59 +09:00
Hajime Hoshi
690c3cf981 graphics: Embed 'scale' part of the color matrix
If the color matrix includes only 'scale' part, they are embedded
into vertices in order to reduce draw calls.

Fixes #662
2018-08-10 23:20:55 +09:00
Hajime Hoshi
77e905eb25 Revert "graphics: Embed color matrices values to vertices (#655)"
This reverts commit 5a9235aaf9.
2018-08-06 01:44:31 +09:00
Hajime Hoshi
9af8e621bd Revert "affine: Refactoring: Unify two element slices into one"
This reverts commit da662b384c.
2018-08-06 01:44:31 +09:00
Hajime Hoshi
da662b384c affine: Refactoring: Unify two element slices into one 2018-07-27 01:51:49 +09:00
Hajime Hoshi
2b4785f863 affine: Remove unused function 2018-07-27 01:23:14 +09:00
Hajime Hoshi
5a9235aaf9
graphics: Embed color matrices values to vertices (#655)
Fixes #531
2018-07-26 11:37:27 +09:00
Hajime Hoshi
e3ab158d7d affine: Allow absence of the translate part 2018-07-21 17:21:55 +09:00
Hajime Hoshi
b4ace53596 affine: Remove GeoM to avoid GeoM allocations on the heap 2018-06-17 00:59:50 +09:00
Hajime Hoshi
61d7f1e9b5 affine: Bug fix: (*GeoM).det() was wrong (#547) 2018-03-12 11:11:53 +09:00
Hajime Hoshi
c2872017ab affine: Add GeoM.Invert, IsInvertible (#547) 2018-03-11 19:13:39 +09:00
Hajime Hoshi
f1ba3e5894 affine: Optimization Equals 2018-03-04 23:23:11 +09:00
Hajime Hoshi
dca60a2520 affine: Make initial affine.GeoM{} value identity (again) 2018-02-28 02:38:57 +09:00
Hajime Hoshi
1a2a108639 affine: Add comments 2018-02-28 02:21:07 +09:00
Hajime Hoshi
ccd9241b07 affine: Refactoring ColorM 2018-02-28 02:14:09 +09:00
Hajime Hoshi
8c8e512059 affine: User nillable pattern for ColorM 2018-02-28 02:14:06 +09:00
Hajime Hoshi
bea63946fc affine: Bug fix: ColorM.Apply was wrong when alpha is 0 2018-02-27 12:16:16 +09:00
Hajime Hoshi
2bd099014b affine: Remove geoMImpl and use nillable pattern 2018-02-27 01:02:53 +09:00