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

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

Issue 1230803002: YUV to RGB Texture threading GrProcessorDataManager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks 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/effects/GrYUVtoRGBEffect.cpp ('k') | no next file » | 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 dstDesc.fSampleCnt = 0; 223 dstDesc.fSampleCnt = 0;
224 224
225 SkAutoTUnref<GrTexture> dst(ctx->textureProvider()->refScratchTexture( 225 SkAutoTUnref<GrTexture> dst(ctx->textureProvider()->refScratchTexture(
226 dstDesc, GrTextureProvider::kExact_ScratchTexMatch)); 226 dstDesc, GrTextureProvider::kExact_ScratchTexMatch));
227 if (!dst) { 227 if (!dst) {
228 return NULL; 228 return NULL;
229 } 229 }
230 230
231 GrPaint paint; 231 GrPaint paint;
232 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 232 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
233 paint.addColorProcessor(GrYUVtoRGBEffect::Create(yTex, uTex, vTex, yuvSizes, 233 paint.addColorProcessor(GrYUVtoRGBEffect::Create(paint.getProcessorDataManag er(), yTex, uTex,
234 colorSpace))->unref(); 234 vTex, yuvSizes, colorSpace) )->unref();
235 235
236 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth), 236 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth),
237 SkIntToScalar(dstDesc.fHeight)); 237 SkIntToScalar(dstDesc.fHeight));
238 GrDrawContext* drawContext = ctx->drawContext(); 238 GrDrawContext* drawContext = ctx->drawContext();
239 drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, SkMa trix::I(), rect); 239 drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, SkMa trix::I(), rect);
240 ctx->flushSurfaceWrites(dst); 240 ctx->flushSurfaceWrites(dst);
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 251 // need to be a rendertarget for readpixels to work, instead of kNone_GrSurf aceFlags
252 desc.fFlags = kRenderTarget_GrSurfaceFlag; 252 desc.fFlags = kRenderTarget_GrSurfaceFlag;
253 GrTexture* dst = ctx->textureProvider()->createTexture(desc, budgeted, NULL, 0); 253 GrTexture* dst = ctx->textureProvider()->createTexture(desc, budgeted, NULL, 0);
254 if (!dst) { 254 if (!dst) {
255 return NULL; 255 return NULL;
256 } 256 }
257 257
258 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); 258 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
259 const SkIPoint dstP = SkIPoint::Make(0, 0); 259 const SkIPoint dstP = SkIPoint::Make(0, 0);
260 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); 260 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp);
261 return dst; 261 return dst;
262 } 262 }
263 263
OLDNEW
« no previous file with comments | « src/gpu/effects/GrYUVtoRGBEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698