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" |
11 #include "effects/GrTextureDomainEffect.h" | 11 #include "effects/GrTextureDomain.h" |
12 #include "effects/GrSimpleTextureEffect.h" | 12 #include "effects/GrSimpleTextureEffect.h" |
13 | 13 |
14 #include "GrContext.h" | 14 #include "GrContext.h" |
15 #include "GrBitmapTextContext.h" | 15 #include "GrBitmapTextContext.h" |
16 #if SK_DISTANCEFIELD_FONTS | 16 #if SK_DISTANCEFIELD_FONTS |
17 #include "GrDistanceFieldTextContext.h" | 17 #include "GrDistanceFieldTextContext.h" |
18 #endif | 18 #endif |
19 | 19 |
20 #include "SkGrTexturePixelRef.h" | 20 #include "SkGrTexturePixelRef.h" |
21 | 21 |
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 SkScalar border = SK_ScalarHalf / texture->height(); | 1413 SkScalar border = SK_ScalarHalf / texture->height(); |
1414 top = paintRect.top() + border; | 1414 top = paintRect.top() + border; |
1415 bottom = paintRect.bottom() - border; | 1415 bottom = paintRect.bottom() - border; |
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 GrTextureDomainEffect::kClamp
_WrapMode, | 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 effect.reset(GrBicubicEffect::Create(texture, SkMatrix::I(), params)); |
1427 } else { | 1427 } else { |
1428 effect.reset(GrSimpleTextureEffect::Create(texture, SkMatrix::I(), param
s)); | 1428 effect.reset(GrSimpleTextureEffect::Create(texture, SkMatrix::I(), param
s)); |
1429 } | 1429 } |
1430 | 1430 |
1431 // Construct a GrPaint by setting the bitmap texture as the first effect and
then configuring | 1431 // Construct a GrPaint by setting the bitmap texture as the first effect and
then configuring |
1432 // the rest from the SkPaint. | 1432 // the rest from the SkPaint. |
1433 GrPaint grPaint; | 1433 GrPaint grPaint; |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1895 GrTexture* texture, | 1895 GrTexture* texture, |
1896 bool needClear) | 1896 bool needClear) |
1897 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1897 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
1898 | 1898 |
1899 SkASSERT(texture && texture->asRenderTarget()); | 1899 SkASSERT(texture && texture->asRenderTarget()); |
1900 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1900 // 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. | 1901 // cache. We pass true for the third argument so that it will get unlocked. |
1902 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1902 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
1903 fNeedClear = needClear; | 1903 fNeedClear = needClear; |
1904 } | 1904 } |
OLD | NEW |