caryclark | aec2510 | 2015-04-29 08:28:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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 "SkPathOpsRect.h" |
| 9 | #include "SkPathOpsCurve.h" |
| 10 | |
caryclark | aec2510 | 2015-04-29 08:28:30 -0700 | [diff] [blame] | 11 | void SkDCurve::setConicBounds(const SkPoint curve[3], SkScalar curveWeight, |
| 12 | double tStart, double tEnd, SkPathOpsBounds* bounds) { |
| 13 | SkDConic dCurve; |
| 14 | dCurve.set(curve, curveWeight); |
| 15 | SkDRect dRect; |
| 16 | dRect.setBounds(dCurve, fConic, tStart, tEnd); |
| 17 | bounds->set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), |
| 18 | SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); |
| 19 | } |
| 20 | |
| 21 | void SkDCurve::setCubicBounds(const SkPoint curve[4], SkScalar , |
| 22 | double tStart, double tEnd, SkPathOpsBounds* bounds) { |
| 23 | SkDCubic dCurve; |
| 24 | dCurve.set(curve); |
| 25 | SkDRect dRect; |
| 26 | dRect.setBounds(dCurve, fCubic, tStart, tEnd); |
| 27 | bounds->set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), |
| 28 | SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); |
| 29 | } |
| 30 | |
caryclark | aec2510 | 2015-04-29 08:28:30 -0700 | [diff] [blame] | 31 | void SkDCurve::setQuadBounds(const SkPoint curve[3], SkScalar , |
| 32 | double tStart, double tEnd, SkPathOpsBounds* bounds) { |
| 33 | SkDQuad dCurve; |
| 34 | dCurve.set(curve); |
| 35 | SkDRect dRect; |
| 36 | dRect.setBounds(dCurve, fQuad, tStart, tEnd); |
| 37 | bounds->set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), |
| 38 | SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); |
| 39 | } |