Index: src/gpu/SkGpuDevice.cpp |
=================================================================== |
--- src/gpu/SkGpuDevice.cpp (revision 12666) |
+++ src/gpu/SkGpuDevice.cpp (working copy) |
@@ -214,11 +214,8 @@ |
if (NULL == surface) { |
surface = fRenderTarget; |
} |
+ SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (surface, cached)); |
- SkImageInfo info; |
- surface->asImageInfo(&info); |
- SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, surface, cached)); |
- |
this->setPixelRef(pr, 0)->unref(); |
} |
@@ -227,8 +224,8 @@ |
int width, |
int height, |
int sampleCount) |
- : SkBitmapDevice(make_bitmap(config, width, height, false /*isOpaque*/)) |
-{ |
+ : SkBitmapDevice(make_bitmap(config, width, height, false /*isOpaque*/)) { |
+ |
fDrawProcs = NULL; |
fContext = context; |
@@ -248,14 +245,6 @@ |
desc.fConfig = SkBitmapConfig2GrPixelConfig(config); |
desc.fSampleCnt = sampleCount; |
- SkImageInfo info; |
- if (!GrPixelConfig2ColorType(desc.fConfig, &info.fColorType)) { |
- sk_throw(); |
- } |
- info.fWidth = width; |
- info.fHeight = height; |
- info.fAlphaType = kPremul_SkAlphaType; |
- |
SkAutoTUnref<GrTexture> texture(fContext->createUncachedTexture(desc, NULL, 0)); |
if (NULL != texture) { |
@@ -265,7 +254,7 @@ |
SkASSERT(NULL != fRenderTarget); |
// wrap the bitmap with a pixelref to expose our texture |
- SkGrPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, texture)); |
+ SkGrPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (texture)); |
this->setPixelRef(pr, 0)->unref(); |
} else { |
GrPrintf("--- failed to create gpu-offscreen [%d %d]\n", |
@@ -851,12 +840,11 @@ |
} |
SkBitmap wrap_texture(GrTexture* texture) { |
- SkImageInfo info; |
- texture->asImageInfo(&info); |
- |
SkBitmap result; |
- result.setConfig(info); |
- result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref(); |
+ bool dummy; |
+ SkBitmap::Config config = grConfig2skConfig(texture->config(), &dummy); |
+ result.setConfig(config, texture->width(), texture->height()); |
+ result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (texture)))->unref(); |
return result; |
} |