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 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 SkShader::TileMode tileModes[2] = { params.getTileModeX(), params.getTil
eModeY() }; | 1369 SkShader::TileMode tileModes[2] = { params.getTileModeX(), params.getTil
eModeY() }; |
1370 effect.reset(GrBicubicEffect::Create(texture, SkMatrix::I(), tileModes))
; | 1370 effect.reset(GrBicubicEffect::Create(texture, SkMatrix::I(), tileModes))
; |
1371 } else { | 1371 } else { |
1372 effect.reset(GrSimpleTextureEffect::Create(texture, SkMatrix::I(), param
s)); | 1372 effect.reset(GrSimpleTextureEffect::Create(texture, SkMatrix::I(), param
s)); |
1373 } | 1373 } |
1374 | 1374 |
1375 // Construct a GrPaint by setting the bitmap texture as the first effect and
then configuring | 1375 // Construct a GrPaint by setting the bitmap texture as the first effect and
then configuring |
1376 // the rest from the SkPaint. | 1376 // the rest from the SkPaint. |
1377 GrPaint grPaint; | 1377 GrPaint grPaint; |
1378 grPaint.addColorEffect(effect); | 1378 grPaint.addColorEffect(effect); |
1379 bool alphaOnly = !(SkBitmap::kA8_Config == bitmap.config()); | 1379 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType()); |
1380 GrColor grColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor()) : | 1380 GrColor grColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor()) : |
1381 SkColor2GrColor(paint.getColor()); | 1381 SkColor2GrColor(paint.getColor()); |
1382 SkPaint2GrPaintNoShader(this->context(), paint, grColor, false, &grPaint); | 1382 SkPaint2GrPaintNoShader(this->context(), paint, grColor, false, &grPaint); |
1383 | 1383 |
1384 fContext->drawRectToRect(grPaint, dstRect, paintRect, NULL); | 1384 fContext->drawRectToRect(grPaint, dstRect, paintRect, NULL); |
1385 } | 1385 } |
1386 | 1386 |
1387 static bool filter_texture(SkBaseDevice* device, GrContext* context, | 1387 static bool filter_texture(SkBaseDevice* device, GrContext* context, |
1388 GrTexture* texture, const SkImageFilter* filter, | 1388 GrTexture* texture, const SkImageFilter* filter, |
1389 int w, int h, const SkImageFilter::Context& ctx, | 1389 int w, int h, const SkImageFilter::Context& ctx, |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
ure, i); | 2002 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
ure, i); |
2003 | 2003 |
2004 if (NULL != layer->getTexture()) { | 2004 if (NULL != layer->getTexture()) { |
2005 fContext->unlockScratchTexture(layer->getTexture()); | 2005 fContext->unlockScratchTexture(layer->getTexture()); |
2006 layer->setTexture(NULL); | 2006 layer->setTexture(NULL); |
2007 } | 2007 } |
2008 } | 2008 } |
2009 | 2009 |
2010 return true; | 2010 return true; |
2011 } | 2011 } |
OLD | NEW |