check to see if CGImage already knows if we're opaque
Review URL: https://codereview.appspot.com/6838043 git-svn-id: http://skia.googlecode.com/svn/trunk@6340 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
e8ca6c6e3a
commit
52e91bf564
@ -87,8 +87,18 @@ bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
|
||||
CGContextDrawImage(cg, CGRectMake(0, 0, width, height), image);
|
||||
CGContextRelease(cg);
|
||||
|
||||
// since CGImage won't tell us if it is opaque, we have to compute it.
|
||||
bm->computeAndSetOpaquePredicate();
|
||||
CGImageAlphaInfo info = CGImageGetAlphaInfo(image);
|
||||
switch (info) {
|
||||
case kCGImageAlphaNone:
|
||||
case kCGImageAlphaNoneSkipLast:
|
||||
case kCGImageAlphaNoneSkipFirst:
|
||||
SkASSERT(SkBitmap::ComputeIsOpaque(*bm));
|
||||
bm->setIsOpaque(true);
|
||||
break;
|
||||
default:
|
||||
// we don't know if we're opaque or not, so compute it.
|
||||
bm->computeAndSetOpaquePredicate();
|
||||
}
|
||||
bm->unlockPixels();
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user