Hajime Hoshi
3cb9d18fc4
graphics: Bug fix: Too small mipmap
...
Bug: #839
2019-04-07 05:29:46 +09:00
Hajime Hoshi
5195161253
graphics: Remove SetFinalizer at Image
...
Package shareable should take care of this.
Finalizers are called at arbitrary timing in a different goroutine
and might cause tough problems. This might be related to #821 .
2019-02-22 11:08:34 +09:00
Hajime Hoshi
6c47e31f49
graphics: Do nothing at Dispose of a subimage
2019-02-22 00:08:19 +09:00
Hajime Hoshi
9595f7ae26
graphics: Refactoring: Use a value type of bounds instead of a pointer
2019-02-21 23:51:05 +09:00
Hajime Hoshi
5ed6565d1d
graphics: Bug fix: SubImage's SubImage's bounds was wrong
2019-02-21 23:44:57 +09:00
Hajime Hoshi
8f133c443e
graphics: Change the definition of isSubImage
2019-02-21 23:27:40 +09:00
Hajime Hoshi
75a0d109be
graphics: Rename isSubimage -> isSubImage
2019-02-21 23:24:02 +09:00
Hajime Hoshi
8934f8296f
graphics: Bug fix: Don't touch pixelsToSet when disposing a subimage
...
This change also removes finalizer for subimages since this is not
necessary.
Fixes #823
2019-02-21 23:07:11 +09:00
Hajime Hoshi
ef31a6bb21
graphics: Update comments about makeVolatile
2019-02-13 09:47:30 +09:00
Hajime Hoshi
83da4ea112
graphics: Forbid mipmap for a volatile image explicitly
2019-02-13 01:58:08 +09:00
Hajime Hoshi
5990da4844
graphics: Add makeVolatile instead of newVolatileImage
2019-02-13 00:41:26 +09:00
Hajime Hoshi
5fed3d3bed
shareable: Add MakeVolatile
2019-02-13 00:41:24 +09:00
Hajime Hoshi
b962d58097
graphics: Fix comments
2019-02-12 14:36:06 +09:00
Hajime Hoshi
a3eddeb50f
Improve panic messages
2019-02-06 23:43:03 -10:00
Jake Bentvelzen
4cb79888fe
graphics: Clear mipmap map to avoid unnecessary allocation ( #799 )
...
This change uses a pattern that Go 1.11+ compilers can optimize to a clear operation
https://github.com/golang/go/blob/master/doc/go1.11.html#L447
2019-01-27 21:30:30 +09:00
Hajime Hoshi
b5ee209e0b
graphics: Bug fix: Filter was not used when SourceRect is used
2019-01-24 14:22:53 +09:00
Hajime Hoshi
15b13c8b62
graphics: Fix comments to be more precise
2019-01-22 00:18:32 +09:00
Hajime Hoshi
8f3ef39d74
graphics: Fix some comments to adjust 80 chars in one line
2019-01-21 11:58:41 +09:00
Hajime Hoshi
29211238d3
graphics: Misspelling again
2019-01-21 11:24:43 +09:00
Hajime Hoshi
234f29e5f6
graphics: Misspelling
2019-01-21 11:22:35 +09:00
Hajime Hoshi
92d6c6bc58
graphics: Fix documents about DrawImage and ColorM
2019-01-21 11:19:23 +09:00
Hajime Hoshi
aa2919ada4
graphics: Add comments about DrawImage
2019-01-20 03:27:02 +09:00
Hajime Hoshi
10cb0bba5f
graphics: Add documentation about texture atlas size
2019-01-19 22:14:50 +09:00
Hajime Hoshi
c1c0306471
graphics: Update the document about DrawImage
2019-01-19 22:14:04 +09:00
Hajime Hoshi
58cc5cb105
graphics: Better error message for At and Set ( #790 )
2019-01-19 02:59:22 +09:00
Hajime Hoshi
dd59d8ae6e
Fix comments
2019-01-19 02:30:06 +09:00
Hajime Hoshi
107dfe5074
graphics: Improve Set speed
...
On GopherJS, copying a struct is very heavy. This change avoids
copying (color) structs when possible.
2019-01-14 04:25:43 +09:00
Hajime Hoshi
6b110bf99e
graphics: Better implementation of Set
2019-01-14 04:07:26 +09:00
Hajime Hoshi
128e99b6af
graphics: Implement (*Image).Set
2019-01-14 02:25:36 +09:00
Hajime Hoshi
1e1f309a1c
shareable: Add Fill
...
Before introducing Fill, filling an image with a solid color was
implemented by ReplacePixels. When an offscreen image is used, the
offscreen image is not fully cleared or filled with a color and
out of (0,0)-(width,height) region. This causes a glitch thin line
on mobile platforms.
This change adds (*shareable.Image).Fill to fill the whole
framebuffer region of the image.
2019-01-13 02:12:47 +09:00
Hajime Hoshi
d5e6e6893e
graphics: Refactoring
2019-01-13 00:56:33 +09:00
Hajime Hoshi
ea9eac0461
graphics: Add explicit types for documents (godoc.org)
2018-12-24 19:36:41 +09:00
Hajime Hoshi
f1582c2d73
graphics: Add Address representing a sampler address mode
...
Fixes #761
2018-12-24 17:29:31 +09:00
Hajime Hoshi
529cd3376b
graphics: Fix comments about Vertex
2018-12-23 06:14:35 +09:00
Hajime Hoshi
189b8a17e9
graphics: Use source-border check even at DrawTriangles
...
DrawTriangles can now take a sub-image.
2018-12-23 03:24:39 +09:00
Hajime Hoshi
1a54ff34e6
graphics: Forbid nil at ReplacePixels explicitly
2018-11-28 22:26:34 +01:00
Hajime Hoshi
b48d501bc0
graphics: Explicit limitation of indices at DrawTriangles
...
Fixes #728
2018-11-23 19:02:10 +09:00
Hajime Hoshi
7586c660d5
graphics: Change the number of floats for a vertex from 10 to 12
...
This is a preparation for Metal, that forces 4 floats for a vertex
position.
2018-11-17 15:30:11 +09:00
Hajime Hoshi
dfb63852c2
graphics: Refactoring
2018-11-09 01:40:05 +09:00
Hajime Hoshi
9f0d14dd05
graphics: Add tests for #732
2018-11-09 00:48:21 +09:00
Hajime Hoshi
f54bdfa159
Reland: graphics: Bug fix: a sub image's Size was wrong
...
Size() usages are also fixed.
Fixes #732
2018-11-08 12:58:14 +09:00
Hajime Hoshi
27331024af
Revert "graphics: Bug fix: a sub image's Size was wrong"
...
This reverts commit 76ac850f6b
.
Reason: This breaks many examples
2018-11-08 12:19:38 +09:00
Hajime Hoshi
76ac850f6b
graphics: Bug fix: a sub image's Size was wrong
...
Fixes #732
2018-11-08 04:22:19 +09:00
seebs
74e204d952
graphics: Speed up DrawTriangles ( #723 )
...
DrawTriangles is expensive and slow because of massive memory
allocation and garbage collection costs. This patch moves from ~47TPS
on my laptop (with ~24k triangles) to 60TPS. The first part
is just allocating the right size of vertex buffer up front; that
got to about 55TPS. The second part replaces the frequent
allocations of []float32 in Vertex() calls with writing the
desired values into a provided destination slice.
Time spent in drawing triangles for 1,000 frames:
13.07s baseline
11.09s preallocate whole buffer to avoid resizing
6.13s use new PutVertex function
This might need some cleanup, but I think it's good evidence that
the design change is viable.
2018-10-31 10:53:17 +09:00
Hajime Hoshi
ec92f61a3e
graphics: Misspelling
2018-10-29 02:05:59 +09:00
Hajime Hoshi
27ee54b008
graphics: Forbid using a subimage at DrawTriangles ( #727 )
2018-10-29 01:37:59 +09:00
Hajime Hoshi
ce1c616f69
Merge graphics and graphicsutil
2018-10-28 23:03:06 +09:00
Hajime Hoshi
ff54d3b681
Move CompositeMode to graphics package
2018-10-28 21:49:47 +09:00
Hajime Hoshi
06f2052817
Add graphics package and move Filter to graphics
2018-10-28 20:25:52 +09:00
Hajime Hoshi
2da5192510
Rename graphics -> graphicscommand
2018-10-28 20:10:05 +09:00
Hajime Hoshi
3349a2c520
graphics: Add comments
2018-10-28 19:41:39 +09:00
Hajime Hoshi
781554ecb9
graphics: Refactoring
2018-10-28 19:35:01 +09:00
Hajime Hoshi
710f56531f
graphics: Experimental: (*image.Image).SubImage
...
Fixes #722
2018-10-28 02:19:14 +09:00
Hajime Hoshi
41877bba0b
graphics: Add image state check at DrawTriangles
2018-10-28 01:43:28 +09:00
Hajime Hoshi
170f0fcaa9
graphics: Refactoring
2018-10-28 01:39:58 +09:00
Hajime Hoshi
5f04f05cb1
graphics: Add comments
2018-10-26 03:29:20 +09:00
Hajime Hoshi
d3bd858aba
graphics: Bug fix: Mipmap was not invalidated at DrawTriangle
...
Fixes #725
2018-10-26 02:08:18 +09:00
Hajime Hoshi
8b82667df1
graphics: Bug fix: Violating edge pixels with linear filter
...
Fixes #724
2018-10-26 00:48:51 +09:00
Hajime Hoshi
58f4feda8d
graphics: Refactoring (preparing SubImage)
2018-10-25 12:48:24 +09:00
Hajime Hoshi
765af5a7af
gofmt -s -w
2018-10-25 12:47:27 +09:00
Hajime Hoshi
ce60f44490
graphics: Add (*mipmap).original()
2018-10-25 02:11:54 +09:00
Hajime Hoshi
15cad6ed9a
graphics: Rename shareableImages -> mipmap
2018-10-25 02:05:25 +09:00
Hajime Hoshi
022c40aa17
graphics: Move creating mipmap logic to shareableImages
2018-10-25 01:35:34 +09:00
Hajime Hoshi
4cd3e3ae30
Update go.mod/go.sum
2018-10-24 01:16:17 +09:00
Hajime Hoshi
7494b19dea
graphics: Refactoring: Add shareableImages struct
2018-10-24 01:09:59 +09:00
Hajime Hoshi
5e09da1298
graphics: Bug fix: don't apply color matrix when creating mipmap images
...
TODO: Add tests.
Fixes #710
2018-10-11 02:34:07 +09:00
Yuval Langer
8ba787522f
Fix minor typo ( #706 )
2018-10-09 03:19:27 +09:00
Hajime Hoshi
8772d310fe
Revert "Revert "graphics: Fix documentation about DrawImage""
...
This reverts commit f16c7cb90d
.
Reason: Oops, I reverted a wrong commit
2018-08-14 12:27:18 +09:00
Hajime Hoshi
f16c7cb90d
Revert "graphics: Fix documentation about DrawImage"
...
This reverts commit 610bf6e39f
.
Reason: This caused a new black line at the bottom (macOS).
2018-08-14 12:26:28 +09:00
Hajime Hoshi
2360b2930f
graphics: Add DrawTriangles
...
Fixes #624
2018-08-14 01:23:14 +09:00
Hajime Hoshi
610bf6e39f
graphics: Fix documentation about DrawImage
2018-08-11 02:14:37 +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
3daaef2cab
restorable: Refactoring: Use ReplacePixels(nil, ...) for clearing an image
2018-08-09 01:16:46 +09:00
Hajime Hoshi
c68c36b0b7
restoreable: Add ClearState to clear the state explicitly
...
Fixes #566
2018-08-09 00:12:45 +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
bf19f902af
Revert "graphics: Fix DrawImage comment"
...
This reverts commit 8e6314f856
.
2018-08-06 01:44:31 +09:00
Hajime Hoshi
bac0431c9f
graphics: Simplify mipmap calculation
2018-08-03 00:02:49 +09:00
Hajime Hoshi
5c201af311
graphics: Bug fix: compile error
2018-07-31 01:56:59 +09:00
Hajime Hoshi
0956ca0ea6
graphicsutil: Add MipmapLevel
2018-07-31 01:47:03 +09:00
Hajime Hoshi
b8ab1363d2
graphics: Bug fix: mipmap level calculation
2018-07-31 01:02:09 +09:00
Hajime Hoshi
d7d02e6d6a
Reland: graphics: mipmap images should be volatile when the base image is volatile
...
This is not a bug fix, but should improve performance.
2018-07-30 00:26:36 +09:00
Hajime Hoshi
20c8d7317c
graphics: Add comments
2018-07-30 00:02:03 +09:00
Hajime Hoshi
5be58086b5
Revert "graphics: Bug fix: mipmap images should be volatile when the base image is volatile"
...
This reverts commit 0f82330009
.
2018-07-29 23:58:46 +09:00
Hajime Hoshi
0f82330009
graphics: Bug fix: mipmap images should be volatile when the base image is volatile
2018-07-29 23:54:46 +09:00
Hajime Hoshi
8a221a5774
graphics: Use mipmap images for minifying images with linear filter
...
Fixes #578
2018-07-29 23:33:49 +09:00
Hajime Hoshi
8e6314f856
graphics: Fix DrawImage comment
2018-07-26 11:40:01 +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
5249afc06b
graphicsutil: Add QuadIndices
2018-07-21 03:40:37 +09:00
Hajime Hoshi
2e7745044d
shareable: Fix Image.DrawImage to accept vertices and indices
2018-07-21 03:30:27 +09:00
Hajime Hoshi
6c8b7f8e9c
graphics: Refactoring: Reduce error propagations
2018-07-12 03:08:50 +09:00
Hajime Hoshi
840c4d24df
graphicsutil: Accept matrix parameters directly for performance
2018-06-19 00:19:32 +09:00
Hajime Hoshi
ac24a8382f
graphicsutil: Extract matrix applying for performance
2018-06-17 19:45:09 +09:00
Hajime Hoshi
95561bbf6b
affine: Use float32 values for GeoM
...
float32 was slow on GopherJS, but not slow on Wasm.
2018-06-17 15:38:10 +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
e53fa53f7d
graphics: Prefer ReplacePixels to DrawImage for small images
2018-05-03 11:52:04 +09:00
Hajime Hoshi
4d3d407205
graphics: Add comments to At
2018-05-01 18:07:52 +09:00
Hajime Hoshi
63c33b24df
graphics: Refactoring
2018-04-16 01:51:32 +09:00
Hajime Hoshi
008ed26276
graphics: Check isDisposed at (*Image).Clear and Fill
2018-04-08 01:39:06 +09:00
Hajime Hoshi
c62e63f874
graphics: Remove 'filter' argument from newVolatileImage ( #503 )
2018-04-06 03:34:14 +09:00
Hajime Hoshi
7b5ad46e49
shareable: NewImage* now returns a cleared image
2018-04-06 02:08:12 +09:00