From: reed@google.com Date: Wed, 18 May 2011 19:00:53 +0000 (+0000) Subject: encode current LCD orientation and order into font-cache-key X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~18441 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=02b5331078861b02b61e9a93f845617a7c900409;p=platform%2Fupstream%2FlibSkiaSharp.git encode current LCD orientation and order into font-cache-key git-svn-id: http://skia.googlecode.com/svn/trunk@1368 2bbb7eff-a529-9590-31e7-b0007b416f81 --- diff --git a/include/core/SkScalerContext.h b/include/core/SkScalerContext.h index 55dfcef..3f818a3 100644 --- a/include/core/SkScalerContext.h +++ b/include/core/SkScalerContext.h @@ -179,6 +179,9 @@ public: kEmbolden_Flag = 0x80, kSubpixelPositioning_Flag = 0x100, kAutohinting_Flag = 0x200, + // these should only ever be set if fMaskFormat is LCD + kLCD_Vertical_Flag = 0x400, // else Horizontal + kLCD_BGROrder_Flag = 0x800, // else RGB order }; private: enum { diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 14c0397..311ec7d 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -1292,18 +1292,35 @@ void SkScalerContext::MakeRec(const SkPaint& paint, rec->fStrokeJoin = 0; } - rec->fMaskFormat = SkToU8(computeMaskFormat(paint)); - rec->fFlags = SkToU8(flags); rec->setHinting(computeHinting(paint)); + rec->fMaskFormat = SkToU8(computeMaskFormat(paint)); + + if (SkMask::kLCD16_Format == rec->fMaskFormat) { + SkFontHost::LCDOrder order = SkFontHost::GetSubpixelOrder(); + SkFontHost::LCDOrientation orient = SkFontHost::GetSubpixelOrientation(); + if (SkFontHost::kNONE_LCDOrder == order) { + // eeek, can't support LCD + rec->fMaskFormat = SkMask::kA8_Format; + } else { + if (SkFontHost::kVertical_LCDOrientation == orient) { + flags |= SkScalerContext::kLCD_Vertical_Flag; + } + if (SkFontHost::kBGR_LCDOrder == order) { + flags |= SkScalerContext::kLCD_BGROrder_Flag; + } + } + } + if (paint.isEmbeddedBitmapText()) { - rec->fFlags |= SkScalerContext::kEmbeddedBitmapText_Flag; + flags |= SkScalerContext::kEmbeddedBitmapText_Flag; } if (paint.isSubpixelText()) { - rec->fFlags |= SkScalerContext::kSubpixelPositioning_Flag; + flags |= SkScalerContext::kSubpixelPositioning_Flag; } if (paint.isAutohinted()) { - rec->fFlags |= SkScalerContext::kAutohinting_Flag; + flags |= SkScalerContext::kAutohinting_Flag; } + rec->fFlags = SkToU16(flags); /* 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,