Index: src/core/SkPaint.cpp |
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp |
index 6c16428d818b5d99220ff1369a81d114ee2b66dc..193568effb2b322e250b17ae46de5a909df30b0e 100644 |
--- a/src/core/SkPaint.cpp |
+++ b/src/core/SkPaint.cpp |
@@ -83,6 +83,7 @@ SkPaint::SkPaint() { |
fHinting = SkPaintDefaults_Hinting; |
fPrivFlags = 0; |
#ifdef SK_BUILD_FOR_ANDROID |
+ new (&fPaintOptionsAndroid) SkPaintOptionsAndroid; |
fGenerationID = 0; |
#endif |
} |
@@ -141,11 +142,15 @@ SkPaint& SkPaint::operator=(const SkPaint& src) { |
SkSafeUnref(fAnnotation); |
#ifdef SK_BUILD_FOR_ANDROID |
+ fPaintOptionsAndroid.~SkPaintOptionsAndroid(); |
+ |
uint32_t oldGenerationID = fGenerationID; |
#endif |
memcpy(this, &src, sizeof(src)); |
#ifdef SK_BUILD_FOR_ANDROID |
fGenerationID = oldGenerationID + 1; |
+ |
+ new (&fPaintOptionsAndroid) SkPaintOptionsAndroid(src.fPaintOptionsAndroid); |
#endif |
return *this; |
@@ -180,14 +185,19 @@ uint32_t SkPaint::getGenerationID() const { |
void SkPaint::setGenerationID(uint32_t generationID) { |
fGenerationID = generationID; |
} |
-#endif |
-#ifdef SK_BUILD_FOR_ANDROID |
unsigned SkPaint::getBaseGlyphCount(SkUnichar text) const { |
SkAutoGlyphCache autoCache(*this, NULL, NULL); |
SkGlyphCache* cache = autoCache.getCache(); |
return cache->getBaseGlyphCount(text); |
} |
+ |
+void SkPaint::setPaintOptionsAndroid(const SkPaintOptionsAndroid& options) { |
+ if (options != fPaintOptionsAndroid) { |
+ fPaintOptionsAndroid = options; |
+ GEN_ID_INC; |
+ } |
+} |
#endif |
void SkPaint::setHinting(Hinting hintingLevel) { |
@@ -1806,6 +1816,13 @@ void SkPaint::descriptorProc(const SkDeviceProperties* deviceProperties, |
rec.fMaskFormat = SkMask::kA8_Format; // force antialiasing when we do the scan conversion |
} |
+#ifdef SK_BUILD_FOR_ANDROID |
+ SkOrderedWriteBuffer androidBuffer(128); |
+ fPaintOptionsAndroid.flatten(androidBuffer); |
+ descSize += androidBuffer.size(); |
+ entryCount += 1; |
+#endif |
+ |
/////////////////////////////////////////////////////////////////////////// |
// Now that we're done tweaking the rec, call the PostMakeRec cleanup |
SkScalerContext::PostMakeRec(*this, &rec); |
@@ -1818,6 +1835,10 @@ void SkPaint::descriptorProc(const SkDeviceProperties* deviceProperties, |
desc->init(); |
desc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec); |
+#ifdef SK_BUILD_FOR_ANDROID |
+ add_flattenable(desc, kAndroidOpts_SkDescriptorTag, &androidBuffer); |
+#endif |
+ |
if (pe) { |
add_flattenable(desc, kPathEffect_SkDescriptorTag, &peBuffer); |
} |
@@ -1852,6 +1873,11 @@ void SkPaint::descriptorProc(const SkDeviceProperties* deviceProperties, |
desc1->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec); |
desc2->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec); |
+#ifdef SK_BUILD_FOR_ANDROID |
+ add_flattenable(desc1, kAndroidOpts_SkDescriptorTag, &androidBuffer); |
+ add_flattenable(desc2, kAndroidOpts_SkDescriptorTag, &androidBuffer); |
+#endif |
+ |
if (pe) { |
add_flattenable(desc1, kPathEffect_SkDescriptorTag, &peBuffer); |
add_flattenable(desc2, kPathEffect_SkDescriptorTag, &peBuffer); |