| 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 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 } else { | 1416 } else { |
| 1417 top = bottom = SkScalarHalf(paintRect.top() + paintRect.bottom()); | 1417 top = bottom = SkScalarHalf(paintRect.top() + paintRect.bottom()); |
| 1418 } | 1418 } |
| 1419 textureDomain.setLTRB(left, top, right, bottom); | 1419 textureDomain.setLTRB(left, top, right, bottom); |
| 1420 effect.reset(GrTextureDomainEffect::Create(texture, | 1420 effect.reset(GrTextureDomainEffect::Create(texture, |
| 1421 SkMatrix::I(), | 1421 SkMatrix::I(), |
| 1422 textureDomain, | 1422 textureDomain, |
| 1423 GrTextureDomain::kClamp_Mode, | 1423 GrTextureDomain::kClamp_Mode, |
| 1424 params.filterMode())); | 1424 params.filterMode())); |
| 1425 } else if (bicubic) { | 1425 } else if (bicubic) { |
| 1426 effect.reset(GrBicubicEffect::Create(texture, SkMatrix::I(), params)); | 1426 SkASSERT(GrTextureParams::kNone_FilterMode == params.filterMode()); |
| 1427 SkShader::TileMode tileModes[2] = { params.getTileModeX(), params.getTil
eModeY() }; |
| 1428 effect.reset(GrBicubicEffect::Create(texture, SkMatrix::I(), tileModes))
; |
| 1427 } else { | 1429 } else { |
| 1428 effect.reset(GrSimpleTextureEffect::Create(texture, SkMatrix::I(), param
s)); | 1430 effect.reset(GrSimpleTextureEffect::Create(texture, SkMatrix::I(), param
s)); |
| 1429 } | 1431 } |
| 1430 | 1432 |
| 1431 // Construct a GrPaint by setting the bitmap texture as the first effect and
then configuring | 1433 // Construct a GrPaint by setting the bitmap texture as the first effect and
then configuring |
| 1432 // the rest from the SkPaint. | 1434 // the rest from the SkPaint. |
| 1433 GrPaint grPaint; | 1435 GrPaint grPaint; |
| 1434 grPaint.addColorEffect(effect); | 1436 grPaint.addColorEffect(effect); |
| 1435 bool alphaOnly = !(SkBitmap::kA8_Config == bitmap.config()); | 1437 bool alphaOnly = !(SkBitmap::kA8_Config == bitmap.config()); |
| 1436 if (!skPaint2GrPaintNoShader(this, paint, alphaOnly, false, &grPaint)) { | 1438 if (!skPaint2GrPaintNoShader(this, paint, alphaOnly, false, &grPaint)) { |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 GrTexture* texture, | 1897 GrTexture* texture, |
| 1896 bool needClear) | 1898 bool needClear) |
| 1897 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1899 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
| 1898 | 1900 |
| 1899 SkASSERT(texture && texture->asRenderTarget()); | 1901 SkASSERT(texture && texture->asRenderTarget()); |
| 1900 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1902 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
| 1901 // cache. We pass true for the third argument so that it will get unlocked. | 1903 // cache. We pass true for the third argument so that it will get unlocked. |
| 1902 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1904 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
| 1903 fNeedClear = needClear; | 1905 fNeedClear = needClear; |
| 1904 } | 1906 } |
| OLD | NEW |