diff options
author | Mike Reed <reed@google.com> | 2017-07-17 10:13:58 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-17 20:37:28 +0000 |
commit | 262b319dcdbf6329d5ca3212b22323ebec7a7b49 (patch) | |
tree | b10f16da65b12d577c37981bee52be6316e05024 /src/pdf | |
parent | 4d7a9bf0c0ec32394fb5923e01f816ca5ff29cd4 (diff) |
Index8 is dead, remove guarded code
Needs google3 to be updated before this can land.
Bug: skia:6828
Change-Id: I2c16be13c6937ffa48768cc24f9f980171c824d6
Reviewed-on: https://skia-review.googlesource.com/23940
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/pdf')
-rw-r--r-- | src/pdf/SkPDFBitmap.cpp | 82 |
1 files changed, 1 insertions, 81 deletions
diff --git a/src/pdf/SkPDFBitmap.cpp b/src/pdf/SkPDFBitmap.cpp index 47facff8c3..d0dcce6b3c 100644 --- a/src/pdf/SkPDFBitmap.cpp +++ b/src/pdf/SkPDFBitmap.cpp @@ -20,18 +20,7 @@ void image_get_ro_pixels(const SkImage* image, SkBitmap* dst) { SkColorSpace* legacyColorSpace = nullptr; if(as_IB(image)->getROPixels(dst, legacyColorSpace) && dst->dimensions() == image->dimensions()) { -#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE - if (dst->colorType() != kIndex_8_SkColorType) { - return; - } - if (!dst->getColorTable()) { - // We can't use an indexed bitmap with no colortable. - dst->reset(); - } else -#endif - { - return; - } + return; } // no pixels or wrong size: fill with zeros. dst->setInfo(SkImageInfo::MakeN32(image->width(), image->height(), image->alphaType())); @@ -166,9 +155,6 @@ static size_t pdf_color_component_count(SkColorType ct) { case kBGRA_8888_SkColorType: return 3; case kAlpha_8_SkColorType: -#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE - case kIndex_8_SkColorType: -#endif case kGray_8_SkColorType: return 1; case kUnknown_SkColorType: @@ -239,9 +225,6 @@ static void bitmap_to_pdf_pixels(const SkBitmap& bitmap, SkWStream* out) { fill_stream(out, '\x00', pixel_count(bm)); return; case kGray_8_SkColorType: -#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE - case kIndex_8_SkColorType: -#endif SkASSERT(1 == pdf_color_component_count(colorType)); // these two formats need no transformation to serialize. for (int y = 0; y < bm.height(); ++y) { @@ -284,22 +267,6 @@ static void bitmap_alpha_to_a8(const SkBitmap& bitmap, SkWStream* out) { out->write(bm.getAddr8(0, y), bm.width()); } return; -#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE - case kIndex_8_SkColorType: { - SkColorTable* ct = bm.getColorTable(); - SkASSERT(ct); - SkAutoTMalloc<uint8_t> scanline(bm.width()); - for (int y = 0; y < bm.height(); ++y) { - uint8_t* dst = scanline.get(); - const uint8_t* src = bm.getAddr8(0, y); - for (int x = 0; x < bm.width(); ++x) { - *dst++ = SkGetPackedA32((*ct)[*src++]); - } - out->write(scanline.get(), bm.width()); - } - return; - } -#endif case kRGB_565_SkColorType: case kGray_8_SkColorType: SkDEBUGFAIL("color type has no alpha"); @@ -313,46 +280,6 @@ static void bitmap_alpha_to_a8(const SkBitmap& bitmap, SkWStream* out) { } } -#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE -static sk_sp<SkPDFArray> make_indexed_color_space( - const SkColorTable* table, - SkAlphaType alphaType) { - auto result = sk_make_sp<SkPDFArray>(); - result->reserve(4); - result->appendName("Indexed"); - result->appendName("DeviceRGB"); - SkASSERT(table); - if (table->count() < 1) { - result->appendInt(0); - char shortTableArray[3] = {0, 0, 0}; - SkString tableString(shortTableArray, SK_ARRAY_COUNT(shortTableArray)); - result->appendString(tableString); - return result; - } - result->appendInt(table->count() - 1); // maximum color index. - - // Potentially, this could be represented in fewer bytes with a stream. - // Max size as a string is 1.5k. - char tableArray[256 * 3]; - SkASSERT(3u * table->count() <= SK_ARRAY_COUNT(tableArray)); - uint8_t* tablePtr = reinterpret_cast<uint8_t*>(tableArray); - const SkPMColor* colors = table->readColors(); - for (int i = 0; i < table->count(); i++) { - if (alphaType == kPremul_SkAlphaType) { - pmcolor_to_rgb24(colors[i], tablePtr, kN32_SkColorType); - tablePtr += 3; - } else { - *tablePtr++ = SkGetR32Component(colors[i], kN32_SkColorType); - *tablePtr++ = SkGetG32Component(colors[i], kN32_SkColorType); - *tablePtr++ = SkGetB32Component(colors[i], kN32_SkColorType); - } - } - SkString tableString(tableArray, 3 * table->count()); - result->appendString(tableString); - return result; -} -#endif - static void emit_image_xobject(SkWStream* stream, const SkImage* image, bool alpha, @@ -377,13 +304,6 @@ static void emit_image_xobject(SkWStream* stream, pdfDict.insertInt("Height", bitmap.height()); if (alpha) { pdfDict.insertName("ColorSpace", "DeviceGray"); -#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE - } else if (bitmap.colorType() == kIndex_8_SkColorType) { - SkASSERT(1 == pdf_color_component_count(bitmap.colorType())); - pdfDict.insertObject("ColorSpace", - make_indexed_color_space(bitmap.getColorTable(), - bitmap.alphaType())); -#endif } else if (1 == pdf_color_component_count(bitmap.colorType())) { pdfDict.insertName("ColorSpace", "DeviceGray"); } else { |