| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 virtual GrTexture* asTexture() = 0; | 57 virtual GrTexture* asTexture() = 0; |
| 58 virtual const GrTexture* asTexture() const = 0; | 58 virtual const GrTexture* asTexture() const = 0; |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * @return the render target underlying this surface, may be NULL. | 61 * @return the render target underlying this surface, may be NULL. |
| 62 */ | 62 */ |
| 63 virtual GrRenderTarget* asRenderTarget() = 0; | 63 virtual GrRenderTarget* asRenderTarget() = 0; |
| 64 virtual const GrRenderTarget* asRenderTarget() const = 0; | 64 virtual const GrRenderTarget* asRenderTarget() const = 0; |
| 65 | 65 |
| 66 /** | 66 /** |
| 67 * Checks whether this GrSurface refers to the same GPU object as other. Thi
s |
| 68 * catches the case where a GrTexture and GrRenderTarget refer to the same |
| 69 * GPU memory. |
| 70 */ |
| 71 bool isSameAs(const GrSurface* other) const { |
| 72 const GrRenderTarget* thisRT = this->asRenderTarget(); |
| 73 if (NULL != thisRT) { |
| 74 return thisRT == other->asRenderTarget(); |
| 75 } else { |
| 76 const GrTexture* thisTex = this->asTexture(); |
| 77 GrAssert(NULL != thisTex); // We must be one or the other |
| 78 return thisTex == other->asTexture(); |
| 79 } |
| 80 } |
| 81 |
| 82 /** |
| 67 * Reads a rectangle of pixels from the surface. | 83 * Reads a rectangle of pixels from the surface. |
| 68 * @param left left edge of the rectangle to read (inclusive) | 84 * @param left left edge of the rectangle to read (inclusive) |
| 69 * @param top top edge of the rectangle to read (inclusive) | 85 * @param top top edge of the rectangle to read (inclusive) |
| 70 * @param width width of rectangle to read in pixels. | 86 * @param width width of rectangle to read in pixels. |
| 71 * @param height height of rectangle to read in pixels. | 87 * @param height height of rectangle to read in pixels. |
| 72 * @param config the pixel config of the destination buffer | 88 * @param config the pixel config of the destination buffer |
| 73 * @param buffer memory to read the rectangle into. | 89 * @param buffer memory to read the rectangle into. |
| 74 * @param rowBytes number of bytes between consecutive rows. Zero means
rows are tightly | 90 * @param rowBytes number of bytes between consecutive rows. Zero means
rows are tightly |
| 75 * packed. | 91 * packed. |
| 76 * @param pixelOpsFlags See the GrContext::PixelOpsFlags enum. | 92 * @param pixelOpsFlags See the GrContext::PixelOpsFlags enum. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 , fDesc(desc) { | 125 , fDesc(desc) { |
| 110 } | 126 } |
| 111 | 127 |
| 112 GrTextureDesc fDesc; | 128 GrTextureDesc fDesc; |
| 113 | 129 |
| 114 private: | 130 private: |
| 115 typedef GrResource INHERITED; | 131 typedef GrResource INHERITED; |
| 116 }; | 132 }; |
| 117 | 133 |
| 118 #endif // GrSurface_DEFINED | 134 #endif // GrSurface_DEFINED |
| OLD | NEW |