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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 // No hairlines unless we can map the 1 px width to the object space. | 54 // No hairlines unless we can map the 1 px width to the object space. |
55 if (paint.getStyle() == SkPaint::kStroke_Style | 55 if (paint.getStyle() == SkPaint::kStroke_Style |
56 && paint.getStrokeWidth() == 0 | 56 && paint.getStrokeWidth() == 0 |
57 && viewMatrix.hasPerspective()) { | 57 && viewMatrix.hasPerspective()) { |
58 return false; | 58 return false; |
59 } | 59 } |
60 | 60 |
61 // No color bitmap fonts. | 61 // No color bitmap fonts. |
62 SkScalerContext::Rec rec; | 62 SkScalerContext::Rec rec; |
63 SkScalerContext::MakeRec(paint, &fDeviceProperties, NULL, &rec); | 63 SkScalerContext::MakeRec(paint, &fDeviceProperties, NULL, &rec); |
64 return rec.getFormat() != SkMask::kARGB32_Format; | 64 return rec.getFormat() != SkMask::kARGB32_Format; |
Chris Dalton
2015/03/17 00:39:35
Add some sort of check about:
if (paint.isAntiAl
| |
65 } | 65 } |
66 | 66 |
67 void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt, | 67 void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt, |
68 const GrClip& clip, | 68 const GrClip& clip, |
69 const GrPaint& paint, | 69 const GrPaint& paint, |
70 const SkPaint& skPaint, | 70 const SkPaint& skPaint, |
71 const SkMatrix& viewMatrix, | 71 const SkMatrix& viewMatrix, |
72 const char text[], | 72 const char text[], |
73 size_t byteLength, | 73 size_t byteLength, |
74 SkScalar x, SkScalar y) { | 74 SkScalar x, SkScalar y) { |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, NULL, true /*igno reGamma*/); | 351 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, NULL, true /*igno reGamma*/); |
352 fGlyphs = canUseRawPaths ? | 352 fGlyphs = canUseRawPaths ? |
353 get_gr_glyphs(fContext, fSkPaint.getTypeface(), NULL, fStr oke) : | 353 get_gr_glyphs(fContext, fSkPaint.getTypeface(), NULL, fStr oke) : |
354 get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->g etTypeface(), | 354 get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->g etTypeface(), |
355 &fGlyphCache->getDescriptor(), fStroke); | 355 &fGlyphCache->getDescriptor(), fStroke); |
356 } | 356 } |
357 | 357 |
358 fStateRestore.set(&fPipelineBuilder); | 358 fStateRestore.set(&fPipelineBuilder); |
359 | 359 |
360 fPipelineBuilder.setFromPaint(fPaint, fRenderTarget, fClip); | 360 fPipelineBuilder.setFromPaint(fPaint, fRenderTarget, fClip); |
361 fPipelineBuilder.enableState(GrPipelineBuilder::kHWAntialias_StateBit); | |
Chris Dalton
2015/03/16 19:31:24
I forgot before that we technically should only en
| |
361 | 362 |
362 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 363 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, |
363 kZero_StencilOp, | 364 kZero_StencilOp, |
364 kZero_StencilOp, | 365 kZero_StencilOp, |
365 kNotEqual_StencilFunc, | 366 kNotEqual_StencilFunc, |
366 0xffff, | 367 0xffff, |
367 0x0000, | 368 0x0000, |
368 0xffff); | 369 0xffff); |
369 | 370 |
370 *fPipelineBuilder.stencil() = kStencilPass; | 371 *fPipelineBuilder.stencil() = kStencilPass; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
463 | 464 |
464 SkGlyphCache::AttachCache(fGlyphCache); | 465 SkGlyphCache::AttachCache(fGlyphCache); |
465 fGlyphCache = NULL; | 466 fGlyphCache = NULL; |
466 | 467 |
467 fPipelineBuilder.stencil()->setDisabled(); | 468 fPipelineBuilder.stencil()->setDisabled(); |
468 fStateRestore.set(NULL); | 469 fStateRestore.set(NULL); |
469 fViewMatrix = fContextInitialMatrix; | 470 fViewMatrix = fContextInitialMatrix; |
470 GrTextContext::finish(); | 471 GrTextContext::finish(); |
471 } | 472 } |
472 | 473 |
OLD | NEW |