diff options
| -rw-r--r-- | libs/hwui/VectorDrawable.cpp | 16 | ||||
| -rw-r--r-- | libs/hwui/VectorDrawable.h | 13 |
2 files changed, 15 insertions, 14 deletions
diff --git a/libs/hwui/VectorDrawable.cpp b/libs/hwui/VectorDrawable.cpp index 793df92dae45..3e20608dc4cc 100644 --- a/libs/hwui/VectorDrawable.cpp +++ b/libs/hwui/VectorDrawable.cpp @@ -31,7 +31,7 @@ namespace VectorDrawable { const int Tree::MAX_CACHED_BITMAP_SIZE = 2048; -void Path::draw(Canvas* outCanvas, const SkMatrix& groupStackedMatrix, float scaleX, float scaleY) { +void Path::draw(SkCanvas* outCanvas, const SkMatrix& groupStackedMatrix, float scaleX, float scaleY) { float matrixScale = getMatrixScale(groupStackedMatrix); if (matrixScale == 0) { // When either x or y is scaled to 0, we don't need to draw anything. @@ -186,7 +186,7 @@ inline SkColor applyAlpha(SkColor color, float alpha) { return SkColorSetA(color, alphaBytes * alpha); } -void FullPath::drawPath(Canvas* outCanvas, const SkPath& renderPath, float strokeScale){ +void FullPath::drawPath(SkCanvas* outCanvas, const SkPath& renderPath, float strokeScale){ // Draw path's fill, if fill color isn't transparent. if (mFillColor != SK_ColorTRANSPARENT) { mPaint.setStyle(SkPaint::Style::kFill_Style); @@ -287,9 +287,9 @@ bool FullPath::getProperties(int8_t* outProperties, int length) { return true; } -void ClipPath::drawPath(Canvas* outCanvas, const SkPath& renderPath, +void ClipPath::drawPath(SkCanvas* outCanvas, const SkPath& renderPath, float strokeScale){ - outCanvas->clipPath(&renderPath, SkRegion::kIntersect_Op); + outCanvas->clipPath(renderPath, SkRegion::kIntersect_Op); } Group::Group(const Group& group) : Node(group) { @@ -302,7 +302,7 @@ Group::Group(const Group& group) : Node(group) { mTranslateY = group.mTranslateY; } -void Group::draw(Canvas* outCanvas, const SkMatrix& currentMatrix, float scaleX, +void Group::draw(SkCanvas* outCanvas, const SkMatrix& currentMatrix, float scaleX, float scaleY) { // TODO: Try apply the matrix to the canvas instead of passing it down the tree @@ -315,7 +315,7 @@ void Group::draw(Canvas* outCanvas, const SkMatrix& currentMatrix, float scaleX, stackedMatrix.postConcat(currentMatrix); // Save the current clip information, which is local to this group. - outCanvas->save(SkCanvas::kMatrixClip_SaveFlag); + outCanvas->save(); // Draw the group tree in the same order as the XML file. for (Node* child : mChildren) { child->draw(outCanvas, stackedMatrix, scaleX, scaleY); @@ -465,10 +465,10 @@ void Tree::drawCachedBitmapWithRootAlpha(Canvas* outCanvas, SkColorFilter* filte void Tree::updateCachedBitmap(int width, int height) { mCachedBitmap.eraseColor(SK_ColorTRANSPARENT); - Canvas* outCanvas = Canvas::create_canvas(mCachedBitmap); + SkCanvas outCanvas(mCachedBitmap); float scaleX = width / mViewportWidth; float scaleY = height / mViewportHeight; - mRootNode->draw(outCanvas, SkMatrix::I(), scaleX, scaleY); + mRootNode->draw(&outCanvas, SkMatrix::I(), scaleX, scaleY); mCacheDirty = false; } diff --git a/libs/hwui/VectorDrawable.h b/libs/hwui/VectorDrawable.h index 6c84b052faf4..5ae5f6a3bdba 100644 --- a/libs/hwui/VectorDrawable.h +++ b/libs/hwui/VectorDrawable.h @@ -20,6 +20,7 @@ #include "Canvas.h" #include <SkBitmap.h> #include <SkColor.h> +#include <SkCanvas.h> #include <SkMatrix.h> #include <SkPaint.h> #include <SkPath.h> @@ -56,7 +57,7 @@ public: mName = node.mName; } Node() {} - virtual void draw(Canvas* outCanvas, const SkMatrix& currentMatrix, + virtual void draw(SkCanvas* outCanvas, const SkMatrix& currentMatrix, float scaleX, float scaleY) = 0; virtual void dump() = 0; void setName(const char* name) { @@ -85,7 +86,7 @@ public: void dump() override; bool canMorph(const Data& path); bool canMorph(const Path& path); - void draw(Canvas* outCanvas, const SkMatrix& groupStackedMatrix, + void draw(SkCanvas* outCanvas, const SkMatrix& groupStackedMatrix, float scaleX, float scaleY) override; void setPath(const char* path, size_t strLength); void setPathData(const Data& data); @@ -93,7 +94,7 @@ public: protected: virtual const SkPath& getUpdatedPath(); - virtual void drawPath(Canvas *outCanvas, const SkPath& renderPath, + virtual void drawPath(SkCanvas *outCanvas, const SkPath& renderPath, float strokeScale) = 0; Data mData; SkPath mSkPath; @@ -163,7 +164,7 @@ public: protected: const SkPath& getUpdatedPath() override; - void drawPath(Canvas* outCanvas, const SkPath& renderPath, + void drawPath(SkCanvas* outCanvas, const SkPath& renderPath, float strokeScale) override; private: @@ -193,7 +194,7 @@ public: ClipPath(const Data& nodes) : Path(nodes) {} protected: - void drawPath(Canvas* outCanvas, const SkPath& renderPath, + void drawPath(SkCanvas* outCanvas, const SkPath& renderPath, float strokeScale) override; }; @@ -243,7 +244,7 @@ public: void setTranslateY(float translateY) { mTranslateY = translateY; } - virtual void draw(Canvas* outCanvas, const SkMatrix& currentMatrix, + virtual void draw(SkCanvas* outCanvas, const SkMatrix& currentMatrix, float scaleX, float scaleY) override; void updateLocalMatrix(float rotate, float pivotX, float pivotY, float scaleX, float scaleY, float translateX, float translateY); |