| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrBitmapTextContext.h" | 8 #include "GrBitmapTextContext.h" |
| 9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
| 10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // setup our sampler state for our text texture/atlas | 63 // setup our sampler state for our text texture/atlas |
| 64 SkASSERT(GrIsALIGN4(fCurrVertex)); | 64 SkASSERT(GrIsALIGN4(fCurrVertex)); |
| 65 SkASSERT(fCurrTexture); | 65 SkASSERT(fCurrTexture); |
| 66 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNon
e_FilterMode); | 66 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNon
e_FilterMode); |
| 67 | 67 |
| 68 // This effect could be stored with one of the cache objects (atlas?) | 68 // This effect could be stored with one of the cache objects (atlas?) |
| 69 drawState->addCoverageEffect( | 69 drawState->addCoverageEffect( |
| 70 GrCustomCoordsTextureEffect::Create(fCurrTexture
, params), | 70 GrCustomCoordsTextureEffect::Create(fCurrTexture
, params), |
| 71 kGlyphCoordsAttributeIndex)->unref(); | 71 kGlyphCoordsAttributeIndex)->unref(); |
| 72 | 72 |
| 73 if (!GrPixelConfigIsAlphaOnly(fCurrTexture->config())) { | 73 if (NULL != fStrike && kARGB_GrMaskFormat == fStrike->getMaskFormat()) { |
| 74 drawState->setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDstBlen
dCoeff()); |
| 75 drawState->setColor(0xffffffff); |
| 76 } else if (!GrPixelConfigIsAlphaOnly(fCurrTexture->config())) { |
| 74 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || | 77 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || |
| 75 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || | 78 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || |
| 76 fPaint.numColorStages()) { | 79 fPaint.numColorStages()) { |
| 77 GrPrintf("LCD Text will not draw correctly.\n"); | 80 GrPrintf("LCD Text will not draw correctly.\n"); |
| 78 } | 81 } |
| 79 // We don't use the GrPaint's color in this case because it's been p
remultiplied by | 82 // We don't use the GrPaint's color in this case because it's been p
remultiplied by |
| 80 // alpha. Instead we feed in a non-premultiplied color, and multiply
its alpha by | 83 // alpha. Instead we feed in a non-premultiplied color, and multiply
its alpha by |
| 81 // the mask texture color. The end result is that we get | 84 // the mask texture color. The end result is that we get |
| 82 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*dstCo
lor | 85 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*dstCo
lor |
| 83 int a = SkColorGetA(fSkPaintColor); | 86 int a = SkColorGetA(fSkPaintColor); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 SkFixedToFloat(vx + width), | 262 SkFixedToFloat(vx + width), |
| 260 SkFixedToFloat(vy + height), | 263 SkFixedToFloat(vy + height), |
| 261 2 * sizeof(SkPoint)); | 264 2 * sizeof(SkPoint)); |
| 262 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed
X(tx)), | 265 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed
X(tx)), |
| 263 SkFixedToFloat(texture->normalizeFixed
Y(ty)), | 266 SkFixedToFloat(texture->normalizeFixed
Y(ty)), |
| 264 SkFixedToFloat(texture->normalizeFixed
X(tx + width)), | 267 SkFixedToFloat(texture->normalizeFixed
X(tx + width)), |
| 265 SkFixedToFloat(texture->normalizeFixed
Y(ty + height)), | 268 SkFixedToFloat(texture->normalizeFixed
Y(ty + height)), |
| 266 2 * sizeof(SkPoint)); | 269 2 * sizeof(SkPoint)); |
| 267 fCurrVertex += 4; | 270 fCurrVertex += 4; |
| 268 } | 271 } |
| OLD | NEW |