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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 SkScalar x, SkScalar y, | 578 SkScalar x, SkScalar y, |
579 const SkIRect& clipBounds, | 579 const SkIRect& clipBounds, |
580 GrAtlasTextContext* fallbackTex
tContext, | 580 GrAtlasTextContext* fallbackTex
tContext, |
581 const SkPaint& originalSkPaint)
const { | 581 const SkPaint& originalSkPaint)
const { |
582 SkASSERT(fInstanceData); | 582 SkASSERT(fInstanceData); |
583 SkASSERT(dc->accessRenderTarget()->isStencilBufferMultisampled() || !fFont.i
sAntiAlias()); | 583 SkASSERT(dc->accessRenderTarget()->isStencilBufferMultisampled() || !fFont.i
sAntiAlias()); |
584 | 584 |
585 if (fInstanceData->count()) { | 585 if (fInstanceData->count()) { |
586 pipelineBuilder->setState(GrPipelineBuilder::kHWAntialias_Flag, fFont.is
AntiAlias()); | 586 pipelineBuilder->setState(GrPipelineBuilder::kHWAntialias_Flag, fFont.is
AntiAlias()); |
587 | 587 |
588 static constexpr GrStencilSettings kStencilPass( | 588 static constexpr GrUserStencilSettings kCoverPass( |
589 kZero_StencilOp, | 589 GrUserStencilSettings::StaticInit< |
590 kKeep_StencilOp, | 590 0x0000, |
591 kNotEqual_StencilFunc, | 591 GrUserStencilTest::kNotEqual, // Stencil pass accounts for clip. |
592 0xffff, | 592 0xffff, |
593 0x0000, | 593 GrUserStencilOp::kZero, |
594 0xffff); | 594 GrUserStencilOp::kKeep, |
| 595 0xffff>() |
| 596 ); |
595 | 597 |
596 *pipelineBuilder->stencil() = kStencilPass; | 598 pipelineBuilder->setUserStencil(&kCoverPass); |
597 | 599 |
598 SkAutoTUnref<GrPathRange> glyphs(this->createGlyphs(ctx)); | 600 SkAutoTUnref<GrPathRange> glyphs(this->createGlyphs(ctx)); |
599 if (fLastDrawnGlyphsID != glyphs->getUniqueID()) { | 601 if (fLastDrawnGlyphsID != glyphs->getUniqueID()) { |
600 // Either this is the first draw or the glyphs object was purged sin
ce last draw. | 602 // Either this is the first draw or the glyphs object was purged sin
ce last draw. |
601 glyphs->loadPathsIfNeeded(fInstanceData->indices(), fInstanceData->c
ount()); | 603 glyphs->loadPathsIfNeeded(fInstanceData->indices(), fInstanceData->c
ount()); |
602 fLastDrawnGlyphsID = glyphs->getUniqueID(); | 604 fLastDrawnGlyphsID = glyphs->getUniqueID(); |
603 } | 605 } |
604 | 606 |
605 // Don't compute a bounding box. For dst copy texture, we'll opt instead
for it to just copy | 607 // Don't compute a bounding box. For dst copy texture, we'll opt instead
for it to just copy |
606 // the entire dst. Realistically this is a moot point, because any conte
xt that supports | 608 // 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... |
703 } | 705 } |
704 | 706 |
705 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { | 707 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { |
706 *count = fCount; | 708 *count = fCount; |
707 if (fCount) { | 709 if (fCount) { |
708 this->flush(); | 710 this->flush(); |
709 return fBuilder->build(); | 711 return fBuilder->build(); |
710 } | 712 } |
711 return nullptr; | 713 return nullptr; |
712 } | 714 } |
OLD | NEW |