aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGr.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-07 19:36:43 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-07 19:36:43 +0000
commit7f4ad5a30ff745e666579d2b518dfd0c1aa49596 (patch)
tree73515d3a45f7be5196c1e26de6451d4913174411 /src/gpu/SkGr.cpp
parentc77256b83b92fef3a796ea7036bf725d51194c08 (diff)
Reland r9043 with fix.
git-svn-id: http://skia.googlecode.com/svn/trunk@9046 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/SkGr.cpp')
-rw-r--r--src/gpu/SkGr.cpp18
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;