| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrContext.h" | 8 #include "GrContext.h" |
| 9 #include "GrDrawContext.h" | 9 #include "GrDrawContext.h" |
| 10 #include "GrYUVProvider.h" | 10 #include "GrYUVProvider.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 SkAutoTUnref<GrTexture> result(ctx->textureProvider()->createTexture(rtDesc,
true, nullptr, 0)); | 115 SkAutoTUnref<GrTexture> result(ctx->textureProvider()->createTexture(rtDesc,
true, nullptr, 0)); |
| 116 if (!result) { | 116 if (!result) { |
| 117 return nullptr; | 117 return nullptr; |
| 118 } | 118 } |
| 119 | 119 |
| 120 GrRenderTarget* renderTarget = result->asRenderTarget(); | 120 GrRenderTarget* renderTarget = result->asRenderTarget(); |
| 121 SkASSERT(renderTarget); | 121 SkASSERT(renderTarget); |
| 122 | 122 |
| 123 GrPaint paint; | 123 GrPaint paint; |
| 124 SkAutoTUnref<GrFragmentProcessor> yuvToRgbProcessor( | 124 SkAutoTUnref<GrFragmentProcessor> yuvToRgbProcessor( |
| 125 GrYUVtoRGBEffect::Create(paint.getProces
sorDataManager(), | 125 GrYUVtoRGBEffect::Create(yuvTextures[0], |
| 126 yuvTextures[0], | |
| 127 yuvTextures[1], | 126 yuvTextures[1], |
| 128 yuvTextures[2], | 127 yuvTextures[2], |
| 129 yuvInfo.fSize, | 128 yuvInfo.fSize, |
| 130 yuvInfo.fColorS
pace)); | 129 yuvInfo.fColorS
pace)); |
| 131 paint.addColorFragmentProcessor(yuvToRgbProcessor); | 130 paint.addColorFragmentProcessor(yuvToRgbProcessor); |
| 132 const SkRect r = SkRect::MakeIWH(yuvInfo.fSize[0].fWidth, yuvInfo.fSize[0].f
Height); | 131 const SkRect r = SkRect::MakeIWH(yuvInfo.fSize[0].fWidth, yuvInfo.fSize[0].f
Height); |
| 133 | 132 |
| 134 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext()); | 133 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext()); |
| 135 if (!drawContext) { | 134 if (!drawContext) { |
| 136 return nullptr; | 135 return nullptr; |
| 137 } | 136 } |
| 138 | 137 |
| 139 drawContext->drawRect(renderTarget, GrClip::WideOpen(), paint, SkMatrix::I()
, r); | 138 drawContext->drawRect(renderTarget, GrClip::WideOpen(), paint, SkMatrix::I()
, r); |
| 140 | 139 |
| 141 return result.detach(); | 140 return result.detach(); |
| 142 } | 141 } |
| 143 | 142 |
| OLD | NEW |