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
diff --git a/libs/hwui/VectorDrawable.h b/libs/hwui/VectorDrawable.h
index 7f75609..d9cf8ab 100644
--- a/libs/hwui/VectorDrawable.h
+++ b/libs/hwui/VectorDrawable.h
@@ -124,6 +124,7 @@
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 @@
}
}
}
+ virtual void setAntiAlias(bool aa) { mAntiAlias = aa; }
protected:
const SkPath& getUpdatedPath(bool useStagingData, SkPath* tempStagingPath) override;
@@ -365,6 +367,8 @@
// 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 @@
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 @@
}
}
+ 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 @@
*/
void updateCache(sp<skiapipeline::VectorDrawableAtlas>& atlas, GrContext* context);
+ void setAntiAlias(bool aa) { mRootNode->setAntiAlias(aa); }
+
private:
class Cache {
public: