summaryrefslogtreecommitdiff
path: root/libs/hwui/pipeline/skia/LayerDrawable.cpp
AgeCommit message (Collapse)Author
2021-02-08Remove two macrosJohn Reck
This is colliding with ag/13519705 and causing build issues. So replace the macros with constexpr's which are better Bug: 179047472 Test: make Change-Id: Icf7c38077ef608ec97e737d47d3d6c25246190bf
2021-01-29Modernize calls to drawImageMike Reed
1. drawBitmap --> drawImage 2. drawImage now always requires sampling parameter Bug:178700363 Test: make Change-Id: I96f610a180b3774ba955cc334949fd62b1cf4d69
2020-07-28Migrate from GrContext to GrDirectContextAdlai Holler
This is part of an effort to distinguish between different types of contexts in GPU Skia. When using a DeferredDisplayList (DDL) recorder, the context you get is not a direct context and cannot be used for operations like uploading or reading textures. Since Android does not use DDLs, it is not directly affected by this change but other APIs, such as SkImage::MakeFromTexture are being migrated to require a GrDirectContext to increase sanity. Change-Id: I9afbdf3c026a9f9cb6ad2aad904915e189e584d6
2019-09-27Improve comparison of fractionsStan Iliev
Fraction comparison does not work for 143.999985 and 2.000001. This CL resolves this corner case. Bug: 140778647 Test: pass CTS Change-Id: I7e39ba822167a3c36c628255a4c79b1ade976929
2019-07-29Improve integer aligned coordinate detectionStan Iliev
65.9998 should be detected as integer aligned. Before this CL only 65.0001 was detected as an integer. Test: Pass TextureViewTest#testSamplingWithTransform Bug: 137682518 Change-Id: I65e650f50040ab56d2237c14d5d8ee191349b93e
2019-07-11Improve logic when to use filtering in readback and TextureViewStan Iliev
Detect scaling in screen coordinates, which allows to turn off filtering for some rect-to-rect matrices (90/270 rotation, scaling). Test: CTS test coverage expanded in testSamplingWithTransform Bug: 135895166 Change-Id: Icf5c45fa62bb7a96c5f5464d312bf98a653bc78d
2018-12-14New WebViewFunctor APIJohn Reck
Should function alongside existing functor API. Bug: 120997728 Test: hwuiunit passes Change-Id: I8f6143d0be1111431b55016f34de319f6b8c8910
2018-12-03Remove ; from closing namespaces in libs/hwuiChris Blume
When closing a namespace a } is sufficient. It doesn't need to be }; like closing a class or enum. Within frameworks/base/libs/hwui there is a mix between } and }; when closing a namespace. There are even mixes between a .h and the corresponding .cpp files. In a separate CL I was asked to not close with };. That was a good comment. I adopted the style from nearby code. This CL cleans up the nearby code. Test: I made sure the code still built as expected. Change-Id: Ieb314a4f48d6e33752463f3be4361fdc9be97482
2018-11-28Merge "Set the color space to sRGB on the Surface and remove colorFilter."Derek Sollenberger
2018-11-26Fix failing TextureViewTestJohn Reck
A tiny scaleX/scaleY is sneaking into the matrix, throwing off the nearest/bilerp calculation. This tiny scaleX/scaleY appears to be coming from the inverse texture matrix necessary to workaround skia issue https://bugs.chromium.org/p/skia/issues/detail?id=7075 So add another workaround for SkMatrix::getType() reporting this as having a scale, even though there really isn't one. Bug: 119783323 Test: atest android.view.cts.TextureViewTest#testSamplingWithTransform Change-Id: I3e675102ef99ce093f698460242c19dfe7e90345
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-10-23Use bilerp sampling when drawing TextureView with non-translate matrixStan Iliev
Draw TextureView with bilerp sampling, when the matrix is not integer translate or identity. For example scaling matrix or translation on X by 0.4f will draw with GL_LINEAR on OpenGL pipeline. Translation on X by 3.0f will draw TextureView with GL_NEAREST. Bug: 117890671 Test: ran camera app Change-Id: I3acd710ff2cb4ee7b14dd4b7d9227842187130c9
2018-09-10Refactor HWUI readback code to be backend independentStan Iliev
Implement readback from Surface, TextureView and HW Bitmap for Vulkan pipeline by wrapping the graphics buffer in an SkImage. Refactor both Vulkan and GL readback to use common code. TextureView readback is moved from IRenderPipeline interface to Readback class. Refactor all 3 readback flows to use common implementation. Test: Passed all view, uirendering and graphics CTS tests with GL Test: Passed many CTS test with Vulkan, that require readback Bug: 113673613 Change-Id: Ifbfd8170a5401f87a709b4b1b9fa058e8e11768d
2018-09-05Reland "TextureView Vulkan support and optimized OpenGL draw"Stan Iliev
Fix an issue with incorrect texture matrix, when there is 90/270 rotation. This happened, because after refactoring SkImage has buffer width/height, instead of layer width/height. This reverts commit a683eb3945320f592f58705c3c31b3c044f4bd72. Bug: 113673613 Test: Ran TextureView CTS and lensblur in camera app Change-Id: If3bcf9cd5195de09fd67a753708568a8e3ca3a9a
2018-09-04Revert "Revert "Revert "TextureView Vulkan support and optimized OpenGL draw"""Stan Iliev
This reverts commit 85f9096b5272c9a39e592e2e97cbbe6cb0e767ab. Reason for revert: lensblur broken. Change-Id: I83ac163159fc537bc15936a0f8597a7512ca9d6e
2018-08-31Revert "Revert "TextureView Vulkan support and optimized OpenGL draw""Stan Iliev
This reverts commit 867c43de0544217d26c3ee18f4d6603bb2ea97ce. Reason for revert: Fixed issue with unsupported hardware buffer formats by landing https://skia-review.googlesource.com/c/skia/+/150470 "Support more hardware buffer formats" Bug: 113673613 Change-Id: I1f7c528f138e290160e75833c8d989d9535002ee
2018-08-30Revert "TextureView Vulkan support and optimized OpenGL draw"John Reck
This reverts commit c8e22a653297837da9a80b0ba65f6854c8986c96. Reason for revert: broke camera, b/113555199 Bug: 113555199 Change-Id: Iae9b462694d5de0cd99427afead63b567fb4d71d
2018-08-29TextureView Vulkan support and optimized OpenGL drawStan Iliev
Render TextureView as hardware bitmaps, instead of GL textures. Cache SkImage for each observed GraphicBuffer, which is faster even for GL. Implement C++ SurfaceTexture, which allows Java SurfaceTexture to be used with Vulkan HWUI render thread and application GL. threads. Delete GLLayer and VkLayer classes and texture code from old HWUI pipeline. Test: Ran skiagl and skiavk pipeline with a TextureView app. Test: TextureView CTS tests pass for GL pipeline. Test: Ran Android NDK Native codec sample app. Change-Id: Idc94f864ce2d34fd6ceff4be4fc7d3327e99879c
2018-07-17Fix TextureView.getBitmap with scale layer transformStan Iliev
Fix TextureView.getBitmap to capture content only from the layer. Bug: 111401911 Test: A new test TextureViewTest.testTransformScale is passing Change-Id: I2b9cee17fc48de7b12ed03d5b4f173ce5445dbfe
2018-05-29Update sk_sp use for explicit.Ben Wagner
Skia's sk_sp class is moving from operator pointer to field to explicit operator bool. As a result a few uses need to be updated. Test: refactoring CL. Existing unit tests still pass. Change-Id: I97ca0647c7c490554da7dd626c99b3447d7cbc84
2018-04-30Respect a Layer's (e.g. SurfaceTexture) colorSpace when compositingDerek Sollenberger
This CL extracts the android_dataspace from the GLConsumer and converts it to a SkColorSpace. HWUI always expects to composite into an sRGB destination so when we draw the layer we run the draw through a colorFilter that converts the input colorSpace into that of the destination. Test: CtsViewTestCases Bug: 78016220 Change-Id: Ic0446a0d861e86a5a9d0382346b57fcc45c8a61b
2018-03-30Merge "Fix Skia's impl for TextureView.getBitmap" into pi-dev am: 5d27097739Leon Scroggins III
am: 6eb88411e6 Change-Id: I04f782a456997f6946a1ea258dea964ffd1b59f2
2018-03-29Fix Skia's impl for TextureView.getBitmapLeon Scroggins III
Bug: 73392905 Test: New test added with I2d4ef440f943a50b9367976ba1444f4350071bfd When providing a width and height, getBitmap should scale to the destination. Add a parameter to LayerDrawable::DrawLayer for a destination rectangle to scale to. Pass the size of the bitmap in SkiaOpenGLPipeline::copyLayerInto down to DrawLayer. The only other caller of DrawLayer is unaffected. Change-Id: I7aa192181c2d15bc8fd4de2fb15c4d276b05d2ac
2018-03-20Update skia framework to use new MakeFromTexture callsGreg Daniel
Test: manual testing Change-Id: If8dfc13ca4c343be7abd9287cff59c1d0174b780
2017-11-03Format the world (or just HWUI)John Reck
Test: No code changes, just ran through clang-format Change-Id: Id23aa4ec7eebc0446fe3a30260f33e7fd455bb8c
2017-10-20Convert skpCaptureEnabled compile time flag into a propertyStan Iliev
Convert SkiaPipeline::skpCaptureEnabled into a system property. Add ability to capture drawing in layers. Add ability to capture animations/sequence of frames. Fix crash when recording a TextureView. Test: Ran capture script. Change-Id: I463eecf6ec90a601a6cc172ad1901bd4bcc86ac8
2017-10-06Fix layer transform matrix for TextureViewStan Iliev
Fix order of matrix multipication and use drawImage instead of shader. Test: Ran camera app, message app and smart face lock app. Bug: 67405584 Change-Id: I3df161d58218e1b1845f1c1ca2db2b12c51b3532
2017-09-27Apply texture matrix to the layer canvasStan Iliev
Fix camera preview shown inverted. Apply texture matrix when drawing opengl layer. Test: Ran camera preview in message app and smart lock with face. Ran CtsUiRenderingTestCases and CtsGraphicsTestCases tests. Bug: 65534412 Change-Id: I3ed52a6c62921fcdfe30104dd176802ed1533fad
2017-07-28Merge "Fix SurfaceTexture CTS test case when using the Skia pipeline."TreeHugger Robot
2017-07-12Update to use GrBackendTexture/RT instead of DescriptorsGreg Daniel
Test: manual testing Change-Id: Ide727a39e2c49f226c8d432608e0072214249451
2017-06-15Fix SurfaceTexture CTS test case when using the Skia pipeline.Derek Sollenberger
Test: UiRendering CTS TextureViewTests#testReuseSurfaceTexture Change-Id: Iaf665b88b83cacfbbd37c93aaebc64e937053cb7
2017-01-10Add support for dummy draws for Vulkan webview and texture views.Greg Daniel
Test: manual testing Change-Id: Iaec8c3a34367673c281665ff6c6e97d1ce532265
2017-01-10Break Layer class into Gl and Vulkan subclassesGreg Daniel
Test: manual testing Change-Id: Ibd2beed39de3ac6da7448e96496253cfe427dfbb
2016-11-16Support Surface and Layer Readback in the SkiaPipelines.Derek Sollenberger
Test: CTS TextureViewTests and UIRendering Change-Id: I2969c8f5a975bfd9aebcbb585c64d1fcbb2487c2
2016-11-02Adding changes required by the master-skia merge.Derek Sollenberger
Test: compile only Change-Id: I39637a20da439edbf2831952df9bfa12da78e9b9
2016-10-31Implement SkiaRecordingCanvas, RenderNodeDrawable and other drawables.Stan Iliev
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