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

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

Issue 1404823005: GrDrawContext now holds GrRenderTarget pointer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix overlength line Created 5 years, 2 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/GrConfigConversionEffect.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 "SkBitmapCache.h" 8 #include "SkBitmapCache.h"
9 #include "SkImage_Gpu.h" 9 #include "SkImage_Gpu.h"
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 return nullptr; 357 return nullptr;
358 } 358 }
359 359
360 GrPaint paint; 360 GrPaint paint;
361 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 361 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
362 paint.addColorFragmentProcessor(GrYUVtoRGBEffect::Create(yTex, uTex, vTex, y uvSizes, 362 paint.addColorFragmentProcessor(GrYUVtoRGBEffect::Create(yTex, uTex, vTex, y uvSizes,
363 colorSpace))->unref (); 363 colorSpace))->unref ();
364 364
365 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth), 365 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth),
366 SkIntToScalar(dstDesc.fHeight)); 366 SkIntToScalar(dstDesc.fHeight));
367 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext()); 367 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext(dst->asRenderTarget ()));
368 if (!drawContext) { 368 if (!drawContext) {
369 return nullptr; 369 return nullptr;
370 } 370 }
371 371
372 drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, SkMa trix::I(), rect); 372 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect);
373 ctx->flushSurfaceWrites(dst); 373 ctx->flushSurfaceWrites(dst);
374 return new SkImage_Gpu(dstDesc.fWidth, dstDesc.fHeight, kNeedNewImageUniqueI D, 374 return new SkImage_Gpu(dstDesc.fWidth, dstDesc.fHeight, kNeedNewImageUniqueI D,
375 kOpaque_SkAlphaType, dst, budgeted); 375 kOpaque_SkAlphaType, dst, budgeted);
376 } 376 }
377 377
378 //////////////////////////////////////////////////////////////////////////////// /////////////////// 378 //////////////////////////////////////////////////////////////////////////////// ///////////////////
379 379
380 GrTexture* GrDeepCopyTexture(GrTexture* src, bool budgeted) { 380 GrTexture* GrDeepCopyTexture(GrTexture* src, bool budgeted) {
381 GrContext* ctx = src->getContext(); 381 GrContext* ctx = src->getContext();
382 382
383 GrSurfaceDesc desc = src->desc(); 383 GrSurfaceDesc desc = src->desc();
384 GrTexture* dst = ctx->textureProvider()->createTexture(desc, budgeted, nullp tr, 0); 384 GrTexture* dst = ctx->textureProvider()->createTexture(desc, budgeted, nullp tr, 0);
385 if (!dst) { 385 if (!dst) {
386 return nullptr; 386 return nullptr;
387 } 387 }
388 388
389 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); 389 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
390 const SkIPoint dstP = SkIPoint::Make(0, 0); 390 const SkIPoint dstP = SkIPoint::Make(0, 0);
391 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); 391 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp);
392 return dst; 392 return dst;
393 } 393 }
394 394
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConfigConversionEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698