Guard to remove kIndex_8_SkColorType
Bug: skia:6828 Change-Id: Ia942a36abb18213184f8d436555a658270d97d47 Reviewed-on: https://skia-review.googlesource.com/22721 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org> Reviewed-by: Herb Derby <herb@google.com>
This commit is contained in:
parent
4d41b8f2fd
commit
580501382f
@ -121,7 +121,12 @@ public:
|
|||||||
/** Return true iff drawing this bitmap has no effect.
|
/** Return true iff drawing this bitmap has no effect.
|
||||||
*/
|
*/
|
||||||
bool drawsNothing() const {
|
bool drawsNothing() const {
|
||||||
return this->colorType() == kIndex_8_SkColorType || this->empty() || this->isNull();
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
|
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. */
|
/** Return the number of bytes between subsequent rows of the bitmap. */
|
||||||
@ -424,8 +429,12 @@ public:
|
|||||||
non-null colortable. Returns true if all of the above are met.
|
non-null colortable. Returns true if all of the above are met.
|
||||||
*/
|
*/
|
||||||
bool readyToDraw() const {
|
bool readyToDraw() const {
|
||||||
return this->getPixels() != NULL &&
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
(this->colorType() != kIndex_8_SkColorType || this->getColorTable());
|
if (this->colorType() == kIndex_8_SkColorType) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return this->getPixels() != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the bitmap's colortable, if it uses one (i.e. colorType is
|
/** Return the bitmap's colortable, if it uses one (i.e. colorType is
|
||||||
@ -725,6 +734,7 @@ inline uint8_t* SkBitmap::getAddr8(int x, int y) const {
|
|||||||
return (uint8_t*)fPixels + y * fRowBytes + x;
|
return (uint8_t*)fPixels + y * fRowBytes + x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
|
inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
|
||||||
SkASSERT(fPixels);
|
SkASSERT(fPixels);
|
||||||
SkASSERT(kIndex_8_SkColorType == this->colorType());
|
SkASSERT(kIndex_8_SkColorType == this->colorType());
|
||||||
@ -732,5 +742,6 @@ inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
|
|||||||
SkASSERT(this->getColorTable());
|
SkASSERT(this->getColorTable());
|
||||||
return (*this->getColorTable())[*((const uint8_t*)fPixels + y * fRowBytes + x)];
|
return (*this->getColorTable())[*((const uint8_t*)fPixels + y * fRowBytes + x)];
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -72,7 +72,9 @@ enum SkColorType {
|
|||||||
kARGB_4444_SkColorType,
|
kARGB_4444_SkColorType,
|
||||||
kRGBA_8888_SkColorType,
|
kRGBA_8888_SkColorType,
|
||||||
kBGRA_8888_SkColorType,
|
kBGRA_8888_SkColorType,
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
kIndex_8_SkColorType,
|
kIndex_8_SkColorType,
|
||||||
|
#endif
|
||||||
kGray_8_SkColorType,
|
kGray_8_SkColorType,
|
||||||
kRGBA_F16_SkColorType,
|
kRGBA_F16_SkColorType,
|
||||||
|
|
||||||
@ -95,7 +97,9 @@ static int SkColorTypeBytesPerPixel(SkColorType ct) {
|
|||||||
2, // ARGB_4444
|
2, // ARGB_4444
|
||||||
4, // RGBA_8888
|
4, // RGBA_8888
|
||||||
4, // BGRA_8888
|
4, // BGRA_8888
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
1, // kIndex_8
|
1, // kIndex_8
|
||||||
|
#endif
|
||||||
1, // kGray_8
|
1, // kGray_8
|
||||||
8, // kRGBA_F16
|
8, // kRGBA_F16
|
||||||
};
|
};
|
||||||
@ -114,7 +118,9 @@ static int SkColorTypeShiftPerPixel(SkColorType ct) {
|
|||||||
1, // ARGB_4444
|
1, // ARGB_4444
|
||||||
2, // RGBA_8888
|
2, // RGBA_8888
|
||||||
2, // BGRA_8888
|
2, // BGRA_8888
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
0, // kIndex_8
|
0, // kIndex_8
|
||||||
|
#endif
|
||||||
0, // kGray_8
|
0, // kGray_8
|
||||||
3, // kRGBA_F16
|
3, // kRGBA_F16
|
||||||
};
|
};
|
||||||
|
@ -30,9 +30,12 @@ public:
|
|||||||
SkColorTable* ctable = NULL)
|
SkColorTable* ctable = NULL)
|
||||||
: fPixels(addr), fCTable(ctable), fRowBytes(rowBytes), fInfo(info)
|
: fPixels(addr), fCTable(ctable), fRowBytes(rowBytes), fInfo(info)
|
||||||
{
|
{
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
if (kIndex_8_SkColorType == info.colorType()) {
|
if (kIndex_8_SkColorType == info.colorType()) {
|
||||||
SkASSERT(ctable);
|
SkASSERT(ctable);
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
SkASSERT(NULL == ctable);
|
SkASSERT(NULL == ctable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,9 @@ bool SkBitmapRegionCodec::decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocat
|
|||||||
SkImageInfo decodeInfo = SkImageInfo::Make(scaledSize.width(), scaledSize.height(),
|
SkImageInfo decodeInfo = SkImageInfo::Make(scaledSize.width(), scaledSize.height(),
|
||||||
dstColorType, dstAlphaType, dstColorSpace);
|
dstColorType, dstAlphaType, dstColorSpace);
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
SkASSERT(dstColorType != kIndex_8_SkColorType);
|
SkASSERT(dstColorType != kIndex_8_SkColorType);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Initialize the destination bitmap
|
// Initialize the destination bitmap
|
||||||
int scaledOutX = 0;
|
int scaledOutX = 0;
|
||||||
|
@ -17,6 +17,7 @@ static bool is_valid_sample_size(int sampleSize) {
|
|||||||
return sampleSize > 0;
|
return sampleSize > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
/**
|
/**
|
||||||
* Loads the gamut as a set of three points (triangle).
|
* Loads the gamut as a set of three points (triangle).
|
||||||
*/
|
*/
|
||||||
@ -59,6 +60,7 @@ static bool is_wide_gamut(const SkColorSpace* colorSpace) {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SkAndroidCodec::SkAndroidCodec(SkCodec* codec)
|
SkAndroidCodec::SkAndroidCodec(SkCodec* codec)
|
||||||
: fInfo(codec->getInfo())
|
: fInfo(codec->getInfo())
|
||||||
@ -110,7 +112,9 @@ SkColorType SkAndroidCodec::computeOutputColorType(SkColorType requestedColorTyp
|
|||||||
case kARGB_4444_SkColorType:
|
case kARGB_4444_SkColorType:
|
||||||
return kN32_SkColorType;
|
return kN32_SkColorType;
|
||||||
case kN32_SkColorType:
|
case kN32_SkColorType:
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case kAlpha_8_SkColorType:
|
case kAlpha_8_SkColorType:
|
||||||
// Fall through to kGray_8. Before kGray_8_SkColorType existed,
|
// Fall through to kGray_8. Before kGray_8_SkColorType existed,
|
||||||
@ -148,6 +152,7 @@ sk_sp<SkColorSpace> SkAndroidCodec::computeOutputColorSpace(SkColorType outputCo
|
|||||||
switch (outputColorType) {
|
switch (outputColorType) {
|
||||||
case kRGBA_8888_SkColorType:
|
case kRGBA_8888_SkColorType:
|
||||||
case kBGRA_8888_SkColorType:
|
case kBGRA_8888_SkColorType:
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType: {
|
case kIndex_8_SkColorType: {
|
||||||
// If |prefColorSpace| is supported, choose it.
|
// If |prefColorSpace| is supported, choose it.
|
||||||
SkColorSpaceTransferFn fn;
|
SkColorSpaceTransferFn fn;
|
||||||
@ -169,6 +174,7 @@ sk_sp<SkColorSpace> SkAndroidCodec::computeOutputColorSpace(SkColorType outputCo
|
|||||||
|
|
||||||
return SkColorSpace::MakeSRGB();
|
return SkColorSpace::MakeSRGB();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
case kRGBA_F16_SkColorType:
|
case kRGBA_F16_SkColorType:
|
||||||
// Note that |prefColorSpace| is ignored, F16 is always linear sRGB.
|
// Note that |prefColorSpace| is ignored, F16 is always linear sRGB.
|
||||||
return SkColorSpace::MakeSRGBLinear();
|
return SkColorSpace::MakeSRGBLinear();
|
||||||
|
@ -23,10 +23,11 @@ static SkImageInfo adjust_info(const SkImageInfo& info) {
|
|||||||
newInfo = newInfo.makeAlphaType(kPremul_SkAlphaType);
|
newInfo = newInfo.makeAlphaType(kPremul_SkAlphaType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
if (kIndex_8_SkColorType == info.colorType()) {
|
if (kIndex_8_SkColorType == info.colorType()) {
|
||||||
newInfo = newInfo.makeColorType(kN32_SkColorType);
|
newInfo = newInfo.makeColorType(kN32_SkColorType);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return newInfo;
|
return newInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,9 +57,11 @@ void SkSampler::Fill(const SkImageInfo& info, void* dst, size_t rowBytes,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
// On an index destination color type, always assume the input is an index.
|
// On an index destination color type, always assume the input is an index.
|
||||||
// Fall through
|
// Fall through
|
||||||
|
#endif
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
// If the destination is kGray, the caller passes in an 8-bit color.
|
// If the destination is kGray, the caller passes in an 8-bit color.
|
||||||
// We will not assert that the high bits of colorOrIndex must be zeroed.
|
// We will not assert that the high bits of colorOrIndex must be zeroed.
|
||||||
|
@ -104,6 +104,7 @@ static void swizzle_bit_to_grayscale(
|
|||||||
#undef GRAYSCALE_BLACK
|
#undef GRAYSCALE_BLACK
|
||||||
#undef GRAYSCALE_WHITE
|
#undef GRAYSCALE_WHITE
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
// same as swizzle_bit_to_grayscale and swizzle_bit_to_n32 except for value assigned to dst[x]
|
// same as swizzle_bit_to_grayscale and swizzle_bit_to_n32 except for value assigned to dst[x]
|
||||||
static void swizzle_bit_to_index(
|
static void swizzle_bit_to_index(
|
||||||
void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth,
|
void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth,
|
||||||
@ -124,6 +125,7 @@ static void swizzle_bit_to_index(
|
|||||||
dst[x] = ((currByte >> (7-bitIndex)) & 1);
|
dst[x] = ((currByte >> (7-bitIndex)) & 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// same as swizzle_bit_to_grayscale and swizzle_bit_to_index except for value assigned to dst[x]
|
// same as swizzle_bit_to_grayscale and swizzle_bit_to_index except for value assigned to dst[x]
|
||||||
static void swizzle_bit_to_n32(
|
static void swizzle_bit_to_n32(
|
||||||
@ -203,6 +205,7 @@ static void swizzle_bit_to_f16(
|
|||||||
|
|
||||||
// kIndex1, kIndex2, kIndex4
|
// kIndex1, kIndex2, kIndex4
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
static void swizzle_small_index_to_index(
|
static void swizzle_small_index_to_index(
|
||||||
void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth,
|
void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth,
|
||||||
int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) {
|
int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) {
|
||||||
@ -223,6 +226,7 @@ static void swizzle_small_index_to_index(
|
|||||||
dst[x] = index;
|
dst[x] = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void swizzle_small_index_to_565(
|
static void swizzle_small_index_to_565(
|
||||||
void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth,
|
void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth,
|
||||||
@ -887,9 +891,11 @@ SkSwizzler* SkSwizzler::CreateSwizzler(const SkEncodedInfo& encodedInfo,
|
|||||||
case kBGRA_8888_SkColorType:
|
case kBGRA_8888_SkColorType:
|
||||||
proc = &swizzle_bit_to_n32;
|
proc = &swizzle_bit_to_n32;
|
||||||
break;
|
break;
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
proc = &swizzle_bit_to_index;
|
proc = &swizzle_bit_to_index;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case kRGB_565_SkColorType:
|
case kRGB_565_SkColorType:
|
||||||
proc = &swizzle_bit_to_565;
|
proc = &swizzle_bit_to_565;
|
||||||
break;
|
break;
|
||||||
@ -970,9 +976,11 @@ SkSwizzler* SkSwizzler::CreateSwizzler(const SkEncodedInfo& encodedInfo,
|
|||||||
case kRGB_565_SkColorType:
|
case kRGB_565_SkColorType:
|
||||||
proc = &swizzle_small_index_to_565;
|
proc = &swizzle_small_index_to_565;
|
||||||
break;
|
break;
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
proc = &swizzle_small_index_to_index;
|
proc = &swizzle_small_index_to_index;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -990,10 +998,12 @@ SkSwizzler* SkSwizzler::CreateSwizzler(const SkEncodedInfo& encodedInfo,
|
|||||||
case kRGB_565_SkColorType:
|
case kRGB_565_SkColorType:
|
||||||
proc = &swizzle_index_to_565;
|
proc = &swizzle_index_to_565;
|
||||||
break;
|
break;
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
proc = &sample1;
|
proc = &sample1;
|
||||||
fastProc = ©
|
fastProc = ©
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,9 @@ static inline bool valid_color_type(const SkImageInfo& dstInfo) {
|
|||||||
switch (dstInfo.colorType()) {
|
switch (dstInfo.colorType()) {
|
||||||
case kRGBA_8888_SkColorType:
|
case kRGBA_8888_SkColorType:
|
||||||
case kBGRA_8888_SkColorType:
|
case kBGRA_8888_SkColorType:
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
|
#endif
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
case kRGB_565_SkColorType:
|
case kRGB_565_SkColorType:
|
||||||
return true;
|
return true;
|
||||||
|
@ -311,7 +311,9 @@ static void pick_memory_stages(SkColorType ct, SkRasterPipeline::StockStage* loa
|
|||||||
case kUnknown_SkColorType:
|
case kUnknown_SkColorType:
|
||||||
case kAlpha_8_SkColorType:
|
case kAlpha_8_SkColorType:
|
||||||
case kARGB_4444_SkColorType:
|
case kARGB_4444_SkColorType:
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
|
#endif
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
SkASSERT(false);
|
SkASSERT(false);
|
||||||
break;
|
break;
|
||||||
|
@ -242,9 +242,11 @@ bool SkBitmap::tryAllocPixels(Allocator* allocator, SkColorTable* ctable) {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, size_t rowBytes) {
|
bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, size_t rowBytes) {
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
if (kIndex_8_SkColorType == requestedInfo.colorType()) {
|
if (kIndex_8_SkColorType == requestedInfo.colorType()) {
|
||||||
return reset_return_false(this);
|
return reset_return_false(this);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (!this->setInfo(requestedInfo, rowBytes)) {
|
if (!this->setInfo(requestedInfo, rowBytes)) {
|
||||||
return reset_return_false(this);
|
return reset_return_false(this);
|
||||||
}
|
}
|
||||||
@ -268,9 +270,11 @@ bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, size_t rowBytes)
|
|||||||
|
|
||||||
bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, sk_sp<SkColorTable> ctable,
|
bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, sk_sp<SkColorTable> ctable,
|
||||||
uint32_t allocFlags) {
|
uint32_t allocFlags) {
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
if (kIndex_8_SkColorType == requestedInfo.colorType() && nullptr == ctable) {
|
if (kIndex_8_SkColorType == requestedInfo.colorType() && nullptr == ctable) {
|
||||||
return reset_return_false(this);
|
return reset_return_false(this);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (!this->setInfo(requestedInfo)) {
|
if (!this->setInfo(requestedInfo)) {
|
||||||
return reset_return_false(this);
|
return reset_return_false(this);
|
||||||
}
|
}
|
||||||
@ -428,7 +432,9 @@ void* SkBitmap::getAddr(int x, int y) const {
|
|||||||
base += x << 1;
|
base += x << 1;
|
||||||
break;
|
break;
|
||||||
case kAlpha_8_SkColorType:
|
case kAlpha_8_SkColorType:
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
|
#endif
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
base += x;
|
base += x;
|
||||||
break;
|
break;
|
||||||
@ -449,7 +455,9 @@ void SkBitmap::erase(SkColor c, const SkIRect& area) const {
|
|||||||
|
|
||||||
switch (fInfo.colorType()) {
|
switch (fInfo.colorType()) {
|
||||||
case kUnknown_SkColorType:
|
case kUnknown_SkColorType:
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
|
#endif
|
||||||
// TODO: can we ASSERT that we never get here?
|
// TODO: can we ASSERT that we never get here?
|
||||||
return; // can't erase. Should we bzero so the memory is not uninitialized?
|
return; // can't erase. Should we bzero so the memory is not uninitialized?
|
||||||
default:
|
default:
|
||||||
@ -651,11 +659,14 @@ static void write_raw_pixels(SkWriteBuffer* buffer, const SkPixmap& pmap) {
|
|||||||
}
|
}
|
||||||
buffer->writeByteArray(storage.get(), size);
|
buffer->writeByteArray(storage.get(), size);
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
const SkColorTable* ct = pmap.ctable();
|
const SkColorTable* ct = pmap.ctable();
|
||||||
if (kIndex_8_SkColorType == info.colorType() && ct) {
|
if (kIndex_8_SkColorType == info.colorType() && ct) {
|
||||||
buffer->writeBool(true);
|
buffer->writeBool(true);
|
||||||
ct->writeToBuffer(*buffer);
|
ct->writeToBuffer(*buffer);
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
buffer->writeBool(false);
|
buffer->writeBool(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,8 +105,12 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
static bool Supports(const SkPixmap& src) {
|
static bool Supports(const SkPixmap& src) {
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
// We'd need to add a load_i8 stage.
|
// We'd need to add a load_i8 stage.
|
||||||
return src.colorType() != kIndex_8_SkColorType;
|
return src.colorType() != kIndex_8_SkColorType;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup(const SkPixmap& dst, int left, int top, const SkPaint& paint) override {
|
void setup(const SkPixmap& dst, int left, int top, const SkPaint& paint) override {
|
||||||
|
@ -243,6 +243,7 @@ static void convert_to_alpha8(uint8_t* dst, size_t dstRB, const SkImageInfo& src
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType: {
|
case kIndex_8_SkColorType: {
|
||||||
SkASSERT(ctable);
|
SkASSERT(ctable);
|
||||||
const uint32_t* table = ctable->readColors();
|
const uint32_t* table = ctable->readColors();
|
||||||
@ -256,6 +257,7 @@ static void convert_to_alpha8(uint8_t* dst, size_t dstRB, const SkImageInfo& src
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
case kRGBA_F16_SkColorType: {
|
case kRGBA_F16_SkColorType: {
|
||||||
auto src64 = (const uint64_t*) src;
|
auto src64 = (const uint64_t*) src;
|
||||||
for (int y = 0; y < srcInfo.height(); y++) {
|
for (int y = 0; y < srcInfo.height(); y++) {
|
||||||
@ -428,6 +430,7 @@ void SkConvertPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
// Fast Path 4: Index 8 sources.
|
// Fast Path 4: Index 8 sources.
|
||||||
if (kIndex_8_SkColorType == srcInfo.colorType()) {
|
if (kIndex_8_SkColorType == srcInfo.colorType()) {
|
||||||
SkASSERT(ctable);
|
SkASSERT(ctable);
|
||||||
@ -435,6 +438,7 @@ void SkConvertPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
|
|||||||
ctable, behavior);
|
ctable, behavior);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Fast Path 5: Alpha 8 dsts.
|
// Fast Path 5: Alpha 8 dsts.
|
||||||
if (kAlpha_8_SkColorType == dstInfo.colorType()) {
|
if (kAlpha_8_SkColorType == dstInfo.colorType()) {
|
||||||
|
@ -16,9 +16,14 @@ SkImageGenerator::SkImageGenerator(const SkImageInfo& info, uint32_t uniqueID)
|
|||||||
|
|
||||||
bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
|
bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
|
||||||
const Options* opts) {
|
const Options* opts) {
|
||||||
if (kUnknown_SkColorType == info.colorType() || kIndex_8_SkColorType == info.colorType()) {
|
if (kUnknown_SkColorType == info.colorType()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
|
if (kIndex_8_SkColorType == info.colorType()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (nullptr == pixels) {
|
if (nullptr == pixels) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,66 @@
|
|||||||
#include "SkReadBuffer.h"
|
#include "SkReadBuffer.h"
|
||||||
#include "SkWriteBuffer.h"
|
#include "SkWriteBuffer.h"
|
||||||
|
|
||||||
|
// These values must be constant over revisions, though they can be renamed to reflect if/when
|
||||||
|
// they are deprecated.
|
||||||
|
enum Stored_SkColorType {
|
||||||
|
kUnknown_Stored_SkColorType = 0,
|
||||||
|
kAlpha_8_Stored_SkColorType = 1,
|
||||||
|
kRGB_565_Stored_SkColorType = 2,
|
||||||
|
kARGB_4444_Stored_SkColorType = 3,
|
||||||
|
kRGBA_8888_Stored_SkColorType = 4,
|
||||||
|
kBGRA_8888_Stored_SkColorType = 5,
|
||||||
|
kIndex_8_Stored_SkColorType_DEPRECATED = 6,
|
||||||
|
kGray_8_Stored_SkColorType = 7,
|
||||||
|
kRGBA_F16_Stored_SkColorType = 8,
|
||||||
|
|
||||||
|
kLast_Stored_SkColorType = kRGBA_F16_Stored_SkColorType,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Index with Stored_SkColorType
|
||||||
|
const SkColorType gStoredToLive[] = {
|
||||||
|
kUnknown_SkColorType,
|
||||||
|
kAlpha_8_SkColorType,
|
||||||
|
kRGB_565_SkColorType,
|
||||||
|
kARGB_4444_SkColorType,
|
||||||
|
kRGBA_8888_SkColorType,
|
||||||
|
kBGRA_8888_SkColorType,
|
||||||
|
kUnknown_SkColorType, // was kIndex_8
|
||||||
|
kGray_8_SkColorType,
|
||||||
|
kRGBA_F16_SkColorType,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Index with SkColorType
|
||||||
|
const Stored_SkColorType gLiveToStored[] = {
|
||||||
|
kUnknown_Stored_SkColorType,
|
||||||
|
kAlpha_8_Stored_SkColorType,
|
||||||
|
kRGB_565_Stored_SkColorType,
|
||||||
|
kARGB_4444_Stored_SkColorType,
|
||||||
|
kRGBA_8888_Stored_SkColorType,
|
||||||
|
kBGRA_8888_Stored_SkColorType,
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
|
kIndex_8_Stored_SkColorType_DEPRECATED,
|
||||||
|
#endif
|
||||||
|
kGray_8_Stored_SkColorType,
|
||||||
|
kRGBA_F16_Stored_SkColorType,
|
||||||
|
};
|
||||||
|
|
||||||
|
static uint8_t live_to_stored(unsigned ct) {
|
||||||
|
static_assert(SK_ARRAY_COUNT(gLiveToStored) == (kLastEnum_SkColorType + 1), "");
|
||||||
|
SkASSERT(ct < SK_ARRAY_COUNT(gLiveToStored));
|
||||||
|
|
||||||
|
return gLiveToStored[ct];
|
||||||
|
}
|
||||||
|
|
||||||
|
static SkColorType stored_to_live(unsigned stored) {
|
||||||
|
static_assert(SK_ARRAY_COUNT(gStoredToLive) == (kLast_Stored_SkColorType + 1), "");
|
||||||
|
SkASSERT(stored < SK_ARRAY_COUNT(gStoredToLive));
|
||||||
|
|
||||||
|
return gStoredToLive[stored];
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static bool alpha_type_is_valid(SkAlphaType alphaType) {
|
static bool alpha_type_is_valid(SkAlphaType alphaType) {
|
||||||
return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType);
|
return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType);
|
||||||
}
|
}
|
||||||
@ -30,7 +90,7 @@ void SkImageInfo::unflatten(SkReadBuffer& buffer) {
|
|||||||
fHeight = buffer.read32();
|
fHeight = buffer.read32();
|
||||||
|
|
||||||
uint32_t packed = buffer.read32();
|
uint32_t packed = buffer.read32();
|
||||||
fColorType = (SkColorType)((packed >> 0) & kColorTypeMask);
|
fColorType = stored_to_live((SkColorType)((packed >> 0) & kColorTypeMask));
|
||||||
fAlphaType = (SkAlphaType)((packed >> 8) & kAlphaTypeMask);
|
fAlphaType = (SkAlphaType)((packed >> 8) & kAlphaTypeMask);
|
||||||
buffer.validate(alpha_type_is_valid(fAlphaType) && color_type_is_valid(fColorType));
|
buffer.validate(alpha_type_is_valid(fAlphaType) && color_type_is_valid(fColorType));
|
||||||
|
|
||||||
@ -44,7 +104,7 @@ void SkImageInfo::flatten(SkWriteBuffer& buffer) const {
|
|||||||
|
|
||||||
SkASSERT(0 == (fAlphaType & ~kAlphaTypeMask));
|
SkASSERT(0 == (fAlphaType & ~kAlphaTypeMask));
|
||||||
SkASSERT(0 == (fColorType & ~kColorTypeMask));
|
SkASSERT(0 == (fColorType & ~kColorTypeMask));
|
||||||
uint32_t packed = (fAlphaType << 8) | fColorType;
|
uint32_t packed = (fAlphaType << 8) | live_to_stored(fColorType);
|
||||||
buffer.write32(packed);
|
buffer.write32(packed);
|
||||||
|
|
||||||
if (fColorSpace) {
|
if (fColorSpace) {
|
||||||
@ -71,7 +131,9 @@ bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType,
|
|||||||
alphaType = kPremul_SkAlphaType;
|
alphaType = kPremul_SkAlphaType;
|
||||||
}
|
}
|
||||||
// fall-through
|
// fall-through
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
|
#endif
|
||||||
case kARGB_4444_SkColorType:
|
case kARGB_4444_SkColorType:
|
||||||
case kRGBA_8888_SkColorType:
|
case kRGBA_8888_SkColorType:
|
||||||
case kBGRA_8888_SkColorType:
|
case kBGRA_8888_SkColorType:
|
||||||
|
@ -111,6 +111,7 @@ static inline bool SkImageInfoValidConversion(const SkImageInfo& dst, const SkIm
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
if (kIndex_8_SkColorType == dst.colorType()) {
|
if (kIndex_8_SkColorType == dst.colorType()) {
|
||||||
if (kIndex_8_SkColorType != src.colorType()) {
|
if (kIndex_8_SkColorType != src.colorType()) {
|
||||||
return false;
|
return false;
|
||||||
@ -126,6 +127,7 @@ static inline bool SkImageInfoValidConversion(const SkImageInfo& dst, const SkIm
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (kGray_8_SkColorType == dst.colorType()) {
|
if (kGray_8_SkColorType == dst.colorType()) {
|
||||||
if (kGray_8_SkColorType != src.colorType()) {
|
if (kGray_8_SkColorType != src.colorType()) {
|
||||||
|
@ -372,9 +372,11 @@ SkLinearBitmapPipeline::SkLinearBitmapPipeline(
|
|||||||
|
|
||||||
// If it is an index 8 color type, the sampler converts to unpremul for better fidelity.
|
// If it is an index 8 color type, the sampler converts to unpremul for better fidelity.
|
||||||
SkAlphaType alphaType = srcImageInfo.alphaType();
|
SkAlphaType alphaType = srcImageInfo.alphaType();
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
if (srcPixmap.colorType() == kIndex_8_SkColorType) {
|
if (srcPixmap.colorType() == kIndex_8_SkColorType) {
|
||||||
alphaType = kUnpremul_SkAlphaType;
|
alphaType = kUnpremul_SkAlphaType;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
float postAlpha = SkColorGetA(paintColor) * (1.0f / 255.0f);
|
float postAlpha = SkColorGetA(paintColor) * (1.0f / 255.0f);
|
||||||
// As the stages are built, the chooser function may skip a stage. For example, with the
|
// As the stages are built, the chooser function may skip a stage. For example, with the
|
||||||
@ -596,8 +598,10 @@ SkLinearBitmapPipeline::PixelAccessorInterface* SkLinearBitmapPipeline::choosePi
|
|||||||
return this->chooseSpecificAccessor<kRGBA_8888_SkColorType>(srcPixmap, allocator);
|
return this->chooseSpecificAccessor<kRGBA_8888_SkColorType>(srcPixmap, allocator);
|
||||||
case kBGRA_8888_SkColorType:
|
case kBGRA_8888_SkColorType:
|
||||||
return this->chooseSpecificAccessor<kBGRA_8888_SkColorType>(srcPixmap, allocator);
|
return this->chooseSpecificAccessor<kBGRA_8888_SkColorType>(srcPixmap, allocator);
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
return this->chooseSpecificAccessor<kIndex_8_SkColorType>(srcPixmap, allocator);
|
return this->chooseSpecificAccessor<kIndex_8_SkColorType>(srcPixmap, allocator);
|
||||||
|
#endif
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
return this->chooseSpecificAccessor<kGray_8_SkColorType>(srcPixmap, allocator);
|
return this->chooseSpecificAccessor<kGray_8_SkColorType>(srcPixmap, allocator);
|
||||||
case kRGBA_F16_SkColorType: {
|
case kRGBA_F16_SkColorType: {
|
||||||
@ -632,12 +636,14 @@ SkLinearBitmapPipeline::SampleProcessorInterface* SkLinearBitmapPipeline::choose
|
|||||||
PixelAccessor<kN32_SkColorType, kSRGB_SkGammaType>, Blender>;
|
PixelAccessor<kN32_SkColorType, kSRGB_SkGammaType>, Blender>;
|
||||||
return allocator->make<Sampler>(next, srcPixmap);
|
return allocator->make<Sampler>(next, srcPixmap);
|
||||||
}
|
}
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType: {
|
case kIndex_8_SkColorType: {
|
||||||
using Sampler =
|
using Sampler =
|
||||||
NearestNeighborSampler<
|
NearestNeighborSampler<
|
||||||
PixelAccessor<kIndex_8_SkColorType, kSRGB_SkGammaType>, Blender>;
|
PixelAccessor<kIndex_8_SkColorType, kSRGB_SkGammaType>, Blender>;
|
||||||
return allocator->make<Sampler>(next, srcPixmap);
|
return allocator->make<Sampler>(next, srcPixmap);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -649,12 +655,14 @@ SkLinearBitmapPipeline::SampleProcessorInterface* SkLinearBitmapPipeline::choose
|
|||||||
PixelAccessor<kN32_SkColorType, kSRGB_SkGammaType>, Blender>;
|
PixelAccessor<kN32_SkColorType, kSRGB_SkGammaType>, Blender>;
|
||||||
return allocator->make<Sampler>(next, dimensions, xTile, yTile, srcPixmap);
|
return allocator->make<Sampler>(next, dimensions, xTile, yTile, srcPixmap);
|
||||||
}
|
}
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType: {
|
case kIndex_8_SkColorType: {
|
||||||
using Sampler =
|
using Sampler =
|
||||||
BilerpSampler<
|
BilerpSampler<
|
||||||
PixelAccessor<kIndex_8_SkColorType, kSRGB_SkGammaType>, Blender>;
|
PixelAccessor<kIndex_8_SkColorType, kSRGB_SkGammaType>, Blender>;
|
||||||
return allocator->make<Sampler>(next, dimensions, xTile, yTile, srcPixmap);
|
return allocator->make<Sampler>(next, dimensions, xTile, yTile, srcPixmap);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
template <SkGammaType gammaType>
|
template <SkGammaType gammaType>
|
||||||
class PixelConverter<kIndex_8_SkColorType, gammaType> {
|
class PixelConverter<kIndex_8_SkColorType, gammaType> {
|
||||||
public:
|
public:
|
||||||
@ -166,7 +167,8 @@ private:
|
|||||||
SkAutoMalloc fColorTableStorage{kColorTableSize};
|
SkAutoMalloc fColorTableStorage{kColorTableSize};
|
||||||
Sk4f* fColorTable;
|
Sk4f* fColorTable;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
template <SkGammaType gammaType>
|
template <SkGammaType gammaType>
|
||||||
class PixelConverter<kGray_8_SkColorType, gammaType> {
|
class PixelConverter<kGray_8_SkColorType, gammaType> {
|
||||||
public:
|
public:
|
||||||
|
@ -144,9 +144,12 @@ sk_sp<SkPixelRef> SkMallocPixelRef::MakeWithData(const SkImageInfo& info,
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static sk_sp<SkColorTable> sanitize(const SkImageInfo& info, sk_sp<SkColorTable> ctable) {
|
static sk_sp<SkColorTable> sanitize(const SkImageInfo& info, sk_sp<SkColorTable> ctable) {
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
if (kIndex_8_SkColorType == info.colorType()) {
|
if (kIndex_8_SkColorType == info.colorType()) {
|
||||||
SkASSERT(ctable);
|
SkASSERT(ctable);
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
ctable.reset(nullptr);
|
ctable.reset(nullptr);
|
||||||
}
|
}
|
||||||
return ctable;
|
return ctable;
|
||||||
|
@ -272,11 +272,13 @@ SkColor SkPixmap::getColor(int x, int y) const {
|
|||||||
case kAlpha_8_SkColorType: {
|
case kAlpha_8_SkColorType: {
|
||||||
return SkColorSetA(0, *this->addr8(x, y));
|
return SkColorSetA(0, *this->addr8(x, y));
|
||||||
}
|
}
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType: {
|
case kIndex_8_SkColorType: {
|
||||||
SkASSERT(this->ctable());
|
SkASSERT(this->ctable());
|
||||||
SkPMColor c = (*this->ctable())[*this->addr8(x, y)];
|
SkPMColor c = (*this->ctable())[*this->addr8(x, y)];
|
||||||
return toColor(c);
|
return toColor(c);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
case kRGB_565_SkColorType: {
|
case kRGB_565_SkColorType: {
|
||||||
return SkPixel16ToColor(*this->addr16(x, y));
|
return SkPixel16ToColor(*this->addr16(x, y));
|
||||||
}
|
}
|
||||||
@ -332,6 +334,7 @@ bool SkPixmap::computeIsOpaque() const {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} break;
|
} break;
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType: {
|
case kIndex_8_SkColorType: {
|
||||||
const SkColorTable* ctable = this->ctable();
|
const SkColorTable* ctable = this->ctable();
|
||||||
if (nullptr == ctable) {
|
if (nullptr == ctable) {
|
||||||
@ -344,6 +347,7 @@ bool SkPixmap::computeIsOpaque() const {
|
|||||||
}
|
}
|
||||||
return 0xFF == SkGetPackedA32(c);
|
return 0xFF == SkGetPackedA32(c);
|
||||||
} break;
|
} break;
|
||||||
|
#endif
|
||||||
case kRGB_565_SkColorType:
|
case kRGB_565_SkColorType:
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
return true;
|
return true;
|
||||||
|
@ -113,6 +113,7 @@ static const SkPixmap* compute_desc(const GrCaps& caps, const SkPixmap& pixmap,
|
|||||||
pmap = tmpPixmap;
|
pmap = tmpPixmap;
|
||||||
// must rebuild desc, since we've forced the info to be N32
|
// must rebuild desc, since we've forced the info to be N32
|
||||||
*desc = GrImageInfoToSurfaceDesc(pmap->info(), caps);
|
*desc = GrImageInfoToSurfaceDesc(pmap->info(), caps);
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
} else if (kIndex_8_SkColorType == pixmap.colorType()) {
|
} else if (kIndex_8_SkColorType == pixmap.colorType()) {
|
||||||
SkImageInfo info = SkImageInfo::MakeN32Premul(pixmap.width(), pixmap.height());
|
SkImageInfo info = SkImageInfo::MakeN32Premul(pixmap.width(), pixmap.height());
|
||||||
tmpBitmap->allocPixels(info);
|
tmpBitmap->allocPixels(info);
|
||||||
@ -125,6 +126,7 @@ static const SkPixmap* compute_desc(const GrCaps& caps, const SkPixmap& pixmap,
|
|||||||
pmap = tmpPixmap;
|
pmap = tmpPixmap;
|
||||||
// must rebuild desc, since we've forced the info to be N32
|
// must rebuild desc, since we've forced the info to be N32
|
||||||
*desc = GrImageInfoToSurfaceDesc(pmap->info(), caps);
|
*desc = GrImageInfoToSurfaceDesc(pmap->info(), caps);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return pmap;
|
return pmap;
|
||||||
@ -339,8 +341,10 @@ GrPixelConfig SkImageInfo2GrPixelConfig(const SkImageInfo& info, const GrCaps& c
|
|||||||
case kBGRA_8888_SkColorType:
|
case kBGRA_8888_SkColorType:
|
||||||
return (caps.srgbSupport() && cs && cs->gammaCloseToSRGB())
|
return (caps.srgbSupport() && cs && cs->gammaCloseToSRGB())
|
||||||
? kSBGRA_8888_GrPixelConfig : kBGRA_8888_GrPixelConfig;
|
? kSBGRA_8888_GrPixelConfig : kBGRA_8888_GrPixelConfig;
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
return kSkia8888_GrPixelConfig;
|
return kSkia8888_GrPixelConfig;
|
||||||
|
#endif
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
return kGray_8_GrPixelConfig;
|
return kGray_8_GrPixelConfig;
|
||||||
case kRGBA_F16_SkColorType:
|
case kRGBA_F16_SkColorType:
|
||||||
|
@ -201,11 +201,13 @@ SkImage_Lazy::Validator::Validator(sk_sp<SharedGenerator> gen, const SkIRect* su
|
|||||||
fUniqueID = SkNextID::ImageID();
|
fUniqueID = SkNextID::ImageID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
// colortables are poorly to not-at-all supported in our resourcecache, so we
|
// colortables are poorly to not-at-all supported in our resourcecache, so we
|
||||||
// bully them into N32 (the generator will perform the up-sample)
|
// bully them into N32 (the generator will perform the up-sample)
|
||||||
if (fInfo.colorType() == kIndex_8_SkColorType) {
|
if (fInfo.colorType() == kIndex_8_SkColorType) {
|
||||||
fInfo = fInfo.makeColorType(kN32_SkColorType);
|
fInfo = fInfo.makeColorType(kN32_SkColorType);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -240,7 +242,9 @@ SkImage_Lazy::SkImage_Lazy(Validator* validator)
|
|||||||
, fInfo(validator->fInfo)
|
, fInfo(validator->fInfo)
|
||||||
, fOrigin(validator->fOrigin) {
|
, fOrigin(validator->fOrigin) {
|
||||||
SkASSERT(fSharedGenerator);
|
SkASSERT(fSharedGenerator);
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
SkASSERT(kIndex_8_SkColorType != fInfo.colorType());
|
SkASSERT(kIndex_8_SkColorType != fInfo.colorType());
|
||||||
|
#endif
|
||||||
// We explicit set the legacy format slot, but leave the others uninitialized (via SkOnce)
|
// We explicit set the legacy format slot, but leave the others uninitialized (via SkOnce)
|
||||||
// and only resolove them to IDs as needed (by calling getUniqueID()).
|
// and only resolove them to IDs as needed (by calling getUniqueID()).
|
||||||
fIDRecs[kLegacy_CachedFormat].fOnce([this, validator] {
|
fIDRecs[kLegacy_CachedFormat].fOnce([this, validator] {
|
||||||
@ -307,9 +311,11 @@ SkImageCacherator::CachedFormat SkImage_Lazy::chooseCacheFormat(SkColorSpace* ds
|
|||||||
// TODO: Ask the codec to decode these to something else (at least sRGB 8888)?
|
// TODO: Ask the codec to decode these to something else (at least sRGB 8888)?
|
||||||
return kLegacy_CachedFormat;
|
return kLegacy_CachedFormat;
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
SkDEBUGFAIL("Index_8 should have been remapped at construction time.");
|
SkDEBUGFAIL("Index_8 should have been remapped at construction time.");
|
||||||
return kLegacy_CachedFormat;
|
return kLegacy_CachedFormat;
|
||||||
|
#endif
|
||||||
|
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
// TODO: What do we do with grayscale sources that have strange color spaces attached?
|
// TODO: What do we do with grayscale sources that have strange color spaces attached?
|
||||||
|
@ -57,10 +57,11 @@ public:
|
|||||||
if (kUnknown_SkColorType == info.colorType()) {
|
if (kUnknown_SkColorType == info.colorType()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
if (kIndex_8_SkColorType == info.colorType()) {
|
if (kIndex_8_SkColorType == info.colorType()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (rowBytes < info.minRowBytes()) {
|
if (rowBytes < info.minRowBytes()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,7 @@ bool SkJpegEncoderMgr::setParams(const SkImageInfo& srcInfo, const SkJpegEncoder
|
|||||||
jpegColorType = JCS_RGB;
|
jpegColorType = JCS_RGB;
|
||||||
numComponents = 3;
|
numComponents = 3;
|
||||||
break;
|
break;
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
if (SkJpegEncoder::AlphaOption::kBlendOnBlack == options.fAlphaOption) {
|
if (SkJpegEncoder::AlphaOption::kBlendOnBlack == options.fAlphaOption) {
|
||||||
return false;
|
return false;
|
||||||
@ -122,6 +123,7 @@ bool SkJpegEncoderMgr::setParams(const SkImageInfo& srcInfo, const SkJpegEncoder
|
|||||||
jpegColorType = JCS_RGB;
|
jpegColorType = JCS_RGB;
|
||||||
numComponents = 3;
|
numComponents = 3;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
SkASSERT(srcInfo.isOpaque());
|
SkASSERT(srcInfo.isOpaque());
|
||||||
jpegColorType = JCS_GRAYSCALE;
|
jpegColorType = JCS_GRAYSCALE;
|
||||||
|
@ -115,6 +115,7 @@ bool SkPngEncoderMgr::setHeader(const SkImageInfo& srcInfo, const SkPngEncoder::
|
|||||||
pngColorType = srcInfo.isOpaque() ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGB_ALPHA;
|
pngColorType = srcInfo.isOpaque() ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGB_ALPHA;
|
||||||
fPngBytesPerPixel = 8;
|
fPngBytesPerPixel = 8;
|
||||||
break;
|
break;
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
sigBit.red = 8;
|
sigBit.red = 8;
|
||||||
sigBit.green = 8;
|
sigBit.green = 8;
|
||||||
@ -123,6 +124,7 @@ bool SkPngEncoderMgr::setHeader(const SkImageInfo& srcInfo, const SkPngEncoder::
|
|||||||
pngColorType = PNG_COLOR_TYPE_PALETTE;
|
pngColorType = PNG_COLOR_TYPE_PALETTE;
|
||||||
fPngBytesPerPixel = 1;
|
fPngBytesPerPixel = 1;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
sigBit.gray = 8;
|
sigBit.gray = 8;
|
||||||
pngColorType = PNG_COLOR_TYPE_GRAY;
|
pngColorType = PNG_COLOR_TYPE_GRAY;
|
||||||
@ -250,7 +252,9 @@ static transform_scanline_proc choose_proc(const SkImageInfo& info,
|
|||||||
SkASSERT(false);
|
SkASSERT(false);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
|
#endif
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
return transform_scanline_memcpy;
|
return transform_scanline_memcpy;
|
||||||
case kRGBA_F16_SkColorType:
|
case kRGBA_F16_SkColorType:
|
||||||
@ -270,6 +274,7 @@ static transform_scanline_proc choose_proc(const SkImageInfo& info,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
/*
|
/*
|
||||||
* Pack palette[] with the corresponding colors, and if the image has alpha, also
|
* Pack palette[] with the corresponding colors, and if the image has alpha, also
|
||||||
* pack trans[] and return the number of alphas[] entries written. If the image is
|
* pack trans[] and return the number of alphas[] entries written. If the image is
|
||||||
@ -331,6 +336,7 @@ static inline int pack_palette(SkColorTable* ctable, png_color* SK_RESTRICT pale
|
|||||||
|
|
||||||
return numWithAlpha;
|
return numWithAlpha;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool SkPngEncoderMgr::setPalette(const SkImageInfo& srcInfo, SkColorTable* colorTable,
|
bool SkPngEncoderMgr::setPalette(const SkImageInfo& srcInfo, SkColorTable* colorTable,
|
||||||
SkTransferFunctionBehavior unpremulBehavior) {
|
SkTransferFunctionBehavior unpremulBehavior) {
|
||||||
@ -338,6 +344,7 @@ bool SkPngEncoderMgr::setPalette(const SkImageInfo& srcInfo, SkColorTable* color
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
png_color paletteColors[256];
|
png_color paletteColors[256];
|
||||||
png_byte trans[256];
|
png_byte trans[256];
|
||||||
if (kIndex_8_SkColorType == srcInfo.colorType()) {
|
if (kIndex_8_SkColorType == srcInfo.colorType()) {
|
||||||
@ -351,7 +358,7 @@ bool SkPngEncoderMgr::setPalette(const SkImageInfo& srcInfo, SkColorTable* color
|
|||||||
png_set_tRNS(fPngPtr, fInfoPtr, trans, numTrans, nullptr);
|
png_set_tRNS(fPngPtr, fInfoPtr, trans, numTrans, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@ static transform_scanline_proc choose_proc(const SkImageInfo& info,
|
|||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
switch (info.alphaType()) {
|
switch (info.alphaType()) {
|
||||||
case kOpaque_SkAlphaType:
|
case kOpaque_SkAlphaType:
|
||||||
@ -98,6 +99,7 @@ static transform_scanline_proc choose_proc(const SkImageInfo& info,
|
|||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
return transform_scanline_gray;
|
return transform_scanline_gray;
|
||||||
case kRGBA_F16_SkColorType:
|
case kRGBA_F16_SkColorType:
|
||||||
@ -147,6 +149,7 @@ bool SkWebpEncoder::Encode(SkWStream* stream, const SkPixmap& pixmap, const Opti
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SkPMColor* colors = nullptr;
|
const SkPMColor* colors = nullptr;
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
SkPMColor storage[256];
|
SkPMColor storage[256];
|
||||||
if (kIndex_8_SkColorType == pixmap.colorType()) {
|
if (kIndex_8_SkColorType == pixmap.colorType()) {
|
||||||
if (!pixmap.ctable()) {
|
if (!pixmap.ctable()) {
|
||||||
@ -162,6 +165,7 @@ bool SkWebpEncoder::Encode(SkWStream* stream, const SkPixmap& pixmap, const Opti
|
|||||||
colors = storage;
|
colors = storage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
WebPConfig webp_config;
|
WebPConfig webp_config;
|
||||||
if (!WebPConfigPreset(&webp_config, WEBP_PRESET_DEFAULT, opts.fQuality)) {
|
if (!WebPConfigPreset(&webp_config, WEBP_PRESET_DEFAULT, opts.fQuality)) {
|
||||||
|
@ -20,13 +20,16 @@ void image_get_ro_pixels(const SkImage* image, SkBitmap* dst) {
|
|||||||
SkColorSpace* legacyColorSpace = nullptr;
|
SkColorSpace* legacyColorSpace = nullptr;
|
||||||
if(as_IB(image)->getROPixels(dst, legacyColorSpace)
|
if(as_IB(image)->getROPixels(dst, legacyColorSpace)
|
||||||
&& dst->dimensions() == image->dimensions()) {
|
&& dst->dimensions() == image->dimensions()) {
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
if (dst->colorType() != kIndex_8_SkColorType) {
|
if (dst->colorType() != kIndex_8_SkColorType) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!dst->getColorTable()) {
|
if (!dst->getColorTable()) {
|
||||||
// We can't use an indexed bitmap with no colortable.
|
// We can't use an indexed bitmap with no colortable.
|
||||||
dst->reset();
|
dst->reset();
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,7 +166,9 @@ static size_t pdf_color_component_count(SkColorType ct) {
|
|||||||
case kBGRA_8888_SkColorType:
|
case kBGRA_8888_SkColorType:
|
||||||
return 3;
|
return 3;
|
||||||
case kAlpha_8_SkColorType:
|
case kAlpha_8_SkColorType:
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
|
#endif
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
return 1;
|
return 1;
|
||||||
case kUnknown_SkColorType:
|
case kUnknown_SkColorType:
|
||||||
@ -234,7 +239,9 @@ static void bitmap_to_pdf_pixels(const SkBitmap& bitmap, SkWStream* out) {
|
|||||||
fill_stream(out, '\x00', pixel_count(bm));
|
fill_stream(out, '\x00', pixel_count(bm));
|
||||||
return;
|
return;
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
|
#endif
|
||||||
SkASSERT(1 == pdf_color_component_count(colorType));
|
SkASSERT(1 == pdf_color_component_count(colorType));
|
||||||
// these two formats need no transformation to serialize.
|
// these two formats need no transformation to serialize.
|
||||||
for (int y = 0; y < bm.height(); ++y) {
|
for (int y = 0; y < bm.height(); ++y) {
|
||||||
@ -277,6 +284,7 @@ static void bitmap_alpha_to_a8(const SkBitmap& bitmap, SkWStream* out) {
|
|||||||
out->write(bm.getAddr8(0, y), bm.width());
|
out->write(bm.getAddr8(0, y), bm.width());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType: {
|
case kIndex_8_SkColorType: {
|
||||||
SkColorTable* ct = bm.getColorTable();
|
SkColorTable* ct = bm.getColorTable();
|
||||||
SkASSERT(ct);
|
SkASSERT(ct);
|
||||||
@ -291,6 +299,7 @@ static void bitmap_alpha_to_a8(const SkBitmap& bitmap, SkWStream* out) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
case kRGB_565_SkColorType:
|
case kRGB_565_SkColorType:
|
||||||
case kGray_8_SkColorType:
|
case kGray_8_SkColorType:
|
||||||
SkDEBUGFAIL("color type has no alpha");
|
SkDEBUGFAIL("color type has no alpha");
|
||||||
@ -304,6 +313,7 @@ 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(
|
static sk_sp<SkPDFArray> make_indexed_color_space(
|
||||||
const SkColorTable* table,
|
const SkColorTable* table,
|
||||||
SkAlphaType alphaType) {
|
SkAlphaType alphaType) {
|
||||||
@ -341,6 +351,7 @@ static sk_sp<SkPDFArray> make_indexed_color_space(
|
|||||||
result->appendString(tableString);
|
result->appendString(tableString);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void emit_image_xobject(SkWStream* stream,
|
static void emit_image_xobject(SkWStream* stream,
|
||||||
const SkImage* image,
|
const SkImage* image,
|
||||||
@ -366,11 +377,13 @@ static void emit_image_xobject(SkWStream* stream,
|
|||||||
pdfDict.insertInt("Height", bitmap.height());
|
pdfDict.insertInt("Height", bitmap.height());
|
||||||
if (alpha) {
|
if (alpha) {
|
||||||
pdfDict.insertName("ColorSpace", "DeviceGray");
|
pdfDict.insertName("ColorSpace", "DeviceGray");
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
} else if (bitmap.colorType() == kIndex_8_SkColorType) {
|
} else if (bitmap.colorType() == kIndex_8_SkColorType) {
|
||||||
SkASSERT(1 == pdf_color_component_count(bitmap.colorType()));
|
SkASSERT(1 == pdf_color_component_count(bitmap.colorType()));
|
||||||
pdfDict.insertObject("ColorSpace",
|
pdfDict.insertObject("ColorSpace",
|
||||||
make_indexed_color_space(bitmap.getColorTable(),
|
make_indexed_color_space(bitmap.getColorTable(),
|
||||||
bitmap.alphaType()));
|
bitmap.alphaType()));
|
||||||
|
#endif
|
||||||
} else if (1 == pdf_color_component_count(bitmap.colorType())) {
|
} else if (1 == pdf_color_component_count(bitmap.colorType())) {
|
||||||
pdfDict.insertName("ColorSpace", "DeviceGray");
|
pdfDict.insertName("ColorSpace", "DeviceGray");
|
||||||
} else {
|
} else {
|
||||||
|
@ -326,7 +326,9 @@ bool SkImageShader::onAppendStages(SkRasterPipeline* p, SkColorSpace* dstCS, SkA
|
|||||||
}
|
}
|
||||||
switch (info.colorType()) {
|
switch (info.colorType()) {
|
||||||
case kAlpha_8_SkColorType: p->append(SkRasterPipeline::gather_a8, gather); break;
|
case kAlpha_8_SkColorType: p->append(SkRasterPipeline::gather_a8, gather); break;
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
case kIndex_8_SkColorType: p->append(SkRasterPipeline::gather_i8, gather); break;
|
case kIndex_8_SkColorType: p->append(SkRasterPipeline::gather_i8, gather); break;
|
||||||
|
#endif
|
||||||
case kGray_8_SkColorType: p->append(SkRasterPipeline::gather_g8, gather); break;
|
case kGray_8_SkColorType: p->append(SkRasterPipeline::gather_g8, gather); break;
|
||||||
case kRGB_565_SkColorType: p->append(SkRasterPipeline::gather_565, gather); break;
|
case kRGB_565_SkColorType: p->append(SkRasterPipeline::gather_565, gather); break;
|
||||||
case kARGB_4444_SkColorType: p->append(SkRasterPipeline::gather_4444, gather); break;
|
case kARGB_4444_SkColorType: p->append(SkRasterPipeline::gather_4444, gather); break;
|
||||||
@ -390,9 +392,11 @@ bool SkImageShader::onAppendStages(SkRasterPipeline* p, SkColorSpace* dstCS, SkA
|
|||||||
p->append(SkRasterPipeline::move_dst_src);
|
p->append(SkRasterPipeline::move_dst_src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
if (info.colorType() == kIndex_8_SkColorType && kN32_SkColorType == kBGRA_8888_SkColorType) {
|
if (info.colorType() == kIndex_8_SkColorType && kN32_SkColorType == kBGRA_8888_SkColorType) {
|
||||||
p->append(SkRasterPipeline::swap_rb);
|
p->append(SkRasterPipeline::swap_rb);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (info.colorType() == kAlpha_8_SkColorType) {
|
if (info.colorType() == kAlpha_8_SkColorType) {
|
||||||
p->append(SkRasterPipeline::set_rgb, &misc->paint_color);
|
p->append(SkRasterPipeline::set_rgb, &misc->paint_color);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,11 @@ SkString* SkObjectParser::BitmapToString(const SkBitmap& bitmap) {
|
|||||||
mBitmap->appendS32(bitmap.height());
|
mBitmap->appendS32(bitmap.height());
|
||||||
|
|
||||||
const char* gColorTypeStrings[] = {
|
const char* gColorTypeStrings[] = {
|
||||||
"None", "A8", "565", "4444", "RGBA", "BGRA", "Index8", "G8", "RGBAf16"
|
"None", "A8", "565", "4444", "RGBA", "BGRA",
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE
|
||||||
|
"Index8",
|
||||||
|
#endif
|
||||||
|
"G8", "RGBAf16"
|
||||||
};
|
};
|
||||||
static_assert(kLastEnum_SkColorType + 1 == SK_ARRAY_COUNT(gColorTypeStrings),
|
static_assert(kLastEnum_SkColorType + 1 == SK_ARRAY_COUNT(gColorTypeStrings),
|
||||||
"colortype names do not match colortype enum");
|
"colortype names do not match colortype enum");
|
||||||
|
Loading…
Reference in New Issue
Block a user