| 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()) { |
| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 360 |
| 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, kStencilBuffer_G
rPipelineStage); |
| 365 | 371 |
| 366 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 372 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, |
| 367 kZero_StencilOp, | 373 kZero_StencilOp, |
| 368 kZero_StencilOp, | 374 kZero_StencilOp, |
| 369 kNotEqual_StencilFunc, | 375 kNotEqual_StencilFunc, |
| 370 0xffff, | 376 0xffff, |
| 371 0x0000, | 377 0x0000, |
| 372 0xffff); | 378 0xffff); |
| 373 | 379 |
| 374 *fPipelineBuilder.stencil() = kStencilPass; | 380 *fPipelineBuilder.stencil() = kStencilPass; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 473 |
| 468 SkGlyphCache::AttachCache(fGlyphCache); | 474 SkGlyphCache::AttachCache(fGlyphCache); |
| 469 fGlyphCache = NULL; | 475 fGlyphCache = NULL; |
| 470 | 476 |
| 471 fPipelineBuilder.stencil()->setDisabled(); | 477 fPipelineBuilder.stencil()->setDisabled(); |
| 472 fStateRestore.set(NULL); | 478 fStateRestore.set(NULL); |
| 473 fViewMatrix = fContextInitialMatrix; | 479 fViewMatrix = fContextInitialMatrix; |
| 474 GrTextContext::finish(); | 480 GrTextContext::finish(); |
| 475 } | 481 } |
| 476 | 482 |
| OLD | NEW |