| 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/GrTextureDomainEffect.h" | 10 #include "effects/GrTextureDomainEffect.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 // same meaning as in skPaint2GrPaintNoShader. | 528 // same meaning as in skPaint2GrPaintNoShader. |
| 529 inline bool skPaint2GrPaintShader(SkGpuDevice* dev, | 529 inline bool skPaint2GrPaintShader(SkGpuDevice* dev, |
| 530 const SkPaint& skPaint, | 530 const SkPaint& skPaint, |
| 531 bool constantColor, | 531 bool constantColor, |
| 532 GrPaint* grPaint) { | 532 GrPaint* grPaint) { |
| 533 SkShader* shader = skPaint.getShader(); | 533 SkShader* shader = skPaint.getShader(); |
| 534 if (NULL == shader) { | 534 if (NULL == shader) { |
| 535 return skPaint2GrPaintNoShader(dev, skPaint, false, constantColor, grPai
nt); | 535 return skPaint2GrPaintNoShader(dev, skPaint, false, constantColor, grPai
nt); |
| 536 } | 536 } |
| 537 | 537 |
| 538 // SkShader::asNewEffect() may do offscreen rendering. Setup default drawing
state |
| 539 // Also require shader to set the render target . |
| 540 GrContext::AutoWideOpenIdentityDraw awo(dev->context(), NULL); |
| 541 GrContext::AutoRenderTarget(dev->context(), NULL); |
| 542 |
| 538 // setup the shader as the first color effect on the paint | 543 // setup the shader as the first color effect on the paint |
| 539 SkAutoTUnref<GrEffectRef> effect(shader->asNewEffect(dev->context(), skPaint
)); | 544 SkAutoTUnref<GrEffectRef> effect(shader->asNewEffect(dev->context(), skPaint
)); |
| 540 if (NULL != effect.get()) { | 545 if (NULL != effect.get()) { |
| 541 grPaint->addColorEffect(effect); | 546 grPaint->addColorEffect(effect); |
| 542 // Now setup the rest of the paint. | 547 // Now setup the rest of the paint. |
| 543 return skPaint2GrPaintNoShader(dev, skPaint, true, false, grPaint); | 548 return skPaint2GrPaintNoShader(dev, skPaint, true, false, grPaint); |
| 544 } else { | 549 } else { |
| 545 // We still don't have SkColorShader::asNewEffect() implemented. | 550 // We still don't have SkColorShader::asNewEffect() implemented. |
| 546 SkShader::GradientInfo info; | 551 SkShader::GradientInfo info; |
| 547 SkColor color; | 552 SkColor color; |
| (...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1859 GrTexture* texture, | 1864 GrTexture* texture, |
| 1860 bool needClear) | 1865 bool needClear) |
| 1861 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1866 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
| 1862 | 1867 |
| 1863 SkASSERT(texture && texture->asRenderTarget()); | 1868 SkASSERT(texture && texture->asRenderTarget()); |
| 1864 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1869 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
| 1865 // cache. We pass true for the third argument so that it will get unlocked. | 1870 // cache. We pass true for the third argument so that it will get unlocked. |
| 1866 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1871 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
| 1867 fNeedClear = needClear; | 1872 fNeedClear = needClear; |
| 1868 } | 1873 } |
| OLD | NEW |