aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrWindowRectangles.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-03-13 17:57:28 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-13 22:01:06 +0000
commit9a7677273a3f270e6137d396e972c83c036a47a7 (patch)
treeadbb840ffebb12282ac4a59bba7105ded9838afb /src/gpu/GrWindowRectangles.h
parent301c69c9167c9b7f4dd147e27d720f05522fe263 (diff)
Remove origin from GrClipStackClip and GrWindowRectsState.
Change-Id: I993f426fee0f21cf1f529f58d242de3017253678 Reviewed-on: https://skia-review.googlesource.com/9623 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/GrWindowRectangles.h')
-rw-r--r--src/gpu/GrWindowRectangles.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gpu/GrWindowRectangles.h b/src/gpu/GrWindowRectangles.h
index 076c40d7a4..4a375860e0 100644
--- a/src/gpu/GrWindowRectangles.h
+++ b/src/gpu/GrWindowRectangles.h
@@ -19,6 +19,8 @@ public:
GrWindowRectangles(const GrWindowRectangles& that) : fCount(0) { *this = that; }
~GrWindowRectangles() { SkSafeUnref(this->rec()); }
+ GrWindowRectangles makeOffset(int dx, int dy) const;
+
bool empty() const { return !fCount; }
int count() const { return fCount; }
const SkIRect* data() const;
@@ -50,6 +52,7 @@ struct GrWindowRectangles::Rec : public GrNonAtomicRef<Rec> {
SkASSERT(numWindows < kMaxWindows);
memcpy(fData, windows, sizeof(SkIRect) * numWindows);
}
+ Rec() = default;
SkIRect fData[kMaxWindows];
};
@@ -74,6 +77,25 @@ inline GrWindowRectangles& GrWindowRectangles::operator=(const GrWindowRectangle
return *this;
}
+inline GrWindowRectangles GrWindowRectangles::makeOffset(int dx, int dy) const {
+ if (!dx && !dy) {
+ return *this;
+ }
+ GrWindowRectangles result;
+ result.fCount = fCount;
+ SkIRect* windows;
+ if (result.fCount > kNumLocalWindows) {
+ result.fRec = new Rec();
+ windows = result.fRec->fData;
+ } else {
+ windows = result.fLocalWindows;
+ }
+ for (int i = 0; i < fCount; ++i) {
+ windows[i] = this->data()[i].makeOffset(dx, dy);
+ }
+ return result;
+}
+
inline SkIRect& GrWindowRectangles::addWindow() {
SkASSERT(fCount < kMaxWindows);
if (fCount < kNumLocalWindows) {