Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: src/core/SkPaint.cpp

Issue 447873003: Remove SkPaintOptionsAndroid (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: typo Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/core/SkPaint.cpp
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 9e53d19e2a31575a11879d84f3074567fe38e7f6..3dd87b7aa6f84b4f0214d8137061dda115907e34 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -21,7 +21,6 @@
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
#include "SkPaintDefaults.h"
-#include "SkPaintOptionsAndroid.h"
#include "SkPathEffect.h"
#include "SkRasterizer.h"
#include "SkScalar.h"
@@ -55,7 +54,6 @@ enum {
kImageFilter_DirtyBit = 1 << 13,
kTypeface_DirtyBit = 1 << 14,
kAnnotation_DirtyBit = 1 << 15,
- kPaintOptionsAndroid_DirtyBit = 1 << 16,
};
// define this to get a printf for out-of-range parameter in setters
@@ -101,7 +99,6 @@ SkPaint::SkPaint() {
fDirtyBits = 0;
#ifdef SK_BUILD_FOR_ANDROID
- new (&fPaintOptionsAndroid) SkPaintOptionsAndroid;
fGenerationID = 0;
#endif
}
@@ -131,7 +128,6 @@ SkPaint::SkPaint(const SkPaint& src) {
COPY(fDirtyBits);
#ifdef SK_BUILD_FOR_ANDROID
- new (&fPaintOptionsAndroid) SkPaintOptionsAndroid(src.fPaintOptionsAndroid);
COPY(fGenerationID);
#endif
@@ -183,8 +179,6 @@ SkPaint& SkPaint::operator=(const SkPaint& src) {
COPY(fDirtyBits);
#ifdef SK_BUILD_FOR_ANDROID
- fPaintOptionsAndroid.~SkPaintOptionsAndroid();
- new (&fPaintOptionsAndroid) SkPaintOptionsAndroid(src.fPaintOptionsAndroid);
++fGenerationID;
#endif
@@ -214,9 +208,6 @@ bool operator==(const SkPaint& a, const SkPaint& b) {
&& EQUAL(fWidth)
&& EQUAL(fMiterLimit)
&& EQUAL(fBitfieldsUInt)
-#ifdef SK_BUILD_FOR_ANDROID
- && EQUAL(fPaintOptionsAndroid)
-#endif
;
#undef EQUAL
}
@@ -241,14 +232,6 @@ uint32_t SkPaint::getGenerationID() const {
void SkPaint::setGenerationID(uint32_t generationID) {
fGenerationID = generationID;
}
-
-void SkPaint::setPaintOptionsAndroid(const SkPaintOptionsAndroid& options) {
- if (options != fPaintOptionsAndroid) {
- fPaintOptionsAndroid = options;
- GEN_ID_INC;
- fDirtyBits |= kPaintOptionsAndroid_DirtyBit;
- }
-}
#endif
void SkPaint::setFilterLevel(FilterLevel level) {
@@ -1843,14 +1826,6 @@ void SkPaint::descriptorProc(const SkDeviceProperties* deviceProperties,
rec.fMaskFormat = SkMask::kA8_Format; // force antialiasing when we do the scan conversion
}
-#ifdef SK_BUILD_FOR_ANDROID
- char buffer[128];
- SkWriteBuffer androidBuffer(buffer, sizeof(buffer));
- fPaintOptionsAndroid.flatten(androidBuffer);
- descSize += androidBuffer.bytesWritten();
- entryCount += 1;
-#endif
-
///////////////////////////////////////////////////////////////////////////
// Now that we're done tweaking the rec, call the PostMakeRec cleanup
SkScalerContext::PostMakeRec(*this, &rec);
@@ -1863,10 +1838,6 @@ 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);
}
@@ -1901,11 +1872,6 @@ 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);
@@ -2122,11 +2088,6 @@ void SkPaint::flatten(SkWriteBuffer& buffer) const {
asint(this->getImageFilter())) {
flatFlags |= kHasEffects_FlatFlag;
}
-#ifdef SK_BUILD_FOR_ANDROID
- if (this->getPaintOptionsAndroid() != SkPaintOptionsAndroid()) {
- flatFlags |= kHasNonDefaultPaintOptionsAndroid_FlatFlag;
- }
-#endif
SkASSERT(SkAlign4(kPODPaintSize) == kPODPaintSize);
uint32_t* ptr = buffer.reserve(kPODPaintSize);
@@ -2165,11 +2126,6 @@ void SkPaint::flatten(SkWriteBuffer& buffer) const {
buffer.writeBool(false);
}
}
-#ifdef SK_BUILD_FOR_ANDROID
- if (flatFlags & kHasNonDefaultPaintOptionsAndroid_FlatFlag) {
- this->getPaintOptionsAndroid().flatten(buffer);
- }
-#endif
}
void SkPaint::unflatten(SkReadBuffer& buffer) {
@@ -2228,15 +2184,12 @@ void SkPaint::unflatten(SkReadBuffer& buffer) {
this->setImageFilter(NULL);
}
-#ifdef SK_BUILD_FOR_ANDROID
- this->setPaintOptionsAndroid(SkPaintOptionsAndroid());
-#endif
- if (flatFlags & kHasNonDefaultPaintOptionsAndroid_FlatFlag) {
- SkPaintOptionsAndroid options;
- options.unflatten(buffer);
-#ifdef SK_BUILD_FOR_ANDROID
- this->setPaintOptionsAndroid(options);
-#endif
+ if (buffer.isVersionLT(SkReadBuffer::kRemoveAndroidPaintOpts_Version) &&
+ flatFlags & kHasNonDefaultPaintOptionsAndroid_FlatFlag) {
tomhudson 2014/08/13 19:52:28 I suppose hardcoding these is the expedient thing
djsollen 2014/08/13 20:00:22 Yep, otherwise I have to keep around a class/file
+ SkString tag;
+ buffer.readUInt();
+ buffer.readString(&tag);
+ buffer.readBool();
}
}
@@ -2695,9 +2648,6 @@ void SkPaint::FlatteningTraits::Flatten(SkWriteBuffer& buffer, const SkPaint& pa
#undef F
if (dirty & kTypeface_DirtyBit) buffer.writeTypeface(paint.getTypeface());
if (dirty & kAnnotation_DirtyBit) paint.getAnnotation()->writeToBuffer(buffer);
-#ifdef SK_BUILD_FOR_ANDROID
- if (dirty & kPaintOptionsAndroid_DirtyBit) paint.getPaintOptionsAndroid().flatten(buffer);
-#endif
}
void SkPaint::FlatteningTraits::Unflatten(SkReadBuffer& buffer, SkPaint* paint) {
@@ -2732,12 +2682,5 @@ void SkPaint::FlatteningTraits::Unflatten(SkReadBuffer& buffer, SkPaint* paint)
if (dirty & kAnnotation_DirtyBit) {
paint->setAnnotation(SkAnnotation::Create(buffer))->unref();
}
-#ifdef SK_BUILD_FOR_ANDROID
- if (dirty & kPaintOptionsAndroid_DirtyBit) {
- SkPaintOptionsAndroid options;
- options.unflatten(buffer);
- paint->setPaintOptionsAndroid(options);
- }
-#endif
SkASSERT(dirty == paint->fDirtyBits);
}

Powered by Google App Engine
This is Rietveld 408576698