diff options
author | Doris Liu <tianliu@google.com> | 2017-12-04 16:31:07 -0800 |
---|---|---|
committer | Doris Liu <tianliu@google.com> | 2017-12-04 16:31:07 -0800 |
commit | 6b184d7a43d88511841407673448c64a114fdb4e (patch) | |
tree | 748e3eca3919a7c409c15fc13ae3fa3fdeca90b8 /libs/hwui/VectorDrawable.h | |
parent | aad6c9841c81b8eed80eb12dd2e79b81cc772461 (diff) |
Private API to turn off anti-aliasing for VectorDrawable
Bug: 69322344
Test: visual inspection on VectorDrawableTest with AA off. Jagged edges
that are otherwise smooth were spotted.
Change-Id: Ib2dfbd3a941be0b4ff92b8458346f8c8f5015a4b
Diffstat (limited to 'libs/hwui/VectorDrawable.h')
-rw-r--r-- | libs/hwui/VectorDrawable.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/hwui/VectorDrawable.h b/libs/hwui/VectorDrawable.h index 7f7560958022..d9cf8ab7eedf 100644 --- a/libs/hwui/VectorDrawable.h +++ b/libs/hwui/VectorDrawable.h @@ -124,6 +124,7 @@ public: virtual void onPropertyChanged(Properties* properties) = 0; virtual ~Node() {} virtual void syncProperties() = 0; + virtual void setAntiAlias(bool aa) = 0; protected: std::string mName; @@ -354,6 +355,7 @@ public: } } } + virtual void setAntiAlias(bool aa) { mAntiAlias = aa; } protected: const SkPath& getUpdatedPath(bool useStagingData, SkPath* tempStagingPath) override; @@ -365,6 +367,8 @@ private: // Intermediate data for drawing, render thread only SkPath mTrimmedSkPath; + // Default to use AntiAlias + bool mAntiAlias = true; }; class ANDROID_API ClipPath : public Path { @@ -373,6 +377,7 @@ public: ClipPath(const char* path, size_t strLength) : Path(path, strLength) {} ClipPath() : Path() {} void draw(SkCanvas* outCanvas, bool useStagingData) override; + virtual void setAntiAlias(bool aa) {} }; class ANDROID_API Group : public Node { @@ -476,6 +481,12 @@ public: } } + virtual void setAntiAlias(bool aa) { + for (auto& child : mChildren) { + child->setAntiAlias(aa); + } + } + private: GroupProperties mProperties = GroupProperties(this); GroupProperties mStagingProperties = GroupProperties(this); @@ -641,6 +652,8 @@ public: */ void updateCache(sp<skiapipeline::VectorDrawableAtlas>& atlas, GrContext* context); + void setAntiAlias(bool aa) { mRootNode->setAntiAlias(aa); } + private: class Cache { public: |