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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 * @param rowBytes number of bytes between consecutive rows. Zero means
rows are tightly | 119 * @param rowBytes number of bytes between consecutive rows. Zero means
rows are tightly |
120 * packed. | 120 * packed. |
121 * @param pixelOpsFlags See the GrContext::PixelOpsFlags enum. | 121 * @param pixelOpsFlags See the GrContext::PixelOpsFlags enum. |
122 */ | 122 */ |
123 virtual void writePixels(int left, int top, int width, int height, | 123 virtual void writePixels(int left, int top, int width, int height, |
124 GrPixelConfig config, | 124 GrPixelConfig config, |
125 const void* buffer, | 125 const void* buffer, |
126 size_t rowBytes = 0, | 126 size_t rowBytes = 0, |
127 uint32_t pixelOpsFlags = 0) = 0; | 127 uint32_t pixelOpsFlags = 0) = 0; |
128 | 128 |
| 129 /** |
| 130 * Write the contents of the surface to a PNG. Returns true if successful. |
| 131 * @param filename Full path to desired file |
| 132 */ |
| 133 bool savePixels(const char* filename); |
| 134 |
129 protected: | 135 protected: |
130 GrSurface(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc) | 136 GrSurface(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc) |
131 : INHERITED(gpu, isWrapped) | 137 : INHERITED(gpu, isWrapped) |
132 , fDesc(desc) { | 138 , fDesc(desc) { |
133 } | 139 } |
134 | 140 |
135 GrTextureDesc fDesc; | 141 GrTextureDesc fDesc; |
136 | 142 |
137 private: | 143 private: |
138 typedef GrResource INHERITED; | 144 typedef GrResource INHERITED; |
139 }; | 145 }; |
140 | 146 |
141 #endif // GrSurface_DEFINED | 147 #endif // GrSurface_DEFINED |
OLD | NEW |