Flutter Engine
The Flutter Engine
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);
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)
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48
double fTop
Definition: SkPathOpsRect.h:22
double fRight
Definition: SkPathOpsRect.h:22
bool intersects(const SkDRect &r) const
Definition: SkPathOpsRect.h:38
void add(const SkDPoint &pt)
Definition: SkPathOpsRect.h:24
void set(const SkDPoint &pt)
Definition: SkPathOpsRect.h:46
double height() const
Definition: SkPathOpsRect.h:55
double width() const
Definition: SkPathOpsRect.h:51
void debugInit()
void setBounds(const SkDCubic &curve)
Definition: SkPathOpsRect.h:65
bool valid() const
Definition: SkPathOpsRect.h:79
double fBottom
Definition: SkPathOpsRect.h:22
void setBounds(const SkDQuad &curve)
Definition: SkPathOpsRect.h:71
void setBounds(const SkDConic &curve)
Definition: SkPathOpsRect.h:59
bool contains(const SkDPoint &pt) const
Definition: SkPathOpsRect.h:31
double fLeft
Definition: SkPathOpsRect.h:22