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" |
11 #include "GrFontScaler.h" | 11 #include "GrFontScaler.h" |
12 #include "GrIndexBuffer.h" | 12 #include "GrIndexBuffer.h" |
13 #include "GrStrokeInfo.h" | 13 #include "GrStrokeInfo.h" |
14 #include "GrTexturePriv.h" | |
15 #include "GrTextStrike.h" | 14 #include "GrTextStrike.h" |
16 #include "GrTextStrike_impl.h" | 15 #include "GrTextStrike_impl.h" |
| 16 #include "SkColorPriv.h" |
| 17 #include "SkPath.h" |
| 18 #include "SkRTConf.h" |
| 19 #include "SkStrokeRec.h" |
17 #include "effects/GrCustomCoordsTextureEffect.h" | 20 #include "effects/GrCustomCoordsTextureEffect.h" |
18 | 21 |
19 #include "SkAutoKern.h" | 22 #include "SkAutoKern.h" |
20 #include "SkColorPriv.h" | |
21 #include "SkDraw.h" | 23 #include "SkDraw.h" |
22 #include "SkDrawProcs.h" | 24 #include "SkDrawProcs.h" |
23 #include "SkGlyphCache.h" | 25 #include "SkGlyphCache.h" |
24 #include "SkGpuDevice.h" | 26 #include "SkGpuDevice.h" |
25 #include "SkGr.h" | 27 #include "SkGr.h" |
26 #include "SkPath.h" | |
27 #include "SkRTConf.h" | |
28 #include "SkStrokeRec.h" | |
29 #include "SkTextMapStateProc.h" | 28 #include "SkTextMapStateProc.h" |
30 | 29 |
31 SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false, | 30 SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false, |
32 "Dump the contents of the font cache before every purge."); | 31 "Dump the contents of the font cache before every purge."); |
33 | 32 |
34 namespace { | 33 namespace { |
35 // position + texture coord | 34 // position + texture coord |
36 extern const GrVertexAttrib gTextVertexAttribs[] = { | 35 extern const GrVertexAttrib gTextVertexAttribs[] = { |
37 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding
}, | 36 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding
}, |
38 {kVec2f_GrVertexAttribType, sizeof(SkPoint), kGeometryProcessor_GrVertexAttr
ibBinding} | 37 {kVec2f_GrVertexAttribType, sizeof(SkPoint), kGeometryProcessor_GrVertexAttr
ibBinding} |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 581 |
583 SkASSERT(vertSize == fDrawTarget->getDrawState().getVertexStride()); | 582 SkASSERT(vertSize == fDrawTarget->getDrawState().getVertexStride()); |
584 | 583 |
585 SkPoint* positions = reinterpret_cast<SkPoint*>( | 584 SkPoint* positions = reinterpret_cast<SkPoint*>( |
586 reinterpret_cast<intptr_t>(fVertices) + vertSize * fCurrVertex); | 585 reinterpret_cast<intptr_t>(fVertices) + vertSize * fCurrVertex); |
587 positions->setRectFan(r.fLeft, r.fTop, r.fRight, r.fBottom, vertSize); | 586 positions->setRectFan(r.fLeft, r.fTop, r.fRight, r.fBottom, vertSize); |
588 | 587 |
589 // The texture coords are last in both the with and without color vertex lay
outs. | 588 // The texture coords are last in both the with and without color vertex lay
outs. |
590 SkPoint* textureCoords = reinterpret_cast<SkPoint*>( | 589 SkPoint* textureCoords = reinterpret_cast<SkPoint*>( |
591 reinterpret_cast<intptr_t>(positions) + vertSize - sizeof(SkPoint))
; | 590 reinterpret_cast<intptr_t>(positions) + vertSize - sizeof(SkPoint))
; |
592 textureCoords->setRectFan(SkFixedToFloat(texture->texturePriv().normalizeFix
edX(tx)), | 591 textureCoords->setRectFan(SkFixedToFloat(texture->normalizeFixedX(tx)), |
593 SkFixedToFloat(texture->texturePriv().normalizeFix
edY(ty)), | 592 SkFixedToFloat(texture->normalizeFixedY(ty)), |
594 SkFixedToFloat(texture->texturePriv().normalizeFix
edX(tx + width)), | 593 SkFixedToFloat(texture->normalizeFixedX(tx + width
)), |
595 SkFixedToFloat(texture->texturePriv().normalizeFix
edY(ty + height)), | 594 SkFixedToFloat(texture->normalizeFixedY(ty + heigh
t)), |
596 vertSize); | 595 vertSize); |
597 if (useColorVerts) { | 596 if (useColorVerts) { |
598 if (0xFF == GrColorUnpackA(fPaint.getColor())) { | 597 if (0xFF == GrColorUnpackA(fPaint.getColor())) { |
599 fDrawTarget->drawState()->setHint(GrDrawState::kVertexColorsAreOpaqu
e_Hint, true); | 598 fDrawTarget->drawState()->setHint(GrDrawState::kVertexColorsAreOpaqu
e_Hint, true); |
600 } | 599 } |
601 // color comes after position. | 600 // color comes after position. |
602 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); | 601 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); |
603 for (int i = 0; i < 4; ++i) { | 602 for (int i = 0; i < 4; ++i) { |
604 *colors = fPaint.getColor(); | 603 *colors = fPaint.getColor(); |
605 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors
) + vertSize); | 604 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors
) + vertSize); |
606 } | 605 } |
607 } | 606 } |
608 fCurrVertex += 4; | 607 fCurrVertex += 4; |
609 } | 608 } |
OLD | NEW |