Chromium Code Reviews| Index: src/core/SkPaint.cpp |
| diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp |
| index 6c16428d818b5d99220ff1369a81d114ee2b66dc..3a1650a1cb5334291f88fb7bb6e0e715d9de768c 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(); |
|
reed1
2013/05/10 17:14:43
I *think* you don't want/need the () at the end...
djsollen
2013/05/10 17:29:40
Done.
|
| 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(!memcmp(&fPaintOptionsAndroid, &options, sizeof(SkPaintOptionsAndroid))) { |
|
reed1
2013/05/10 17:14:43
I think you want
if (fPaintOptionsAndroid != opt
djsollen
2013/05/10 17:29:40
Done.
|
| + 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); |