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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 } | 247 } |
248 | 248 |
249 GrTextureDesc yuvDesc; | 249 GrTextureDesc yuvDesc; |
250 yuvDesc.fConfig = kAlpha_8_GrPixelConfig; | 250 yuvDesc.fConfig = kAlpha_8_GrPixelConfig; |
251 GrAutoScratchTexture yuvTextures[3]; | 251 GrAutoScratchTexture yuvTextures[3]; |
252 for (int i = 0; i < 3; ++i) { | 252 for (int i = 0; i < 3; ++i) { |
253 yuvDesc.fWidth = yuvSizes[i].fWidth; | 253 yuvDesc.fWidth = yuvSizes[i].fWidth; |
254 yuvDesc.fHeight = yuvSizes[i].fHeight; | 254 yuvDesc.fHeight = yuvSizes[i].fHeight; |
255 yuvTextures[i].set(ctx, yuvDesc); | 255 yuvTextures[i].set(ctx, yuvDesc); |
256 if ((NULL == yuvTextures[i].texture()) || | 256 if ((NULL == yuvTextures[i].texture()) || |
257 !ctx->writeTexturePixels(yuvTextures[i].texture(), | 257 !yuvTextures[i].texture()->writePixels(0, 0, yuvDesc.fWidth, yuvDesc
.fHeight, |
258 0, 0, yuvDesc.fWidth, yuvDesc.fHeight, | 258 yuvDesc.fConfig, planes[i], r
owBytes[i])) { |
259 yuvDesc.fConfig, planes[i], rowBytes[i])) { | |
260 return NULL; | 259 return NULL; |
261 } | 260 } |
262 } | 261 } |
263 | 262 |
264 GrTextureDesc rtDesc = desc; | 263 GrTextureDesc rtDesc = desc; |
265 rtDesc.fFlags = rtDesc.fFlags | | 264 rtDesc.fFlags = rtDesc.fFlags | |
266 kRenderTarget_GrTextureFlagBit | | 265 kRenderTarget_GrTextureFlagBit | |
267 kNoStencil_GrTextureFlagBit; | 266 kNoStencil_GrTextureFlagBit; |
268 | 267 |
269 GrTexture* result = sk_gr_allocate_texture(ctx, cache, params, bm, rtDesc, N
ULL, 0); | 268 GrTexture* result = sk_gr_allocate_texture(ctx, cache, params, bm, rtDesc, N
ULL, 0); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 if (shader->asFragmentProcessor(context, skPaint, NULL, &paintColor, &fp
) && fp) { | 569 if (shader->asFragmentProcessor(context, skPaint, NULL, &paintColor, &fp
) && fp) { |
571 grPaint->addColorProcessor(fp)->unref(); | 570 grPaint->addColorProcessor(fp)->unref(); |
572 constantColor = false; | 571 constantColor = false; |
573 } | 572 } |
574 } | 573 } |
575 | 574 |
576 // The grcolor is automatically set when calling asFragmentProcessor. | 575 // The grcolor is automatically set when calling asFragmentProcessor. |
577 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. | 576 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. |
578 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); | 577 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); |
579 } | 578 } |
OLD | NEW |