Commit Graph

416 Commits

Author SHA1 Message Date
Hajime Hoshi
52b52e7d92 grpahics: Move DrawImage implementation to mipmap and remove (*mipmap).original() 2019-09-19 11:25:33 +09:00
Hajime Hoshi
e585fda253 grpahics: Move DrawTriangles implementation to mipmap 2019-09-19 11:15:14 +09:00
Hajime Hoshi
504a433540 graphics: Reduce original() usage 2019-09-19 02:27:20 +09:00
Hajime Hoshi
95bc445fea graphics: Refactoring: Remove imports 2019-09-19 02:17:35 +09:00
Hajime Hoshi
e0790ee950 Revert "graphics: Delay draw commands and execute them only when needed"
This reverts commit 0c70823f27.

Reason: Switching apps on Android sometimes broke the screen
2019-09-19 01:18:53 +09:00
Hajime Hoshi
0c70823f27 graphics: Delay draw commands and execute them only when needed
This change introduces a queue for delayed graphics commands.
When an image's pixels are retrieved or the screen is rendered,
Ebiten calculates the set of the necessary draw commands and
execute them.

This reduces the number of draw calls especially for the launching
phase.

Fixes #921
2019-09-19 01:09:48 +09:00
Hajime Hoshi
464713f19d graphics: Refactoring 2019-08-25 22:06:20 +09:00
Hajime Hoshi
3646e7930d graphics: Bug fix: the flag and the enqueueing operation must be protected by a same mutex
It was theoretically possible that an item was enqueued even
though the flag said it should not.
2019-08-25 21:22:54 +09:00
Hajime Hoshi
fc939fabb8 graphics: Bug fix: Copy variables out of the closures 2019-08-25 21:06:44 +09:00
Hajime Hoshi
d2312f1450 shareable: Lock before BeginFrame
This make package shareable more consistent. The mutex is lock
after EndFrame and before BeginFrame, and the similar rule will be
applied at launching (BeginFrame unlocks the lock in any cases).

Instead, package ebiten queues image operations if BeginFrame and
doesn't create provisional non-shared images. This should improve
performance at launching since this reduces the number of draw
calls, especifally for creating new images.

Updates #879.
Updates #921.
2019-08-25 18:12:04 +09:00
Hajime Hoshi
3960a4bbdf restorable: Add (*Image).Fill
This resets the infomation for restoring if possible. This makes
it more efficient to use offscreens.
2019-08-25 02:57:44 +09:00
Hajime Hoshi
b8eeded538 graphics: Remove 'resetRestoringState'
This is basically a revert of 2d079b123f

As filling can happen on a part of a shared image, resetting the
restoring state was wrong.
2019-08-25 02:18:51 +09:00
Hajime Hoshi
e931494c66 shareable: Allocate the screen framebuffer image lazily
This improves consistency.
2019-08-25 00:43:29 +09:00
Hajime Hoshi
ef56d0a535 Refactoring: isRunning -> isImageAvailable 2019-08-25 00:14:37 +09:00
Hajime Hoshi
c49815a2b2 docs: Update the link 2019-08-22 23:16:44 +09:00
Hajime Hoshi
07c484fa49 graphics: Fix documentation 2019-08-21 01:43:08 +09:00
Hajime Hoshi
42d7cce989 graphics: Update docs about (*Image).Dispose
Updates #920
2019-08-19 22:41:45 +09:00
Hajime Hoshi
215e9e5c66 graphics: Fix wrong comments 2019-07-31 01:58:54 +09:00
Hajime Hoshi
fc42af208d graphics: Use 1x1 image for empty images
This change leaves some empty images for DrawTriangles.
2019-07-30 23:11:06 +09:00
Hajime Hoshi
b210339786 graphics: Use 'negative' mipmap when enlarging a too small image
This is a hack to render edges correctly.

This works only when the filter is nearest.

Fixes #611
2019-07-30 23:03:55 +09:00
Hajime Hoshi
2d079b123f restorable: Add ResetRestoringState to reset the state
After Fill command, the image doesn't have to keep the restoring
information. Now Fill command is as same as DrawTriangles, there
is no way for restorable.Image to know whether it can reset the
state or not. ResetRestoringState clears the state explicitly.
2019-07-20 14:04:02 +09:00
Hajime Hoshi
0dc1d0eba5 graphics: Clear/Fill is now implemented with DrawImage
Only clearing the screen still requires the special method.
2019-07-20 04:34:42 +09:00
Hajime Hoshi
801e0c4d47 graphics: Refactoring 2019-07-15 03:10:37 +09:00
Hajime Hoshi
e499535728 graphics: Move functions to the package ebiten 2019-06-26 22:23:09 +09:00
Hajime Hoshi
f40798b586 graphics: Move const definitions to driver package
Let's keep 'graphics' package as a package for utility functions
or testable functions as much as possible.
2019-06-26 01:05:13 +09:00
Hajime Hoshi
f48a72a43e shareable: Refactoring: Remove PutQuadVertices 2019-06-22 21:13:44 +09:00
Hajime Hoshi
f3cdb0537b graphics: Move the vertices backend to ebiten package
Now restorable/sharable packages cannot use the same vertices
backend, but I think this won't affect the performance
significantly.
2019-06-22 00:02:22 +09:00
Hajime Hoshi
3eee4754c5 graphics: Use the common vertices backend for PutVertex 2019-06-21 02:30:58 +09:00
Hajime Hoshi
008de78cec graphics: Refactoring: Change QuadVertices -> PutQuadVertices for consistency 2019-06-21 02:20:31 +09:00
Hajime Hoshi
5c93462a9d graphics: Refactoring: Merge DrawImage and drawImage 2019-06-12 23:54:59 +09:00
Hajime Hoshi
cc8e8aef19 graphics: Bounds doesn't work when the image is disposed 2019-05-11 22:44:52 +09:00
Hajime Hoshi
6022d8856e graphics: Bug fix: level must be >= 0
There was a cache that level can be negative. This change fixes
this.
2019-04-25 02:49:59 +09:00
Hajime Hoshi
cce41e8152 graphics: Rename DrawImage -> DrawTriangles for consistency 2019-04-22 23:12:36 +09:00
Hajime Hoshi
c8cc98e307 graphics: Fix documents about At 2019-04-11 14:12:22 -07:00
Hajime Hoshi
61156dd90e graphics: Rename pixelsToSet -> pendingPixels 2019-04-11 14:02:41 -07:00
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