| 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,
|
|
|