| 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 23 matching lines...) Expand all Loading... |
| 34 */ | 34 */ |
| 35 int height() const { return fDesc.fHeight; } | 35 int height() const { return fDesc.fHeight; } |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * Helper that gets the width and height of the surface as a bounding rectan
gle. | 38 * Helper that gets the width and height of the surface as a bounding rectan
gle. |
| 39 */ | 39 */ |
| 40 void getBoundsRect(SkRect* rect) const { rect->setWH(SkIntToScalar(this->wid
th()), | 40 void getBoundsRect(SkRect* rect) const { rect->setWH(SkIntToScalar(this->wid
th()), |
| 41 SkIntToScalar(this->hei
ght())); } | 41 SkIntToScalar(this->hei
ght())); } |
| 42 | 42 |
| 43 GrSurfaceOrigin origin() const { | 43 GrSurfaceOrigin origin() const { |
| 44 GrAssert(kTopLeft_GrSurfaceOrigin == fDesc.fOrigin || kBottomLeft_GrSurf
aceOrigin == fDesc.fOrigin); | 44 SkASSERT(kTopLeft_GrSurfaceOrigin == fDesc.fOrigin || kBottomLeft_GrSurf
aceOrigin == fDesc.fOrigin); |
| 45 return fDesc.fOrigin; | 45 return fDesc.fOrigin; |
| 46 } | 46 } |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * Retrieves the pixel config specified when the surface was created. | 49 * Retrieves the pixel config specified when the surface was created. |
| 50 * For render targets this can be kUnknown_GrPixelConfig | 50 * For render targets this can be kUnknown_GrPixelConfig |
| 51 * if client asked us to render to a target that has a pixel | 51 * if client asked us to render to a target that has a pixel |
| 52 * config that isn't equivalent with one of our configs. | 52 * config that isn't equivalent with one of our configs. |
| 53 */ | 53 */ |
| 54 GrPixelConfig config() const { return fDesc.fConfig; } | 54 GrPixelConfig config() const { return fDesc.fConfig; } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 * Checks whether this GrSurface refers to the same GPU object as other. Thi
s | 74 * Checks whether this GrSurface refers to the same GPU object as other. Thi
s |
| 75 * catches the case where a GrTexture and GrRenderTarget refer to the same | 75 * catches the case where a GrTexture and GrRenderTarget refer to the same |
| 76 * GPU memory. | 76 * GPU memory. |
| 77 */ | 77 */ |
| 78 bool isSameAs(const GrSurface* other) const { | 78 bool isSameAs(const GrSurface* other) const { |
| 79 const GrRenderTarget* thisRT = this->asRenderTarget(); | 79 const GrRenderTarget* thisRT = this->asRenderTarget(); |
| 80 if (NULL != thisRT) { | 80 if (NULL != thisRT) { |
| 81 return thisRT == other->asRenderTarget(); | 81 return thisRT == other->asRenderTarget(); |
| 82 } else { | 82 } else { |
| 83 const GrTexture* thisTex = this->asTexture(); | 83 const GrTexture* thisTex = this->asTexture(); |
| 84 GrAssert(NULL != thisTex); // We must be one or the other | 84 SkASSERT(NULL != thisTex); // We must be one or the other |
| 85 return thisTex == other->asTexture(); | 85 return thisTex == other->asTexture(); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 /** | 89 /** |
| 90 * Reads a rectangle of pixels from the surface. | 90 * Reads a rectangle of pixels from the surface. |
| 91 * @param left left edge of the rectangle to read (inclusive) | 91 * @param left left edge of the rectangle to read (inclusive) |
| 92 * @param top top edge of the rectangle to read (inclusive) | 92 * @param top top edge of the rectangle to read (inclusive) |
| 93 * @param width width of rectangle to read in pixels. | 93 * @param width width of rectangle to read in pixels. |
| 94 * @param height height of rectangle to read in pixels. | 94 * @param height height of rectangle to read in pixels. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 , fDesc(desc) { | 132 , fDesc(desc) { |
| 133 } | 133 } |
| 134 | 134 |
| 135 GrTextureDesc fDesc; | 135 GrTextureDesc fDesc; |
| 136 | 136 |
| 137 private: | 137 private: |
| 138 typedef GrResource INHERITED; | 138 typedef GrResource INHERITED; |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 #endif // GrSurface_DEFINED | 141 #endif // GrSurface_DEFINED |
| OLD | NEW |