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