OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 | 9 |
10 #ifndef GrGLIRect_DEFINED | 10 #ifndef GrGLIRect_DEFINED |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 void pushToGLScissor(const GrGLInterface* gl) const { | 30 void pushToGLScissor(const GrGLInterface* gl) const { |
31 GR_GL_CALL(gl, Scissor(fLeft, fBottom, fWidth, fHeight)); | 31 GR_GL_CALL(gl, Scissor(fLeft, fBottom, fWidth, fHeight)); |
32 } | 32 } |
33 | 33 |
34 void setFromGLViewport(const GrGLInterface* gl) { | 34 void setFromGLViewport(const GrGLInterface* gl) { |
35 GR_STATIC_ASSERT(sizeof(GrGLIRect) == 4*sizeof(GrGLint)); | 35 GR_STATIC_ASSERT(sizeof(GrGLIRect) == 4*sizeof(GrGLint)); |
36 GR_GL_GetIntegerv(gl, GR_GL_VIEWPORT, (GrGLint*) this); | 36 GR_GL_GetIntegerv(gl, GR_GL_VIEWPORT, (GrGLint*) this); |
37 } | 37 } |
38 | 38 |
39 // sometimes we have a GrIRect from the client that we | 39 // sometimes we have a SkIRect from the client that we |
40 // want to simultaneously make relative to GL's viewport | 40 // want to simultaneously make relative to GL's viewport |
41 // and (optionally) convert from top-down to bottom-up. | 41 // and (optionally) convert from top-down to bottom-up. |
42 void setRelativeTo(const GrGLIRect& glRect, | 42 void setRelativeTo(const GrGLIRect& glRect, |
43 int leftOffset, | 43 int leftOffset, |
44 int topOffset, | 44 int topOffset, |
45 int width, | 45 int width, |
46 int height, | 46 int height, |
47 GrSurfaceOrigin origin) { | 47 GrSurfaceOrigin origin) { |
48 fLeft = glRect.fLeft + leftOffset; | 48 fLeft = glRect.fLeft + leftOffset; |
49 fWidth = width; | 49 fWidth = width; |
(...skipping 20 matching lines...) Expand all Loading... |
70 void invalidate() {fLeft = fWidth = fBottom = fHeight = -1;} | 70 void invalidate() {fLeft = fWidth = fBottom = fHeight = -1;} |
71 | 71 |
72 bool operator ==(const GrGLIRect& glRect) const { | 72 bool operator ==(const GrGLIRect& glRect) const { |
73 return 0 == memcmp(this, &glRect, sizeof(GrGLIRect)); | 73 return 0 == memcmp(this, &glRect, sizeof(GrGLIRect)); |
74 } | 74 } |
75 | 75 |
76 bool operator !=(const GrGLIRect& glRect) const {return !(*this == glRect);} | 76 bool operator !=(const GrGLIRect& glRect) const {return !(*this == glRect);} |
77 }; | 77 }; |
78 | 78 |
79 #endif | 79 #endif |
OLD | NEW |