Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkPathOpsRect.h
Go to the documentation of this file.
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#ifndef SkPathOpsRect_DEFINED
8#define SkPathOpsRect_DEFINED
9
13
14#include <algorithm>
15
16class SkTCurve;
17struct SkDConic;
18struct SkDCubic;
19struct SkDQuad;
20
21struct SkDRect {
23
24 void add(const SkDPoint& pt) {
25 fLeft = std::min(fLeft, pt.fX);
26 fTop = std::min(fTop, pt.fY);
27 fRight = std::max(fRight, pt.fX);
28 fBottom = std::max(fBottom, pt.fY);
29 }
30
31 bool contains(const SkDPoint& pt) const {
34 }
35
36 void debugInit();
37
38 bool intersects(const SkDRect& r) const {
41 SkASSERT(r.fLeft <= r.fRight);
42 SkASSERT(r.fTop <= r.fBottom);
43 return r.fLeft <= fRight && fLeft <= r.fRight && r.fTop <= fBottom && fTop <= r.fBottom;
44 }
45
46 void set(const SkDPoint& pt) {
47 fLeft = fRight = pt.fX;
48 fTop = fBottom = pt.fY;
49 }
50
51 double width() const {
52 return fRight - fLeft;
53 }
54
55 double height() const {
56 return fBottom - fTop;
57 }
58
59 void setBounds(const SkDConic& curve) {
60 setBounds(curve, curve, 0, 1);
61 }
62
63 void setBounds(const SkDConic& curve, const SkDConic& sub, double tStart, double tEnd);
64
65 void setBounds(const SkDCubic& curve) {
66 setBounds(curve, curve, 0, 1);
67 }
68
69 void setBounds(const SkDCubic& curve, const SkDCubic& sub, double tStart, double tEnd);
70
71 void setBounds(const SkDQuad& curve) {
72 setBounds(curve, curve, 0, 1);
73 }
74
75 void setBounds(const SkDQuad& curve, const SkDQuad& sub, double tStart, double tEnd);
76
77 void setBounds(const SkTCurve& curve);
78
79 bool valid() const {
80 return fLeft <= fRight && fTop <= fBottom;
81 }
82};
83
84#endif
#define SkASSERT(cond)
Definition SkAssert.h:116
bool approximately_between(double a, double b, double c)
double fTop
double fRight
bool intersects(const SkDRect &r) const
void add(const SkDPoint &pt)
void set(const SkDPoint &pt)
double height() const
double width() const
void debugInit()
void setBounds(const SkDCubic &curve)
bool valid() const
double fBottom
void setBounds(const SkDQuad &curve)
void setBounds(const SkDConic &curve)
bool contains(const SkDPoint &pt) const
double fLeft