diff options
author | reed <reed@google.com> | 2014-11-13 14:39:58 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-13 14:39:58 -0800 |
commit | d54d3fc82456f8789b3e4dff40faeb7b670bcf4b (patch) | |
tree | 274b6297429de7473cfbd12bf6732bea76de29db /src/ports | |
parent | 112e7e277702e104357f2d44742253ee1b0109ac (diff) |
remove unused kLCD_MaskFormat
BUG=skia:
Review URL: https://codereview.chromium.org/728673002
Diffstat (limited to 'src/ports')
-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 |
5 files changed, 19 insertions, 119 deletions
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); - } } } |