| 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 SkASSERT(fLeft >= 0); | |
| 58 SkASSERT(fWidth >= 0); | 57 SkASSERT(fWidth >= 0); |
| 59 SkASSERT(fBottom >= 0); | |
| 60 SkASSERT(fHeight >= 0); | 58 SkASSERT(fHeight >= 0); |
| 61 } | 59 } |
| 62 | 60 |
| 63 bool contains(const GrGLIRect& glRect) const { | 61 bool contains(const GrGLIRect& glRect) const { |
| 64 return fLeft <= glRect.fLeft && | 62 return fLeft <= glRect.fLeft && |
| 65 fBottom <= glRect.fBottom && | 63 fBottom <= glRect.fBottom && |
| 66 fLeft + fWidth >= glRect.fLeft + glRect.fWidth && | 64 fLeft + fWidth >= glRect.fLeft + glRect.fWidth && |
| 67 fBottom + fHeight >= glRect.fBottom + glRect.fHeight; | 65 fBottom + fHeight >= glRect.fBottom + glRect.fHeight; |
| 68 } | 66 } |
| 69 | 67 |
| 70 void invalidate() {fLeft = fWidth = fBottom = fHeight = -1;} | 68 void invalidate() {fLeft = fWidth = fBottom = fHeight = -1;} |
| 71 | 69 |
| 72 bool operator ==(const GrGLIRect& glRect) const { | 70 bool operator ==(const GrGLIRect& glRect) const { |
| 73 return 0 == memcmp(this, &glRect, sizeof(GrGLIRect)); | 71 return 0 == memcmp(this, &glRect, sizeof(GrGLIRect)); |
| 74 } | 72 } |
| 75 | 73 |
| 76 bool operator !=(const GrGLIRect& glRect) const {return !(*this == glRect);} | 74 bool operator !=(const GrGLIRect& glRect) const {return !(*this == glRect);} |
| 77 }; | 75 }; |
| 78 | 76 |
| 79 #endif | 77 #endif |
| OLD | NEW |