diff options
Diffstat (limited to 'libs/hwui/Layer.h')
-rw-r--r-- | libs/hwui/Layer.h | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h index b70042f..49610d5 100644 --- a/libs/hwui/Layer.h +++ b/libs/hwui/Layer.h @@ -17,7 +17,9 @@ #ifndef ANDROID_HWUI_LAYER_H #define ANDROID_HWUI_LAYER_H +#include <cutils/compiler.h> #include <sys/types.h> +#include <utils/StrongPointer.h> #include <GLES2/gl2.h> @@ -26,9 +28,9 @@ #include <SkPaint.h> #include <SkXfermode.h> +#include "Matrix.h" #include "Rect.h" #include "RenderBuffer.h" -#include "SkiaColorFilter.h" #include "Texture.h" #include "Vertex.h" @@ -42,14 +44,15 @@ namespace uirenderer { // Forward declarations class Caches; class OpenGLRenderer; -class DisplayList; +class RenderNode; class DeferredDisplayList; class DeferStateStruct; /** * A layer has dimensions and is backed by an OpenGL texture or FBO. */ -struct Layer { +class Layer { +public: Layer(const uint32_t layerWidth, const uint32_t layerHeight); ~Layer(); @@ -82,14 +85,8 @@ struct Layer { regionRect.translate(layer.left, layer.top); } - void updateDeferred(OpenGLRenderer* renderer, DisplayList* displayList, - int left, int top, int right, int bottom) { - this->renderer = renderer; - this->displayList = displayList; - const Rect r(left, top, right, bottom); - dirtyRect.unionWith(r); - deferredUpdateScheduled = true; - } + void updateDeferred(RenderNode* displayList, + int left, int top, int right, int bottom); inline uint32_t getWidth() const { return texture.width; @@ -115,7 +112,7 @@ struct Layer { texture.height = height; } - ANDROID_API void setPaint(SkPaint* paint); + ANDROID_API void setPaint(const SkPaint* paint); inline void setBlend(bool blend) { texture.blend = blend; @@ -125,6 +122,14 @@ struct Layer { return texture.blend; } + inline void setForceFilter(bool forceFilter) { + this->forceFilter = forceFilter; + } + + inline bool getForceFilter() const { + return forceFilter; + } + inline void setAlpha(int alpha) { this->alpha = alpha; } @@ -216,11 +221,19 @@ struct Layer { this->textureLayer = textureLayer; } - inline SkiaColorFilter* getColorFilter() const { + inline SkColorFilter* getColorFilter() const { return colorFilter; } - ANDROID_API void setColorFilter(SkiaColorFilter* filter); + ANDROID_API void setColorFilter(SkColorFilter* filter); + + inline void setConvexMask(const SkPath* convexMask) { + this->convexMask = convexMask; + } + + inline const SkPath* getConvexMask() { + return convexMask; + } void bindStencilRenderBuffer() const; @@ -284,12 +297,14 @@ struct Layer { */ bool deferredUpdateScheduled; OpenGLRenderer* renderer; - DisplayList* displayList; + sp<RenderNode> displayList; Rect dirtyRect; bool debugDrawUpdate; bool hasDrawnSinceUpdate; private: + void requireRenderer(); + Caches& caches; /** @@ -338,12 +353,18 @@ private: /** * Color filter used to draw this layer. Optional. */ - SkiaColorFilter* colorFilter; + SkColorFilter* colorFilter; + + /** + * Indicates raster data backing the layer is scaled, requiring filtration. + */ + bool forceFilter; /** * Opacity of the layer. */ int alpha; + /** * Blending mode of the layer. */ @@ -365,6 +386,13 @@ private: */ DeferredDisplayList* deferredList; + /** + * This convex path should be used to mask the layer's draw to the screen. + * + * Data not owned/managed by layer object. + */ + const SkPath* convexMask; + }; // struct Layer }; // namespace uirenderer |