diff options
Diffstat (limited to 'src/gpu/SkGr.cpp')
-rw-r--r-- | src/gpu/SkGr.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index d76a34a1cf..23aa49b419 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -24,7 +24,7 @@ static void build_compressed_data(void* buffer, const SkBitmap& bitmap) { SkASSERT(SkBitmap::kIndex8_Config == bitmap.config()); - SkAutoLockPixels apl(bitmap); + SkAutoLockPixels alp(bitmap); if (!bitmap.readyToDraw()) { SkDEBUGFAIL("bitmap not ready to draw!"); return; @@ -88,12 +88,6 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx, bool cache, const GrTextureParams* params, const SkBitmap& origBitmap) { - SkAutoLockPixels alp(origBitmap); - - if (!origBitmap.readyToDraw()) { - return NULL; - } - SkBitmap tmpBitmap; const SkBitmap* bitmap = &origBitmap; @@ -104,10 +98,8 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx, if (SkBitmap::kIndex8_Config == bitmap->config()) { // build_compressed_data doesn't do npot->pot expansion // and paletted textures can't be sub-updated - if (ctx->supportsIndex8PixelConfig(params, - bitmap->width(), bitmap->height())) { - size_t imagesize = bitmap->width() * bitmap->height() + - kGrColorTableSize; + if (ctx->supportsIndex8PixelConfig(params, bitmap->width(), bitmap->height())) { + size_t imagesize = bitmap->width() * bitmap->height() + kGrColorTableSize; SkAutoMalloc storage(imagesize); build_compressed_data(storage.get(), origBitmap); @@ -135,6 +127,10 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx, } } + SkAutoLockPixels alp(*bitmap); + if (!bitmap->readyToDraw()) { + return NULL; + } if (cache) { // This texture is likely to be used again so leave it in the cache GrCacheID cacheID; |