hide index8 support

Bug: skia:
Change-Id: I4ab7f4665cc9992319d3c9a5e02a417d503c189e
Reviewed-on: https://skia-review.googlesource.com/20121
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2017-07-02 15:46:49 -04:00 committed by Skia Commit-Bot
parent f642cb337a
commit 0401c0d1d3
4 changed files with 21 additions and 1 deletions

View File

@ -120,7 +120,14 @@ public:
/** Return true iff drawing this bitmap has no effect.
*/
bool drawsNothing() const { return this->empty() || this->isNull(); }
bool drawsNothing() const {
#ifndef SK_SUPPORT_LEGACY_INDEX_8
if (this->colorType() == kIndex_8_SkColorType) {
return true;
}
#endif
return this->empty() || this->isNull();
}
/** Return the number of bytes between subsequent rows of the bitmap. */
size_t rowBytes() const { return fRowBytes; }

View File

@ -59,9 +59,15 @@ public:
}
const bool needsCT = kIndex_8_SkColorType == info.colorType();
#ifdef SK_SUPPORT_LEGACY_INDEX_8
if (needsCT != hasColorTable) {
return false;
}
#else
if (needsCT) {
return false;
}
#endif
if (rowBytes < info.minRowBytes()) {
return false;

View File

@ -296,6 +296,7 @@ DEF_TEST(Image_Serialize_Encoding_Failure, reporter) {
}
}
#ifdef SK_SUPPORT_LEGACY_INDEX_8
DEF_TEST(Image_NewRasterCopy, reporter) {
const SkPMColor red = SkPackARGB32(0xFF, 0xFF, 0, 0);
const SkPMColor green = SkPackARGB32(0xFF, 0, 0xFF, 0);
@ -322,6 +323,7 @@ DEF_TEST(Image_NewRasterCopy, reporter) {
REPORTER_ASSERT(reporter, blue == pixels[2]);
REPORTER_ASSERT(reporter, 0 == pixels[3]);
}
#endif
// Test that a draw that only partially covers the drawing surface isn't
// interpreted as covering the entire drawing surface (i.e., exercise one of the
@ -555,6 +557,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_drawAbandonedGpuImage, reporter, c
#endif
#ifdef SK_SUPPORT_LEGACY_INDEX_8
// https://bug.skia.org/4390
DEF_TEST(ImageFromIndex8Bitmap, r) {
SkPMColor pmColors[1] = {SkPreMultiplyColor(SK_ColorWHITE)};
@ -565,6 +569,7 @@ DEF_TEST(ImageFromIndex8Bitmap, r) {
sk_sp<SkImage> img(SkImage::MakeFromBitmap(bm));
REPORTER_ASSERT(r, img != nullptr);
}
#endif
class EmptyGenerator : public SkImageGenerator {
public:

View File

@ -589,7 +589,9 @@ DEF_TEST(ReadPixels_ValidConversion, reporter) {
kARGB_4444_SkColorType,
kRGBA_8888_SkColorType,
kBGRA_8888_SkColorType,
#ifdef SK_SUPPORT_LEGACY_INDEX_8
kIndex_8_SkColorType,
#endif
kGray_8_SkColorType,
kRGBA_F16_SkColorType,
};