| 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 "GrPathRendering.h" | 8 #include "GrPathRendering.h" |
| 9 #include "SkDescriptor.h" | 9 #include "SkDescriptor.h" |
| 10 #include "SkGlyph.h" | 10 #include "SkGlyph.h" |
| 11 #include "SkMatrix.h" | 11 #include "SkMatrix.h" |
| 12 #include "SkTypeface.h" | 12 #include "SkTypeface.h" |
| 13 #include "GrPathRange.h" | 13 #include "GrPathRange.h" |
| 14 | 14 |
| 15 const GrUserStencilSettings& GrPathRendering::GetStencilPassSettings(FillType fi
ll) { |
| 16 switch (fill) { |
| 17 default: |
| 18 SkFAIL("Unexpected path fill."); |
| 19 case GrPathRendering::kWinding_FillType: { |
| 20 constexpr static GrUserStencilSettings kWindingStencilPass( |
| 21 GrUserStencilSettings::StaticInit< |
| 22 0xffff, |
| 23 GrUserStencilTest::kAlwaysIfInClip, |
| 24 0xffff, |
| 25 GrUserStencilOp::kIncWrap, |
| 26 GrUserStencilOp::kIncWrap, |
| 27 0xffff>() |
| 28 ); |
| 29 return kWindingStencilPass; |
| 30 } |
| 31 case GrPathRendering::kEvenOdd_FillType: { |
| 32 constexpr static GrUserStencilSettings kEvenOddStencilPass( |
| 33 GrUserStencilSettings::StaticInit< |
| 34 0xffff, |
| 35 GrUserStencilTest::kAlwaysIfInClip, |
| 36 0xffff, |
| 37 GrUserStencilOp::kInvert, |
| 38 GrUserStencilOp::kInvert, |
| 39 0xffff>() |
| 40 ); |
| 41 return kEvenOddStencilPass; |
| 42 } |
| 43 } |
| 44 } |
| 45 |
| 15 class GlyphGenerator : public GrPathRange::PathGenerator { | 46 class GlyphGenerator : public GrPathRange::PathGenerator { |
| 16 public: | 47 public: |
| 17 GlyphGenerator(const SkTypeface& typeface, const SkScalerContextEffects& eff
ects, | 48 GlyphGenerator(const SkTypeface& typeface, const SkScalerContextEffects& eff
ects, |
| 18 const SkDescriptor& desc) | 49 const SkDescriptor& desc) |
| 19 : fScalerContext(typeface.createScalerContext(effects, &desc)) | 50 : fScalerContext(typeface.createScalerContext(effects, &desc)) |
| 20 #ifdef SK_DEBUG | 51 #ifdef SK_DEBUG |
| 21 , fDesc(desc.copy()) | 52 , fDesc(desc.copy()) |
| 22 #endif | 53 #endif |
| 23 {} | 54 {} |
| 24 | 55 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 genericDesc->init(); | 109 genericDesc->init(); |
| 79 genericDesc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec); | 110 genericDesc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec); |
| 80 genericDesc->computeChecksum(); | 111 genericDesc->computeChecksum(); |
| 81 | 112 |
| 82 // No effects, so we make a dummy struct | 113 // No effects, so we make a dummy struct |
| 83 SkScalerContextEffects noEffects; | 114 SkScalerContextEffects noEffects; |
| 84 | 115 |
| 85 SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, noEffec
ts, *genericDesc)); | 116 SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, noEffec
ts, *genericDesc)); |
| 86 return this->createPathRange(generator, style); | 117 return this->createPathRange(generator, style); |
| 87 } | 118 } |
| OLD | NEW |