aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPaint.cpp
diff options
context:
space:
mode:
authorGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-08 18:35:13 +0000
committerGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-08 18:35:13 +0000
commit4bd2bdbf04f21237337616aa931e34d7c8991edc (patch)
treeade3b197e460003914d462c1eeedc93c203f181c /src/core/SkPaint.cpp
parent184487c8083e4e3958f9efe6fb6a9b1d4865fdf5 (diff)
Upstream changes from Android.
Review URL: https://codereview.chromium.org/12699002 git-svn-id: http://skia.googlecode.com/svn/trunk@8045 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPaint.cpp')
-rw-r--r--src/core/SkPaint.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 07d1c33bd4..37edfbb6fe 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) {