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 "GrBitmapTextContext.h" | 9 #include "GrBitmapTextContext.h" |
10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 return false; | 55 return false; |
56 } | 56 } |
57 | 57 |
58 // No hairlines unless we can map the 1 px width to the object space. | 58 // No hairlines unless we can map the 1 px width to the object space. |
59 if (skPaint.getStyle() == SkPaint::kStroke_Style | 59 if (skPaint.getStyle() == SkPaint::kStroke_Style |
60 && skPaint.getStrokeWidth() == 0 | 60 && skPaint.getStrokeWidth() == 0 |
61 && viewMatrix.hasPerspective()) { | 61 && viewMatrix.hasPerspective()) { |
62 return false; | 62 return false; |
63 } | 63 } |
64 | 64 |
65 if (skPaint.isAntiAlias() && | |
66 kStencil_GrSampleConfig == rt->sampleConfig() && | |
67 !paint.getXPFactory()->canTweakAlphaForCoverage()) { | |
Chris Dalton
2015/03/26 05:11:39
We may need to check if it will do in-shader blend
bsalomon
2015/03/31 16:37:33
I think your concern is correct. Adding egdaniel@
| |
68 return false; | |
69 } | |
70 | |
65 // No color bitmap fonts. | 71 // No color bitmap fonts. |
66 SkScalerContext::Rec rec; | 72 SkScalerContext::Rec rec; |
67 SkScalerContext::MakeRec(skPaint, &fDeviceProperties, NULL, &rec); | 73 SkScalerContext::MakeRec(skPaint, &fDeviceProperties, NULL, &rec); |
68 return rec.getFormat() != SkMask::kARGB32_Format; | 74 return rec.getFormat() != SkMask::kARGB32_Format; |
69 } | 75 } |
70 | 76 |
71 void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt, | 77 void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt, |
72 const GrClip& clip, | 78 const GrClip& clip, |
73 const GrPaint& paint, | 79 const GrPaint& paint, |
74 const SkPaint& skPaint, | 80 const SkPaint& skPaint, |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, NULL, true /*igno reGamma*/); | 361 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, NULL, true /*igno reGamma*/); |
356 fGlyphs = canUseRawPaths ? | 362 fGlyphs = canUseRawPaths ? |
357 get_gr_glyphs(fContext, fSkPaint.getTypeface(), NULL, fStr oke) : | 363 get_gr_glyphs(fContext, fSkPaint.getTypeface(), NULL, fStr oke) : |
358 get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->g etTypeface(), | 364 get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->g etTypeface(), |
359 &fGlyphCache->getDescriptor(), fStroke); | 365 &fGlyphCache->getDescriptor(), fStroke); |
360 } | 366 } |
361 | 367 |
362 fStateRestore.set(&fPipelineBuilder); | 368 fStateRestore.set(&fPipelineBuilder); |
363 | 369 |
364 fPipelineBuilder.setFromPaint(fPaint, fRenderTarget, fClip); | 370 fPipelineBuilder.setFromPaint(fPaint, fRenderTarget, fClip); |
371 SkASSERT(fRenderTarget->isMultisampled(GrRenderTarget::kStencilBuffer_Pipeli neStage)); | |
372 fPipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_StateBit, fPaint.i sAntiAlias()); | |
365 | 373 |
366 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 374 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, |
367 kZero_StencilOp, | 375 kZero_StencilOp, |
368 kZero_StencilOp, | 376 kZero_StencilOp, |
369 kNotEqual_StencilFunc, | 377 kNotEqual_StencilFunc, |
370 0xffff, | 378 0xffff, |
371 0x0000, | 379 0x0000, |
372 0xffff); | 380 0xffff); |
373 | 381 |
374 *fPipelineBuilder.stencil() = kStencilPass; | 382 *fPipelineBuilder.stencil() = kStencilPass; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
467 | 475 |
468 SkGlyphCache::AttachCache(fGlyphCache); | 476 SkGlyphCache::AttachCache(fGlyphCache); |
469 fGlyphCache = NULL; | 477 fGlyphCache = NULL; |
470 | 478 |
471 fPipelineBuilder.stencil()->setDisabled(); | 479 fPipelineBuilder.stencil()->setDisabled(); |
472 fStateRestore.set(NULL); | 480 fStateRestore.set(NULL); |
473 fViewMatrix = fContextInitialMatrix; | 481 fViewMatrix = fContextInitialMatrix; |
474 GrTextContext::finish(); | 482 GrTextContext::finish(); |
475 } | 483 } |
476 | 484 |
OLD | NEW |