| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "GrTextureToYUVPlanes.h" | 8 #include "GrTextureToYUVPlanes.h" |
| 9 #include "effects/GrSimpleTextureEffect.h" | 9 #include "effects/GrSimpleTextureEffect.h" |
| 10 #include "effects/GrYUVEffect.h" | 10 #include "effects/GrYUVEffect.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 if (!fp) { | 36 if (!fp) { |
| 37 return false; | 37 return false; |
| 38 } | 38 } |
| 39 fp.reset(proc(fp, colorSpace)); | 39 fp.reset(proc(fp, colorSpace)); |
| 40 if (!fp) { | 40 if (!fp) { |
| 41 return false; | 41 return false; |
| 42 } | 42 } |
| 43 GrPaint paint; | 43 GrPaint paint; |
| 44 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 44 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
| 45 paint.addColorFragmentProcessor(fp); | 45 paint.addColorFragmentProcessor(fp); |
| 46 dst->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), SkRect::MakeIWH(dstW
, dstH)); | 46 dst->drawRect(GrNoClip(), paint, SkMatrix::I(), SkRect::MakeIWH(dstW, dstH))
; |
| 47 return true; | 47 return true; |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
t planes[3], | 50 bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
t planes[3], |
| 51 const size_t rowBytes[3], SkYUVColorSpace colorSpace)
{ | 51 const size_t rowBytes[3], SkYUVColorSpace colorSpace)
{ |
| 52 if (GrContext* context = texture->getContext()) { | 52 if (GrContext* context = texture->getContext()) { |
| 53 // Depending on the relative sizes of the y, u, and v planes we may do 1
to 3 draws/ | 53 // Depending on the relative sizes of the y, u, and v planes we may do 1
to 3 draws/ |
| 54 // readbacks. | 54 // readbacks. |
| 55 sk_sp<GrDrawContext> yuvDrawContext; | 55 sk_sp<GrDrawContext> yuvDrawContext; |
| 56 sk_sp<GrDrawContext> yDrawContext; | 56 sk_sp<GrDrawContext> yDrawContext; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 if (!tex->readPixels(0, 0, sizes[2].fWidth, sizes[2].fHeight, | 221 if (!tex->readPixels(0, 0, sizes[2].fWidth, sizes[2].fHeight, |
| 222 kAlpha_8_GrPixelConfig, planes[2], rowBytes
[2])) { | 222 kAlpha_8_GrPixelConfig, planes[2], rowBytes
[2])) { |
| 223 return false; | 223 return false; |
| 224 } | 224 } |
| 225 return true; | 225 return true; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 return false; | 229 return false; |
| 230 } | 230 } |
| OLD | NEW |