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 #include "SkRect.h" |
15 | 15 |
16 class GrTexture; | 16 class GrTexture; |
17 class GrRenderTarget; | 17 class GrRenderTarget; |
| 18 struct SkImageInfo; |
18 | 19 |
19 class GrSurface : public GrResource { | 20 class GrSurface : public GrResource { |
20 public: | 21 public: |
21 SK_DECLARE_INST_COUNT(GrSurface); | 22 SK_DECLARE_INST_COUNT(GrSurface); |
22 | 23 |
23 /** | 24 /** |
24 * Retrieves the width of the surface. | 25 * Retrieves the width of the surface. |
25 * | 26 * |
26 * @return the width in texels | 27 * @return the width in texels |
27 */ | 28 */ |
(...skipping 23 matching lines...) Expand all Loading... |
51 * if client asked us to render to a target that has a pixel | 52 * if client asked us to render to a target that has a pixel |
52 * config that isn't equivalent with one of our configs. | 53 * config that isn't equivalent with one of our configs. |
53 */ | 54 */ |
54 GrPixelConfig config() const { return fDesc.fConfig; } | 55 GrPixelConfig config() const { return fDesc.fConfig; } |
55 | 56 |
56 /** | 57 /** |
57 * Return the descriptor describing the surface | 58 * Return the descriptor describing the surface |
58 */ | 59 */ |
59 const GrTextureDesc& desc() const { return fDesc; } | 60 const GrTextureDesc& desc() const { return fDesc; } |
60 | 61 |
| 62 void asImageInfo(SkImageInfo*) const; |
| 63 |
61 /** | 64 /** |
62 * @return the texture associated with the surface, may be NULL. | 65 * @return the texture associated with the surface, may be NULL. |
63 */ | 66 */ |
64 virtual GrTexture* asTexture() = 0; | 67 virtual GrTexture* asTexture() = 0; |
65 virtual const GrTexture* asTexture() const = 0; | 68 virtual const GrTexture* asTexture() const = 0; |
66 | 69 |
67 /** | 70 /** |
68 * @return the render target underlying this surface, may be NULL. | 71 * @return the render target underlying this surface, may be NULL. |
69 */ | 72 */ |
70 virtual GrRenderTarget* asRenderTarget() = 0; | 73 virtual GrRenderTarget* asRenderTarget() = 0; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 , fDesc(desc) { | 141 , fDesc(desc) { |
139 } | 142 } |
140 | 143 |
141 GrTextureDesc fDesc; | 144 GrTextureDesc fDesc; |
142 | 145 |
143 private: | 146 private: |
144 typedef GrResource INHERITED; | 147 typedef GrResource INHERITED; |
145 }; | 148 }; |
146 | 149 |
147 #endif // GrSurface_DEFINED | 150 #endif // GrSurface_DEFINED |
OLD | NEW |