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 "SkAutoPixmapStorage.h" | 8 #include "SkAutoPixmapStorage.h" |
9 #include "GrCaps.h" | 9 #include "GrCaps.h" |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 return nullptr; | 263 return nullptr; |
264 } | 264 } |
265 | 265 |
266 GrPaint paint; | 266 GrPaint paint; |
267 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 267 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
268 paint.addColorFragmentProcessor(GrYUVEffect::CreateYUVToRGB(yTex, uTex, vTex
, yuvSizes, | 268 paint.addColorFragmentProcessor(GrYUVEffect::CreateYUVToRGB(yTex, uTex, vTex
, yuvSizes, |
269 colorSpace))->un
ref(); | 269 colorSpace))->un
ref(); |
270 | 270 |
271 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth), | 271 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth), |
272 SkIntToScalar(dstDesc.fHeight)); | 272 SkIntToScalar(dstDesc.fHeight)); |
273 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext(dst->asRenderTarget
())); | 273 sk_sp<GrDrawContext> drawContext(ctx->drawContext(sk_ref_sp(dst->asRenderTar
get()))); |
274 if (!drawContext) { | 274 if (!drawContext) { |
275 return nullptr; | 275 return nullptr; |
276 } | 276 } |
277 | 277 |
278 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect); | 278 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect); |
279 ctx->flushSurfaceWrites(dst); | 279 ctx->flushSurfaceWrites(dst); |
280 return sk_make_sp<SkImage_Gpu>(dstDesc.fWidth, dstDesc.fHeight, kNeedNewImag
eUniqueID, | 280 return sk_make_sp<SkImage_Gpu>(dstDesc.fWidth, dstDesc.fHeight, kNeedNewImag
eUniqueID, |
281 kOpaque_SkAlphaType, dst, budgeted); | 281 kOpaque_SkAlphaType, dst, budgeted); |
282 } | 282 } |
283 | 283 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 return nullptr; | 454 return nullptr; |
455 } | 455 } |
456 | 456 |
457 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); | 457 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); |
458 const SkIPoint dstP = SkIPoint::Make(0, 0); | 458 const SkIPoint dstP = SkIPoint::Make(0, 0); |
459 ctx->copySurface(dst, src, srcR, dstP); | 459 ctx->copySurface(dst, src, srcR, dstP); |
460 ctx->flushSurfaceWrites(dst); | 460 ctx->flushSurfaceWrites(dst); |
461 return dst; | 461 return dst; |
462 } | 462 } |
463 | 463 |
OLD | NEW |