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