Commit Graph

370 Commits

Author SHA1 Message Date
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