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

Side by Side Diff: src/image/SkImage_Gpu.cpp

Issue 1234313002: Make readpixels work on GrTextures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix and more kRT removal Created 5 years, 5 months 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 unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | tests/ReadPixelsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkImage_Gpu.h" 8 #include "SkImage_Gpu.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 return SkNEW_ARGS(SkImage_Gpu, (dstDesc.fWidth, dstDesc.fHeight, kOpaque_SkA lphaType, dst, 0, 241 return SkNEW_ARGS(SkImage_Gpu, (dstDesc.fWidth, dstDesc.fHeight, kOpaque_SkA lphaType, dst, 0,
242 budgeted)); 242 budgeted));
243 } 243 }
244 244
245 //////////////////////////////////////////////////////////////////////////////// /////////////////// 245 //////////////////////////////////////////////////////////////////////////////// ///////////////////
246 246
247 GrTexture* GrDeepCopyTexture(GrTexture* src, bool budgeted) { 247 GrTexture* GrDeepCopyTexture(GrTexture* src, bool budgeted) {
248 GrContext* ctx = src->getContext(); 248 GrContext* ctx = src->getContext();
249 249
250 GrSurfaceDesc desc = src->desc(); 250 GrSurfaceDesc desc = src->desc();
251 // need to be a rendertarget for readpixels to work, instead of kNone_GrSurf aceFlags
252 desc.fFlags = kRenderTarget_GrSurfaceFlag;
253 GrTexture* dst = ctx->textureProvider()->createTexture(desc, budgeted, NULL, 0); 251 GrTexture* dst = ctx->textureProvider()->createTexture(desc, budgeted, NULL, 0);
254 if (!dst) { 252 if (!dst) {
255 return NULL; 253 return NULL;
256 } 254 }
257 255
258 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); 256 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
259 const SkIPoint dstP = SkIPoint::Make(0, 0); 257 const SkIPoint dstP = SkIPoint::Make(0, 0);
260 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); 258 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp);
261 return dst; 259 return dst;
262 } 260 }
263 261
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | tests/ReadPixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698