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 "GrBitmapTextContext.h" | 10 #include "GrBitmapTextContext.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return false; | 62 return false; |
63 } | 63 } |
64 | 64 |
65 // No hairlines unless we can map the 1 px width to the object space. | 65 // No hairlines unless we can map the 1 px width to the object space. |
66 if (skPaint.getStyle() == SkPaint::kStroke_Style | 66 if (skPaint.getStyle() == SkPaint::kStroke_Style |
67 && skPaint.getStrokeWidth() == 0 | 67 && skPaint.getStrokeWidth() == 0 |
68 && viewMatrix.hasPerspective()) { | 68 && viewMatrix.hasPerspective()) { |
69 return false; | 69 return false; |
70 } | 70 } |
71 | 71 |
| 72 if (skPaint.isAntiAlias() && |
| 73 GrRenderTarget::kStencil_SampleConfig == rt->sampleConfig()) { |
| 74 if (!paint.getXPFactory()->canTweakAlphaForCoverage()) { |
| 75 return false; |
| 76 } |
| 77 // No Xfer processors that might do blending inside the shader. |
| 78 // Coverage modulation for mixed samples is done *after* shading, so ble
nding |
| 79 // must occur in the ROP. |
| 80 // TODO: Update Xfer processors to better support mixed samples. |
| 81 if (paint.getXPFactory()->willNeedDstCopy(*fContext->getGpu()->caps(), |
| 82 GrProcOptInfo(), GrProcOptInfo())) { |
| 83 return false; |
| 84 } |
| 85 } |
| 86 |
72 // No color bitmap fonts. | 87 // No color bitmap fonts. |
73 SkScalerContext::Rec rec; | 88 SkScalerContext::Rec rec; |
74 SkScalerContext::MakeRec(skPaint, &fDeviceProperties, NULL, &rec); | 89 SkScalerContext::MakeRec(skPaint, &fDeviceProperties, NULL, &rec); |
75 return rec.getFormat() != SkMask::kARGB32_Format; | 90 return rec.getFormat() != SkMask::kARGB32_Format; |
76 } | 91 } |
77 | 92 |
78 void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt, | 93 void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt, |
79 const GrClip& clip, | 94 const GrClip& clip, |
80 const GrPaint& paint, | 95 const GrPaint& paint, |
81 const SkPaint& skPaint, | 96 const SkPaint& skPaint, |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, NULL, true /*igno
reGamma*/); | 382 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, NULL, true /*igno
reGamma*/); |
368 fGlyphs = canUseRawPaths ? | 383 fGlyphs = canUseRawPaths ? |
369 get_gr_glyphs(fContext, fSkPaint.getTypeface(), NULL, fStr
oke) : | 384 get_gr_glyphs(fContext, fSkPaint.getTypeface(), NULL, fStr
oke) : |
370 get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->g
etTypeface(), | 385 get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->g
etTypeface(), |
371 &fGlyphCache->getDescriptor(), fStroke); | 386 &fGlyphCache->getDescriptor(), fStroke); |
372 } | 387 } |
373 | 388 |
374 fStateRestore.set(&fPipelineBuilder); | 389 fStateRestore.set(&fPipelineBuilder); |
375 | 390 |
376 fPipelineBuilder.setFromPaint(fPaint, fRenderTarget, fClip); | 391 fPipelineBuilder.setFromPaint(fPaint, fRenderTarget, fClip); |
| 392 SkASSERT(fRenderTarget->isMultisampled(GrRenderTarget::kStencil_BufferBit)); |
| 393 fPipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_StateBit, fPaint.i
sAntiAlias()); |
377 | 394 |
378 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 395 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, |
379 kZero_StencilOp, | 396 kZero_StencilOp, |
380 kZero_StencilOp, | 397 kZero_StencilOp, |
381 kNotEqual_StencilFunc, | 398 kNotEqual_StencilFunc, |
382 0xffff, | 399 0xffff, |
383 0x0000, | 400 0x0000, |
384 0xffff); | 401 0xffff); |
385 | 402 |
386 *fPipelineBuilder.stencil() = kStencilPass; | 403 *fPipelineBuilder.stencil() = kStencilPass; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 | 496 |
480 SkGlyphCache::AttachCache(fGlyphCache); | 497 SkGlyphCache::AttachCache(fGlyphCache); |
481 fGlyphCache = NULL; | 498 fGlyphCache = NULL; |
482 | 499 |
483 fPipelineBuilder.stencil()->setDisabled(); | 500 fPipelineBuilder.stencil()->setDisabled(); |
484 fStateRestore.set(NULL); | 501 fStateRestore.set(NULL); |
485 fViewMatrix = fContextInitialMatrix; | 502 fViewMatrix = fContextInitialMatrix; |
486 GrTextContext::finish(); | 503 GrTextContext::finish(); |
487 } | 504 } |
488 | 505 |
OLD | NEW |