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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 unsigned g = SkColorGetG(c); | 541 unsigned g = SkColorGetG(c); |
542 unsigned b = SkColorGetB(c); | 542 unsigned b = SkColorGetB(c); |
543 return GrColorPackRGBA(r, g, b, 0xff); | 543 return GrColorPackRGBA(r, g, b, 0xff); |
544 } | 544 } |
545 | 545 |
546 void GrBitmapTextContext::flush() { | 546 void GrBitmapTextContext::flush() { |
547 if (NULL == fDrawTarget) { | 547 if (NULL == fDrawTarget) { |
548 return; | 548 return; |
549 } | 549 } |
550 | 550 |
551 GrDrawState drawState; | 551 if (fCurrVertex > 0) { |
552 drawState.setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget()); | 552 GrDrawState drawState; |
| 553 drawState.setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget(
)); |
553 | 554 |
554 set_vertex_attributes(&drawState, fCurrMaskFormat); | 555 set_vertex_attributes(&drawState, fCurrMaskFormat); |
555 | 556 |
556 if (fCurrVertex > 0) { | |
557 // setup our sampler state for our text texture/atlas | 557 // setup our sampler state for our text texture/atlas |
558 SkASSERT(SkIsAlign4(fCurrVertex)); | 558 SkASSERT(SkIsAlign4(fCurrVertex)); |
559 SkASSERT(fCurrTexture); | 559 SkASSERT(fCurrTexture); |
560 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNon
e_FilterMode); | 560 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNon
e_FilterMode); |
561 | 561 |
562 // This effect could be stored with one of the cache objects (atlas?) | 562 // This effect could be stored with one of the cache objects (atlas?) |
563 if (kARGB_GrMaskFormat == fCurrMaskFormat) { | 563 if (kARGB_GrMaskFormat == fCurrMaskFormat) { |
564 drawState.setGeometryProcessor(GrDefaultGeoProcFactory::Create(true)
)->unref(); | 564 drawState.setGeometryProcessor(GrDefaultGeoProcFactory::Create(true)
)->unref(); |
565 GrFragmentProcessor* fragProcessor = GrSimpleTextureEffect::Create(f
CurrTexture, | 565 GrFragmentProcessor* fragProcessor = GrSimpleTextureEffect::Create(f
CurrTexture, |
566 S
kMatrix::I(), | 566 S
kMatrix::I(), |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 } | 637 } |
638 } | 638 } |
639 | 639 |
640 inline void GrBitmapTextContext::finish() { | 640 inline void GrBitmapTextContext::finish() { |
641 this->flush(); | 641 this->flush(); |
642 fTotalVertexCount = 0; | 642 fTotalVertexCount = 0; |
643 | 643 |
644 GrTextContext::finish(); | 644 GrTextContext::finish(); |
645 } | 645 } |
646 | 646 |
OLD | NEW |