| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkEdge.h" | 10 #include "SkEdge.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 // are we completely above or below the clip? | 68 // are we completely above or below the clip? |
| 69 if (clip && (top >= clip->fBottom || bot <= clip->fTop)) { | 69 if (clip && (top >= clip->fBottom || bot <= clip->fTop)) { |
| 70 return 0; | 70 return 0; |
| 71 } | 71 } |
| 72 | 72 |
| 73 SkFixed slope = SkFDot6Div(x1 - x0, y1 - y0); | 73 SkFixed slope = SkFDot6Div(x1 - x0, y1 - y0); |
| 74 const SkFDot6 dy = SkEdge_Compute_DY(top, y0); | 74 const SkFDot6 dy = SkEdge_Compute_DY(top, y0); |
| 75 | 75 |
| 76 fX = SkFDot6ToFixed(x0 + SkFixedMul(slope, dy)); // + SK_Fixed1/2 | 76 fX = SkFDot6ToFixed(x0 + SkFixedMul(slope, dy)); // + SK_Fixed1/2 |
| 77 fFirstXf = winding < 0 ? p1.fX : p0.fX; |
| 77 fDX = slope; | 78 fDX = slope; |
| 78 fFirstY = top; | 79 fFirstY = top; |
| 80 fFirstYf = static_cast<float>(top); |
| 79 fLastY = bot - 1; | 81 fLastY = bot - 1; |
| 80 fCurveCount = 0; | 82 fCurveCount = 0; |
| 81 fWinding = SkToS8(winding); | 83 fWinding = SkToS8(winding); |
| 82 fCurveShift = 0; | 84 fCurveShift = 0; |
| 83 | 85 |
| 84 if (clip) { | 86 if (clip) { |
| 85 this->chopLineWithClip(*clip); | 87 this->chopLineWithClip(*clip); |
| 86 } | 88 } |
| 87 return 1; | 89 return 1; |
| 88 } | 90 } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 261 |
| 260 A = SkFDot6ToFixedDiv2(y0 - y1 - y1 + y2); // 1/2 the real value | 262 A = SkFDot6ToFixedDiv2(y0 - y1 - y1 + y2); // 1/2 the real value |
| 261 B = SkFDot6ToFixed(y1 - y0); // 1/2 the real value | 263 B = SkFDot6ToFixed(y1 - y0); // 1/2 the real value |
| 262 | 264 |
| 263 fQy = SkFDot6ToFixed(y0); | 265 fQy = SkFDot6ToFixed(y0); |
| 264 fQDy = B + (A >> shift); // biased by shift | 266 fQDy = B + (A >> shift); // biased by shift |
| 265 fQDDy = A >> (shift - 1); // biased by shift | 267 fQDDy = A >> (shift - 1); // biased by shift |
| 266 | 268 |
| 267 fQLastX = SkFDot6ToFixed(x2); | 269 fQLastX = SkFDot6ToFixed(x2); |
| 268 fQLastY = SkFDot6ToFixed(y2); | 270 fQLastY = SkFDot6ToFixed(y2); |
| 271 fFirstXf = winding < 0 ? pts[2].fX : pts[0].fX; |
| 272 fFirstYf = static_cast<float>(top); |
| 269 | 273 |
| 270 return this->updateQuadratic(); | 274 return this->updateQuadratic(); |
| 271 } | 275 } |
| 272 | 276 |
| 273 int SkQuadraticEdge::updateQuadratic() | 277 int SkQuadraticEdge::updateQuadratic() |
| 274 { | 278 { |
| 275 int success; | 279 int success; |
| 276 int count = fCurveCount; | 280 int count = fCurveCount; |
| 277 SkFixed oldx = fQx; | 281 SkFixed oldx = fQx; |
| 278 SkFixed oldy = fQy; | 282 SkFixed oldy = fQy; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 D = SkFDot6UpShift(y3 + 3 * (y1 - y2) - y0, upShift); | 425 D = SkFDot6UpShift(y3 + 3 * (y1 - y2) - y0, upShift); |
| 422 | 426 |
| 423 fCy = SkFDot6ToFixed(y0); | 427 fCy = SkFDot6ToFixed(y0); |
| 424 fCDy = B + (C >> shift) + (D >> 2*shift); // biased by shift | 428 fCDy = B + (C >> shift) + (D >> 2*shift); // biased by shift |
| 425 fCDDy = 2*C + (3*D >> (shift - 1)); // biased by 2*shift | 429 fCDDy = 2*C + (3*D >> (shift - 1)); // biased by 2*shift |
| 426 fCDDDy = 3*D >> (shift - 1); // biased by 2*shift | 430 fCDDDy = 3*D >> (shift - 1); // biased by 2*shift |
| 427 | 431 |
| 428 fCLastX = SkFDot6ToFixed(x3); | 432 fCLastX = SkFDot6ToFixed(x3); |
| 429 fCLastY = SkFDot6ToFixed(y3); | 433 fCLastY = SkFDot6ToFixed(y3); |
| 430 | 434 |
| 435 fFirstXf = winding < 0 ? pts[3].fX : pts[0].fX; |
| 436 fFirstYf = static_cast<float>(top); |
| 431 return this->updateCubic(); | 437 return this->updateCubic(); |
| 432 } | 438 } |
| 433 | 439 |
| 434 int SkCubicEdge::updateCubic() | 440 int SkCubicEdge::updateCubic() |
| 435 { | 441 { |
| 436 int success; | 442 int success; |
| 437 int count = fCurveCount; | 443 int count = fCurveCount; |
| 438 SkFixed oldx = fCx; | 444 SkFixed oldx = fCx; |
| 439 SkFixed oldy = fCy; | 445 SkFixed oldy = fCy; |
| 440 SkFixed newx, newy; | 446 SkFixed newx, newy; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 470 success = this->updateLine(oldx, oldy, newx, newy); | 476 success = this->updateLine(oldx, oldy, newx, newy); |
| 471 oldx = newx; | 477 oldx = newx; |
| 472 oldy = newy; | 478 oldy = newy; |
| 473 } while (count < 0 && !success); | 479 } while (count < 0 && !success); |
| 474 | 480 |
| 475 fCx = newx; | 481 fCx = newx; |
| 476 fCy = newy; | 482 fCy = newy; |
| 477 fCurveCount = SkToS8(count); | 483 fCurveCount = SkToS8(count); |
| 478 return success; | 484 return success; |
| 479 } | 485 } |
| OLD | NEW |