ensure that opaque-only colortypes always report opaque-alphatype
BUG=skia: R=scroggo@google.com, djsollen@google.com, reed@google.com Author: reed@chromium.org Review URL: https://codereview.chromium.org/164233006 git-svn-id: http://skia.googlecode.com/svn/trunk@13443 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
fa9e5fa42a
commit
d5414e5efe
@ -253,7 +253,14 @@ static bool validate_alphaType(SkColorType colorType, SkAlphaType alphaType,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SkBitmap::setConfig(const SkImageInfo& info, size_t rowBytes) {
|
||||
bool SkBitmap::setConfig(const SkImageInfo& origInfo, size_t rowBytes) {
|
||||
SkImageInfo info = origInfo;
|
||||
|
||||
if (!validate_alphaType(info.fColorType, info.fAlphaType,
|
||||
&info.fAlphaType)) {
|
||||
return reset_return_false(this);
|
||||
}
|
||||
|
||||
// require that rowBytes fit in 31bits
|
||||
int64_t mrb = info.minRowBytes64();
|
||||
if ((int32_t)mrb != mrb) {
|
||||
@ -1619,6 +1626,13 @@ SkBitmap::RLEPixels::~RLEPixels() {
|
||||
#ifdef SK_DEBUG
|
||||
void SkBitmap::validate() const {
|
||||
fInfo.validate();
|
||||
|
||||
// ImageInfo may not require this, but Bitmap ensures that opaque-only
|
||||
// colorTypes report opaque for their alphatype
|
||||
if (kRGB_565_SkColorType == fInfo.colorType()) {
|
||||
SkASSERT(kOpaque_SkAlphaType == fInfo.alphaType());
|
||||
}
|
||||
|
||||
SkASSERT(fInfo.validRowBytes(fRowBytes));
|
||||
uint8_t allFlags = kImageIsOpaque_Flag | kImageIsVolatile_Flag | kImageIsImmutable_Flag;
|
||||
#ifdef SK_BUILD_FOR_ANDROID
|
||||
|
Loading…
Reference in New Issue
Block a user