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