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;
}