OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 "SkGr.h" | 8 #include "SkGr.h" |
9 #include "SkColorFilter.h" | 9 #include "SkColorFilter.h" |
10 #include "SkConfig8888.h" | 10 #include "SkConfig8888.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } else { | 213 } else { |
214 return NULL; | 214 return NULL; |
215 } | 215 } |
216 | 216 |
217 return sk_gr_allocate_texture(ctx, cache, params, bm, desc, bytes, 0); | 217 return sk_gr_allocate_texture(ctx, cache, params, bm, desc, bytes, 0); |
218 } | 218 } |
219 #endif // SK_IGNORE_ETC1_SUPPORT | 219 #endif // SK_IGNORE_ETC1_SUPPORT |
220 | 220 |
221 static GrTexture *load_yuv_texture(GrContext* ctx, bool cache, const GrTexturePa
rams* params, | 221 static GrTexture *load_yuv_texture(GrContext* ctx, bool cache, const GrTexturePa
rams* params, |
222 const SkBitmap& bm, const GrTextureDesc& desc
) { | 222 const SkBitmap& bm, const GrTextureDesc& desc
) { |
| 223 // Subsets are not supported, the whole pixelRef is loaded when using YUV de
coding |
| 224 if ((bm.pixelRef()->info().width() != bm.info().width()) || |
| 225 (bm.pixelRef()->info().height() != bm.info().height())) { |
| 226 return NULL; |
| 227 } |
| 228 |
223 SkPixelRef* pixelRef = bm.pixelRef(); | 229 SkPixelRef* pixelRef = bm.pixelRef(); |
224 SkISize yuvSizes[3]; | 230 SkISize yuvSizes[3]; |
225 if ((NULL == pixelRef) || !pixelRef->getYUV8Planes(yuvSizes, NULL, NULL, NUL
L)) { | 231 if ((NULL == pixelRef) || !pixelRef->getYUV8Planes(yuvSizes, NULL, NULL, NUL
L)) { |
226 return NULL; | 232 return NULL; |
227 } | 233 } |
228 | 234 |
229 // Allocate the memory for YUV | 235 // Allocate the memory for YUV |
230 size_t totalSize(0); | 236 size_t totalSize(0); |
231 size_t sizes[3], rowBytes[3]; | 237 size_t sizes[3], rowBytes[3]; |
232 for (int i = 0; i < 3; ++i) { | 238 for (int i = 0; i < 3; ++i) { |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 if (shader->asFragmentProcessor(context, skPaint, NULL, &paintColor, &fp
) && fp) { | 575 if (shader->asFragmentProcessor(context, skPaint, NULL, &paintColor, &fp
) && fp) { |
570 grPaint->addColorProcessor(fp)->unref(); | 576 grPaint->addColorProcessor(fp)->unref(); |
571 constantColor = false; | 577 constantColor = false; |
572 } | 578 } |
573 } | 579 } |
574 | 580 |
575 // The grcolor is automatically set when calling asFragmentProcessor. | 581 // The grcolor is automatically set when calling asFragmentProcessor. |
576 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. | 582 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. |
577 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); | 583 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); |
578 } | 584 } |
OLD | NEW |