| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // This texture is likely to be used again so leave it in the cache | 246 // This texture is likely to be used again so leave it in the cache |
| 247 GrCacheID cacheID; | 247 GrCacheID cacheID; |
| 248 generate_bitmap_cache_id(bm, &cacheID); | 248 generate_bitmap_cache_id(bm, &cacheID); |
| 249 | 249 |
| 250 GrResourceKey key; | 250 GrResourceKey key; |
| 251 result = ctx->createTexture(params, rtDesc, cacheID, NULL, 0, &key); | 251 result = ctx->createTexture(params, rtDesc, cacheID, NULL, 0, &key); |
| 252 GrRenderTarget* renderTarget = result ? result->asRenderTarget() : NULL; | 252 GrRenderTarget* renderTarget = result ? result->asRenderTarget() : NULL; |
| 253 if (NULL != renderTarget) { | 253 if (NULL != renderTarget) { |
| 254 add_genID_listener(key, bm.pixelRef()); | 254 add_genID_listener(key, bm.pixelRef()); |
| 255 SkAutoTUnref<GrEffect> yuvToRgbEffect(GrYUVtoRGBEffect::Create( | 255 SkAutoTUnref<GrEffect> yuvToRgbEffect(GrYUVtoRGBEffect::Create( |
| 256 yuvTextures[0].texture(), yuvTextures[1].texture(), yuvTextures[2].t
exture())); | 256 yuvTextures[0].texture(), yuvTextures[1].texture(), yuvTextures[2].t
exture(), |
| 257 GrYUVtoRGBEffect::kJPEG)); |
| 257 GrPaint paint; | 258 GrPaint paint; |
| 258 paint.addColorEffect(yuvToRgbEffect); | 259 paint.addColorEffect(yuvToRgbEffect); |
| 259 SkRect r = SkRect::MakeWH(SkIntToScalar(yuvSizes[0].fWidth), | 260 SkRect r = SkRect::MakeWH(SkIntToScalar(yuvSizes[0].fWidth), |
| 260 SkIntToScalar(yuvSizes[0].fHeight)); | 261 SkIntToScalar(yuvSizes[0].fHeight)); |
| 261 GrContext::AutoRenderTarget autoRT(ctx, renderTarget); | 262 GrContext::AutoRenderTarget autoRT(ctx, renderTarget); |
| 262 GrContext::AutoMatrix am; | 263 GrContext::AutoMatrix am; |
| 263 am.setIdentity(ctx); | 264 am.setIdentity(ctx); |
| 264 GrContext::AutoClip ac(ctx, GrContext::AutoClip::kWideOpen_InitialClip); | 265 GrContext::AutoClip ac(ctx, GrContext::AutoClip::kWideOpen_InitialClip); |
| 265 ctx->drawRect(paint, r); | 266 ctx->drawRect(paint, r); |
| 266 } else { | 267 } else { |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 if (shader->asNewEffect(context, skPaint, NULL, &paintColor, &effect) &&
NULL != effect) { | 599 if (shader->asNewEffect(context, skPaint, NULL, &paintColor, &effect) &&
NULL != effect) { |
| 599 grPaint->addColorEffect(effect)->unref(); | 600 grPaint->addColorEffect(effect)->unref(); |
| 600 constantColor = false; | 601 constantColor = false; |
| 601 } | 602 } |
| 602 } | 603 } |
| 603 | 604 |
| 604 // The grcolor is automatically set when calling asneweffect. | 605 // The grcolor is automatically set when calling asneweffect. |
| 605 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. | 606 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. |
| 606 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); | 607 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); |
| 607 } | 608 } |
| OLD | NEW |