SkASSERT(bitmap.width() <= fContext->getMaxTextureSize() &&
bitmap.height() <= fContext->getMaxTextureSize());
+ SkAutoLockPixels alp(bitmap, !bitmap.getTexture());
+ if (!bitmap.getTexture() && !bitmap.readyToDraw()) {
+ SkDebugf("nothing to draw\n");
+ return;
+ }
+
GrTexture* texture;
SkAutoCachedTexture act(this, bitmap, ¶ms, &texture);
if (NULL == texture) {
static void build_compressed_data(void* buffer, const SkBitmap& bitmap) {
SkASSERT(SkBitmap::kIndex8_Config == bitmap.config());
- SkAutoLockPixels alp(bitmap);
+ SkAutoLockPixels apl(bitmap);
if (!bitmap.readyToDraw()) {
SkDEBUGFAIL("bitmap not ready to draw!");
return;
}
}
- 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;