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 "SkColorFilter.h" |
10 #include "GrDrawTarget.h" | 11 #include "GrDrawTarget.h" |
11 #include "GrDrawTargetCaps.h" | 12 #include "GrDrawTargetCaps.h" |
12 #include "GrFontScaler.h" | 13 #include "GrFontScaler.h" |
| 14 #include "SkGlyphCache.h" |
13 #include "GrGpu.h" | 15 #include "GrGpu.h" |
14 #include "GrIndexBuffer.h" | 16 #include "GrIndexBuffer.h" |
15 #include "GrStrokeInfo.h" | 17 #include "GrStrokeInfo.h" |
16 #include "GrTexturePriv.h" | |
17 #include "GrTextStrike.h" | 18 #include "GrTextStrike.h" |
18 #include "GrTextStrike_impl.h" | 19 #include "GrTextStrike_impl.h" |
19 | |
20 #include "SkColorFilter.h" | |
21 #include "SkDistanceFieldGen.h" | 20 #include "SkDistanceFieldGen.h" |
22 #include "SkDraw.h" | 21 #include "SkDraw.h" |
23 #include "SkGlyphCache.h" | |
24 #include "SkGpuDevice.h" | 22 #include "SkGpuDevice.h" |
25 #include "SkPath.h" | 23 #include "SkPath.h" |
26 #include "SkRTConf.h" | 24 #include "SkRTConf.h" |
27 #include "SkStrokeRec.h" | 25 #include "SkStrokeRec.h" |
28 #include "effects/GrDistanceFieldTextureEffect.h" | 26 #include "effects/GrDistanceFieldTextureEffect.h" |
29 | 27 |
30 SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false, | 28 SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false, |
31 "Dump the contents of the font cache before every purge."); | 29 "Dump the contents of the font cache before every purge."); |
32 | 30 |
33 static const int kSmallDFFontSize = 32; | 31 static const int kSmallDFFontSize = 32; |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 | 416 |
419 SkASSERT(vertSize == fDrawTarget->getDrawState().getVertexStride()); | 417 SkASSERT(vertSize == fDrawTarget->getDrawState().getVertexStride()); |
420 | 418 |
421 SkPoint* positions = reinterpret_cast<SkPoint*>( | 419 SkPoint* positions = reinterpret_cast<SkPoint*>( |
422 reinterpret_cast<intptr_t>(fVertices) + vertSize * fCurrVertex); | 420 reinterpret_cast<intptr_t>(fVertices) + vertSize * fCurrVertex); |
423 positions->setRectFan(r.fLeft, r.fTop, r.fRight, r.fBottom, vertSize); | 421 positions->setRectFan(r.fLeft, r.fTop, r.fRight, r.fBottom, vertSize); |
424 | 422 |
425 // The texture coords are last in both the with and without color vertex lay
outs. | 423 // The texture coords are last in both the with and without color vertex lay
outs. |
426 SkPoint* textureCoords = reinterpret_cast<SkPoint*>( | 424 SkPoint* textureCoords = reinterpret_cast<SkPoint*>( |
427 reinterpret_cast<intptr_t>(positions) + vertSize - sizeof(SkPoint))
; | 425 reinterpret_cast<intptr_t>(positions) + vertSize - sizeof(SkPoint))
; |
428 textureCoords->setRectFan(SkFixedToFloat(texture->texturePriv().normalizeFix
edX(tx)), | 426 textureCoords->setRectFan(SkFixedToFloat(texture->normalizeFixedX(tx)), |
429 SkFixedToFloat(texture->texturePriv().normalizeFix
edY(ty)), | 427 SkFixedToFloat(texture->normalizeFixedY(ty)), |
430 SkFixedToFloat(texture->texturePriv().normalizeFix
edX(tx + tw)), | 428 SkFixedToFloat(texture->normalizeFixedX(tx + tw)), |
431 SkFixedToFloat(texture->texturePriv().normalizeFix
edY(ty + th)), | 429 SkFixedToFloat(texture->normalizeFixedY(ty + th)), |
432 vertSize); | 430 vertSize); |
433 if (useColorVerts) { | 431 if (useColorVerts) { |
434 if (0xFF == GrColorUnpackA(fPaint.getColor())) { | 432 if (0xFF == GrColorUnpackA(fPaint.getColor())) { |
435 fDrawTarget->drawState()->setHint(GrDrawState::kVertexColorsAreOpaqu
e_Hint, true); | 433 fDrawTarget->drawState()->setHint(GrDrawState::kVertexColorsAreOpaqu
e_Hint, true); |
436 } | 434 } |
437 // color comes after position. | 435 // color comes after position. |
438 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); | 436 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); |
439 for (int i = 0; i < 4; ++i) { | 437 for (int i = 0; i < 4; ++i) { |
440 *colors = fPaint.getColor(); | 438 *colors = fPaint.getColor(); |
441 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(color
s) + vertSize); | 439 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(color
s) + vertSize); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 SkScalarToFixed(x) - (glyph.fAdvanceX >> a
lignShift), | 666 SkScalarToFixed(x) - (glyph.fAdvanceX >> a
lignShift), |
669 SkScalarToFixed(y) - (glyph.fAdvanceY >> a
lignShift), | 667 SkScalarToFixed(y) - (glyph.fAdvanceY >> a
lignShift), |
670 fontScaler); | 668 fontScaler); |
671 } | 669 } |
672 pos += scalarsPerPosition; | 670 pos += scalarsPerPosition; |
673 } | 671 } |
674 } | 672 } |
675 | 673 |
676 this->finish(); | 674 this->finish(); |
677 } | 675 } |
OLD | NEW |