summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Renderer.h
Commit message (Collapse)AuthorAgeFilesLines
* Update HWUI to store its own SkBitmap objectsDerek Sollenberger2015-01-091-1/+0
| | | | | | | | | | | This enables us to... 1) simplify the lifecycle/ownership between Java and HWUI 2) remove DisplayListRenderer::drawBitmapData and associated logic 3) track pixel lifecycle using standard SkPixelRef refcounting 4) Remove uncessary calls to ref/unref the bitmap's pixels and colorTable Change-Id: I3c95078da20995444f6388a029414280fd654318
* Make DisplayListRenderer inherit from Canvas, merge JNITom Hudson2015-01-051-34/+0
| | | | | | | | | | | | | Incrementally unify the upper layers for Skia and HWUI. Remove redundant code from GLES20Canvas.java; instead use inherited mNativeCanvasWrapper and superclass method definitions. Moves some unrelated SkPaint utility functions from Renderer to new utils/PaintUtils. bug: 15672762 Change-Id: I4ddd4214b8e9eeb95289d054ef423f2542bb5fa5
* Add overrides and switch to nullptr keywordChris Craik2014-12-221-2/+2
| | | | | | | | Changes generated with clang-modernize. Additionally, fixed some struct-vs-class usage to make clang happy. Change-Id: Ic6ef2427401ff1e794d26f21f7b44868fc75fb72
* resolve merge conflicts of cabf8a7 to master.John Reck2014-11-071-1/+0
|\ | | | | | | Change-Id: If0ca1c37d05f5dc471d88a3bf158dd68a1880bbf
| * Fix wrong-thread issueJohn Reck2014-11-071-1/+0
| | | | | | | | | | | | Bug: 18259560 Change-Id: Ic63a86efba9c86f21defac0695a73db8b09ae284
* | Remove status return from all uirenderer::Renderer functionsTom Hudson2014-11-041-24/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves the interface closer to android::Canvas. The only use of return values was in the OpenGLRenderer subclass; that is replaced with an internal dirty flag: returned from finish(), checked by CanvasContext. This is part of a series of CLs to refactor the Graphics JNI bindings. BUG:15672762 R=djsollen@google.com,ccraik@google.com Change-Id: Ifd533eb8839a254b0d3a5d04fc5a2905afdfc89e
* | Refactor HWUI to better handle Canvas DrawFilters.Derek Sollenberger2014-10-171-4/+4
|/ | | | | | | | | | | | | | | | | | | First, this CL removes the need to decompose the DrawFilters in Java and instead passes the SkDrawFilter to HWUI directly. This also allows the removal of duplicated logic between HWUI and other Canvas implementations regarding Paint filter levels. Second, the DrawFilter is now stored in the DisplayListRenderer where we apply it to every paint BEFORE it is stored in the DisplayList. This eliminates the need to filter all Paints on playback and removes additional complexity at playback. Finally, as a result of storing the filtered paint we can now do a better job caching the paints. This takes advantage of recent changes in Skia to quickly enable quick hashing and comparison of paint objects. Change-Id: Iec507a2d894827975cc4f1d22241542bb0534b4e
* Account for colorfilter transparency in determining paint opacityChris Craik2014-10-011-1/+10
| | | | | bug:17765601 Change-Id: I90d76ee199bb357c71fc8f537c1abfa20d848416
* Reject transparent draws more conservativelyChris Craik2014-09-231-1/+1
| | | | | | | | | | | | | bug:17600162 Transparent draws are not safe to reject for all xfermodes other than clear. Now, to be safe, only perform the rejection for SrcOver draws since other modes are fairly uncommon. We could specifically determine whether the xfermode could change the output given a transparent input, but there's little to be gained from the additional complexity. Change-Id: Ia699ac4bdc4da3353955840b53f1922d3cb1d85d
* Handle premultiplication correctly for ColorMatrixColorFiltersChris Craik2014-09-171-0/+2
| | | | | | | | | | | | bug:17405627 Previously, the input content to the color matrix computation was left premultiplied. Since the color matrix could reduce the alpha channel, the alpha was re-multiplied, but this was incomplete, and incorrect. Instead, apply the color matrix in unpremultiplied space. Change-Id: I87b8e03d2e228e6ded81f7bbfea952605d7a095c
* Early reject drawText calls that will not drawChris Craik2014-08-191-0/+12
| | | | | | | | | | bug:17114102 Prevents high contrast text from drawing invisible text. Also fixes stroked text bounds calculation. Change-Id: Iaeff51ead8b7b8ef2a1a0ca8b89598564e0d443f
* Move bitmap transforms out of bitmap opsChris Craik2014-08-061-6/+2
| | | | | | | | | | bug:11359533 This allows us to deduplicate a lot between the two ops, and fixes the shader coordinate space for the left,top argument drawBitmap to match software. Change-Id: I53da05af9ee74c74e9e70b4ab8053190ca220b16
* Connect shadow style attributes to rendererChris Craik2014-07-241-8/+0
| | | | | | | | | bug:15859361 Moves lighting info out of StatefulBaseRenderer, since it's not useful at record time, and only used by OGLR. Change-Id: I7ab065d02d9304afad1dc4c48597a7a621366f8e
* Remove isRecording() method from renderersChris Craik2014-06-271-8/+0
| | | | | | | DisplayListRenderer is all that's accessed from java, and is entirely separate from OpenGLRenderer now. Change-Id: Ie733be71520c13fdb55dfe3522bb445ae2b50ac1
* No-fail invokeFunctorJohn Reck2014-06-231-15/+0
| | | | | | | Bug: 15513308 Bug: 15449247 Change-Id: I13a29f9c8d4975cdda6dcb33b6332c2555ff0f7c
* Update 'DisplayList' vs 'RenderNode' naming in several placesChris Craik2014-06-231-1/+1
| | | | Change-Id: I635c6627d098b661fb9b0ba1bd42fa6d7277d287
* Update HWUI matrix APIDerek Sollenberger2014-05-291-3/+3
| | | | | | | 1. more closely mirror Skia API by using const ref instead of ptrs 2. store SkMatrix in the drawOp instead of the linear allocation heap Change-Id: I4b9f6f76b9f7d19325e29303d27b793679fd4823
* Merge "Inspect SkShader to determine hw shader."Chris Craik2014-05-231-4/+0
|\
| * Inspect SkShader to determine hw shader.Leon Scroggins III2014-05-221-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of duplicating internal info about SkShader, inspect the SkShader installed on the SkPaint. core/java/android/view/GLES20Canvas.java: Remove setupModifiers, nResetModifiers, and nSetupShader. core/jni/android/graphics/Shader.cpp: Remove calls to create/destroy the (previously) attached SkiaShader. core/jni/android_view_GLES20Canvas.cpp: Remove native code for setupShader and resetModifiers. graphics/java/android/graphics/BitmapShader.java: graphics/java/android/graphics/ComposeShader.java: graphics/java/android/graphics/LinearGradient.java: graphics/java/android/graphics/RadialGradient.java: graphics/java/android/graphics/Shader.java: graphics/java/android/graphics/SweepGradient.java: Remove code keeping track of native SkiaShader. libs/hwui/Caches.h: Include Extensions.h. libs/hwui/DeferredDisplayList.cpp: Compare shaders on the paint, instead of on DrawModifiers. libs/hwui/DisplayList.cpp: libs/hwui/DisplayList.h: Remove vector of SkiaShaders. libs/hwui/DisplayListOp.h: Access the SkShader on mPaint. Remove SetupShaderOp and ResetShaderOp. libs/hwui/DisplayListRenderer.cpp: libs/hwui/DisplayListRenderer.h: Remove resetShader, setupShader, refShader, and mShaderMap. libs/hwui/FontRenderer.cpp: Pass SkShader to setupDrawShader and setupDrawShaderUniforms. libs/hwui/OpenGLRenderer.cpp: libs/hwui/OpenGLRenderer.h: Add LayerShader, a class inheriting from SkShader, to mimic the behavior of SkiaLayerShader. Unlike SkiaLayerShader, it can be set on the SkPaint so it can be inspected later. Set a LayerShader instead of a SkiaLayerShader. setupDrawShader and setupDrawShaderUniforms now inspect an SkShader passed in. Inspect SkShader instead of mDrawModifiers.mShader. Remove resetShader and setupShader. setupDrawColorUniforms now takes a boolean indicating whether there is a shader. Add an inline function for accessing the SkShader on an SkPaint. In setupDrawBlending(Layer*, bool), do not check the shader (which will never be set), but do check whether the color filter may change the alpha (newly fixed behavior). In setupDrawBlending(SkPaint, ...), check the SkShader and whether the color filter affects alpha (the latter is new behavior). libs/hwui/Renderer.h: Remove pure virtual functions setupShader and resetShader. libs/hwui/ResourceCache.cpp: libs/hwui/ResourceCache.h: Remove functions for refing/unrefing shaders. libs/hwui/SkiaShader.cpp: libs/hwui/SkiaShader.h: Much of this code was redundant and has been removed. Convert structs into class with nothing but static functions for calling describe/setupProgram. libs/hwui/TextureCache.cpp: libs/hwui/TextureCache.h: Use the SkPixelRef as the key to the bitmap Lru cache, since shader inspection will provide a different SkBitmap pointer (though it will hold the correct SkPixelRef with the correct generation ID). tests/CanvasCompare/src/com/android/test/hwuicompare/DisplayModifier.java: tests/CanvasCompare/src/com/android/test/hwuicompare/ResourceModifiers.java: Update manual test to have more shaders: radial, sweep, compose, invalid compose. BUG:10650594 Change-Id: Iaa7189178bda1c55f96da044d2a9fa602ba36034
* | Define light position (using new lighting spec) in JavaChris Craik2014-05-211-0/+8
|/ | | | | | Also updates the relative shadow strengths. Change-Id: I6cac7275d38df98aea9f0dda463cd7207102986a
* Avoid caching shadow properties in Java & HWUI.Derek Sollenberger2014-05-071-3/+0
| | | | | bug: 10650594 Change-Id: I6f57df002710bb0567ed7e53fc0bfe96cfd504b8
* Clip TouchFeedbackDrawable effect to receiver OutlineChris Craik2014-04-231-1/+1
| | | | | | | | Projected RenderNodes are now wrapped with a ClipRect or masked SaveLayer, so that they are clipped to the outline of the projection receiver surface. Change-Id: I1d4afc1bb5d638d650bc0b1dac51a498f216773e
* Rename DisplayList->RenderNodeJohn Reck2014-03-121-2/+2
| | | | Change-Id: Id42e23c9a1a6eb6eaeafef707ced7fa6887b03d0
* Removing SkiaColorFilter and inspecting the native object directly.Derek Sollenberger2014-02-071-3/+0
| | | | | bug: 10650594 Change-Id: I4fcf66d008765afa0e35d011f58bc792183cb74f
* Keep the SkPaint used when creating a layer.Derek Sollenberger2014-02-071-13/+6
| | | | | | | | This will allow us to inspect the paint for thing other than color and xfermode, such as SkColorFilters and SkShaders. bug: 10650594 Change-Id: I2c3ddd07a3966e1e77af34136307e2b59b2898c1
* Native-side proxyJohn Reck2014-01-271-2/+0
| | | | | | | Remove RemoteGLRenderer Remove reflection-based control Change-Id: If17c2bbb61c7141986d88c4763def77ed1074985
* Remove dead codeJohn Reck2014-01-151-22/+0
| | | | Change-Id: I9c96d3d21bd3faed91a5146f5a2b8916c634fdff
* Use const where possible for drawing parametersChris Craik2014-01-031-26/+31
| | | | | | They should never be modified by a Renderer, only read and copied. Change-Id: I9d8d55dca19115ee9dfeb2bb3f092ba2fb327cd4
* Fix Clang warnings/errorsChris Craik2014-01-021-1/+1
| | | | | | | Fix several build warnings (struct != class, int != size_t) and errors (variable leng non-POD arrays). Change-Id: I70b4e784365514303d8954bfcb1f39d7c22c1321
* Move Snapshot management to intermediate StatefulBaseRenderer classChris Craik2014-01-011-7/+14
| | | | | | | | | | | | | | | | | | The eventual goal is for the StatefulBaseRenderer to serve as the common base class between the DisplayListRenderer and OpenGLRenderer. This will separate DisplayList recording, Snapshot stack management, and the GL in OpenGLRenderer. Additionally, avoid sp<> parameters, and use const parameters in several places, with the intent of greatly reducing the surface area where renderer subclasses can modify snapshot stack. Next steps: -move bulk of clipping logic into StatefulBaseRenderer -disable direct snapshot access Change-Id: Ibc3c6747134ec7daf8ea535866239fa73b874390
* Create abstract base class for OpenGLRendererChris Craik2013-12-271-0/+267
This will eventually serve as a base class to allow DisplayListRenderer to split off from OpenGLRenderer, and could eventually support other rendering approaches, such as an SkCanvas/SkPicture. This will also be the main source of (implementation-independent) documentation of the canvas/renderer methods. Change-Id: I52047f338f5cf86a3b0b3002af7154bff5c3c227