| OLD | NEW |
| 1 /* libs/graphics/sgl/SkEdge.cpp | 1 /* libs/graphics/sgl/SkEdge.cpp |
| 2 ** | 2 ** |
| 3 ** Copyright 2006, The Android Open Source Project | 3 ** Copyright 2006, The Android Open Source Project |
| 4 ** | 4 ** |
| 5 ** Licensed under the Apache License, Version 2.0 (the "License"); | 5 ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 ** you may not use this file except in compliance with the License. | 6 ** you may not use this file except in compliance with the License. |
| 7 ** You may obtain a copy of the License at | 7 ** You may obtain a copy of the License at |
| 8 ** | 8 ** |
| 9 ** http://www.apache.org/licenses/LICENSE-2.0 | 9 ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 ** | 10 ** |
| 11 ** Unless required by applicable law or agreed to in writing, software | 11 ** Unless required by applicable law or agreed to in writing, software |
| 12 ** distributed under the License is distributed on an "AS IS" BASIS, | 12 ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 ** See the License for the specific language governing permissions and | 14 ** See the License for the specific language governing permissions and |
| 15 ** limitations under the License. | 15 ** limitations under the License. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 #include "SkEdge.h" | 18 #include "SkEdge.h" |
| 19 #include "SkFDot6.h" | 19 #include "SkFDot6.h" |
| 20 | 20 |
| 21 /* | 21 /* |
| 22 In setLine, setQuadratic, setCubic, the first thing we do is to convert | 22 In setLine, setQuadratic, setCubic, the first thing we do is to convert |
| 23 the points into FDot6. This is modulated by the shift parameter, which | 23 the points into FDot6. This is modulated by the shift parameter, which |
| 24 will either be 0, or something like 2 for antialiasing. | 24 will either be 0, or something like 2 for antialiasing. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 SkFDot6 dy = ((y1 << 1) - y0 - y2) >> 2; | 219 SkFDot6 dy = ((y1 << 1) - y0 - y2) >> 2; |
| 220 shift = diff_to_shift(dx, dy); | 220 shift = diff_to_shift(dx, dy); |
| 221 SkASSERT(shift >= 0); | 221 SkASSERT(shift >= 0); |
| 222 } | 222 } |
| 223 // need at least 1 subdivision for our bias trick | 223 // need at least 1 subdivision for our bias trick |
| 224 if (shift == 0) { | 224 if (shift == 0) { |
| 225 shift = 1; | 225 shift = 1; |
| 226 } else if (shift > MAX_COEFF_SHIFT) { | 226 } else if (shift > MAX_COEFF_SHIFT) { |
| 227 shift = MAX_COEFF_SHIFT; | 227 shift = MAX_COEFF_SHIFT; |
| 228 } | 228 } |
| 229 | 229 |
| 230 fWinding = SkToS8(winding); | 230 fWinding = SkToS8(winding); |
| 231 fCurveShift = SkToU8(shift); | 231 fCurveShift = SkToU8(shift); |
| 232 //fCubicDShift only set for cubics | 232 //fCubicDShift only set for cubics |
| 233 fCurveCount = SkToS8(1 << shift); | 233 fCurveCount = SkToS8(1 << shift); |
| 234 | 234 |
| 235 SkFixed A = SkFDot6ToFixed(x0 - x1 - x1 + x2); | 235 SkFixed A = SkFDot6ToFixed(x0 - x1 - x1 + x2); |
| 236 SkFixed B = SkFDot6ToFixed(x1 - x0 + x1 - x0); | 236 SkFixed B = SkFDot6ToFixed(x1 - x0 + x1 - x0); |
| 237 | 237 |
| 238 fQx = SkFDot6ToFixed(x0); | 238 fQx = SkFDot6ToFixed(x0); |
| 239 fQDx = B + (A >> shift); // biased by shift | 239 fQDx = B + (A >> shift); // biased by shift |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 } while (count < 0 && !success); | 464 } while (count < 0 && !success); |
| 465 | 465 |
| 466 fCx = newx; | 466 fCx = newx; |
| 467 fCy = newy; | 467 fCy = newy; |
| 468 fCurveCount = SkToS16(count); | 468 fCurveCount = SkToS16(count); |
| 469 return success; | 469 return success; |
| 470 } | 470 } |
| 471 | 471 |
| 472 | 472 |
| 473 | 473 |
| OLD | NEW |