From 742a3e298fda669006147e4a305bab8452369b1f Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Mon, 10 Jul 2017 11:51:37 -0400 Subject: Remove support for decoding to kIndex_8 Fix up callsites, and remove tests that no longer make sense. Bug: skia:6828 Change-Id: I2548c4b7528b7b1be7412563156f27b52c9d4295 Reviewed-on: https://skia-review.googlesource.com/21664 Reviewed-by: Derek Sollenberger Commit-Queue: Leon Scroggins --- include/codec/SkAndroidCodec.h | 33 ++----------------------- include/codec/SkCodec.h | 56 +++++++++++------------------------------- include/codec/SkEncodedInfo.h | 2 +- 3 files changed, 17 insertions(+), 74 deletions(-) (limited to 'include/codec') diff --git a/include/codec/SkAndroidCodec.h b/include/codec/SkAndroidCodec.h index 87d514dfff..b4dd3854e6 100644 --- a/include/codec/SkAndroidCodec.h +++ b/include/codec/SkAndroidCodec.h @@ -57,7 +57,7 @@ public: * @param requestedColorType Color type requested by the client * * |requestedColorType| may be overriden. We will default to kF16 - * for high precision images and kIndex8 for GIF and WBMP. + * for high precision images. * * In the general case, if it is possible to decode to * |requestedColorType|, this returns |requestedColorType|. @@ -154,8 +154,6 @@ public: AndroidOptions() : fZeroInitialized(SkCodec::kNo_ZeroInitialized) , fSubset(nullptr) - , fColorPtr(nullptr) - , fColorCount(nullptr) , fSampleSize(1) {} @@ -178,22 +176,6 @@ public: */ SkIRect* fSubset; - /** - * If the client has requested a decode to kIndex8_SkColorType - * (specified in the SkImageInfo), then the caller must provide - * storage for up to 256 SkPMColor values in fColorPtr. On success, - * the codec must copy N colors into that storage, (where N is the - * logical number of table entries) and set fColorCount to N. - * - * If the client does not request kIndex8_SkColorType, then the last - * two parameters may be NULL. If fColorCount is not null, it will be - * set to 0. - * - * The default is NULL for both pointers. - */ - SkPMColor* fColorPtr; - int* fColorCount; - /** * The client may provide an integer downscale factor for the decode. * The codec may implement this downscaling by sampling or another @@ -224,14 +206,6 @@ public: * to scale or subset. If the codec cannot perform this * scaling or subsetting, it will return an error code. * - * If info is kIndex8_SkColorType, then the caller must provide storage for up to 256 - * SkPMColor values in options->fColorPtr. On success the codec must copy N colors into - * that storage, (where N is the logical number of table entries) and set - * options->fColorCount to N. - * - * If info is not kIndex8_SkColorType, options->fColorPtr and options->fColorCount may - * be nullptr. - * * The AndroidOptions object is also used to specify any requested scaling or subsetting * using options->fSampleSize and options->fSubset. If NULL, the defaults (as specified above * for AndroidOptions) are used. @@ -247,10 +221,7 @@ public: /** * Simplified version of getAndroidPixels() where we supply the default AndroidOptions as - * specified above for AndroidOptions. - * - * This will return an error if the info is kIndex_8_SkColorType and also will not perform - * any scaling or subsetting. + * specified above for AndroidOptions. It will not perform any scaling or subsetting. */ SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size_t rowBytes); diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h index 2043d230b1..b78ec69c74 100644 --- a/include/codec/SkCodec.h +++ b/include/codec/SkCodec.h @@ -338,26 +338,19 @@ public: * reported by the codec, the color space transformation is * a no-op. * - * If info is kIndex8_SkColorType, then the caller must provide storage for up to 256 - * SkPMColor values in ctable. On success the generator must copy N colors into that storage, - * (where N is the logical number of table entries) and set ctableCount to N. - * - * If info is not kIndex8_SkColorType, then the last two parameters may be NULL. If ctableCount - * is not null, it will be set to 0. - * * If a scanline decode is in progress, scanline mode will end, requiring the client to call * startScanlineDecode() in order to return to decoding scanlines. * * @return Result kSuccess, or another value explaining the type of failure. */ - Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, const Options*, - SkPMColor ctable[], int* ctableCount); + Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, const Options*); /** - * Simplified version of getPixels() that asserts that info is NOT kIndex8_SkColorType and - * uses the default Options. + * Simplified version of getPixels() that uses the default Options. */ - Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes); + Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) { + return this->getPixels(info, pixels, rowBytes, nullptr); + } /** * If decoding to YUV is supported, this returns true. Otherwise, this @@ -410,25 +403,13 @@ public: * if present, or the full image as described in dstInfo. * @param options Contains decoding options, including if memory is zero * initialized and whether to decode a subset. - * @param ctable A pointer to a color table. When dstInfo.colorType() is - * kIndex8, this should be non-NULL and have enough storage for 256 - * colors. The color table will be populated after decoding the palette. - * @param ctableCount A pointer to the size of the color table. When - * dstInfo.colorType() is kIndex8, this should be non-NULL. It will - * be modified to the true size of the color table (<= 256) after - * decoding the palette. * @return Enum representing success or reason for failure. */ Result startIncrementalDecode(const SkImageInfo& dstInfo, void* dst, size_t rowBytes, - const Options*, SkPMColor* ctable, int* ctableCount); - - Result startIncrementalDecode(const SkImageInfo& dstInfo, void* dst, size_t rowBytes, - const Options* options) { - return this->startIncrementalDecode(dstInfo, dst, rowBytes, options, nullptr, nullptr); - } + const Options*); Result startIncrementalDecode(const SkImageInfo& dstInfo, void* dst, size_t rowBytes) { - return this->startIncrementalDecode(dstInfo, dst, rowBytes, nullptr, nullptr, nullptr); + return this->startIncrementalDecode(dstInfo, dst, rowBytes, nullptr); } /** @@ -479,23 +460,16 @@ public: * those of getInfo, this implies a scale. * @param options Contains decoding options, including if memory is zero * initialized. - * @param ctable A pointer to a color table. When dstInfo.colorType() is - * kIndex8, this should be non-NULL and have enough storage for 256 - * colors. The color table will be populated after decoding the palette. - * @param ctableCount A pointer to the size of the color table. When - * dstInfo.colorType() is kIndex8, this should be non-NULL. It will - * be modified to the true size of the color table (<= 256) after - * decoding the palette. * @return Enum representing success or reason for failure. */ - Result startScanlineDecode(const SkImageInfo& dstInfo, const Options* options, - SkPMColor ctable[], int* ctableCount); + Result startScanlineDecode(const SkImageInfo& dstInfo, const Options* options); /** - * Simplified version of startScanlineDecode() that asserts that info is NOT - * kIndex8_SkColorType and uses the default Options. + * Simplified version of startScanlineDecode() that uses the default Options. */ - Result startScanlineDecode(const SkImageInfo& dstInfo); + Result startScanlineDecode(const SkImageInfo& dstInfo) { + return this->startScanlineDecode(dstInfo, nullptr); + } /** * Write the next countLines scanlines into dst. @@ -739,7 +713,6 @@ protected: */ virtual Result onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, const Options&, - SkPMColor ctable[], int* ctableCount, int* rowsDecoded) = 0; virtual bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const { @@ -801,7 +774,6 @@ protected: * kN32_SkColorType: Transparent or Black, depending on the src alpha type * kRGB_565_SkColorType: Black * kGray_8_SkColorType: Black - * kIndex_8_SkColorType: First color in color table */ virtual uint64_t onGetFillValue(const SkImageInfo& dstInfo) const; @@ -901,12 +873,12 @@ private: // Methods for scanline decoding. virtual Result onStartScanlineDecode(const SkImageInfo& /*dstInfo*/, - const Options& /*options*/, SkPMColor* /*ctable*/, int* /*ctableCount*/) { + const Options& /*options*/) { return kUnimplemented; } virtual Result onStartIncrementalDecode(const SkImageInfo& /*dstInfo*/, void*, size_t, - const Options&, SkPMColor*, int*) { + const Options&) { return kUnimplemented; } diff --git a/include/codec/SkEncodedInfo.h b/include/codec/SkEncodedInfo.h index eb8c147a3b..3b1ce48713 100644 --- a/include/codec/SkEncodedInfo.h +++ b/include/codec/SkEncodedInfo.h @@ -130,7 +130,7 @@ public: case kPalette_Color: { SkAlphaType alphaType = (kOpaque_Alpha == fAlpha) ? kOpaque_SkAlphaType : kUnpremul_SkAlphaType; - return SkImageInfo::Make(width, height, kIndex_8_SkColorType, + return SkImageInfo::Make(width, height, kN32_SkColorType, alphaType, colorSpace); } case kRGB_Color: -- cgit v1.2.3