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 "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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 GrSurfaceDesc dstDesc; | 218 GrSurfaceDesc dstDesc; |
219 // Needs to be a render target in order to draw to it for the yuv->rgb conve
rsion. | 219 // Needs to be a render target in order to draw to it for the yuv->rgb conve
rsion. |
220 dstDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 220 dstDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
221 dstDesc.fOrigin = origin; | 221 dstDesc.fOrigin = origin; |
222 dstDesc.fWidth = yuvSizes[0].fWidth; | 222 dstDesc.fWidth = yuvSizes[0].fWidth; |
223 dstDesc.fHeight = yuvSizes[0].fHeight; | 223 dstDesc.fHeight = yuvSizes[0].fHeight; |
224 dstDesc.fConfig = kRGBA_8888_GrPixelConfig; | 224 dstDesc.fConfig = kRGBA_8888_GrPixelConfig; |
225 dstDesc.fSampleCnt = 0; | 225 dstDesc.fSampleCnt = 0; |
226 | 226 |
227 SkAutoTUnref<GrTexture> dst(ctx->textureProvider()->refScratchTexture( | 227 SkAutoTUnref<GrTexture> dst(ctx->textureProvider()->createTexture(dstDesc, t
rue)); |
228 dstDesc, GrTextureProvider::kExact_ScratchTexMatch)); | |
229 if (!dst) { | 228 if (!dst) { |
230 return NULL; | 229 return NULL; |
231 } | 230 } |
232 | 231 |
233 GrPaint paint; | 232 GrPaint paint; |
234 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 233 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
235 paint.addColorProcessor(GrYUVtoRGBEffect::Create(paint.getProcessorDataManag
er(), yTex, uTex, | 234 paint.addColorProcessor(GrYUVtoRGBEffect::Create(paint.getProcessorDataManag
er(), yTex, uTex, |
236 vTex, yuvSizes, colorSpace)
)->unref(); | 235 vTex, yuvSizes, colorSpace)
)->unref(); |
237 | 236 |
238 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth), | 237 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth), |
(...skipping 15 matching lines...) Expand all Loading... |
254 if (!dst) { | 253 if (!dst) { |
255 return NULL; | 254 return NULL; |
256 } | 255 } |
257 | 256 |
258 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); | 257 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); |
259 const SkIPoint dstP = SkIPoint::Make(0, 0); | 258 const SkIPoint dstP = SkIPoint::Make(0, 0); |
260 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); | 259 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); |
261 return dst; | 260 return dst; |
262 } | 261 } |
263 | 262 |
OLD | NEW |