Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Attributes | List of all members
GrWindowRectangles Class Reference

#include <GrWindowRectangles.h>

Classes

struct  Rec
 

Public Member Functions

 GrWindowRectangles ()
 
 GrWindowRectangles (const GrWindowRectangles &that)
 
 ~GrWindowRectangles ()
 
GrWindowRectangles makeOffset (int dx, int dy) const
 
bool empty () const
 
int count () const
 
const SkIRectdata () const
 
void reset ()
 
GrWindowRectanglesoperator= (const GrWindowRectangles &)
 
SkIRectaddWindow (const SkIRect &window)
 
SkIRectaddWindow ()
 
bool operator!= (const GrWindowRectangles &that) const
 
bool operator== (const GrWindowRectangles &) const
 

Static Public Attributes

static constexpr int kMaxWindows = 8
 

Detailed Description

Definition at line 14 of file GrWindowRectangles.h.

Constructor & Destructor Documentation

◆ GrWindowRectangles() [1/2]

GrWindowRectangles::GrWindowRectangles ( )
inline

Definition at line 18 of file GrWindowRectangles.h.

18: fCount(0) {}

◆ GrWindowRectangles() [2/2]

GrWindowRectangles::GrWindowRectangles ( const GrWindowRectangles that)
inline

Definition at line 19 of file GrWindowRectangles.h.

19: fCount(0) { *this = that; }

◆ ~GrWindowRectangles()

GrWindowRectangles::~GrWindowRectangles ( )
inline

Definition at line 20 of file GrWindowRectangles.h.

20{ SkSafeUnref(this->rec()); }
static void SkSafeUnref(T *obj)
Definition SkRefCnt.h:149

Member Function Documentation

◆ addWindow() [1/2]

SkIRect & GrWindowRectangles::addWindow ( )
inline

Definition at line 98 of file GrWindowRectangles.h.

98 {
99 SkASSERT(fCount < kMaxWindows);
100 if (fCount == 0) {
101 fCount = 1;
102 return fLocalWindow;
103 }
104 if (fCount == 1) {
105 fRec = new Rec(&fLocalWindow, 1);
106 } else if (!fRec->unique()) { // Simple copy-on-write.
107 fRec->unref();
108 fRec = new Rec(fRec->fData, fCount);
109 }
110 return fRec->fData[fCount++];
111}
#define SkASSERT(cond)
Definition SkAssert.h:116
bool unique() const
void unref() const
static constexpr int kMaxWindows
SkIRect fData[kMaxWindows]

◆ addWindow() [2/2]

SkIRect & GrWindowRectangles::addWindow ( const SkIRect window)
inline

Definition at line 31 of file GrWindowRectangles.h.

31{ return this->addWindow() = window; }
GLFWwindow * window
Definition main.cc:45

◆ count()

int GrWindowRectangles::count ( ) const
inline

Definition at line 25 of file GrWindowRectangles.h.

25{ return fCount; }

◆ data()

const SkIRect * GrWindowRectangles::data ( ) const
inline

Definition at line 59 of file GrWindowRectangles.h.

59 {
60 return fCount <= 1 ? &fLocalWindow : fRec->fData;
61}

◆ empty()

bool GrWindowRectangles::empty ( ) const
inline

Definition at line 24 of file GrWindowRectangles.h.

24{ return !fCount; }

◆ makeOffset()

GrWindowRectangles GrWindowRectangles::makeOffset ( int  dx,
int  dy 
) const
inline

Definition at line 79 of file GrWindowRectangles.h.

79 {
80 if (!dx && !dy) {
81 return *this;
82 }
84 result.fCount = fCount;
85 SkIRect* windows;
86 if (result.fCount > 1) {
87 result.fRec = new Rec();
88 windows = result.fRec->fData;
89 } else {
90 windows = &result.fLocalWindow;
91 }
92 for (int i = 0; i < fCount; ++i) {
93 windows[i] = this->data()[i].makeOffset(dx, dy);
94 }
95 return result;
96}
const SkIRect * data() const
GAsyncResult * result
constexpr SkIRect makeOffset(int32_t dx, int32_t dy) const
Definition SkRect.h:300

◆ operator!=()

bool GrWindowRectangles::operator!= ( const GrWindowRectangles that) const
inline

Definition at line 34 of file GrWindowRectangles.h.

34{ return !(*this == that); }

◆ operator=()

GrWindowRectangles & GrWindowRectangles::operator= ( const GrWindowRectangles that)
inline

Definition at line 68 of file GrWindowRectangles.h.

68 {
69 SkSafeUnref(this->rec());
70 fCount = that.fCount;
71 if (fCount <= 1) {
73 } else {
74 fRec = SkRef(that.fRec);
75 }
76 return *this;
77}
static T * SkRef(T *obj)
Definition SkRefCnt.h:132

◆ operator==()

bool GrWindowRectangles::operator== ( const GrWindowRectangles that) const
inline

Definition at line 113 of file GrWindowRectangles.h.

113 {
114 if (fCount != that.fCount) {
115 return false;
116 }
117 if (fCount > 1 && fRec == that.fRec) {
118 return true;
119 }
120 return !fCount || !memcmp(this->data(), that.data(), sizeof(SkIRect) * fCount);
121}

◆ reset()

void GrWindowRectangles::reset ( )
inline

Definition at line 63 of file GrWindowRectangles.h.

63 {
64 SkSafeUnref(this->rec());
65 fCount = 0;
66}

Member Data Documentation

◆ fLocalWindow

SkIRect GrWindowRectangles::fLocalWindow

Definition at line 44 of file GrWindowRectangles.h.

◆ fRec

Rec* GrWindowRectangles::fRec

Definition at line 45 of file GrWindowRectangles.h.

◆ kMaxWindows

constexpr int GrWindowRectangles::kMaxWindows = 8
staticconstexpr

Definition at line 16 of file GrWindowRectangles.h.


The documentation for this class was generated from the following file: