72 Commits

Author SHA1 Message Date
Mike Reed
871cd2dd60 use SkVertices::Builder in drawBitmapLattice
override new virtual onDrawVerticesObject

Test:  CtsGraphicsTestCases

Change-Id: I38e3ee0aa2a1ee9c11474c2c5d648ee5fca20d78
2017-03-20 08:40:12 -04:00
Tony Mantler
4f641d1e45 Revert "Change behavior of setBitmap to cleanly reset the canvas - identity matrix - no save stack - wide-open clip"
https://buganizer.corp.google.com/issues/36218535

This reverts commit 269f989fbf198b17994baf9141c4640aeaf34b4e.

Change-Id: Ib2473e4fce90c9abaa39eea2b77082ae26197b80
2017-03-14 22:40:31 +00:00
Mike Reed
269f989fbf Change behavior of setBitmap to cleanly reset the canvas
- identity matrix
- no save stack
- wide-open clip

Behavior around the new bitmap is the same.

Tests : CtsGraphicsTestCases

Change-Id: Ieaf8c2a1b96262ed33940dd852a86089eb93efdb
2017-03-13 15:39:57 +00:00
Derek Sollenberger
d7f13f84f8 Prematurely optimizing a Path.
If the path had an inverse fill type we were incorrectly
converting ovals and roundRects to their primitive form
without checking to ensure the path was not inverse fill.

This CL removes these optimizations as they happen internally
within Skia.

Bug: 34245907
Test: verified broken app is fixed and that skia has existing tests
Change-Id: I8c1ff6522ae19fc6c21520adc7e9bc2473a8a4ad
2017-03-09 13:59:23 -05:00
Derek Sollenberger
792fb3252f Use SkPaint.nothingToDraw instead of PaintUtils helper.
The PaintUtils helper is now shared between all pipelines and was
missing a quick reject test for drawLoopers which are used in
view.setShadowLayer and supported in the Skia pipelines.

Bug: 35809097
Test: added hwui unit test and verified in DocumentsUI app
Change-Id: I3c4a988f1c42b7f421f78ac3659af1daee910ea2
2017-03-03 14:24:58 -05:00
Derek Sollenberger
95c1a069f2 Revert "deprecate replayClips"
This reverts commit 82d3b17f6dff9372ec531d90b5d9180671e0ee2c.

Bug: 35831173
Change-Id: I467e7204a5e4bcbab1c12d3fcf52e52188830ed5
2017-02-28 17:49:07 +00:00
Mike Reed
82d3b17f6d deprecate replayClips
replayClips is deprecated, just get the rgn instead for setBitmap

Test: ran Canvas CTS
Change-Id: Id0f0da6602d1488bb4071885704fa6e3b449ab85
2017-02-24 18:23:05 -05:00
Derek Sollenberger
b8201195df Deprecate Canvas save/saveLayer flags.
Test: compile
Bug: 14650725
Change-Id: I6424ac46bae0a7a87c4b7743e81319945dfdd087
2017-02-09 13:18:25 -05:00
Mike Reed
5e43898231 use new clipbounds api
Allows us to remove SK_SUPPORT_LEGACY_GETCLIPBOUNDS flag

Change-Id: I7c6665b4eb67c58fe747c07b8b87d58fe9b10120
2017-01-25 13:26:41 +00:00
Ben Wagner
c2d9470aa9 Remove SkDevice.h includes.
SkDevice.h is being removed from Skia. This removes these already unused
includes which mention this file.

Test: refactoring CL. Existing unit tests still pass.

Change-Id: I8340a5822ad2b75c54fe0dca1303ceab9bbee805
2017-01-13 17:03:13 -05:00
Derek Sollenberger
b29b16e542 Remove clipRegion from the public API.
This API is difficult to support for printing and has other negative
effects as it does not respect the current matrix/clip.

Test: compile
Bug: 14650725
Change-Id: I71f9bd687d446c7ce8910d755421aad8e09458db
2017-01-04 14:57:43 -05:00
Stan Iliev
68885e38b8 Modify savelayer to save matrix and clip for Skia pipeline
Modify SkiaCanvas::saveLayer to always save matrix and clip and
match HWUI behaviour. Also ensure android state tracking
behavior matches that of the Skia API (partial saves not
supported). This change is fixing SaveLayerAnimation
macrobench when buffer age is disabled.
Add a HWUI unit test that verifies clip and matrix are restored.

Test: built and ran angler-eng, ran hwui unit tests
bug:33429678
Change-Id: I62e429f9746518fef67663b0dd99ac499bf31af3
2016-12-15 16:47:34 -05:00
Mike Reed
6e49c9f007 switch over clip calls to use SkClipOp instead of SkRegion::Op
Change-Id: I67d23c487b5249bc31d96e3b2393f693c0b2bcff
2016-12-07 10:34:39 -05:00
Mike Reed
6acfe16b56 SkCanvas is no longer reference-counted
Change-Id: Ie821efe7c0a7d1301715e303aaf4d7ec86ac35e7
2016-11-28 15:11:22 -05:00
Derek Sollenberger
e547dd0b80 Cleanup asserts and remove usage of deprecated data structure.
Test: compile only
Change-Id: I9e9f1a3fb37db043d76a98a9568679e7e531e283
2016-11-09 18:04:44 +00:00
Mike Reed
c2f31df8b3 use SkBlendMode
skbug.com/5814

Test: compile only
Change-Id: Ibbaff43df1117b2ca77fd8f917f03d88cc476330
(cherry picked from commit 26edbcba8a2ed4cb300e7f87e679e3b73cec2772)
2016-11-02 11:36:48 -04:00
Stan Iliev
021693b967 Implement SkiaRecordingCanvas, RenderNodeDrawable and other drawables.
Implement SkiaRecordingCanvas, RenderNodeDrawable, GLFunctorDrawable,
LayerDrawable, StartReorderBarrierDrawable, EndReorderBarrierDrawable.
Move AnimatedRoundRect and AnimatedCircle in a separate file.
All Skia pipeline files are moved in hwui/pipeline/skia folder.
Add unit tests for RenderNodeDrawable, StartReorderBarrierDrawable,
EndReorderBarrierDrawable and SkiaRecordingCanvas.

Test: I tested manually on 6P devices and did run the unit tests.
Change-Id: If2a347bd1fc4689953822294ce5bf98c7f3f57c7
2016-10-31 14:27:02 -04:00
Matt Sarett
7de7385897 Implement getTransparentRegion() using SkLatticeIter
This allows us to delete utils/NinePatchImpl.cpp and
utils/NinePatch.h

Test: Passed cts tests - DrawableTest, NinePatchTest,
NinePatchDrawableTest.

Change-Id: I6b5d09fa3479e758d8b931fa0e977c25f4435a7c
2016-10-27 08:22:38 -04:00
Stan Iliev
f50806afb8 Merge SkiaCanvas changes from master-skia to master branch.
Most changes are taken from ag/1407698, ag/1336660, ag/1488900.

Test: Built and run manually on angler-eng.
Change-Id: Id4e464b9a83c62b6bc7ea31a30e5ca6cd53b659d
2016-10-24 12:16:13 -04:00
sergeyv
5fd2a1cb27 Pass Bitmap instead of SkBitmap in drawNinePatch & drawBitmapMesh
Test: refactoring cl.
bug:32216791

Change-Id: I5adcd59daf752d36012456b0a9960c59d07e2e3d
2016-10-20 15:04:28 -07:00
sergeyv
fc9999505a Pass Bitmap instead of SkBitmap for bitmap rect operation
Test: refactoring cl.
bug:32216791

Change-Id: I66d19194c57b3aa2c400aa87acffc774a533776a
2016-10-20 14:04:35 -07:00
sergeyv
aed7f58fb0 Pass Bitmap instead of SkBitmap in canvas.drawBitmap(Bitmap, float,float,Paint)
Test: refactoring cl.
bug:32216791

Change-Id: If9f9fbc19e683b14cce6c3c268258bd832d495d2
2016-10-20 09:50:49 -07:00
Mike Reed
260ab72648 use SkBlendMode instead of SkXfermode
use sk_sp versions of paint setters/getters

Change-Id: I86591a0a8ec92e6039776cbf00424ea24f585b28
2016-10-13 17:14:52 -04:00
Matt Sarett
d4babda3aa Merge "Use SkMakeBitmapShader, avoid bitmap copy" 2016-09-20 18:49:34 +00:00
Matt Sarett
62feb3a0b4 Use SkMakeBitmapShader, avoid bitmap copy
CreateBitmapShader now forces a copy. This updates the call sites
to use SkMakeBitmapShader (in SkImagePriv.h) with
kNever_SkCopyPixelsMode.

This maintains the behavior where apps can modify the bitmap in
the shader after creating the shader.

This also ensures that the texture cache will work (since it's
based off of SkPixelRefs).

BUG:31594626
Change-Id: Ic75cb6cdc05c750b7946208e48a8127838d9c2f8
2016-09-20 11:09:11 -04:00
Yuqian Li
cbba84d6fc Ignore HasAlphaLayer flag to fix b/30929229 am: 83427ff222 am: df6b413b63
am: 49d49fafb8

Change-Id: Ie454b7160dc04952dc7240bfdf004e249bc9e792
2016-09-15 14:09:37 +00:00
Yuqian Li
49d49fafb8 Ignore HasAlphaLayer flag to fix b/30929229 am: 83427ff222
am: df6b413b63

Change-Id: I994233a48472cd2d11acaa30673504b8589bc303
2016-09-15 14:02:15 +00:00
Yuqian Li
83427ff222 Ignore HasAlphaLayer flag to fix b/30929229
BUG:30929229
Change-Id: Iebadc6b3d224efa0554cbbb99ea43f871c28722b
2016-09-14 11:44:10 -04:00
Yuqian Li
afc221499d More efficient text rendering on path
Change-Id: I004c15473b527df0f296c54a6a3e9b29505fd9b9
2016-07-25 13:44:14 -04:00
Derek Sollenberger
86cbf883f6 Fix ref-counting error when reseting a SkiaCanvas with a new SkCanvas.
Change-Id: Id2ed6627674cbd3112d6ac80f4e29a5ff65606b6
2016-07-20 11:53:05 -04:00
Derek Sollenberger
c190813b93 Expose SkiaCanvas header file.
Previously the header for SkiaCanvas was contained in the .cpp file,
but in prepration for broader use of SkiaCanvas we are moving the
header into its own .h file.

Change-Id: Ib8c738366198a9b63e7429d51e9fa5aec106fdb1
2016-07-19 16:36:45 -04:00
Chih-Hung Hsieh
c968879eb6 Merge "resolve merge conflicts of 1599b981 to nyc-dev-plus-aosp am: 85e0c89ba5" into nyc-mr1-dev-plus-aosp
am: 99feacb026

* commit '99feacb0263f8331e9afcbfdbc0a4322de75593c':
  Fix google-explicit-constructor warnings.

Change-Id: Ifb8bda3157f17c400ae403056bbef3b3c3625ea8
2016-04-28 19:46:13 +00:00
Chih-Hung Hsieh
85e0c89ba5 resolve merge conflicts of 1599b981 to nyc-dev-plus-aosp
Change-Id: I90807581e10b6a0024515ff634ac8b29eaa5fc9f
2016-04-28 12:08:15 -07:00
Yuqian Li
fd92ee4b73 Remove SkTLazy
Change-Id: Ibce5cea66fe67fceb994ff45c9afb527dbaf641b
2016-04-27 17:10:21 -04:00
Chih-Hung Hsieh
c6baf563ba Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: Ibdd6a210bb7ff228e3624cc319169f77aca3b51e
2016-04-27 11:38:12 -07:00
John Reck
cd1c3eba69 Add a callback for when a gl functor is released
Bug: 27709981

Change-Id: Id5be3e8f88d6d84a9c59c7ed23e7e8862feefbe8
2016-04-15 10:56:53 -07:00
Doris Liu
1d8e194661 Make AVD thread safe
This CL introduces staging properties to VectorDrawable, which holds
properties coming from UI thread. When staging properties are changed,
they are marked dirty, and the staging properties then get pushed to
RenderThread at sync point. In cases where no staging property has
been changed, at sync point we sync the render thread properties back
to staging properties to reflect the latest render thread animation
value change.

Also, update Vector Drawable bitmap only when it's dirty

Bug: 27343970
Bug: 27385912
Bug: 27263667
Bug: 27927674
Bug: 27774383

Change-Id: Ia864f5400a53a08dbfb284fae581fb1aac4fff87
2016-04-04 14:40:17 -07:00
Derek Sollenberger
79abbf22d4 Update HWUI tests to use minikin to layout fonts.
This update is a precondition for landing additional tests
that depend on the minkin layout implementation.

bug: 27675371
Change-Id: I9bb98bae6b39462246e42cf8acb968b7df05292d
2016-03-25 11:53:08 -04:00
sergeyv
dccca44ffd Reland: Move text logic from jni to hwui level
Initial CL: https://googleplex-android-review.git.corp.google.com/#/c/886854/

Change-Id: I9dfd85fe1d2a2c44f4360c8a29fd58d80e6f31c8
2016-03-21 15:55:46 -07:00
Sergei Vasilinetc
afbd0f1fef Revert "Move text logic from jni to hwui level"
This reverts commit a7f6bba1a3565c19715e878dfe7f0e01022944ff.

Change-Id: If4f36f87a85411b6128fd92d391313803ccaf9dd
2016-03-21 21:03:40 +00:00
sergeyv
a7f6bba1a3 Move text logic from jni to hwui level
bug:25865834
Change-Id: I2d8c9c9544afcb5ce1784f732aed3e54e0eda372
2016-03-17 09:48:57 -07:00
Doris Liu
766431aa57 Revert "Revert "VectorDrawable native rendering - Step 4 of MANY""
This reverts commit 5a11e8d0ba21624025b89ac63bbd18befa55be0e.

Change-Id: I7a48b59c4f930dad65ddc8590c25a12636244ea2
2016-02-04 16:29:51 -08:00
Doris Liu
5a11e8d0ba Revert "VectorDrawable native rendering - Step 4 of MANY"
b/26949340 and b/26975469, b/26975079 as well 

This reverts commit f276acd98457bcaabc9e79a17a736b3b484f005e.

Change-Id: I4b55177daf0d289bc03604c71fd4bf579f65073a
2016-02-04 20:59:00 +00:00
Derek Sollenberger
6f485569fa Update Canvas API with view system calls.
Refactor DisplayListCanvas, RecordingCanvas, and SkiaCanvas
to share a common API.

Change-Id: I0268ec2749ea5d13a3a72bb2784ed6a9911383d9
2016-02-03 09:13:04 -05:00
Doris Liu
f276acd984 VectorDrawable native rendering - Step 4 of MANY
This CL runs VectorDrawable animation on RenderThread. The changes in this CL
include:
- Convert all the animators in AnimatorSet for AVD into a set of RenderNodeAnimators.
- Hook up the new animators with RenderThread
- Add drawOp in RecordingCanvas for drawing VD so that during the animation
  on RenderThread, all the property changes on VD can be reflected on the screen.

TODO:
- Implement reverse and reset for AVD.

Change-Id: I2df1d754f2db0ad098d9c15dde4bb2bdfafc2315
2016-02-02 15:04:01 -08:00
Florin Malita
eecff56fed Add internal Canvas save flags
Skia's SkCanvas::SaveFlags are being deprecated.  This CL introduces
the equivalent android::SaveFlags, converts all internal clients to
the new enum, and switches the saveLayer glue to the
SaveLayerRec-based API.

Change-Id: Icb1785f4e7c0f652b1f04b34a1e3ccb063c408f3
2016-01-25 15:48:00 -05:00
Chris Craik
a1717271ca Initial text support in new reorderer/renderer
Removes obsolete drawPosText codepath, and unifies text decoration behavior.

Change-Id: I9c563249ab688a3394445a0e7fe1b9d0661f6f7c
2015-11-20 11:03:18 -08:00
Florin Malita
5e27140f48 Fix persistent Canvas clip handling
Partial Canvas save semantics (clip or matrix persisting after restore)
are currently emulated in the native canvas wrapper (SkiaCanvas.cpp).

Persistent clips (save w/ MATRIX_SAVE_FLAG only) in particular are
emulated using the SkCanvas clip stack.  There are two problems with
the current implementation:

1) The canvas save count is used to identify the clip stack topmost
frame, on the assumption that it is the same as the actual clip stack
save count.  But with the introduction of lazy SkCanvas saves in Skia,
the two values can diverge: the clip stack save count only reflects
*committed* saves, while the canvas save count includes both committed
and pending saves.  This means that we can no longer compare canvas and
clip stack save counts directly.

While we're looking at addressing the save count discrepancy in Skia
proper, we can also refactor the partial save emulation to no longer
rely on the two values being synchronized: instead of using the canvas
save count to locate the top clip stack frame, simply use the clip
stack save count for the same purpose - getClipStack()->getSaveCount()
always points to the correct top clip stack frame.

With this patch:

  * we use SkCanvas::getSaveCount() to track *canvas* save frames which
      require persistent matrix/clip handling (mSaveRecStack)
  * we use SkClipStack::getSaveCount() to extract the clips from the
    top clip stack frame

Also, since we're no longer mixing/comparing the two save counts, we
don't have to decrement the canvas value anymore (to make it zero-based
like its clip stack counterpart).

2) When iterating over clip stack elements, we currently start at
kTopIterStart and advance using next().  This is incorrect as next()
moves up the stack, so we only iterate over the topmost element =>
if there are multiple (non-consolidated) clip elements in the top
frame, we only get to see one.

We need to iterate using prev() instead.

Change-Id: Ic2d8cad684018925e749b9172fbf7c6202d9fb62
2015-11-06 18:40:25 +00:00
Leon Scroggins III
f35b989d26 Merge six commits from master-skia to master
Also corrects some code under development behind the HWUI_NEW_OPS flags
to match the updated Skia API.

Include external/skia/include/private
use SrcConstraint for drawBitmapRect
clean up to allow removal of flags for SCALAR_DIV and IMAGEINFO_FIELDS
don't call DEPRECATED getDevice()
update to newer API for drawBitmapRect
asABitmap is deprecated, used isABitmap

previous-Change-Id: I12208855a95948897077b1c1549eb35416cc801e
previous-Change-Id: I5044f0f61315fe48c60d7af5e261a7d0ed574f56
previous-Change-Id: Ic34a3ba77b3f9e091fa7aaba75018a307abacdab
previous-Change-Id: I79f8dd779920565d1204f7fe67b3286b1bbf4e9b
previous-Change-Id: Ic04d1f8274f6a862ea00f8d241363cf31f5ec1ec
previous-Change-Id: I9e4ae257a1976c74302b6a73f17405174ae58cec
previous-Change-Id: I85de3462ad1e4877784df38edc4bcd0acbd24e5e
Change-Id: Ide8e2f669e91a13c32521af3a16efdaa085c81d0
2015-10-29 12:29:03 -04:00
Tom Hudson
d8f904f256 Revert "Merge six commits from master-skia to master"
This reverts commit 550780745fa28ae9a87d02331841ca5ce4f9c763.

Change-Id: Ic71eccea454b26261fe6e9a9a7a24eff56396989
2015-10-28 20:35:36 +00:00