• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
setConicBounds(const SkPoint curve[3],SkScalar curveWeight,double tStart,double tEnd,SkPathOpsBounds * bounds)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 
setCubicBounds(const SkPoint curve[4],SkScalar,double tStart,double tEnd,SkPathOpsBounds * bounds)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 
setQuadBounds(const SkPoint curve[3],SkScalar,double tStart,double tEnd,SkPathOpsBounds * bounds)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 }
40