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 GrUserStencilSettings kCoverPass( | 613 static constexpr GrStencilSettings kStencilPass( |
614 GrUserStencilSettings::StaticInit< | 614 kZero_StencilOp, |
615 0x0000, | 615 kKeep_StencilOp, |
616 GrUserStencilTest::kNotEqual, // Stencil pass accounts for clip. | 616 kNotEqual_StencilFunc, |
617 0xffff, | 617 0xffff, |
618 GrUserStencilOp::kZero, | 618 0x0000, |
619 GrUserStencilOp::kKeep, | 619 0xffff); |
620 0xffff>() | |
621 ); | |
622 | 620 |
623 pipelineBuilder->setUserStencil(&kCoverPass); | 621 *pipelineBuilder->stencil() = kStencilPass; |
624 | 622 |
625 SkAutoTUnref<GrPathRange> glyphs(this->createGlyphs(ctx)); | 623 SkAutoTUnref<GrPathRange> glyphs(this->createGlyphs(ctx)); |
626 if (fLastDrawnGlyphsID != glyphs->getUniqueID()) { | 624 if (fLastDrawnGlyphsID != glyphs->getUniqueID()) { |
627 // Either this is the first draw or the glyphs object was purged sin
ce last draw. | 625 // Either this is the first draw or the glyphs object was purged sin
ce last draw. |
628 glyphs->loadPathsIfNeeded(fInstanceData->indices(), fInstanceData->c
ount()); | 626 glyphs->loadPathsIfNeeded(fInstanceData->indices(), fInstanceData->c
ount()); |
629 fLastDrawnGlyphsID = glyphs->getUniqueID(); | 627 fLastDrawnGlyphsID = glyphs->getUniqueID(); |
630 } | 628 } |
631 | 629 |
632 // Don't compute a bounding box. For dst copy texture, we'll opt instead
for it to just copy | 630 // Don't compute a bounding box. For dst copy texture, we'll opt instead
for it to just copy |
633 // the entire dst. Realistically this is a moot point, because any conte
xt that supports | 631 // 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... |
730 } | 728 } |
731 | 729 |
732 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { | 730 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { |
733 *count = fCount; | 731 *count = fCount; |
734 if (fCount) { | 732 if (fCount) { |
735 this->flush(); | 733 this->flush(); |
736 return fBuilder->build(); | 734 return fBuilder->build(); |
737 } | 735 } |
738 return nullptr; | 736 return nullptr; |
739 } | 737 } |
OLD | NEW |