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 | 9 |
10 #include "GrDrawTargetCaps.h" | 10 #include "GrDrawTargetCaps.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 GrSurfaceDesc rtDesc = desc; | 270 GrSurfaceDesc rtDesc = desc; |
271 rtDesc.fFlags = rtDesc.fFlags | | 271 rtDesc.fFlags = rtDesc.fFlags | |
272 kRenderTarget_GrSurfaceFlag | | 272 kRenderTarget_GrSurfaceFlag | |
273 kNoStencil_GrSurfaceFlag; | 273 kNoStencil_GrSurfaceFlag; |
274 | 274 |
275 GrTexture* result = sk_gr_allocate_texture(ctx, cache, params, bm, rtDesc, N
ULL, 0); | 275 GrTexture* result = sk_gr_allocate_texture(ctx, cache, params, bm, rtDesc, N
ULL, 0); |
276 | 276 |
277 GrRenderTarget* renderTarget = result ? result->asRenderTarget() : NULL; | 277 GrRenderTarget* renderTarget = result ? result->asRenderTarget() : NULL; |
278 if (renderTarget) { | 278 if (renderTarget) { |
279 SkAutoTUnref<GrFragmentProcessor> yuvToRgbProcessor( | 279 SkAutoTUnref<GrFragmentProcessor> yuvToRgbProcessor( |
280 GrYUVtoRGBEffect::Create(yuvTextures[0], yuvTextures[1], yuvTextures
[2], colorSpace)); | 280 GrYUVtoRGBEffect::Create(yuvTextures[0], yuvTextures[1], yuvTextures
[2], |
| 281 yuvSizes, colorSpace)); |
281 GrPaint paint; | 282 GrPaint paint; |
282 paint.addColorProcessor(yuvToRgbProcessor); | 283 paint.addColorProcessor(yuvToRgbProcessor); |
283 SkRect r = SkRect::MakeWH(SkIntToScalar(yuvSizes[0].fWidth), | 284 SkRect r = SkRect::MakeWH(SkIntToScalar(yuvSizes[0].fWidth), |
284 SkIntToScalar(yuvSizes[0].fHeight)); | 285 SkIntToScalar(yuvSizes[0].fHeight)); |
285 GrContext::AutoRenderTarget autoRT(ctx, renderTarget); | 286 GrContext::AutoRenderTarget autoRT(ctx, renderTarget); |
286 GrContext::AutoClip ac(ctx, GrContext::AutoClip::kWideOpen_InitialClip); | 287 GrContext::AutoClip ac(ctx, GrContext::AutoClip::kWideOpen_InitialClip); |
287 ctx->drawRect(paint, SkMatrix::I(), r); | 288 ctx->drawRect(paint, SkMatrix::I(), r); |
288 } else { | 289 } else { |
289 SkSafeSetNull(result); | 290 SkSafeSetNull(result); |
290 } | 291 } |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol
or, &fp) && fp) { | 582 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol
or, &fp) && fp) { |
582 grPaint->addColorProcessor(fp)->unref(); | 583 grPaint->addColorProcessor(fp)->unref(); |
583 constantColor = false; | 584 constantColor = false; |
584 } | 585 } |
585 } | 586 } |
586 | 587 |
587 // The grcolor is automatically set when calling asFragmentProcessor. | 588 // The grcolor is automatically set when calling asFragmentProcessor. |
588 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. | 589 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. |
589 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); | 590 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); |
590 } | 591 } |
OLD | NEW |