Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 100723005: Update all callsites to use info for pixelrefs (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrSurface.cpp ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index ce02f2c55fc97fa76beba1068cc36ae9277b44c6..a413d0420465247250ba4ce8bac057f89ef4f0f0 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -214,7 +214,10 @@ void SkGpuDevice::initFromRenderTarget(GrContext* context,
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();
}
@@ -224,8 +227,8 @@ SkGpuDevice::SkGpuDevice(GrContext* context,
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;
@@ -245,6 +248,14 @@ SkGpuDevice::SkGpuDevice(GrContext* context,
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) {
@@ -254,7 +265,7 @@ SkGpuDevice::SkGpuDevice(GrContext* context,
SkASSERT(NULL != fRenderTarget);
// wrap the bitmap with a pixelref to expose our texture
- SkGrPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (texture));
+ SkGrPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, texture));
this->setPixelRef(pr, 0)->unref();
} else {
GrPrintf("--- failed to create gpu-offscreen [%d %d]\n",
@@ -840,11 +851,12 @@ bool create_mask_GPU(GrContext* context,
}
SkBitmap wrap_texture(GrTexture* texture) {
+ SkImageInfo info;
+ texture->asImageInfo(&info);
+
SkBitmap result;
- bool dummy;
- SkBitmap::Config config = grConfig2skConfig(texture->config(), &dummy);
- result.setConfig(config, texture->width(), texture->height());
- result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (texture)))->unref();
+ result.setConfig(info);
+ result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
return result;
}
« no previous file with comments | « src/gpu/GrSurface.cpp ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698