| 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 |
| 11 | 11 |
| 12 #include "GrTypes.h" | 12 #include "GrTypes.h" |
| 13 #include "GrResource.h" | 13 #include "GrResource.h" |
| 14 #include "SkRect.h" |
| 14 | 15 |
| 15 class GrTexture; | 16 class GrTexture; |
| 16 class GrRenderTarget; | 17 class GrRenderTarget; |
| 17 | 18 |
| 18 class GrSurface : public GrResource { | 19 class GrSurface : public GrResource { |
| 19 public: | 20 public: |
| 20 SK_DECLARE_INST_COUNT(GrSurface); | 21 SK_DECLARE_INST_COUNT(GrSurface); |
| 21 | 22 |
| 22 /** | 23 /** |
| 23 * Retrieves the width of the surface. | 24 * Retrieves the width of the surface. |
| 24 * | 25 * |
| 25 * @return the width in texels | 26 * @return the width in texels |
| 26 */ | 27 */ |
| 27 int width() const { return fDesc.fWidth; } | 28 int width() const { return fDesc.fWidth; } |
| 28 | 29 |
| 29 /** | 30 /** |
| 30 * Retrieves the height of the surface. | 31 * Retrieves the height of the surface. |
| 31 * | 32 * |
| 32 * @return the height in texels | 33 * @return the height in texels |
| 33 */ | 34 */ |
| 34 int height() const { return fDesc.fHeight; } | 35 int height() const { return fDesc.fHeight; } |
| 35 | 36 |
| 37 /** |
| 38 * Helper that gets the width and height of the surface as a bounding rectan
gle. |
| 39 */ |
| 40 void getBoundsRect(SkRect* rect) const { rect->setWH(SkIntToScalar(this->wid
th()), |
| 41 SkIntToScalar(this->hei
ght())); } |
| 42 |
| 36 GrSurfaceOrigin origin() const { | 43 GrSurfaceOrigin origin() const { |
| 37 GrAssert(kTopLeft_GrSurfaceOrigin == fDesc.fOrigin || kBottomLeft_GrSurf
aceOrigin == fDesc.fOrigin); | 44 GrAssert(kTopLeft_GrSurfaceOrigin == fDesc.fOrigin || kBottomLeft_GrSurf
aceOrigin == fDesc.fOrigin); |
| 38 return fDesc.fOrigin; | 45 return fDesc.fOrigin; |
| 39 } | 46 } |
| 40 | 47 |
| 41 /** | 48 /** |
| 42 * Retrieves the pixel config specified when the surface was created. | 49 * Retrieves the pixel config specified when the surface was created. |
| 43 * For render targets this can be kUnknown_GrPixelConfig | 50 * For render targets this can be kUnknown_GrPixelConfig |
| 44 * 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 |
| 45 * config that isn't equivalent with one of our configs. | 52 * config that isn't equivalent with one of our configs. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 , fDesc(desc) { | 132 , fDesc(desc) { |
| 126 } | 133 } |
| 127 | 134 |
| 128 GrTextureDesc fDesc; | 135 GrTextureDesc fDesc; |
| 129 | 136 |
| 130 private: | 137 private: |
| 131 typedef GrResource INHERITED; | 138 typedef GrResource INHERITED; |
| 132 }; | 139 }; |
| 133 | 140 |
| 134 #endif // GrSurface_DEFINED | 141 #endif // GrSurface_DEFINED |
| OLD | NEW |