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

Unified Diff: src/core/SkPaint.cpp

Issue 14761003: API modifications needed to upstream Android font changes. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: addressing comments Created 7 years, 7 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
« no previous file with comments | « include/ports/SkTypeface_android.h ('k') | src/core/SkPaintOptionsAndroid.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « include/ports/SkTypeface_android.h ('k') | src/core/SkPaintOptionsAndroid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698