don't support converting from alpha to non-alpha
BUG=skia: Change-Id: Ia06bef6c0bfc03b5ca9f569c07e993da0bbd67c3 Reviewed-on: https://skia-review.googlesource.com/5288 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
2c8104eb18
commit
22f348281a
@ -707,15 +707,18 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool SkBitmap::canCopyTo(SkColorType dstColorType) const {
|
||||
bool SkBitmap::canCopyTo(SkColorType dstCT) const {
|
||||
const SkColorType srcCT = this->colorType();
|
||||
|
||||
if (srcCT == kUnknown_SkColorType) {
|
||||
return false;
|
||||
}
|
||||
if (srcCT == kAlpha_8_SkColorType && dstCT != kAlpha_8_SkColorType) {
|
||||
return false; // can't convert from alpha to non-alpha
|
||||
}
|
||||
|
||||
bool sameConfigs = (srcCT == dstColorType);
|
||||
switch (dstColorType) {
|
||||
bool sameConfigs = (srcCT == dstCT);
|
||||
switch (dstCT) {
|
||||
case kAlpha_8_SkColorType:
|
||||
case kRGB_565_SkColorType:
|
||||
case kRGBA_8888_SkColorType:
|
||||
|
@ -324,6 +324,12 @@ bool SkPixelInfo::CopyPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t
|
||||
return false;
|
||||
}
|
||||
|
||||
if (srcInfo.colorType() == kAlpha_8_SkColorType &&
|
||||
dstInfo.colorType() != kAlpha_8_SkColorType)
|
||||
{
|
||||
return false; // can't convert from alpha to non-alpha
|
||||
}
|
||||
|
||||
const int width = srcInfo.width();
|
||||
const int height = srcInfo.height();
|
||||
|
||||
|
@ -183,7 +183,7 @@ static void writeCoordPixels(SkBitmap& bm, const Coordinates& coords) {
|
||||
|
||||
static const Pair gPairs[] = {
|
||||
{ kUnknown_SkColorType, "000000" },
|
||||
{ kAlpha_8_SkColorType, "010101" },
|
||||
{ kAlpha_8_SkColorType, "010000" },
|
||||
{ kIndex_8_SkColorType, "011111" },
|
||||
{ kRGB_565_SkColorType, "010101" },
|
||||
{ kARGB_4444_SkColorType, "010111" },
|
||||
|
Loading…
Reference in New Issue
Block a user