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 "GrBitmapTextContext.h" | 10 #include "GrBitmapTextContext.h" |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
628 drawState->setVertexAttribs<gTextVertexAttribs>( | 628 drawState->setVertexAttribs<gTextVertexAttribs>( |
629 SK_ARRAY_COUNT(gTextVertexAttribs), kTextVAS ize); | 629 SK_ARRAY_COUNT(gTextVertexAttribs), kTextVAS ize); |
630 } | 630 } |
631 } | 631 } |
632 | 632 |
633 void GrDistanceFieldTextContext::flush() { | 633 void GrDistanceFieldTextContext::flush() { |
634 if (NULL == fDrawTarget) { | 634 if (NULL == fDrawTarget) { |
635 return; | 635 return; |
636 } | 636 } |
637 | 637 |
638 GrDrawState drawState; | 638 if (fCurrVertex > 0) { |
639 drawState.setFromPaint(fPaint, fContext->getMatrix(), fContext->getRenderTar get()); | 639 GrDrawState drawState; |
640 bool useColorVerts = !fUseLCDText; | 640 drawState.setFromPaint(fPaint, fContext->getMatrix(), fContext->getRende rTarget()); |
tfarina
2014/11/18 17:35:31
is fContext NULL if fCurrVertex is < 0?
Otherwise
| |
641 set_vertex_attributes(&drawState, useColorVerts); | 641 bool useColorVerts = !fUseLCDText; |
642 set_vertex_attributes(&drawState, useColorVerts); | |
642 | 643 |
643 if (fCurrVertex > 0) { | |
644 // setup our sampler state for our text texture/atlas | 644 // setup our sampler state for our text texture/atlas |
645 SkASSERT(SkIsAlign4(fCurrVertex)); | 645 SkASSERT(SkIsAlign4(fCurrVertex)); |
646 | 646 |
647 // get our current color | 647 // get our current color |
648 SkColor filteredColor; | 648 SkColor filteredColor; |
649 SkColorFilter* colorFilter = fSkPaint.getColorFilter(); | 649 SkColorFilter* colorFilter = fSkPaint.getColorFilter(); |
650 if (colorFilter) { | 650 if (colorFilter) { |
651 filteredColor = colorFilter->filterColor(fSkPaint.getColor()); | 651 filteredColor = colorFilter->filterColor(fSkPaint.getColor()); |
652 } else { | 652 } else { |
653 filteredColor = fSkPaint.getColor(); | 653 filteredColor = fSkPaint.getColor(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
702 } | 702 } |
703 } | 703 } |
704 | 704 |
705 inline void GrDistanceFieldTextContext::finish() { | 705 inline void GrDistanceFieldTextContext::finish() { |
706 this->flush(); | 706 this->flush(); |
707 fTotalVertexCount = 0; | 707 fTotalVertexCount = 0; |
708 | 708 |
709 GrTextContext::finish(); | 709 GrTextContext::finish(); |
710 } | 710 } |
711 | 711 |
OLD | NEW |