Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1242)

Unified Diff: src/gpu/gl/GrGLIRect.h

Issue 2251573002: Implement difference clip rects with window rectangles (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: return type Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/GrGLIRect.h
diff --git a/src/gpu/gl/GrGLIRect.h b/src/gpu/gl/GrGLIRect.h
index 41ac13b753eecfc996d9110f4c90969593836989..a699ae36bd79bc54cd793d1d46c114ed9cebe59a 100644
--- a/src/gpu/gl/GrGLIRect.h
+++ b/src/gpu/gl/GrGLIRect.h
@@ -23,6 +23,20 @@ struct GrGLIRect {
GrGLsizei fWidth;
GrGLsizei fHeight;
+ /**
+ * cast-safe way to treat the rect as an array of (4) ints.
+ */
+ const int* asInts() const {
+ return &fLeft;
+
+ GR_STATIC_ASSERT(0 == offsetof(GrGLIRect, fLeft));
+ GR_STATIC_ASSERT(4 == offsetof(GrGLIRect, fBottom));
+ GR_STATIC_ASSERT(8 == offsetof(GrGLIRect, fWidth));
+ GR_STATIC_ASSERT(12 == offsetof(GrGLIRect, fHeight));
+ GR_STATIC_ASSERT(16 == sizeof(GrGLIRect)); // For an array of GrGLIRect.
+ }
+ int* asInts() { return &fLeft; }
+
void pushToGLViewport(const GrGLInterface* gl) const {
GR_GL_CALL(gl, Viewport(fLeft, fBottom, fWidth, fHeight));
}
@@ -39,6 +53,11 @@ struct GrGLIRect {
// sometimes we have a SkIRect from the client that we
// want to simultaneously make relative to GL's viewport
// and (optionally) convert from top-down to bottom-up.
+ void setRelativeTo(const GrGLIRect& glViewport, const SkIRect& devRect, GrSurfaceOrigin org) {
+ this->setRelativeTo(glViewport, devRect.x(), devRect.y(), devRect.width(), devRect.height(),
+ org);
+ }
+
void setRelativeTo(const GrGLIRect& glRect,
int leftOffset,
int topOffset,
« src/gpu/GrCaps.cpp ('K') | « src/gpu/gl/GrGLGpu.cpp ('k') | tests/WindowRectanglesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698