use onPeekBitmap instead of asLegacyBitmap

Since we know we are raster-backed at this point, it is fine, plus it avoids the copy-mutable logic in asLegacyBitmap, which is not needed here (and is slower if our bitmap was built with kNever_SkCopyPixelsMode).

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2223653002

Review-Url: https://codereview.chromium.org/2223653002
This commit is contained in:
reed 2016-08-08 09:00:29 -07:00 committed by Commit bot
parent b9a10d8c75
commit 9a5a201472

View File

@ -315,12 +315,12 @@ sk_sp<SkImage> SkImage::makeTextureImage(GrContext *context) const {
GrImageTextureMaker maker(context, cacher, this, kDisallow_CachingHint); GrImageTextureMaker maker(context, cacher, this, kDisallow_CachingHint);
return create_image_from_maker(&maker, at, this->uniqueID()); return create_image_from_maker(&maker, at, this->uniqueID());
} }
SkBitmap bmp;
if (!this->asLegacyBitmap(&bmp, kRO_LegacyBitmapMode)) { if (const SkBitmap* bmp = as_IB(this)->onPeekBitmap()) {
return nullptr; GrBitmapTextureMaker maker(context, *bmp);
return create_image_from_maker(&maker, at, this->uniqueID());
} }
GrBitmapTextureMaker maker(context, bmp); return nullptr;
return create_image_from_maker(&maker, at, this->uniqueID());
} }
sk_sp<SkImage> SkImage::makeNonTextureImage() const { sk_sp<SkImage> SkImage::makeNonTextureImage() const {