OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkTypes.h" | 8 #include "SkTypes.h" |
9 | 9 |
10 #include "SkDWriteGeometrySink.h" | 10 #include "SkDWriteGeometrySink.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 void STDMETHODCALLTYPE SkDWriteGeometrySink::SetFillMode(D2D1_FILL_MODE fillMode
) { | 47 void STDMETHODCALLTYPE SkDWriteGeometrySink::SetFillMode(D2D1_FILL_MODE fillMode
) { |
48 switch (fillMode) { | 48 switch (fillMode) { |
49 case D2D1_FILL_MODE_ALTERNATE: | 49 case D2D1_FILL_MODE_ALTERNATE: |
50 fPath->setFillType(SkPath::kEvenOdd_FillType); | 50 fPath->setFillType(SkPath::kEvenOdd_FillType); |
51 break; | 51 break; |
52 case D2D1_FILL_MODE_WINDING: | 52 case D2D1_FILL_MODE_WINDING: |
53 fPath->setFillType(SkPath::kWinding_FillType); | 53 fPath->setFillType(SkPath::kWinding_FillType); |
54 break; | 54 break; |
55 default: | 55 default: |
56 SkASSERT(!"Unknown D2D1_FILL_MODE."); | 56 SkDEBUGFAIL("Unknown D2D1_FILL_MODE."); |
57 break; | 57 break; |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 void STDMETHODCALLTYPE SkDWriteGeometrySink::SetSegmentFlags(D2D1_PATH_SEGMENT v
ertexFlags) { | 61 void STDMETHODCALLTYPE SkDWriteGeometrySink::SetSegmentFlags(D2D1_PATH_SEGMENT v
ertexFlags) { |
62 if (vertexFlags == D2D1_PATH_SEGMENT_NONE || vertexFlags == D2D1_PATH_SEGMEN
T_FORCE_ROUND_LINE_JOIN) { | 62 if (vertexFlags == D2D1_PATH_SEGMENT_NONE || vertexFlags == D2D1_PATH_SEGMEN
T_FORCE_ROUND_LINE_JOIN) { |
63 SkASSERT(!"Invalid D2D1_PATH_SEGMENT value."); | 63 SkDEBUGFAIL("Invalid D2D1_PATH_SEGMENT value."); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 void STDMETHODCALLTYPE SkDWriteGeometrySink::BeginFigure(D2D1_POINT_2F startPoin
t, D2D1_FIGURE_BEGIN figureBegin) { | 67 void STDMETHODCALLTYPE SkDWriteGeometrySink::BeginFigure(D2D1_POINT_2F startPoin
t, D2D1_FIGURE_BEGIN figureBegin) { |
68 fPath->moveTo(SkFloatToScalar(startPoint.x), SkFloatToScalar(startPoint.y)); | 68 fPath->moveTo(SkFloatToScalar(startPoint.x), SkFloatToScalar(startPoint.y)); |
69 if (figureBegin == D2D1_FIGURE_BEGIN_HOLLOW) { | 69 if (figureBegin == D2D1_FIGURE_BEGIN_HOLLOW) { |
70 SkASSERT(!"Invalid D2D1_FIGURE_BEGIN value."); | 70 SkDEBUGFAIL("Invalid D2D1_FIGURE_BEGIN value."); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 void STDMETHODCALLTYPE SkDWriteGeometrySink::AddLines(const D2D1_POINT_2F *point
s, UINT pointsCount) { | 74 void STDMETHODCALLTYPE SkDWriteGeometrySink::AddLines(const D2D1_POINT_2F *point
s, UINT pointsCount) { |
75 for (const D2D1_POINT_2F *end = &points[pointsCount]; points < end; ++points
) { | 75 for (const D2D1_POINT_2F *end = &points[pointsCount]; points < end; ++points
) { |
76 fPath->lineTo(SkFloatToScalar(points->x), SkFloatToScalar(points->y)); | 76 fPath->lineTo(SkFloatToScalar(points->x), SkFloatToScalar(points->y)); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 static bool approximately_equal(float a, float b) { | 80 static bool approximately_equal(float a, float b) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 HRESULT SkDWriteGeometrySink::Close() { | 139 HRESULT SkDWriteGeometrySink::Close() { |
140 return S_OK; | 140 return S_OK; |
141 } | 141 } |
142 | 142 |
143 HRESULT SkDWriteGeometrySink::Create(SkPath* path, IDWriteGeometrySink** geometr
yToPath) { | 143 HRESULT SkDWriteGeometrySink::Create(SkPath* path, IDWriteGeometrySink** geometr
yToPath) { |
144 *geometryToPath = new SkDWriteGeometrySink(path); | 144 *geometryToPath = new SkDWriteGeometrySink(path); |
145 return S_OK; | 145 return S_OK; |
146 } | 146 } |
OLD | NEW |