OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2012 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 #include "SkPathOpsBounds.h" | |
8 #include "SkPathOpsConic.h" | |
9 #include "SkPathOpsCubic.h" | |
10 #include "SkPathOpsLine.h" | |
11 #include "SkPathOpsQuad.h" | |
12 | |
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 ) { | |
23 SkDCubic cubic; | |
24 cubic.set(a); | |
25 SkDRect dRect; | |
26 dRect.setBounds(cubic); | |
27 set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), | |
28 SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); | |
29 } | |
30 | |
31 void SkPathOpsBounds::setLineBounds(const SkPoint a[2], SkScalar ) { | |
32 setPointBounds(a[0]); | |
33 add(a[1]); | |
34 } | |
35 | |
36 void SkPathOpsBounds::setQuadBounds(const SkPoint a[3], SkScalar ) { | |
37 SkDQuad quad; | |
38 quad.set(a); | |
39 SkDRect dRect; | |
40 dRect.setBounds(quad); | |
41 set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), | |
42 SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); | |
43 } | |
44 | |
45 void (SkPathOpsBounds::* const SetCurveBounds[])(const SkPoint[], SkScalar weigh
t) = { | |
46 NULL, | |
47 &SkPathOpsBounds::setLineBounds, | |
48 &SkPathOpsBounds::setQuadBounds, | |
49 &SkPathOpsBounds::setConicBounds, | |
50 &SkPathOpsBounds::setCubicBounds | |
51 }; | |
OLD | NEW |