OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #ifndef GrSurface_DEFINED | 9 #ifndef GrSurface_DEFINED |
10 #define GrSurface_DEFINED | 10 #define GrSurface_DEFINED |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 virtual GrRenderTarget* asRenderTarget() = 0; | 73 virtual GrRenderTarget* asRenderTarget() = 0; |
74 virtual const GrRenderTarget* asRenderTarget() const = 0; | 74 virtual const GrRenderTarget* asRenderTarget() const = 0; |
75 | 75 |
76 /** | 76 /** |
77 * Checks whether this GrSurface refers to the same GPU object as other. Thi
s | 77 * Checks whether this GrSurface refers to the same GPU object as other. Thi
s |
78 * catches the case where a GrTexture and GrRenderTarget refer to the same | 78 * catches the case where a GrTexture and GrRenderTarget refer to the same |
79 * GPU memory. | 79 * GPU memory. |
80 */ | 80 */ |
81 bool isSameAs(const GrSurface* other) const { | 81 bool isSameAs(const GrSurface* other) const { |
82 const GrRenderTarget* thisRT = this->asRenderTarget(); | 82 const GrRenderTarget* thisRT = this->asRenderTarget(); |
83 if (NULL != thisRT) { | 83 if (thisRT) { |
84 return thisRT == other->asRenderTarget(); | 84 return thisRT == other->asRenderTarget(); |
85 } else { | 85 } else { |
86 const GrTexture* thisTex = this->asTexture(); | 86 const GrTexture* thisTex = this->asTexture(); |
87 SkASSERT(NULL != thisTex); // We must be one or the other | 87 SkASSERT(thisTex); // We must be one or the other |
88 return thisTex == other->asTexture(); | 88 return thisTex == other->asTexture(); |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 /** | 92 /** |
93 * Reads a rectangle of pixels from the surface. | 93 * Reads a rectangle of pixels from the surface. |
94 * @param left left edge of the rectangle to read (inclusive) | 94 * @param left left edge of the rectangle to read (inclusive) |
95 * @param top top edge of the rectangle to read (inclusive) | 95 * @param top top edge of the rectangle to read (inclusive) |
96 * @param width width of rectangle to read in pixels. | 96 * @param width width of rectangle to read in pixels. |
97 * @param height height of rectangle to read in pixels. | 97 * @param height height of rectangle to read in pixels. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 , fDesc(desc) { | 141 , fDesc(desc) { |
142 } | 142 } |
143 | 143 |
144 GrTextureDesc fDesc; | 144 GrTextureDesc fDesc; |
145 | 145 |
146 private: | 146 private: |
147 typedef GrGpuResource INHERITED; | 147 typedef GrGpuResource INHERITED; |
148 }; | 148 }; |
149 | 149 |
150 #endif // GrSurface_DEFINED | 150 #endif // GrSurface_DEFINED |
OLD | NEW |