OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 #ifndef SkLinearBitmapPipeline_tile_DEFINED | 8 #ifndef SkLinearBitmapPipeline_tile_DEFINED |
9 #define SkLinearBitmapPipeline_tile_DEFINED | 9 #define SkLinearBitmapPipeline_tile_DEFINED |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 Span middle = span.breakAt(xMax, dx); | 93 Span middle = span.breakAt(xMax, dx); |
94 if (!middle.isEmpty()) { | 94 if (!middle.isEmpty()) { |
95 next->pointSpan(middle); | 95 next->pointSpan(middle); |
96 } | 96 } |
97 if (!span.isEmpty()) { | 97 if (!span.isEmpty()) { |
98 span.clampToSinglePixel({xMax - 1, y}); | 98 span.clampToSinglePixel({xMax - 1, y}); |
99 next->pointSpan(span); | 99 next->pointSpan(span); |
100 } | 100 } |
101 } else { | 101 } else { |
102 Span rightClamped = span.breakAt(xMax, dx); | 102 Span rightClamped = span.breakAt(xMax, dx); |
| 103 |
103 if (!rightClamped.isEmpty()) { | 104 if (!rightClamped.isEmpty()) { |
104 rightClamped.clampToSinglePixel({xMax - 1, y}); | 105 rightClamped.clampToSinglePixel({xMax - 1, y}); |
105 next->pointSpan(rightClamped); | 106 next->pointSpan(rightClamped); |
106 } | 107 } |
107 Span middle = span.breakAt(xMin, dx); | 108 Span middle = span.breakAt(xMin, dx); |
108 if (!middle.isEmpty()) { | 109 if (!middle.isEmpty()) { |
109 next->pointSpan(middle); | 110 next->pointSpan(middle); |
110 } | 111 } |
111 if (!span.isEmpty()) { | 112 if (!span.isEmpty()) { |
112 span.clampToSinglePixel({xMin, y}); | 113 span.clampToSinglePixel({xMin, y}); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // | 192 // |
192 // Overall Strategy: | 193 // Overall Strategy: |
193 // While the span hangs over the edge of the tile, draw the span coverin
g the tile then | 194 // While the span hangs over the edge of the tile, draw the span coverin
g the tile then |
194 // slide the span over to the next tile. | 195 // slide the span over to the next tile. |
195 | 196 |
196 // The guard could have been count > 0, but then a bunch of math would b
e done in the | 197 // The guard could have been count > 0, but then a bunch of math would b
e done in the |
197 // common case. | 198 // common case. |
198 | 199 |
199 Span span({x, y}, length, count); | 200 Span span({x, y}, length, count); |
200 if (dx > 0) { | 201 if (dx > 0) { |
201 while (!span.isEmpty() && span.endX() > xMax) { | 202 while (!span.isEmpty() && span.endX() >= xMax) { |
202 Span toDraw = span.breakAt(xMax, dx); | 203 Span toDraw = span.breakAt(xMax, dx); |
203 next->pointSpan(toDraw); | 204 next->pointSpan(toDraw); |
204 span.offset(-xMax); | 205 span.offset(-xMax); |
205 } | 206 } |
206 } else { | 207 } else { |
207 while (!span.isEmpty() && span.endX() < xMin) { | 208 while (!span.isEmpty() && span.endX() < xMin) { |
208 Span toDraw = span.breakAt(xMin, dx); | 209 Span toDraw = span.breakAt(xMin, dx); |
209 next->pointSpan(toDraw); | 210 next->pointSpan(toDraw); |
210 span.offset(xMax); | 211 span.offset(xMax); |
211 } | 212 } |
(...skipping 17 matching lines...) Expand all Loading... |
229 return x - std::floor(x / base) * base; | 230 return x - std::floor(x / base) * base; |
230 } | 231 } |
231 const Sk4s fXMax{0.0f}; | 232 const Sk4s fXMax{0.0f}; |
232 const Sk4s fXInvMax{0.0f}; | 233 const Sk4s fXInvMax{0.0f}; |
233 const Sk4s fYMax{0.0f}; | 234 const Sk4s fYMax{0.0f}; |
234 const Sk4s fYInvMax{0.0f}; | 235 const Sk4s fYInvMax{0.0f}; |
235 }; | 236 }; |
236 | 237 |
237 } // namespace | 238 } // namespace |
238 #endif // SkLinearBitmapPipeline_tile_DEFINED | 239 #endif // SkLinearBitmapPipeline_tile_DEFINED |
OLD | NEW |