summaryrefslogtreecommitdiff
path: root/libs/hwui/SkiaCanvas.cpp
AgeCommit message (Collapse)Author
2020-05-01Fix setShadowLayer + drawTextOnPathLeon Scroggins III
Bug: 140255441 Test: I49c468b0f4cc142e5d6b03f0aee917b3d85153f3 Fix two issues that prevented this combination from working: - make() the SkTextBlob once and reuse it for each iteration of the loop. This is necessary because make() resets the SkTextBlobBuilder, so a second call does nothing. - use the altered SkPaint, passed as a parameter to the lambda, rather than the Paint passed to apply_looper. Incidentally, reference mCanvas directly like the other methods, rather than calling asSkCanvas(), which returns mCanvas. Change-Id: I48ea1232b12df4f5f8afffc20c7dc8e5dc2bb511
2020-01-15Merge "Added support for antialiased canvas clipping"Nader Jawad
2020-01-10Added support for antialiased canvas clippingNader Jawad
Updated native hwui implementation to pass in optional anti-alias flag to canvas clipping operations. Made the default behavior to enable canvas clipping Bug: 69115461 Test: Added test to CtsUiRenderingTestCases Change-Id: I996f4b56e161cdc9f1ec5eba9c30f94474520af5
2020-01-10Include text draws in looper refactorNathaniel Nifong
Test: built for pixel3, confirm shadows on text of launcher icons visible on a background image that shows it well. Bug:144199311 Change-Id: Ia2e71a1f0982ef94a9b0c0573bf76ead0c0b9b81
2019-09-03use canvaspriv for legacy flag.Mike Reed
This allows us to remove the legacy enum from SkCanvas.h Test: make Change-Id: I892f18169d9eaeead8332a63d1cebf28bba4159c
2019-07-29pass Paint not SkPaint to CanvasMike Reed
Test: cts Change-Id: I9a3314bc3f221b6e884c8c84d7b0241f7c5be600
2019-07-15Remove final usage of asSkCanvasJohn Reck
Bug: 137581257 Test: builds Change-Id: Ib38f85c11be332e6cd784f8bbf55f58cde72ac09
2019-05-02Fix fading edge effect from impacting neighboring pixelsDerek Sollenberger
Bug: 129117085 Test: skia unit tests and test cases described in the bug Change-Id: Ieaa7c831dd6298ac0565e6f1837b1c1dbd4545da
2019-04-11Update to new factories for effectsMike Reed
Test: make Change-Id: Ib342878524b51d0eacf6c60ece3c7da8bf27d2c0
2019-01-29don't pass bounds to textblobbuilderMike Reed
Rely on builder to compute it Test: make Change-Id: Ib04b5a79d4e94e269761dd23171ca517e5aebed9
2019-01-24Store SkFont in android::PaintMike Reed
Test: CTS Change-Id: I974fad5a7a8cf54007f0a30f4fe4ae6eb6e01ae1
2019-01-08don't toggle between Paint and SkPaintMike Reed
Test: make Change-Id: Id5864591db0577a24833bbb90036b9554ce130d4
2019-01-01drawTextRSXform is deprecatedMike Reed
Test: make Change-Id: I9c041497688b2657e153eeda4c895cd810fd7f94
2018-12-20Improve performance of unclipped save layers.Derek Sollenberger
Instead of allocating a separate renderTarget and switching between them on each draw the new implementation follows the same pattern that the old HWUI renderer used. The area of the layer is now copied to a buffer on the GPU, the area is then cleared, rendered as normal, and finally the texture is redrawn using dst_over blending. This results in no render target switches and is considerably faster on some hardware. Test: CtsGraphicsTestCases, CtsUiRenderingTestCases Bug: 119222339 Change-Id: I716aac1fc31e4c7a171373d37dee82034c01cf18
2018-12-04use SkTextEncodingMike Reed
Test: make Change-Id: I699aa495573e410043caaf97599172471fe8895d
2018-11-28Merge "Set the color space to sRGB on the Surface and remove colorFilter."Derek Sollenberger
2018-11-21pass font instead of paint to blobbuilderMike Reed
Test: make Change-Id: I8605b03098f8fe1d255d3e4d690680c52baf2352
2018-11-07Set the color space to sRGB on the Surface and remove colorFilter.Derek Sollenberger
Also for a canvas wrapping a bitmap the colorspace of the bitmap will be used to correctly blend content. Test: CtsUiRenderingTestCases Bug: 111436479 Change-Id: I63ad7a30605a7f725cc0ef4716d42ea978fb03e3
2018-11-01move alignment to Paint (from SkPaint)Mike Reed
Test: make Change-Id: I35633b0a43b68b4784d8f253a9c37d1d8da7dc87
2018-10-02Added support for Canvas#drawDoubleRoundRect in application Canvas APINader Jawad
Exposed Skia's underlying drawDRRect method used to draw a double rounded rectangle Bug: 117181396 Test: Added test case to verify Canvas#drawDRRect and re-ran CanvasTests Change-Id: I4e1954c8ffc82811dc541488d1df9b37309faf51
2018-07-11Replace SkDrawFilter with PaintFilter.Ben Wagner
Skia is removing SkDrawFilter. Test: refactoring CL. Existing unit tests still pass. Change-Id: If81c1a2feabf7d377ae1d7bcb3e8cf0f599ad3ce
2018-05-09A better HW Bitmap uploaderJohn Reck
Move all HW bitmap upload operations off of RenderThread. Ensure EGL context outlives all upload requests Bug: 79250950 Test: builds, boots, systrace is good, CTS bitmap tests pass Change-Id: I5ace6c516d33b1afdf1a407cd8b183f6b60c22c1
2018-04-12Remove Properties::isSkiaPipeline (3/!?)John Reck
Test: hwuiunit & CtsUiRenderingTestCases pass Change-Id: Ie7b336eacdd1b8660e09653c64eb6ea0a7b4a258
2018-03-14Update text alignment when using drawTextOnPath.Derek Sollenberger
This is only a partial fix for the bug, but does ensure that Skia doesn't attempt to realign the text after minikin already has. Test: CtsGraphicsTestCases and test app in bug. Bug: 25360203 Change-Id: I6222963b23b910f0261f562f8816604575d540fa
2018-02-08Draw text with a hairline stroke as if it is fill styleStan Iliev
Dew to a side effect of HWUI opengl pipeline, the hairline stroke is not respected, but it is drawn as a fill style. Implement the same behaviour for skiagl pipeline with SDK API 27 and older. On SDK released with Android P, the hairline stroke is respected. Bug: 72494357 Test: Ran duolingo app Change-Id: I48bdcf3ddec4bf65b5e93e01c5002177c4e3da90
2018-02-06remove unused/deprecated flags from savelayerMike Reed
Test: make Change-Id: I39e41a80430dca7878e6983b098c1c4541904fd1
2018-01-24Initial implmentation of AnimatedImageDrawables on the RenderThread.Derek Sollenberger
The current implementation schedules the next frame of the images to be decoded after the current frame completes but potentially schedules tasks that will result in a no-op execution if a new frame is not yet needed. Test: HwAccelerationTest Change-Id: I0510cb5a1b801abd651327e924deb586af0306d6
2018-01-17Make ImageDecoder return animated DrawablesLeon Scroggins III
Bug: 63909536 Bug: 63908092 Test: TODO If ImageDecoder.decodeDrawable is called with an animated image Source (currently GIF or WebP), return an object of a new (hidden) Drawable subclass. The new Drawable animates, and it implements Animatable (TODO: implement Animatable2) so users have some control over the animation. In addition to the normal features of Drawable, this new one supports many of the features of ImageDecoder, including scaling, cropping and PostProcess, which enables circle masks/rounded corners and other arbitrary after-effects. It does *not* support decoding directly to a Hardware Bitmap, since it cycles through frames and reuses the same bitmap memory. But it could be made to use shared memory (TODO?). TODO: Use a better number for the native allocation registry TODO: Use the RenderThread to drive the animation, and remove decoding on the UI thread. TODO: Add support for modifying the loop count Android.bp: - build new AnimatedImageDrawable.cpp AndroidRuntime.cpp: - register new native methods AnimatedImageDrawable.java AnimatedImageDrawable.cpp: - new Drawable that handles animated images Canvas.h, SkiaCanvas.h/.cpp - New virtual method and implementation for drawing SkAnimatedImages RecordingCanvas.h/.cpp - Stub implementation of drawing SkAnimatedImages ImageDecoder.h/cpp - Allow code sharing with AnimatedImageDrawable.cpp - postProcess - access the ImageDecoder struct Depends on https://skia-review.googlesource.com/c/skia/+/94660 in Skia. Change-Id: Ie2ec98d9c52deda4d439c6ef8e5dea2861bb93a3
2018-01-11Improve correctness of SkiaCanvas::drawLayoutOnPathStan Iliev
Align glyph to a tangent touching SkPath in the midle of the symbol. Previously wrong tangent crossing the path at the beginning of the glyph was used. Test: Ran the test app attached to the bug Bug: 71525360 Change-Id: I310394d11e185de314f66a6b332f804188e42ed9
2017-12-11Enable fast drawing for solid color nine patch rectanglesStan Iliev
Pass a hint to Skia, about which lattice rectangles are solid color rectangles. Bug: 69796044 Test: Measured ninepatch performance using sample app from the bug Change-Id: Ib07b1b64c78ab16195f9af88a989d28682084565
2017-11-29Fix text encoding in some macrobench testsStan Iliev
Fix crash in macrobench tests, caused by incorrect text encoding. Test: Ran macrobench tests Change-Id: I3522004f70c7037299fb92157ac8633ebb170131
2017-11-06If the absolute value of a sweep angle >= 360 then draw it as an oval.Derek Sollenberger
Skia's drawArc API is defined to keep winding when drawing an arc with a sweep angle > 360. This allows for special path effects and for points on the arc to potentially be double drawn. This is not the case for the HWUI implementation that optimistically turns the call into a drawOval. This CL updates Skia's pipeline to be in line with the HWUI implemenation. Test: CtsGraphicsTestCases were added to cover this Bug: 68764873 Change-Id: I22cd15a53cd2df44421518256d45a2b5d0525a86
2017-11-03Format the world (or just HWUI)John Reck
Test: No code changes, just ran through clang-format Change-Id: Id23aa4ec7eebc0446fe3a30260f33e7fd455bb8c
2017-08-24Avoid setting high contrast in every view drawJohn Reck
Test: high contrast text still works Change-Id: I6674d1aca8dddf7eb9725a5346aed12ef1dbc195
2017-08-16Merge "Filter empty paths at record time"TreeHugger Robot
2017-08-16Filter empty paths at record timeStan Iliev
Filter empty paths at record time. Quick settings pull test has about 18% empty paths. Test: Ran quick settings pull jank test Bug: 64487466 Change-Id: I5b1650060ae4d157d313efb435ecda26c03d4b72
2017-08-15Use the faster path when calling drawImageRect.Derek Sollenberger
Bug: 64487466 Test: CtsGraphicsTestCases, CtsUiRenderingTestCases Change-Id: Ib2312598b50d402b1749d62a10c6ec343eff5b89
2017-08-07Use colorFilters when rendering to an sRGB bitmap.Derek Sollenberger
Bug: 62347704 Test: CtsUiRenderingTestCases, CtsGraphicsTestCases, hwui_unit_tests Change-Id: I3e237b64cd92217b02d4995bdd695a28d3f393ee
2017-08-02Revert "Use colorFilters when rendering to an sRGB bitmap."Derek Sollenberger
This reverts commit b851b197497783f894b72edcaed8f93d035ddea0. Change-Id: I5bb8fe9bf9f5d411674e289c467b3f569f7bb068
2017-08-02Use colorFilters when rendering to an sRGB bitmap.Derek Sollenberger
Bug: 62347704 Test: CtsUiRenderingTestCases, CtsGraphicsTestCases Change-Id: I55a574ffd9305588b82345a598da7818952a131d
2017-07-27Enable colorspace conversion while perserving legacy blending.Derek Sollenberger
When requesting an SkImage from a android::Bitmap we will also return a colorFilter that will perform the sRGB conversion at draw time. Bug: 62347704 Test: CtsUiRenderingTestCases, CtsGraphicsTestCases, CtsViewTestCases Change-Id: Icc4694e2c42605e29fcc834c252bc21263bac658
2017-07-19Improve color correctness for drawing bitmaps with Skia pipelineStan Iliev
Fix drawing of bitmaps with color profiles. This CL is making ColorSpaceTests and Rgba16fTests CTS tests to pass with Skia pipeline. Drawing bitmaps withs pixels outside SRGB range may need more work (ColorSpaceTests#testDrawDisplayP3 test use a a wider gamut, but the actual pixels fall into the SRGB range). Test: Ran CtsUiRenderingTestCases with HWUI and Skia pipeline. Bug: 62347704 Change-Id: I8d318076bb38f7d32bfde7e5492ae7a61f4731a5
2017-04-18Merge "Remove round rect clipping optimization." into oc-dev am: 190fe086dfDerek Sollenberger
am: c421f748a9 Change-Id: I6fe0b0eabb2ad17a7dd6df8c695029f36f8b3cd6
2017-04-17Remove round rect clipping optimization.Derek Sollenberger
This optimization fails to account for inverse fill. Test: bit CtsGraphicsTestCases.CanvasTest Bug: 37417782 Change-Id: I04adfa93542b1bd1f5d905c64bb40e521242e29d
2017-04-14Merge "Bug fix: use legacy SkCanvas regardless of color space tag" into ↵Matt Sarett
oc-dev am: 101dc265a8 am: 7e92ac449b Change-Id: Ic50bd5fe0358390024bdb9a34e14906dba669f25
2017-04-14Bug fix: use legacy SkCanvas regardless of color space tagMatt Sarett
Test: Added unit test. CtsGraphicsModule. Bug: 32984164 Change-Id: If72e1e31c98e01f97f3a05d763f5d4c71cf88313
2017-04-13Add SkiaCanvas::captureCanvasState()Matt Sarett
Test: Verified bug is fixed. Wrote unit test. Bug: 37268771 Change-Id: I9deb7db353cd2129ad245e7f65419670463bb717
2017-04-13Add SkiaCanvas::captureCanvasState()Matt Sarett
Test: Verified bug is fixed. Wrote unit test. Bug: 37268771 Change-Id: I9deb7db353cd2129ad245e7f65419670463bb717
2017-04-12Merge "Change behavior of setBitmap to cleanly reset the canvas" into oc-dev ↵Derek Sollenberger
am: 7944962b7e am: 43844db75d Change-Id: I8e362993a2fc51ce93015924d4819884301aa0c1
2017-04-11Change behavior of setBitmap to cleanly reset the canvasDerek Sollenberger
- identity matrix - no save stack - wide-open clip This reverts commit 4f641d1e4586b027969052cc0ad6b65c1158e72e Test: bit CtsGraphicsTestCases:.CanvasTest Bug: 36218535 Change-Id: Id11deb06e37d6df61f1f171d424ab150d812a7a8