Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
| 9 | 9 |
| 10 #include "effects/GrBicubicEffect.h" | 10 #include "effects/GrBicubicEffect.h" |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 498 // same meaning as in skPaint2GrPaintNoShader. | 498 // same meaning as in skPaint2GrPaintNoShader. |
| 499 inline bool skPaint2GrPaintShader(SkGpuDevice* dev, | 499 inline bool skPaint2GrPaintShader(SkGpuDevice* dev, |
| 500 const SkPaint& skPaint, | 500 const SkPaint& skPaint, |
| 501 bool constantColor, | 501 bool constantColor, |
| 502 GrPaint* grPaint) { | 502 GrPaint* grPaint) { |
| 503 SkShader* shader = skPaint.getShader(); | 503 SkShader* shader = skPaint.getShader(); |
| 504 if (NULL == shader) { | 504 if (NULL == shader) { |
| 505 return skPaint2GrPaintNoShader(dev, skPaint, false, constantColor, grPai nt); | 505 return skPaint2GrPaintNoShader(dev, skPaint, false, constantColor, grPai nt); |
| 506 } | 506 } |
| 507 | 507 |
| 508 // SkShader::asNewEffect() may do offscreen rendering. Setup default drawing state | 508 // SkShader::asNewEffect() may do offscreen rendering. Setup default drawing state and require |
| 509 // Also require shader to set the render target . | 509 // the shader to set a render target . |
| 510 GrContext::AutoWideOpenIdentityDraw awo(dev->context(), NULL); | 510 GrContext::AutoWideOpenIdentityDraw awo(dev->context(), NULL); |
|
bsalomon
2014/01/13 14:47:10
this NULL param to awo() is the rt, so the art bel
| |
| 511 GrContext::AutoRenderTarget(dev->context(), NULL); | |
| 512 | 511 |
| 513 // setup the shader as the first color effect on the paint | 512 // setup the shader as the first color effect on the paint |
| 514 SkAutoTUnref<GrEffectRef> effect(shader->asNewEffect(dev->context(), skPaint )); | 513 SkAutoTUnref<GrEffectRef> effect(shader->asNewEffect(dev->context(), skPaint )); |
| 515 if (NULL != effect.get()) { | 514 if (NULL != effect.get()) { |
| 516 grPaint->addColorEffect(effect); | 515 grPaint->addColorEffect(effect); |
| 517 // Now setup the rest of the paint. | 516 // Now setup the rest of the paint. |
| 518 return skPaint2GrPaintNoShader(dev, skPaint, true, false, grPaint); | 517 return skPaint2GrPaintNoShader(dev, skPaint, true, false, grPaint); |
| 519 } else { | 518 } else { |
| 520 // We still don't have SkColorShader::asNewEffect() implemented. | 519 // We still don't have SkColorShader::asNewEffect() implemented. |
| 521 SkShader::GradientInfo info; | 520 SkShader::GradientInfo info; |
| (...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1921 GrTexture* texture, | 1920 GrTexture* texture, |
| 1922 bool needClear) | 1921 bool needClear) |
| 1923 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1922 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
| 1924 | 1923 |
| 1925 SkASSERT(texture && texture->asRenderTarget()); | 1924 SkASSERT(texture && texture->asRenderTarget()); |
| 1926 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture | 1925 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture |
| 1927 // cache. We pass true for the third argument so that it will get unlocked. | 1926 // cache. We pass true for the third argument so that it will get unlocked. |
| 1928 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1927 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
| 1929 fNeedClear = needClear; | 1928 fNeedClear = needClear; |
| 1930 } | 1929 } |
| OLD | NEW |