OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 | 8 |
9 | 9 |
10 #include "GrTextContext.h" | 10 #include "GrTextContext.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 GrTextureParams params(SkShader::kRepeat_TileMode, false); | 36 GrTextureParams params(SkShader::kRepeat_TileMode, false); |
37 | 37 |
38 // This effect could be stored with one of the cache objects (atlas?) | 38 // This effect could be stored with one of the cache objects (atlas?) |
39 drawState->addCoverageEffect( | 39 drawState->addCoverageEffect( |
40 GrSimpleTextureEffect::CreateWithCustomCoords(fC
urrTexture, params), | 40 GrSimpleTextureEffect::CreateWithCustomCoords(fC
urrTexture, params), |
41 kGlyphCoordsAttributeIndex)->unref(); | 41 kGlyphCoordsAttributeIndex)->unref(); |
42 | 42 |
43 if (!GrPixelConfigIsAlphaOnly(fCurrTexture->config())) { | 43 if (!GrPixelConfigIsAlphaOnly(fCurrTexture->config())) { |
44 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || | 44 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || |
45 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || | 45 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || |
46 fPaint.hasColorStage()) { | 46 fPaint.numColorStages()) { |
47 GrPrintf("LCD Text will not draw correctly.\n"); | 47 GrPrintf("LCD Text will not draw correctly.\n"); |
48 } | 48 } |
49 // setup blend so that we get mask * paintColor + (1-mask)*dstColor | 49 // setup blend so that we get mask * paintColor + (1-mask)*dstColor |
50 drawState->setBlendConstant(fPaint.getColor()); | 50 drawState->setBlendConstant(fPaint.getColor()); |
51 drawState->setBlendFunc(kConstC_GrBlendCoeff, kISC_GrBlendCoeff); | 51 drawState->setBlendFunc(kConstC_GrBlendCoeff, kISC_GrBlendCoeff); |
52 // don't modulate by the paint's color in the frag since we're | 52 // don't modulate by the paint's color in the frag since we're |
53 // already doing it via the blend const. | 53 // already doing it via the blend const. |
54 drawState->setColor(0xffffffff); | 54 drawState->setColor(0xffffffff); |
55 } else { | 55 } else { |
56 // set back to normal in case we took LCD path previously. | 56 // set back to normal in case we took LCD path previously. |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 SkFixedToFloat(vx + width), | 240 SkFixedToFloat(vx + width), |
241 SkFixedToFloat(vy + height), | 241 SkFixedToFloat(vy + height), |
242 2 * sizeof(SkPoint)); | 242 2 * sizeof(SkPoint)); |
243 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed
X(tx)), | 243 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed
X(tx)), |
244 SkFixedToFloat(texture->normalizeFixed
Y(ty)), | 244 SkFixedToFloat(texture->normalizeFixed
Y(ty)), |
245 SkFixedToFloat(texture->normalizeFixed
X(tx + width)), | 245 SkFixedToFloat(texture->normalizeFixed
X(tx + width)), |
246 SkFixedToFloat(texture->normalizeFixed
Y(ty + height)), | 246 SkFixedToFloat(texture->normalizeFixed
Y(ty + height)), |
247 2 * sizeof(SkPoint)); | 247 2 * sizeof(SkPoint)); |
248 fCurrVertex += 4; | 248 fCurrVertex += 4; |
249 } | 249 } |
OLD | NEW |