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" |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 SkScalar x, SkScalar y, | 603 SkScalar x, SkScalar y, |
604 const SkIRect& clipBounds, | 604 const SkIRect& clipBounds, |
605 GrAtlasTextContext* fallbackTex
tContext, | 605 GrAtlasTextContext* fallbackTex
tContext, |
606 const SkPaint& originalSkPaint)
const { | 606 const SkPaint& originalSkPaint)
const { |
607 SkASSERT(fInstanceData); | 607 SkASSERT(fInstanceData); |
608 SkASSERT(dc->accessRenderTarget()->isStencilBufferMultisampled() || !fFont.i
sAntiAlias()); | 608 SkASSERT(dc->accessRenderTarget()->isStencilBufferMultisampled() || !fFont.i
sAntiAlias()); |
609 | 609 |
610 if (fInstanceData->count()) { | 610 if (fInstanceData->count()) { |
611 pipelineBuilder->setState(GrPipelineBuilder::kHWAntialias_Flag, fFont.is
AntiAlias()); | 611 pipelineBuilder->setState(GrPipelineBuilder::kHWAntialias_Flag, fFont.is
AntiAlias()); |
612 | 612 |
613 static constexpr GrStencilSettings kStencilPass( | 613 static constexpr GrUserStencilSettings kCoverPass( |
614 kZero_StencilOp, | 614 GrUserStencilSettings::StaticInit< |
615 kKeep_StencilOp, | 615 0x0000, |
616 kNotEqual_StencilFunc, | 616 GrUserStencilTest::kNotEqual, // Stencil pass accounts for clip. |
617 0xffff, | 617 0xffff, |
618 0x0000, | 618 GrUserStencilOp::kZero, |
619 0xffff); | 619 GrUserStencilOp::kKeep, |
| 620 0xffff>() |
| 621 ); |
620 | 622 |
621 *pipelineBuilder->stencil() = kStencilPass; | 623 pipelineBuilder->setUserStencil(&kCoverPass); |
622 | 624 |
623 SkAutoTUnref<GrPathRange> glyphs(this->createGlyphs(ctx)); | 625 SkAutoTUnref<GrPathRange> glyphs(this->createGlyphs(ctx)); |
624 if (fLastDrawnGlyphsID != glyphs->getUniqueID()) { | 626 if (fLastDrawnGlyphsID != glyphs->getUniqueID()) { |
625 // Either this is the first draw or the glyphs object was purged sin
ce last draw. | 627 // Either this is the first draw or the glyphs object was purged sin
ce last draw. |
626 glyphs->loadPathsIfNeeded(fInstanceData->indices(), fInstanceData->c
ount()); | 628 glyphs->loadPathsIfNeeded(fInstanceData->indices(), fInstanceData->c
ount()); |
627 fLastDrawnGlyphsID = glyphs->getUniqueID(); | 629 fLastDrawnGlyphsID = glyphs->getUniqueID(); |
628 } | 630 } |
629 | 631 |
630 // Don't compute a bounding box. For dst copy texture, we'll opt instead
for it to just copy | 632 // Don't compute a bounding box. For dst copy texture, we'll opt instead
for it to just copy |
631 // the entire dst. Realistically this is a moot point, because any conte
xt that supports | 633 // the entire dst. Realistically this is a moot point, because any conte
xt that supports |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 } | 730 } |
729 | 731 |
730 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { | 732 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { |
731 *count = fCount; | 733 *count = fCount; |
732 if (fCount) { | 734 if (fCount) { |
733 this->flush(); | 735 this->flush(); |
734 return fBuilder->build(); | 736 return fBuilder->build(); |
735 } | 737 } |
736 return nullptr; | 738 return nullptr; |
737 } | 739 } |
OLD | NEW |