OLD | NEW |
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 Loading... |
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 |
OLD | NEW |