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" |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 | 585 |
586 // The texture coords are last in both the with and without color vertex lay
outs. | 586 // The texture coords are last in both the with and without color vertex lay
outs. |
587 SkPoint* textureCoords = reinterpret_cast<SkPoint*>( | 587 SkPoint* textureCoords = reinterpret_cast<SkPoint*>( |
588 reinterpret_cast<intptr_t>(positions) + vertSize - sizeof(SkPoint))
; | 588 reinterpret_cast<intptr_t>(positions) + vertSize - sizeof(SkPoint))
; |
589 textureCoords->setRectFan(SkFixedToFloat(texture->normalizeFixedX(tx)), | 589 textureCoords->setRectFan(SkFixedToFloat(texture->normalizeFixedX(tx)), |
590 SkFixedToFloat(texture->normalizeFixedY(ty)), | 590 SkFixedToFloat(texture->normalizeFixedY(ty)), |
591 SkFixedToFloat(texture->normalizeFixedX(tx + width
)), | 591 SkFixedToFloat(texture->normalizeFixedX(tx + width
)), |
592 SkFixedToFloat(texture->normalizeFixedY(ty + heigh
t)), | 592 SkFixedToFloat(texture->normalizeFixedY(ty + heigh
t)), |
593 vertSize); | 593 vertSize); |
594 if (useColorVerts) { | 594 if (useColorVerts) { |
| 595 if (0xFF == GrColorUnpackA(fPaint.getColor())) { |
| 596 fDrawTarget->drawState()->setHint(GrDrawState::kVertexColorsAreOpaqu
e_Hint, true); |
| 597 } |
595 // color comes after position. | 598 // color comes after position. |
596 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); | 599 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); |
597 for (int i = 0; i < 4; ++i) { | 600 for (int i = 0; i < 4; ++i) { |
598 *colors = fPaint.getColor(); | 601 *colors = fPaint.getColor(); |
599 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors
) + vertSize); | 602 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors
) + vertSize); |
600 } | 603 } |
601 } | 604 } |
602 fCurrVertex += 4; | 605 fCurrVertex += 4; |
603 } | 606 } |
OLD | NEW |