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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 GrSurfaceOrigin origin) { | 47 GrSurfaceOrigin origin) { |
48 fLeft = glRect.fLeft + leftOffset; | 48 fLeft = glRect.fLeft + leftOffset; |
49 fWidth = width; | 49 fWidth = width; |
50 if (kBottomLeft_GrSurfaceOrigin == origin) { | 50 if (kBottomLeft_GrSurfaceOrigin == origin) { |
51 fBottom = glRect.fBottom + (glRect.fHeight - topOffset - height); | 51 fBottom = glRect.fBottom + (glRect.fHeight - topOffset - height); |
52 } else { | 52 } else { |
53 fBottom = glRect.fBottom + topOffset; | 53 fBottom = glRect.fBottom + topOffset; |
54 } | 54 } |
55 fHeight = height; | 55 fHeight = height; |
56 | 56 |
57 GrAssert(fLeft >= 0); | 57 SkASSERT(fLeft >= 0); |
58 GrAssert(fWidth >= 0); | 58 SkASSERT(fWidth >= 0); |
59 GrAssert(fBottom >= 0); | 59 SkASSERT(fBottom >= 0); |
60 GrAssert(fHeight >= 0); | 60 SkASSERT(fHeight >= 0); |
61 } | 61 } |
62 | 62 |
63 bool contains(const GrGLIRect& glRect) const { | 63 bool contains(const GrGLIRect& glRect) const { |
64 return fLeft <= glRect.fLeft && | 64 return fLeft <= glRect.fLeft && |
65 fBottom <= glRect.fBottom && | 65 fBottom <= glRect.fBottom && |
66 fLeft + fWidth >= glRect.fLeft + glRect.fWidth && | 66 fLeft + fWidth >= glRect.fLeft + glRect.fWidth && |
67 fBottom + fHeight >= glRect.fBottom + glRect.fHeight; | 67 fBottom + fHeight >= glRect.fBottom + glRect.fHeight; |
68 } | 68 } |
69 | 69 |
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 |