| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 ctx->textureProvider()->wrapBackendTexture(vDesc, kBorrow_GrWrapOwne
rship)); | 243 ctx->textureProvider()->wrapBackendTexture(vDesc, kBorrow_GrWrapOwne
rship)); |
| 244 } | 244 } |
| 245 if (!yTex || !uTex || !vTex) { | 245 if (!yTex || !uTex || !vTex) { |
| 246 return nullptr; | 246 return nullptr; |
| 247 } | 247 } |
| 248 | 248 |
| 249 const int width = yuvSizes[0].fWidth; | 249 const int width = yuvSizes[0].fWidth; |
| 250 const int height = yuvSizes[0].fHeight; | 250 const int height = yuvSizes[0].fHeight; |
| 251 | 251 |
| 252 // Needs to be a render target in order to draw to it for the yuv->rgb conve
rsion. | 252 // Needs to be a render target in order to draw to it for the yuv->rgb conve
rsion. |
| 253 sk_sp<GrDrawContext> drawContext(ctx->newDrawContext(SkBackingFit::kExact, | 253 sk_sp<GrDrawContext> drawContext(ctx->makeDrawContext(SkBackingFit::kExact, |
| 254 width, height, | 254 width, height, |
| 255 kRGBA_8888_GrPixelConfi
g, | 255 kRGBA_8888_GrPixelConf
ig, |
| 256 std::move(imageColorSpa
ce), | 256 std::move(imageColorSp
ace), |
| 257 0, | 257 0, |
| 258 origin)); | 258 origin)); |
| 259 if (!drawContext) { | 259 if (!drawContext) { |
| 260 return nullptr; | 260 return nullptr; |
| 261 } | 261 } |
| 262 | 262 |
| 263 GrPaint paint; | 263 GrPaint paint; |
| 264 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 264 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
| 265 paint.addColorFragmentProcessor( | 265 paint.addColorFragmentProcessor( |
| 266 GrYUVEffect::MakeYUVToRGB(yTex.get(), uTex.get(), vTex.get(), yuvSizes,
colorSpace, nv12)); | 266 GrYUVEffect::MakeYUVToRGB(yTex.get(), uTex.get(), vTex.get(), yuvSizes,
colorSpace, nv12)); |
| 267 | 267 |
| 268 const SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(heigh
t)); | 268 const SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(heigh
t)); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 return nullptr; | 546 return nullptr; |
| 547 } | 547 } |
| 548 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
ipLevelCount)); | 548 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m
ipLevelCount)); |
| 549 if (!texture) { | 549 if (!texture) { |
| 550 return nullptr; | 550 return nullptr; |
| 551 } | 551 } |
| 552 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew
ImageUniqueID, | 552 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew
ImageUniqueID, |
| 553 info.alphaType(), texture, sk_ref_sp(info.col
orSpace()), | 553 info.alphaType(), texture, sk_ref_sp(info.col
orSpace()), |
| 554 budgeted); | 554 budgeted); |
| 555 } | 555 } |
| OLD | NEW |