Index: src/core/SkPaint.cpp |
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp |
index 07d1c33bd47b747f3711be4fe75a988b0f98a08b..37edfbb6fe8f5e3b7b332fe6a54c96d9d17a7c6b 100644 |
--- a/src/core/SkPaint.cpp |
+++ b/src/core/SkPaint.cpp |
@@ -176,6 +176,10 @@ void SkPaint::reset() { |
uint32_t SkPaint::getGenerationID() const { |
return fGenerationID; |
} |
+ |
+void SkPaint::setGenerationID(uint32_t generationID) { |
+ fGenerationID = generationID; |
+} |
#endif |
#ifdef SK_BUILD_FOR_ANDROID |
@@ -415,9 +419,10 @@ static void DetachDescProc(const SkDescriptor* desc, void* context) { |
} |
#ifdef SK_BUILD_FOR_ANDROID |
-const SkGlyph& SkPaint::getUnicharMetrics(SkUnichar text) { |
+const SkGlyph& SkPaint::getUnicharMetrics(SkUnichar text, |
+ const SkMatrix* deviceMatrix) { |
SkGlyphCache* cache; |
- descriptorProc(NULL, NULL, DetachDescProc, &cache, true); |
+ descriptorProc(NULL, deviceMatrix, DetachDescProc, &cache, true); |
const SkGlyph& glyph = cache->getUnicharMetrics(text); |
@@ -425,9 +430,10 @@ const SkGlyph& SkPaint::getUnicharMetrics(SkUnichar text) { |
return glyph; |
} |
-const SkGlyph& SkPaint::getGlyphMetrics(uint16_t glyphId) { |
+const SkGlyph& SkPaint::getGlyphMetrics(uint16_t glyphId, |
+ const SkMatrix* deviceMatrix) { |
SkGlyphCache* cache; |
- descriptorProc(NULL, NULL, DetachDescProc, &cache, true); |
+ descriptorProc(NULL, deviceMatrix, DetachDescProc, &cache, true); |
const SkGlyph& glyph = cache->getGlyphIDMetrics(glyphId); |
@@ -435,10 +441,11 @@ const SkGlyph& SkPaint::getGlyphMetrics(uint16_t glyphId) { |
return glyph; |
} |
-const void* SkPaint::findImage(const SkGlyph& glyph) { |
+const void* SkPaint::findImage(const SkGlyph& glyph, |
+ const SkMatrix* deviceMatrix) { |
// See ::detachCache() |
SkGlyphCache* cache; |
- descriptorProc(NULL, NULL, DetachDescProc, &cache, true); |
+ descriptorProc(NULL, deviceMatrix, DetachDescProc, &cache, true); |
const void* image = cache->findImage(glyph); |
@@ -900,17 +907,26 @@ public: |
fTextSize = paint->getTextSize(); |
fStyle = paint->getStyle(); |
fPaint->setStyle(SkPaint::kFill_Style); |
+#ifdef SK_BUILD_FOR_ANDROID |
+ fGenerationID = fPaint->getGenerationID(); |
+#endif |
} |
~SkAutoRestorePaintTextSizeAndFrame() { |
fPaint->setStyle(fStyle); |
fPaint->setTextSize(fTextSize); |
+#ifdef SK_BUILD_FOR_ANDROID |
+ fPaint->setGenerationID(fGenerationID); |
+#endif |
} |
private: |
SkPaint* fPaint; |
SkScalar fTextSize; |
SkPaint::Style fStyle; |
+#ifdef SK_BUILD_FOR_ANDROID |
+ uint32_t fGenerationID; |
+#endif |
}; |
static void set_bounds(const SkGlyph& g, SkRect* bounds) { |