OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrStencilAndCoverTextContext.h" | 8 #include "GrStencilAndCoverTextContext.h" |
9 #include "GrAtlasTextContext.h" | 9 #include "GrAtlasTextContext.h" |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
11 #include "GrDrawContext.h" | 11 #include "GrDrawContext.h" |
12 #include "GrPath.h" | 12 #include "GrPath.h" |
13 #include "GrPathRange.h" | 13 #include "GrPathRange.h" |
14 #include "GrPipelineBuilder.h" | |
15 #include "GrResourceProvider.h" | 14 #include "GrResourceProvider.h" |
16 #include "GrTextUtils.h" | 15 #include "GrTextUtils.h" |
17 #include "SkAutoKern.h" | 16 #include "SkAutoKern.h" |
18 #include "SkDraw.h" | 17 #include "SkDraw.h" |
19 #include "SkDrawProcs.h" | 18 #include "SkDrawProcs.h" |
20 #include "SkGlyphCache.h" | 19 #include "SkGlyphCache.h" |
21 #include "SkGrPriv.h" | 20 #include "SkGrPriv.h" |
22 #include "SkDrawFilter.h" | 21 #include "SkDrawFilter.h" |
23 #include "SkPath.h" | 22 #include "SkPath.h" |
24 #include "SkTextBlobRunIterator.h" | 23 #include "SkTextBlobRunIterator.h" |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 // For clipping we'll just skip any optimizations based on the bounds. T
his does, however, | 635 // For clipping we'll just skip any optimizations based on the bounds. T
his does, however, |
637 // hurt batching. | 636 // hurt batching. |
638 const SkRect bounds = SkRect::MakeIWH(drawContext->width(), drawContext-
>height()); | 637 const SkRect bounds = SkRect::MakeIWH(drawContext->width(), drawContext-
>height()); |
639 | 638 |
640 SkAutoTUnref<GrDrawBatch> batch( | 639 SkAutoTUnref<GrDrawBatch> batch( |
641 GrDrawPathRangeBatch::Create(viewMatrix, fTextRatio, fTextInverseRat
io * x, | 640 GrDrawPathRangeBatch::Create(viewMatrix, fTextRatio, fTextInverseRat
io * x, |
642 fTextInverseRatio * y, grPaint.getColor
(), | 641 fTextInverseRatio * y, grPaint.getColor
(), |
643 GrPathRendering::kWinding_FillType, gly
phs, fInstanceData, | 642 GrPathRendering::kWinding_FillType, gly
phs, fInstanceData, |
644 bounds)); | 643 bounds)); |
645 | 644 |
646 GrPipelineBuilder pipelineBuilder(grPaint); | 645 SkASSERT(drawContext->mustUseHWAA(grPaint) == grPaint.isAntiAlias()); |
647 pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, grPaint.i
sAntiAlias()); | 646 drawContext->drawBatch(grPaint, clip, kCoverPass, batch); |
648 pipelineBuilder.setUserStencil(&kCoverPass); | |
649 | |
650 drawContext->drawBatch(pipelineBuilder, clip, batch); | |
651 } | 647 } |
652 | 648 |
653 if (fFallbackTextBlob) { | 649 if (fFallbackTextBlob) { |
654 SkPaint fallbackSkPaint(originalSkPaint); | 650 SkPaint fallbackSkPaint(originalSkPaint); |
655 fStyle.strokeRec().applyToPaint(&fallbackSkPaint); | 651 fStyle.strokeRec().applyToPaint(&fallbackSkPaint); |
656 if (!fStyle.isSimpleFill()) { | 652 if (!fStyle.isSimpleFill()) { |
657 fallbackSkPaint.setStrokeWidth(fStyle.strokeRec().getWidth() * fText
Ratio); | 653 fallbackSkPaint.setStrokeWidth(fStyle.strokeRec().getWidth() * fText
Ratio); |
658 } | 654 } |
659 | 655 |
660 fallbackTextContext->drawTextBlob(ctx, drawContext, clip, fallbackSkPain
t, viewMatrix, | 656 fallbackTextContext->drawTextBlob(ctx, drawContext, clip, fallbackSkPain
t, viewMatrix, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 } | 729 } |
734 | 730 |
735 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { | 731 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { |
736 *count = fCount; | 732 *count = fCount; |
737 if (fCount) { | 733 if (fCount) { |
738 this->flush(); | 734 this->flush(); |
739 return fBuilder->build(); | 735 return fBuilder->build(); |
740 } | 736 } |
741 return nullptr; | 737 return nullptr; |
742 } | 738 } |
OLD | NEW |