| 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 "GrCaps.h" | 8 #include "GrCaps.h" |
| 9 #include "GrContext.h" | 9 #include "GrContext.h" |
| 10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
| 11 #include "GrImageIDTextureAdjuster.h" | 11 #include "GrImageIDTextureAdjuster.h" |
| 12 #include "effects/GrYUVtoRGBEffect.h" | 12 #include "effects/GrYUVEffect.h" |
| 13 #include "SkCanvas.h" | 13 #include "SkCanvas.h" |
| 14 #include "SkBitmapCache.h" | 14 #include "SkBitmapCache.h" |
| 15 #include "SkGpuDevice.h" | 15 #include "SkGpuDevice.h" |
| 16 #include "SkGrPixelRef.h" | 16 #include "SkGrPixelRef.h" |
| 17 #include "SkGrPriv.h" | 17 #include "SkGrPriv.h" |
| 18 #include "SkImageFilter.h" | 18 #include "SkImageFilter.h" |
| 19 #include "SkImage_Gpu.h" | 19 #include "SkImage_Gpu.h" |
| 20 #include "SkPixelRef.h" | 20 #include "SkPixelRef.h" |
| 21 | 21 |
| 22 SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, GrText
ure* tex, | 22 SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, GrText
ure* tex, |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 dstDesc.fConfig = kRGBA_8888_GrPixelConfig; | 259 dstDesc.fConfig = kRGBA_8888_GrPixelConfig; |
| 260 dstDesc.fSampleCnt = 0; | 260 dstDesc.fSampleCnt = 0; |
| 261 | 261 |
| 262 SkAutoTUnref<GrTexture> dst(ctx->textureProvider()->createTexture(dstDesc, t
rue)); | 262 SkAutoTUnref<GrTexture> dst(ctx->textureProvider()->createTexture(dstDesc, t
rue)); |
| 263 if (!dst) { | 263 if (!dst) { |
| 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(GrYUVtoRGBEffect::Create(yTex, uTex, vTex, y
uvSizes, | 269 paint.addColorFragmentProcessor(GrYUVEffect::CreateYUVToRGB(yTex, uTex, vTex
, yuvSizes, |
| 270 colorSpace))->unref
(); | 270 colorSpace))->un
ref(); |
| 271 | 271 |
| 272 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth), | 272 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth), |
| 273 SkIntToScalar(dstDesc.fHeight)); | 273 SkIntToScalar(dstDesc.fHeight)); |
| 274 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext(dst->asRenderTarget
())); | 274 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext(dst->asRenderTarget
())); |
| 275 if (!drawContext) { | 275 if (!drawContext) { |
| 276 return nullptr; | 276 return nullptr; |
| 277 } | 277 } |
| 278 | 278 |
| 279 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect); | 279 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect); |
| 280 ctx->flushSurfaceWrites(dst); | 280 ctx->flushSurfaceWrites(dst); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 if (!dst) { | 323 if (!dst) { |
| 324 return nullptr; | 324 return nullptr; |
| 325 } | 325 } |
| 326 | 326 |
| 327 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); | 327 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); |
| 328 const SkIPoint dstP = SkIPoint::Make(0, 0); | 328 const SkIPoint dstP = SkIPoint::Make(0, 0); |
| 329 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); | 329 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); |
| 330 return dst; | 330 return dst; |
| 331 } | 331 } |
| 332 | 332 |
| OLD | NEW |