diff options
Diffstat (limited to 'libs/hwui/DisplayListRenderer.h')
-rw-r--r-- | libs/hwui/DisplayListRenderer.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index fb01753..f55f1f2 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -85,6 +85,8 @@ public: SetMatrix, ConcatMatrix, ClipRect, + ClipPath, + ClipRegion, // Drawing operations DrawDisplayList, DrawLayer, @@ -457,6 +459,10 @@ private: return (SkPath*) getInt(); } + SkRegion* getRegion() { + return (SkRegion*) getInt(); + } + SkPaint* getPaint(OpenGLRenderer& renderer) { return renderer.filterPaint((SkPaint*) getInt()); } @@ -496,6 +502,7 @@ private: Vector<SkPaint*> mPaints; Vector<SkPath*> mPaths; SortedVector<SkPath*> mSourcePaths; + Vector<SkRegion*> mRegions; Vector<SkMatrix*> mMatrices; Vector<SkiaShader*> mShaders; Vector<Layer*> mLayers; @@ -577,6 +584,8 @@ public: virtual void concatMatrix(SkMatrix* matrix); virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op); + virtual bool clipPath(SkPath* path, SkRegion::Op op); + virtual bool clipRegion(SkRegion* region, SkRegion::Op op); virtual status_t drawDisplayList(DisplayList* displayList, Rect& dirty, int32_t flags, uint32_t level = 0); @@ -657,6 +666,10 @@ public: return mSourcePaths; } + const Vector<SkRegion*>& getRegions() const { + return mRegions; + } + const Vector<Layer*>& getLayers() const { return mLayers; } @@ -802,6 +815,26 @@ private: return paintCopy; } + inline SkRegion* addRegion(SkRegion* region) { + if (!region) { + addInt((int) NULL); + return region; + } + + SkRegion* regionCopy = mRegionMap.valueFor(region); + // TODO: Add generation ID to SkRegion + if (regionCopy == NULL) { + regionCopy = new SkRegion(*region); + // replaceValueFor() performs an add if the entry doesn't exist + mRegionMap.replaceValueFor(region, regionCopy); + mRegions.add(regionCopy); + } + + addInt((int) regionCopy); + + return regionCopy; + } + inline void addDisplayList(DisplayList* displayList) { // TODO: To be safe, the display list should be ref-counted in the // resources cache, but we rely on the caller (UI toolkit) to @@ -876,6 +909,9 @@ private: SortedVector<SkPath*> mSourcePaths; + Vector<SkRegion*> mRegions; + DefaultKeyedVector<SkRegion*, SkRegion*> mRegionMap; + Vector<SkiaShader*> mShaders; DefaultKeyedVector<SkiaShader*, SkiaShader*> mShaderMap; |