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 "GrDefaultGeoProcFactory.h" | 10 #include "GrDefaultGeoProcFactory.h" |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 // color comes after position. | 508 // color comes after position. |
509 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); | 509 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); |
510 for (int i = 0; i < 4; ++i) { | 510 for (int i = 0; i < 4; ++i) { |
511 *colors = fPaint.getColor(); | 511 *colors = fPaint.getColor(); |
512 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors
) + vertSize); | 512 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors
) + vertSize); |
513 } | 513 } |
514 } | 514 } |
515 fCurrVertex += 4; | 515 fCurrVertex += 4; |
516 } | 516 } |
517 | 517 |
518 static inline GrColor skcolor_to_grcolor_nopremultiply(SkColor c) { | |
519 unsigned r = SkColorGetR(c); | |
520 unsigned g = SkColorGetG(c); | |
521 unsigned b = SkColorGetB(c); | |
522 return GrColorPackRGBA(r, g, b, 0xff); | |
523 } | |
524 | |
525 void GrBitmapTextContext::flush() { | 518 void GrBitmapTextContext::flush() { |
526 if (NULL == fDrawTarget) { | 519 if (NULL == fDrawTarget) { |
527 return; | 520 return; |
528 } | 521 } |
529 | 522 |
530 if (fCurrVertex > 0) { | 523 if (fCurrVertex > 0) { |
531 GrDrawState drawState; | 524 GrDrawState drawState; |
532 drawState.setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget(
)); | 525 drawState.setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget(
)); |
533 | 526 |
534 // setup our sampler state for our text texture/atlas | 527 // setup our sampler state for our text texture/atlas |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 } | 597 } |
605 } | 598 } |
606 | 599 |
607 inline void GrBitmapTextContext::finish() { | 600 inline void GrBitmapTextContext::finish() { |
608 this->flush(); | 601 this->flush(); |
609 fTotalVertexCount = 0; | 602 fTotalVertexCount = 0; |
610 | 603 |
611 GrTextContext::finish(); | 604 GrTextContext::finish(); |
612 } | 605 } |
613 | 606 |
OLD | NEW |