| 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 #include "SkPathOpsBounds.h" | 7 #include "SkPathOpsBounds.h" |
| 8 #include "SkPathOpsConic.h" |
| 8 #include "SkPathOpsCubic.h" | 9 #include "SkPathOpsCubic.h" |
| 9 #include "SkPathOpsLine.h" | 10 #include "SkPathOpsLine.h" |
| 10 #include "SkPathOpsQuad.h" | 11 #include "SkPathOpsQuad.h" |
| 11 | 12 |
| 12 void SkPathOpsBounds::setCubicBounds(const SkPoint a[4]) { | 13 void SkPathOpsBounds::setConicBounds(const SkPoint a[3], SkScalar weight) { |
| 14 SkDConic conic; |
| 15 conic.set(a, weight); |
| 16 SkDRect dRect; |
| 17 dRect.setBounds(conic); |
| 18 set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), |
| 19 SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); |
| 20 } |
| 21 |
| 22 void SkPathOpsBounds::setCubicBounds(const SkPoint a[4], SkScalar ) { |
| 13 SkDCubic cubic; | 23 SkDCubic cubic; |
| 14 cubic.set(a); | 24 cubic.set(a); |
| 15 SkDRect dRect; | 25 SkDRect dRect; |
| 16 dRect.setBounds(cubic); | 26 dRect.setBounds(cubic); |
| 17 set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), | 27 set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), |
| 18 SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); | 28 SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); |
| 19 } | 29 } |
| 20 | 30 |
| 21 void SkPathOpsBounds::setLineBounds(const SkPoint a[2]) { | 31 void SkPathOpsBounds::setLineBounds(const SkPoint a[2], SkScalar ) { |
| 22 setPointBounds(a[0]); | 32 setPointBounds(a[0]); |
| 23 add(a[1]); | 33 add(a[1]); |
| 24 } | 34 } |
| 25 | 35 |
| 26 void SkPathOpsBounds::setQuadBounds(const SkPoint a[3]) { | 36 void SkPathOpsBounds::setQuadBounds(const SkPoint a[3], SkScalar ) { |
| 27 SkDQuad quad; | 37 SkDQuad quad; |
| 28 quad.set(a); | 38 quad.set(a); |
| 29 SkDRect dRect; | 39 SkDRect dRect; |
| 30 dRect.setBounds(quad); | 40 dRect.setBounds(quad); |
| 31 set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), | 41 set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), |
| 32 SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); | 42 SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); |
| 33 } | 43 } |
| 34 | 44 |
| 35 void (SkPathOpsBounds::* const SetCurveBounds[])(const SkPoint[]) = { | 45 void (SkPathOpsBounds::* const SetCurveBounds[])(const SkPoint[], SkScalar weigh
t) = { |
| 36 NULL, | 46 NULL, |
| 37 &SkPathOpsBounds::setLineBounds, | 47 &SkPathOpsBounds::setLineBounds, |
| 38 &SkPathOpsBounds::setQuadBounds, | 48 &SkPathOpsBounds::setQuadBounds, |
| 49 &SkPathOpsBounds::setConicBounds, |
| 39 &SkPathOpsBounds::setCubicBounds | 50 &SkPathOpsBounds::setCubicBounds |
| 40 }; | 51 }; |
| OLD | NEW |