Fix r466 which was causing Chromium valgrind failures.
authoragl@chromium.org <agl@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 4 Jan 2010 23:56:43 +0000 (23:56 +0000)
committeragl@chromium.org <agl@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 4 Jan 2010 23:56:43 +0000 (23:56 +0000)
See the added comment for details.

TBR=reed (since it's a build fix)

git-svn-id: http://skia.googlecode.com/svn/trunk@469 2bbb7eff-a529-9590-31e7-b0007b416f81

include/core/SkScalerContext.h
src/core/SkPaint.cpp
src/ports/SkFontHost_FreeType.cpp

index 05d2508..407985b 100644 (file)
@@ -154,6 +154,7 @@ public:
         // up with the SkPaint::Hinting enum.
         kHintingBit1_Flag   = 0x10,
         kHintingBit2_Flag   = 0x20,
+        kEmbeddedBitmapText_Flag = 0x40,
     };
 private:
     enum {
@@ -166,10 +167,13 @@ public:
         SkScalar    fPost2x2[2][2];
         SkScalar    fFrameWidth, fMiterLimit;
         bool        fSubpixelPositioning;
-        bool        fUseEmbeddedBitmapText;
         uint8_t     fMaskFormat;
         uint8_t     fStrokeJoin;
         uint8_t     fFlags;
+        // Warning: when adding members note that the size of this structure
+        // must be a multiple of 4. SkDescriptor requires that its arguments be
+        // multiples of four and this structure is put in an SkDescriptor in
+        // SkPaint::MakeRec.
 
         void    getMatrixFrom2x2(SkMatrix*) const;
         void    getLocalMatrix(SkMatrix*) const;
index 589b1c7..e4e4ea8 100644 (file)
@@ -1223,7 +1223,8 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
     rec->fMaskFormat = SkToU8(computeMaskFormat(paint));
     rec->fFlags = SkToU8(flags);
     rec->setHinting(computeHinting(paint));
-    rec->fUseEmbeddedBitmapText = paint.isEmbeddedBitmapText();
+    if (paint.isEmbeddedBitmapText())
+        rec->fFlags |= SkScalerContext::kEmbeddedBitmapText_Flag;
 
     /*  Allow the fonthost to modify our rec before we use it as a key into the
         cache. This way if we're asking for something that they will ignore,
index 5eb36f6..d4fdf74 100644 (file)
@@ -376,9 +376,8 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(const SkDescriptor* desc)
             break;
         }
 
-        if (!fRec.fUseEmbeddedBitmapText) {
+        if (fRec.fFlags & SkScalerContext::kEmbeddedBitmapText_Flag == 0)
             loadFlags |= FT_LOAD_NO_BITMAP;
-        }
 
         fLoadGlyphFlags = loadFlags;
     }