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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 width, height, | 259 width, height, |
260 kRGBA_8888_GrPixelConfi
g, | 260 kRGBA_8888_GrPixelConfi
g, |
261 0, | 261 0, |
262 origin)); | 262 origin)); |
263 if (!drawContext) { | 263 if (!drawContext) { |
264 return nullptr; | 264 return nullptr; |
265 } | 265 } |
266 | 266 |
267 GrPaint paint; | 267 GrPaint paint; |
268 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 268 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
269 paint.addColorFragmentProcessor(GrYUVEffect::CreateYUVToRGB(yTex, uTex, vTex
, yuvSizes, | 269 paint.addColorFragmentProcessor(GrYUVEffect::MakeYUVToRGB(yTex, uTex, vTex,
yuvSizes, |
270 colorSpace))->un
ref(); | 270 colorSpace)); |
271 | 271 |
272 const SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(heigh
t)); | 272 const SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(heigh
t)); |
273 | 273 |
274 drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), rect); | 274 drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), rect); |
275 ctx->flushSurfaceWrites(drawContext->accessRenderTarget()); | 275 ctx->flushSurfaceWrites(drawContext->accessRenderTarget()); |
276 return sk_make_sp<SkImage_Gpu>(width, height, kNeedNewImageUniqueID, | 276 return sk_make_sp<SkImage_Gpu>(width, height, kNeedNewImageUniqueID, |
277 kOpaque_SkAlphaType, | 277 kOpaque_SkAlphaType, |
278 drawContext->asTexture().get(), budgeted); | 278 drawContext->asTexture().get(), budgeted); |
279 } | 279 } |
280 | 280 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 if (!ctx) { | 477 if (!ctx) { |
478 return nullptr; | 478 return nullptr; |
479 } | 479 } |
480 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
ipLevelCount)); | 480 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
ipLevelCount)); |
481 if (!texture) { | 481 if (!texture) { |
482 return nullptr; | 482 return nullptr; |
483 } | 483 } |
484 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew
ImageUniqueID, | 484 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew
ImageUniqueID, |
485 info.alphaType(), texture, budgeted); | 485 info.alphaType(), texture, budgeted); |
486 } | 486 } |
OLD | NEW |