diff options
-rw-r--r-- | include/core/SkMask.h | 20 | ||||
-rw-r--r-- | include/gpu/GrTypes.h | 4 | ||||
-rw-r--r-- | src/core/SkAAClip.cpp | 15 | ||||
-rw-r--r-- | src/core/SkBlitMask_D32.cpp | 198 | ||||
-rw-r--r-- | src/core/SkGlyph.h | 4 | ||||
-rw-r--r-- | src/core/SkMask.cpp | 1 | ||||
-rw-r--r-- | src/core/SkPaint.cpp | 5 | ||||
-rw-r--r-- | src/core/SkScalerContext.cpp | 34 | ||||
-rw-r--r-- | src/core/SkScalerContext.h | 2 | ||||
-rwxr-xr-x | src/gpu/GrBitmapTextContext.cpp | 1 | ||||
-rw-r--r-- | src/gpu/GrFontScaler.cpp | 9 | ||||
-rw-r--r-- | src/gpu/GrTextStrike.cpp | 2 | ||||
-rw-r--r-- | src/ports/SkFontHost_FreeType.cpp | 1 | ||||
-rw-r--r-- | src/ports/SkFontHost_FreeType_common.cpp | 16 | ||||
-rwxr-xr-x | src/ports/SkFontHost_mac.cpp | 35 | ||||
-rwxr-xr-x | src/ports/SkFontHost_win.cpp | 55 | ||||
-rw-r--r-- | src/ports/SkScalerContext_win_dw.cpp | 31 | ||||
-rw-r--r-- | tests/AAClipTest.cpp | 1 |
18 files changed, 28 insertions, 406 deletions
diff --git a/include/core/SkMask.h b/include/core/SkMask.h index 5cfef970c5..7be6aff614 100644 --- a/include/core/SkMask.h +++ b/include/core/SkMask.h @@ -23,11 +23,10 @@ struct SkMask { k3D_Format, //!< 3 8bit per pixl planes: alpha, mul, add kARGB32_Format, //!< SkPMColor kLCD16_Format, //!< 565 alpha for r/g/b - kLCD32_Format //!< 888 alpha for r/g/b }; enum { - kCountMaskFormats = kLCD32_Format + 1 + kCountMaskFormats = kLCD16_Format + 1 }; uint8_t* fImage; @@ -88,24 +87,11 @@ struct SkMask { /** * Return the address of the specified 32bit mask. In the debug build, - * this asserts that the mask's format is kLCD32_Format, and that (x,y) - * are contained in the mask's fBounds. - */ - uint32_t* getAddrLCD32(int x, int y) const { - SkASSERT(kLCD32_Format == fFormat); - SkASSERT(fBounds.contains(x, y)); - SkASSERT(fImage != NULL); - uint32_t* row = (uint32_t*)(fImage + (y - fBounds.fTop) * fRowBytes); - return row + (x - fBounds.fLeft); - } - - /** - * Return the address of the specified 32bit mask. In the debug build, * this asserts that the mask's format is 32bits, and that (x,y) * are contained in the mask's fBounds. */ uint32_t* getAddr32(int x, int y) const { - SkASSERT(kLCD32_Format == fFormat || kARGB32_Format == fFormat); + SkASSERT(kARGB32_Format == fFormat); SkASSERT(fBounds.contains(x, y)); SkASSERT(fImage != NULL); uint32_t* row = (uint32_t*)(fImage + (y - fBounds.fTop) * fRowBytes); @@ -116,7 +102,7 @@ struct SkMask { * Returns the address of the specified pixel, computing the pixel-size * at runtime based on the mask format. This will be slightly slower than * using one of the routines where the format is implied by the name - * e.g. getAddr8 or getAddrLCD32. + * e.g. getAddr8 or getAddr32. * * x,y must be contained by the mask's bounds (this is asserted in the * debug build, but not checked in the release build.) diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index 9c68af2ced..ccc04bce8a 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -229,7 +229,6 @@ static const int kPublicGrBlendCoeffCount = kLastPublicGrBlendCoeff + 1; enum GrMaskFormat { kA8_GrMaskFormat, //!< 1-byte per pixel kA565_GrMaskFormat, //!< 2-bytes per pixel - kA888_GrMaskFormat, //!< 4-bytes per pixel kARGB_GrMaskFormat, //!< 4-bytes per pixel, color format kLast_GrMaskFormat = kARGB_GrMaskFormat @@ -243,9 +242,8 @@ static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) { SkASSERT((unsigned)format <= 3); // kA8 (0) -> 1 // kA565 (1) -> 2 - // kA888 (2) -> 4 // kARGB (3) -> 4 - static const int sBytesPerPixel[] = { 1, 2, 4, 4 }; + static const int sBytesPerPixel[] = { 1, 2, 4 }; SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sBytesPerPixel) == kMaskFormatCount, array_size_mismatch); return sBytesPerPixel[(int) format]; diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp index 58a16f3aff..e2c1b12d07 100644 --- a/src/core/SkAAClip.cpp +++ b/src/core/SkAAClip.cpp @@ -2046,6 +2046,7 @@ static void small_bzero(void* dst, size_t n) { static inline uint8_t mergeOne(uint8_t value, unsigned alpha) { return SkMulDiv255Round(value, alpha); } + static inline uint16_t mergeOne(uint16_t value, unsigned alpha) { unsigned r = SkGetPackedR16(value); unsigned g = SkGetPackedG16(value); @@ -2054,16 +2055,6 @@ static inline uint16_t mergeOne(uint16_t value, unsigned alpha) { SkMulDiv255Round(g, alpha), SkMulDiv255Round(b, alpha)); } -static inline SkPMColor mergeOne(SkPMColor value, unsigned alpha) { - unsigned a = SkGetPackedA32(value); - unsigned r = SkGetPackedR32(value); - unsigned g = SkGetPackedG32(value); - unsigned b = SkGetPackedB32(value); - return SkPackARGB32(SkMulDiv255Round(a, alpha), - SkMulDiv255Round(r, alpha), - SkMulDiv255Round(g, alpha), - SkMulDiv255Round(b, alpha)); -} template <typename T> void mergeT(const T* SK_RESTRICT src, int srcN, const uint8_t* SK_RESTRICT row, int rowN, @@ -2111,10 +2102,6 @@ static MergeAAProc find_merge_aa_proc(SkMask::Format format) { void (*proc16)(const uint16_t*, int, const uint8_t*, int, uint16_t*) = mergeT; return (MergeAAProc)proc16; } - case SkMask::kLCD32_Format: { - void (*proc32)(const SkPMColor*, int, const uint8_t*, int, SkPMColor*) = mergeT; - return (MergeAAProc)proc32; - } default: SkDEBUGFAIL("unsupported"); return NULL; diff --git a/src/core/SkBlitMask_D32.cpp b/src/core/SkBlitMask_D32.cpp index ef4d84bfcf..594a274d42 100644 --- a/src/core/SkBlitMask_D32.cpp +++ b/src/core/SkBlitMask_D32.cpp @@ -112,117 +112,6 @@ static void D32_LCD16_Proc(void* SK_RESTRICT dst, size_t dstRB, /////////////////////////////////////////////////////////////////////////////// -static void blit_lcd32_opaque_row(SkPMColor* SK_RESTRICT dst, - const SkPMColor* SK_RESTRICT src, - SkColor color, int width) { - int srcR = SkColorGetR(color); - int srcG = SkColorGetG(color); - int srcB = SkColorGetB(color); - - for (int i = 0; i < width; i++) { - SkPMColor mask = src[i]; - if (0 == mask) { - continue; - } - - SkPMColor d = dst[i]; - - int maskR = SkGetPackedR32(mask); - int maskG = SkGetPackedG32(mask); - int maskB = SkGetPackedB32(mask); - - // Now upscale them to 0..256, so we can use SkAlphaBlend - maskR = SkAlpha255To256(maskR); - maskG = SkAlpha255To256(maskG); - maskB = SkAlpha255To256(maskB); - - int dstR = SkGetPackedR32(d); - int dstG = SkGetPackedG32(d); - int dstB = SkGetPackedB32(d); - - // LCD blitting is only supported if the dst is known/required - // to be opaque - dst[i] = SkPackARGB32(0xFF, - SkAlphaBlend(srcR, dstR, maskR), - SkAlphaBlend(srcG, dstG, maskG), - SkAlphaBlend(srcB, dstB, maskB)); - } -} - -static void blit_lcd32_row(SkPMColor* SK_RESTRICT dst, - const SkPMColor* SK_RESTRICT src, - SkColor color, int width) { - int srcA = SkColorGetA(color); - int srcR = SkColorGetR(color); - int srcG = SkColorGetG(color); - int srcB = SkColorGetB(color); - - srcA = SkAlpha255To256(srcA); - - for (int i = 0; i < width; i++) { - SkPMColor mask = src[i]; - if (0 == mask) { - continue; - } - - SkPMColor d = dst[i]; - - int maskR = SkGetPackedR32(mask); - int maskG = SkGetPackedG32(mask); - int maskB = SkGetPackedB32(mask); - - // Now upscale them to 0..256, so we can use SkAlphaBlend - maskR = SkAlpha255To256(maskR); - maskG = SkAlpha255To256(maskG); - maskB = SkAlpha255To256(maskB); - - maskR = maskR * srcA >> 8; - maskG = maskG * srcA >> 8; - maskB = maskB * srcA >> 8; - - int dstR = SkGetPackedR32(d); - int dstG = SkGetPackedG32(d); - int dstB = SkGetPackedB32(d); - - // LCD blitting is only supported if the dst is known/required - // to be opaque - dst[i] = SkPackARGB32(0xFF, - SkAlphaBlend(srcR, dstR, maskR), - SkAlphaBlend(srcG, dstG, maskG), - SkAlphaBlend(srcB, dstB, maskB)); - } -} - -static void D32_LCD32_Blend(void* SK_RESTRICT dst, size_t dstRB, - const void* SK_RESTRICT mask, size_t maskRB, - SkColor color, int width, int height) { - SkASSERT(height > 0); - SkPMColor* SK_RESTRICT dstRow = (SkPMColor*)dst; - const SkPMColor* SK_RESTRICT srcRow = (const SkPMColor*)mask; - - do { - blit_lcd32_row(dstRow, srcRow, color, width); - dstRow = (SkPMColor*)((char*)dstRow + dstRB); - srcRow = (const SkPMColor*)((const char*)srcRow + maskRB); - } while (--height != 0); -} - -static void D32_LCD32_Opaque(void* SK_RESTRICT dst, size_t dstRB, - const void* SK_RESTRICT mask, size_t maskRB, - SkColor color, int width, int height) { - SkASSERT(height > 0); - SkPMColor* SK_RESTRICT dstRow = (SkPMColor*)dst; - const SkPMColor* SK_RESTRICT srcRow = (const SkPMColor*)mask; - - do { - blit_lcd32_opaque_row(dstRow, srcRow, color, width); - dstRow = (SkPMColor*)((char*)dstRow + dstRB); - srcRow = (const SkPMColor*)((const char*)srcRow + maskRB); - } while (--height != 0); -} - -/////////////////////////////////////////////////////////////////////////////// - static SkBlitMask::ColorProc D32_A8_Factory(SkColor color) { if (SK_ColorBLACK == color) { return D32_A8_Black; @@ -233,10 +122,6 @@ static SkBlitMask::ColorProc D32_A8_Factory(SkColor color) { } } -static SkBlitMask::ColorProc D32_LCD32_Factory(SkColor color) { - return (0xFF == SkColorGetA(color)) ? D32_LCD32_Opaque : D32_LCD32_Blend; -} - SkBlitMask::ColorProc SkBlitMask::ColorFactory(SkColorType ct, SkMask::Format format, SkColor color) { @@ -252,8 +137,6 @@ SkBlitMask::ColorProc SkBlitMask::ColorFactory(SkColorType ct, return D32_A8_Factory(color); case SkMask::kLCD16_Format: return D32_LCD16_Proc; - case SkMask::kLCD32_Format: - return D32_LCD32_Factory(color); default: break; } @@ -476,85 +359,6 @@ static void LCD16_RowProc_Opaque(SkPMColor* SK_RESTRICT dst, } } -static void LCD32_RowProc_Blend(SkPMColor* SK_RESTRICT dst, - const SkPMColor* SK_RESTRICT mask, - const SkPMColor* SK_RESTRICT src, int count) { - for (int i = 0; i < count; ++i) { - SkPMColor m = mask[i]; - if (0 == m) { - continue; - } - - SkPMColor s = src[i]; - int srcA = SkGetPackedA32(s); - int srcR = SkGetPackedR32(s); - int srcG = SkGetPackedG32(s); - int srcB = SkGetPackedB32(s); - - srcA = SkAlpha255To256(srcA); - - SkPMColor d = dst[i]; - - int maskR = SkGetPackedR32(m); - int maskG = SkGetPackedG32(m); - int maskB = SkGetPackedB32(m); - - // Now upscale them to 0..256 - maskR = SkAlpha255To256(maskR); - maskG = SkAlpha255To256(maskG); - maskB = SkAlpha255To256(maskB); - - int dstR = SkGetPackedR32(d); - int dstG = SkGetPackedG32(d); - int dstB = SkGetPackedB32(d); - - // LCD blitting is only supported if the dst is known/required - // to be opaque - dst[i] = SkPackARGB32(0xFF, - src_alpha_blend(srcR, dstR, srcA, maskR), - src_alpha_blend(srcG, dstG, srcA, maskG), - src_alpha_blend(srcB, dstB, srcA, maskB)); - } -} - -static void LCD32_RowProc_Opaque(SkPMColor* SK_RESTRICT dst, - const SkPMColor* SK_RESTRICT mask, - const SkPMColor* SK_RESTRICT src, int count) { - for (int i = 0; i < count; ++i) { - SkPMColor m = mask[i]; - if (0 == m) { - continue; - } - - SkPMColor s = src[i]; - SkPMColor d = dst[i]; - - int maskR = SkGetPackedR32(m); - int maskG = SkGetPackedG32(m); - int maskB = SkGetPackedB32(m); - - int srcR = SkGetPackedR32(s); - int srcG = SkGetPackedG32(s); - int srcB = SkGetPackedB32(s); - - int dstR = SkGetPackedR32(d); - int dstG = SkGetPackedG32(d); - int dstB = SkGetPackedB32(d); - - // Now upscale them to 0..256, so we can use SkAlphaBlend - maskR = SkAlpha255To256(maskR); - maskG = SkAlpha255To256(maskG); - maskB = SkAlpha255To256(maskB); - - // LCD blitting is only supported if the dst is known/required - // to be opaque - dst[i] = SkPackARGB32(0xFF, - SkAlphaBlend(srcR, dstR, maskR), - SkAlphaBlend(srcG, dstG, maskG), - SkAlphaBlend(srcB, dstB, maskB)); - } -} - SkBlitMask::RowProc SkBlitMask::RowFactory(SkColorType ct, SkMask::Format format, RowFlags flags) { @@ -570,7 +374,6 @@ SkBlitMask::RowProc SkBlitMask::RowFactory(SkColorType ct, false ? (RowProc)BW_RowProc_Opaque : NULL, // suppress unused warning (RowProc)A8_RowProc_Blend, (RowProc)A8_RowProc_Opaque, (RowProc)LCD16_RowProc_Blend, (RowProc)LCD16_RowProc_Opaque, - (RowProc)LCD32_RowProc_Blend, (RowProc)LCD32_RowProc_Opaque, }; int index; @@ -580,7 +383,6 @@ SkBlitMask::RowProc SkBlitMask::RowFactory(SkColorType ct, case SkMask::kBW_Format: index = 0; break; case SkMask::kA8_Format: index = 2; break; case SkMask::kLCD16_Format: index = 4; break; - case SkMask::kLCD32_Format: index = 6; break; default: return NULL; } diff --git a/src/core/SkGlyph.h b/src/core/SkGlyph.h index 4290bb889d..4761adf0d2 100644 --- a/src/core/SkGlyph.h +++ b/src/core/SkGlyph.h @@ -50,9 +50,7 @@ struct SkGlyph { unsigned rb = width; if (SkMask::kBW_Format == format) { rb = (rb + 7) >> 3; - } else if (SkMask::kARGB32_Format == format || - SkMask::kLCD32_Format == format) - { + } else if (SkMask::kARGB32_Format == format) { rb <<= 2; } else if (SkMask::kLCD16_Format == format) { rb = SkAlign4(rb << 1); diff --git a/src/core/SkMask.cpp b/src/core/SkMask.cpp index 929835717b..4ae65c7a9c 100644 --- a/src/core/SkMask.cpp +++ b/src/core/SkMask.cpp @@ -52,7 +52,6 @@ static const int gMaskFormatToShift[] = { 0, // 3D 2, // ARGB32 1, // LCD16 - 2 // LCD32 }; static int maskFormatToShift(SkMask::Format format) { diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 4ccfce235a..d81784ace4 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -1407,7 +1407,7 @@ void SkScalerContext::MakeRec(const SkPaint& paint, rec->fMaskFormat = SkToU8(computeMaskFormat(paint)); - if (SkMask::kLCD16_Format == rec->fMaskFormat || SkMask::kLCD32_Format == rec->fMaskFormat) { + if (SkMask::kLCD16_Format == rec->fMaskFormat) { if (too_big_for_lcd(*rec, checkPost2x2)) { rec->fMaskFormat = SkMask::kA8_Format; flags |= SkScalerContext::kGenA8FromLCD_Flag; @@ -1553,8 +1553,7 @@ void SkScalerContext::PostMakeRec(const SkPaint&, SkScalerContext::Rec* rec) { * the lum of one of them. */ switch (rec->fMaskFormat) { - case SkMask::kLCD16_Format: - case SkMask::kLCD32_Format: { + case SkMask::kLCD16_Format: { // filter down the luminance color to a finite number of bits SkColor color = rec->getLuminanceColor(); rec->setLuminanceColor(SkMaskGamma::CanonicalColor(color)); diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index 4d7f3629eb..8cb416e9ae 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -181,7 +181,6 @@ void SkScalerContext::getMetrics(SkGlyph* glyph) { if (glyph->fWidth > 0) { switch (fRec.fMaskFormat) { case SkMask::kLCD16_Format: - case SkMask::kLCD32_Format: glyph->fWidth += 2; glyph->fLeft -= 1; break; @@ -325,31 +324,6 @@ static void pack4xHToLCD16(const SkBitmap& src, const SkMask& dst, } } -template<bool APPLY_PREBLEND> -static void pack4xHToLCD32(const SkBitmap& src, const SkMask& dst, - const SkMaskGamma::PreBlend& maskPreBlend) { - SkASSERT(kAlpha_8_SkColorType == src.colorType()); - SkASSERT(SkMask::kLCD32_Format == dst.fFormat); - - const int width = dst.fBounds.width(); - const int height = dst.fBounds.height(); - SkPMColor* dstP = (SkPMColor*)dst.fImage; - size_t dstRB = dst.fRowBytes; - - for (int y = 0; y < height; ++y) { - const uint8_t* srcP = src.getAddr8(0, y); - - // TODO: need to use fir filter here as well. - for (int x = 0; x < width; ++x) { - U8CPU r = sk_apply_lut_if<APPLY_PREBLEND>(*srcP++, maskPreBlend.fR); - U8CPU g = sk_apply_lut_if<APPLY_PREBLEND>(*srcP++, maskPreBlend.fG); - U8CPU b = sk_apply_lut_if<APPLY_PREBLEND>(*srcP++, maskPreBlend.fB); - dstP[x] = SkPackARGB32(0xFF, r, g, b); - } - dstP = (SkPMColor*)((char*)dstP + dstRB); - } -} - static inline int convert_8_to_1(unsigned byte) { SkASSERT(byte <= 0xFF); return byte >> 7; @@ -418,7 +392,6 @@ static void generateMask(const SkMask& mask, const SkPath& path, case SkMask::kA8_Format: break; case SkMask::kLCD16_Format: - case SkMask::kLCD32_Format: // TODO: trigger off LCD orientation dstW = 4*dstW - 8; matrix.setTranslate(-SkIntToScalar(mask.fBounds.fLeft + 1), @@ -470,13 +443,6 @@ static void generateMask(const SkMask& mask, const SkPath& path, pack4xHToLCD16<false>(bm, mask, maskPreBlend); } break; - case SkMask::kLCD32_Format: - if (maskPreBlend.isApplicable()) { - pack4xHToLCD32<true>(bm, mask, maskPreBlend); - } else { - pack4xHToLCD32<false>(bm, mask, maskPreBlend); - } - break; default: break; } diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h index 337b2e077a..3ebaa5900d 100644 --- a/src/core/SkScalerContext.h +++ b/src/core/SkScalerContext.h @@ -127,7 +127,7 @@ public: kHintingBit2_Flag = 0x0100, // Pixel geometry information. - // only meaningful if fMaskFormat is LCD16 or LCD32 + // only meaningful if fMaskFormat is kLCD16 kLCD_Vertical_Flag = 0x0200, // else Horizontal kLCD_BGROrder_Flag = 0x0400, // else RGB order diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp index 03cdf24f6f..41dc784e79 100755 --- a/src/gpu/GrBitmapTextContext.cpp +++ b/src/gpu/GrBitmapTextContext.cpp @@ -588,7 +588,6 @@ void GrBitmapTextContext::flush() { drawState->setAlpha(fSkPaint.getAlpha()); break; // LCD text - case kA888_GrMaskFormat: case kA565_GrMaskFormat: { if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || diff --git a/src/gpu/GrFontScaler.cpp b/src/gpu/GrFontScaler.cpp index b16b498ac1..0f85b83e16 100644 --- a/src/gpu/GrFontScaler.cpp +++ b/src/gpu/GrFontScaler.cpp @@ -68,8 +68,6 @@ GrMaskFormat GrFontScaler::getMaskFormat() const { return kA8_GrMaskFormat; case SkMask::kLCD16_Format: return kA565_GrMaskFormat; - case SkMask::kLCD32_Format: - return kA888_GrMaskFormat; case SkMask::kARGB32_Format: return kARGB_GrMaskFormat; default: @@ -97,8 +95,6 @@ GrMaskFormat GrFontScaler::getPackedGlyphMaskFormat(GrGlyph::PackedID packed) co return kA8_GrMaskFormat; case SkMask::kLCD16_Format: return kA565_GrMaskFormat; - case SkMask::kLCD32_Format: - return kA888_GrMaskFormat; case SkMask::kARGB32_Format: return kARGB_GrMaskFormat; default: @@ -183,11 +179,6 @@ bool GrFontScaler::getPackedGlyphImage(GrGlyph::PackedID packed, expand_bits(rgb565, bits, width, height, dstRB, srcRB); break; } - case kA888_GrMaskFormat: { - uint32_t* rgba8888 = reinterpret_cast<uint32_t*>(dst); - expand_bits(rgba8888, bits, width, height, dstRB, srcRB); - break; - } default: SkFAIL("Invalid GrMaskFormat"); } diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp index 13f6ff70ca..0186af1f63 100644 --- a/src/gpu/GrTextStrike.cpp +++ b/src/gpu/GrTextStrike.cpp @@ -58,7 +58,6 @@ static GrPixelConfig mask_format_to_pixel_config(GrMaskFormat format) { static const GrPixelConfig sPixelConfigs[] = { kAlpha_8_GrPixelConfig, kRGB_565_GrPixelConfig, - kSkia8888_GrPixelConfig, kSkia8888_GrPixelConfig }; SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sPixelConfigs) == kMaskFormatCount, array_size_mismatch); @@ -70,7 +69,6 @@ static int mask_format_to_atlas_index(GrMaskFormat format) { static const int sAtlasIndices[] = { GrFontCache::kA8_AtlasType, GrFontCache::k565_AtlasType, - GrFontCache::k8888_AtlasType, GrFontCache::k8888_AtlasType }; SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sAtlasIndices) == kMaskFormatCount, array_size_mismatch); diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index f166e0b191..0c28cc2890 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -87,7 +87,6 @@ using namespace skia_advanced_typeface_metrics_utils; static bool isLCD(const SkScalerContext::Rec& rec) { switch (rec.fMaskFormat) { case SkMask::kLCD16_Format: - case SkMask::kLCD32_Format: return true; default: return false; diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp index b53f9e3bf8..bd3cddf596 100644 --- a/src/ports/SkFontHost_FreeType_common.cpp +++ b/src/ports/SkFontHost_FreeType_common.cpp @@ -165,14 +165,14 @@ static void copyFT2LCD16(const FT_Bitmap& bitmap, const SkMask& mask, int lcdIsB * * Yes, No, Never Requested, Never Produced * - * kBW kA8 k3D kARGB32 kLCD16 kLCD32 - * FT_PIXEL_MODE_MONO Y Y NR N Y NR - * FT_PIXEL_MODE_GRAY N Y NR N Y NR - * FT_PIXEL_MODE_GRAY2 NP NP NR NP NP NR - * FT_PIXEL_MODE_GRAY4 NP NP NR NP NP NR - * FT_PIXEL_MODE_LCD NP NP NR NP NP NR - * FT_PIXEL_MODE_LCD_V NP NP NR NP NP NR - * FT_PIXEL_MODE_BGRA N N NR Y N NR + * kBW kA8 k3D kARGB32 kLCD16 + * FT_PIXEL_MODE_MONO Y Y NR N Y + * FT_PIXEL_MODE_GRAY N Y NR N Y + * FT_PIXEL_MODE_GRAY2 NP NP NR NP NP + * FT_PIXEL_MODE_GRAY4 NP NP NR NP NP + * FT_PIXEL_MODE_LCD NP NP NR NP NP + * FT_PIXEL_MODE_LCD_V NP NP NR NP NP + * FT_PIXEL_MODE_BGRA N N NR Y N * * TODO: All of these N need to be Y or otherwise ruled out. */ diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index 4d346e6360..f893f61d47 100755 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -254,7 +254,7 @@ static bool isMountainLion() { } static bool isLCDFormat(unsigned format) { - return SkMask::kLCD16_Format == format || SkMask::kLCD32_Format == format; + return SkMask::kLCD16_Format == format; } static CGFloat ScalarToCG(SkScalar scalar) { @@ -1143,30 +1143,6 @@ static void rgb_to_lcd16(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowByt } } -template<bool APPLY_PREBLEND> -static inline uint32_t rgb_to_lcd32(CGRGBPixel rgb, const uint8_t* tableR, - const uint8_t* tableG, - const uint8_t* tableB) { - U8CPU r = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 16) & 0xFF, tableR); - U8CPU g = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 8) & 0xFF, tableG); - U8CPU b = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 0) & 0xFF, tableB); - return SkPackARGB32(0xFF, r, g, b); -} -template<bool APPLY_PREBLEND> -static void rgb_to_lcd32(const CGRGBPixel* SK_RESTRICT cgPixels, size_t cgRowBytes, const SkGlyph& glyph, - const uint8_t* tableR, const uint8_t* tableG, const uint8_t* tableB) { - const int width = glyph.fWidth; - size_t dstRB = glyph.rowBytes(); - uint32_t* SK_RESTRICT dst = (uint32_t*)glyph.fImage; - for (int y = 0; y < glyph.fHeight; y++) { - for (int i = 0; i < width; i++) { - dst[i] = rgb_to_lcd32<APPLY_PREBLEND>(cgPixels[i], tableR, tableG, tableB); - } - cgPixels = (CGRGBPixel*)((char*)cgPixels + cgRowBytes); - dst = (uint32_t*)((char*)dst + dstRB); - } -} - #ifdef HACK_COLORGLYPHS // hack to colorize the output for testing kARGB32_Format static SkPMColor cgpixels_to_pmcolor(CGRGBPixel rgb, const SkGlyph& glyph, @@ -1229,15 +1205,6 @@ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) { // Convert glyph to mask switch (glyph.fMaskFormat) { - case SkMask::kLCD32_Format: { - if (fPreBlend.isApplicable()) { - rgb_to_lcd32<true>(cgPixels, cgRowBytes, glyph, - fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); - } else { - rgb_to_lcd32<false>(cgPixels, cgRowBytes, glyph, - fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); - } - } break; case SkMask::kLCD16_Format: { if (fPreBlend.isApplicable()) { rgb_to_lcd16<true>(cgPixels, cgRowBytes, glyph, diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 89bac5daf4..a394f1fd64 100755 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -58,8 +58,7 @@ typedef uint32_t SkGdiRGB; //#define SK_ENFORCE_ROTATED_TEXT_AA_ON_WINDOWS static bool isLCD(const SkScalerContext::Rec& rec) { - return SkMask::kLCD16_Format == rec.fMaskFormat || - SkMask::kLCD32_Format == rec.fMaskFormat; + return SkMask::kLCD16_Format == rec.fMaskFormat; } static bool bothZero(SkScalar a, SkScalar b) { @@ -590,7 +589,6 @@ static BYTE compute_quality(const SkScalerContext::Rec& rec) { case SkMask::kBW_Format: return NONANTIALIASED_QUALITY; case SkMask::kLCD16_Format: - case SkMask::kLCD32_Format: return CLEARTYPE_QUALITY; default: if (rec.fFlags & SkScalerContext::kGenA8FromLCD_Flag) { @@ -1133,19 +1131,6 @@ static inline uint16_t rgb_to_lcd16(SkGdiRGB rgb, const uint8_t* tableR, return SkPack888ToRGB16(r, g, b); } -template<bool APPLY_PREBLEND> -static inline SkPMColor rgb_to_lcd32(SkGdiRGB rgb, const uint8_t* tableR, - const uint8_t* tableG, - const uint8_t* tableB) { - U8CPU r = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 16) & 0xFF, tableR); - U8CPU g = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 8) & 0xFF, tableG); - U8CPU b = sk_apply_lut_if<APPLY_PREBLEND>((rgb >> 0) & 0xFF, tableB); -#if SK_SHOW_TEXT_BLIT_COVERAGE - r = SkMax32(r, 10); g = SkMax32(g, 10); b = SkMax32(b, 10); -#endif - return SkPackARGB32(0xFF, r, g, b); -} - // Is this GDI color neither black nor white? If so, we have to keep this // image as is, rather than smashing it down to a BW mask. // @@ -1258,22 +1243,6 @@ static void rgb_to_lcd16(const SkGdiRGB* SK_RESTRICT src, size_t srcRB, const Sk } } -template<bool APPLY_PREBLEND> -static void rgb_to_lcd32(const SkGdiRGB* SK_RESTRICT src, size_t srcRB, const SkGlyph& glyph, - const uint8_t* tableR, const uint8_t* tableG, const uint8_t* tableB) { - const size_t dstRB = glyph.rowBytes(); - const int width = glyph.fWidth; - uint32_t* SK_RESTRICT dst = (uint32_t*)((char*)glyph.fImage + (glyph.fHeight - 1) * dstRB); - - for (int y = 0; y < glyph.fHeight; y++) { - for (int i = 0; i < width; i++) { - dst[i] = rgb_to_lcd32<APPLY_PREBLEND>(src[i], tableR, tableG, tableB); - } - src = SkTAddOffset<const SkGdiRGB>(src, srcRB); - dst = (uint32_t*)((char*)dst - dstRB); - } -} - static inline unsigned clamp255(unsigned x) { SkASSERT(x <= 256); return x - (x >> 8); @@ -1356,23 +1325,13 @@ void SkScalerContext_GDI::generateImage(const SkGlyph& glyph) { rgb_to_bw(src, srcRB, glyph); ((SkGlyph*)&glyph)->fMaskFormat = SkMask::kBW_Format; } else { - if (SkMask::kLCD16_Format == glyph.fMaskFormat) { - if (fPreBlend.isApplicable()) { - rgb_to_lcd16<true>(src, srcRB, glyph, - fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); - } else { - rgb_to_lcd16<false>(src, srcRB, glyph, - fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); - } + SkASSERT(SkMask::kLCD16_Format == glyph.fMaskFormat); + if (fPreBlend.isApplicable()) { + rgb_to_lcd16<true>(src, srcRB, glyph, + fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); } else { - SkASSERT(SkMask::kLCD32_Format == glyph.fMaskFormat); - if (fPreBlend.isApplicable()) { - rgb_to_lcd32<true>(src, srcRB, glyph, - fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); - } else { - rgb_to_lcd32<false>(src, srcRB, glyph, - fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); - } + rgb_to_lcd16<false>(src, srcRB, glyph, + fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); } } } diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp index 7884b13259..f3f371c878 100644 --- a/src/ports/SkScalerContext_win_dw.cpp +++ b/src/ports/SkScalerContext_win_dw.cpp @@ -31,8 +31,7 @@ #endif static bool isLCD(const SkScalerContext::Rec& rec) { - return SkMask::kLCD16_Format == rec.fMaskFormat || - SkMask::kLCD32_Format == rec.fMaskFormat; + return SkMask::kLCD16_Format == rec.fMaskFormat; } static bool is_hinted_without_gasp(DWriteFontTypeface* typeface) { @@ -637,24 +636,6 @@ static void rgb_to_lcd16(const uint8_t* SK_RESTRICT src, const SkGlyph& glyph, } } -template<bool APPLY_PREBLEND> -static void rgb_to_lcd32(const uint8_t* SK_RESTRICT src, const SkGlyph& glyph, - const uint8_t* tableR, const uint8_t* tableG, const uint8_t* tableB) { - const size_t dstRB = glyph.rowBytes(); - const U16CPU width = glyph.fWidth; - SkPMColor* SK_RESTRICT dst = static_cast<SkPMColor*>(glyph.fImage); - - for (U16CPU y = 0; y < glyph.fHeight; y++) { - for (U16CPU i = 0; i < width; i++) { - U8CPU r = sk_apply_lut_if<APPLY_PREBLEND>(*(src++), tableR); - U8CPU g = sk_apply_lut_if<APPLY_PREBLEND>(*(src++), tableG); - U8CPU b = sk_apply_lut_if<APPLY_PREBLEND>(*(src++), tableB); - dst[i] = SkPackARGB32(0xFF, r, g, b); - } - dst = (SkPMColor*)((char*)dst + dstRB); - } -} - const void* SkScalerContext_DW::drawDWMask(const SkGlyph& glyph, DWRITE_RENDERING_MODE renderingMode, DWRITE_TEXTURE_TYPE textureType) @@ -742,19 +723,13 @@ void SkScalerContext_DW::generateImage(const SkGlyph& glyph) { } else { rgb_to_a8<false>(src, glyph, fPreBlend.fG); } - } else if (SkMask::kLCD16_Format == glyph.fMaskFormat) { + } else { + SkASSERT(SkMask::kLCD16_Format == glyph.fMaskFormat); if (fPreBlend.isApplicable()) { rgb_to_lcd16<true>(src, glyph, fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); } else { rgb_to_lcd16<false>(src, glyph, fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); } - } else { - SkASSERT(SkMask::kLCD32_Format == glyph.fMaskFormat); - if (fPreBlend.isApplicable()) { - rgb_to_lcd32<true>(src, glyph, fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); - } else { - rgb_to_lcd32<false>(src, glyph, fPreBlend.fR, fPreBlend.fG, fPreBlend.fB); - } } } diff --git a/tests/AAClipTest.cpp b/tests/AAClipTest.cpp index 693becba38..08dedb49c4 100644 --- a/tests/AAClipTest.cpp +++ b/tests/AAClipTest.cpp @@ -34,7 +34,6 @@ static bool operator==(const SkMask& a, const SkMask& b) { case SkMask::kLCD16_Format: wbytes <<= 1; break; - case SkMask::kLCD32_Format: case SkMask::kARGB32_Format: wbytes <<= 2; break; |