| 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 "GrDistanceFieldTextContext.h" | 8 #include "GrDistanceFieldTextContext.h" |
| 9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
| 10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 GrDrawState::AutoRestoreEffects are(drawState); | 74 GrDrawState::AutoRestoreEffects are(drawState); |
| 75 drawState->setFromPaint(fPaint, fContext->getMatrix(), fContext->getRenderTa
rget()); | 75 drawState->setFromPaint(fPaint, fContext->getMatrix(), fContext->getRenderTa
rget()); |
| 76 | 76 |
| 77 if (fCurrVertex > 0) { | 77 if (fCurrVertex > 0) { |
| 78 // setup our sampler state for our text texture/atlas | 78 // setup our sampler state for our text texture/atlas |
| 79 SkASSERT(GrIsALIGN4(fCurrVertex)); | 79 SkASSERT(GrIsALIGN4(fCurrVertex)); |
| 80 SkASSERT(fCurrTexture); | 80 SkASSERT(fCurrTexture); |
| 81 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBil
erp_FilterMode); | 81 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBil
erp_FilterMode); |
| 82 | 82 |
| 83 // This effect could be stored with one of the cache objects (atlas?) | 83 // This effect could be stored with one of the cache objects (atlas?) |
| 84 SkISize size = fStrike->getAtlasSize(); |
| 84 drawState->addCoverageEffect( | 85 drawState->addCoverageEffect( |
| 85 GrDistanceFieldTextureEffect::Create(fCurrTexture, para
ms, | 86 GrDistanceFieldTextureEffect::Create(fCurrTextur
e, params, size), |
| 86 fContext->getMatri
x().isSimilarity()), | 87 kGlyphCoordsAttributeIndex)->unref(); |
| 87 kGlyphCoordsAttributeIndex)->unref(); | |
| 88 | 88 |
| 89 if (!GrPixelConfigIsAlphaOnly(fCurrTexture->config())) { | 89 if (!GrPixelConfigIsAlphaOnly(fCurrTexture->config())) { |
| 90 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || | 90 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || |
| 91 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || | 91 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || |
| 92 fPaint.numColorStages()) { | 92 fPaint.numColorStages()) { |
| 93 GrPrintf("LCD Text will not draw correctly.\n"); | 93 GrPrintf("LCD Text will not draw correctly.\n"); |
| 94 } | 94 } |
| 95 // We don't use the GrPaint's color in this case because it's been p
remultiplied by | 95 // We don't use the GrPaint's color in this case because it's been p
remultiplied by |
| 96 // alpha. Instead we feed in a non-premultiplied color, and multiply
its alpha by | 96 // alpha. Instead we feed in a non-premultiplied color, and multiply
its alpha by |
| 97 // the mask texture color. The end result is that we get | 97 // the mask texture color. The end result is that we get |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 SkScalarToFixed(y) - (glyph.fAdvanceY >> a
lignShift) | 449 SkScalarToFixed(y) - (glyph.fAdvanceY >> a
lignShift) |
| 450 + SK_FixedHalf, //d1g.fHalfSampleY, | 450 + SK_FixedHalf, //d1g.fHalfSampleY, |
| 451 fontScaler); | 451 fontScaler); |
| 452 } | 452 } |
| 453 pos += scalarsPerPosition; | 453 pos += scalarsPerPosition; |
| 454 } | 454 } |
| 455 } | 455 } |
| 456 | 456 |
| 457 this->finish(); | 457 this->finish(); |
| 458 } | 458 } |
| OLD | NEW |