| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 | 568 |
| 569 // SkShader::asNewEffect() may do offscreen rendering. Setup default drawing
state and require | 569 // SkShader::asNewEffect() may do offscreen rendering. Setup default drawing
state and require |
| 570 // the shader to set a render target . | 570 // the shader to set a render target . |
| 571 GrContext::AutoWideOpenIdentityDraw awo(dev->context(), NULL); | 571 GrContext::AutoWideOpenIdentityDraw awo(dev->context(), NULL); |
| 572 | 572 |
| 573 // setup the shader as the first color effect on the paint | 573 // setup the shader as the first color effect on the paint |
| 574 SkAutoTUnref<GrEffectRef> effect(shader->asNewEffect(dev->context(), skPaint
)); | 574 SkAutoTUnref<GrEffectRef> effect(shader->asNewEffect(dev->context(), skPaint
)); |
| 575 if (NULL != effect.get()) { | 575 if (NULL != effect.get()) { |
| 576 grPaint->addColorEffect(effect); | 576 grPaint->addColorEffect(effect); |
| 577 // Now setup the rest of the paint. | 577 // Now setup the rest of the paint. |
| 578 // If the shader's bitmap is kA8_Config, the paint's RGB is used, and |
| 579 // modulated by the shader's alpha. Otherwise, the shader's RGB is used, |
| 580 // modulated by the paint's alpha. |
| 581 SkBitmap* bitmap = shader->getBitmap(); |
| 582 if (NULL != bitmap && SkBitmap::kA8_Config == bitmap->config()) { |
| 583 return skPaint2GrPaintNoShader(dev, skPaint, false, true, grPaint); |
| 584 } |
| 578 return skPaint2GrPaintNoShader(dev, skPaint, true, false, grPaint); | 585 return skPaint2GrPaintNoShader(dev, skPaint, true, false, grPaint); |
| 579 } else { | 586 } else { |
| 580 // We still don't have SkColorShader::asNewEffect() implemented. | 587 // We still don't have SkColorShader::asNewEffect() implemented. |
| 581 SkShader::GradientInfo info; | 588 SkShader::GradientInfo info; |
| 582 SkColor color; | 589 SkColor color; |
| 583 | 590 |
| 584 info.fColors = &color; | 591 info.fColors = &color; |
| 585 info.fColorOffsets = NULL; | 592 info.fColorOffsets = NULL; |
| 586 info.fColorCount = 1; | 593 info.fColorCount = 1; |
| 587 if (SkShader::kColor_GradientType == shader->asAGradient(&info)) { | 594 if (SkShader::kColor_GradientType == shader->asAGradient(&info)) { |
| (...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1992 GrTexture* texture, | 1999 GrTexture* texture, |
| 1993 bool needClear) | 2000 bool needClear) |
| 1994 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 2001 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
| 1995 | 2002 |
| 1996 SkASSERT(texture && texture->asRenderTarget()); | 2003 SkASSERT(texture && texture->asRenderTarget()); |
| 1997 // This constructor is called from onCreateDevice. It has locked the RT in t
he texture | 2004 // This constructor is called from onCreateDevice. It has locked the RT in t
he texture |
| 1998 // cache. We pass true for the third argument so that it will get unlocked. | 2005 // cache. We pass true for the third argument so that it will get unlocked. |
| 1999 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 2006 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
| 2000 fNeedClear = needClear; | 2007 fNeedClear = needClear; |
| 2001 } | 2008 } |
| OLD | NEW |