Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: include/gpu/GrSurface.h

Issue 25021006: Add GrSurface::savePixels(). (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/gpu/GrSurface.cpp » ('j') | src/gpu/GrSurface.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 class GrDrawState;
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 * @param rowBytes number of bytes between consecutive rows. Zero means rows are tightly 120 * @param rowBytes number of bytes between consecutive rows. Zero means rows are tightly
120 * packed. 121 * packed.
121 * @param pixelOpsFlags See the GrContext::PixelOpsFlags enum. 122 * @param pixelOpsFlags See the GrContext::PixelOpsFlags enum.
122 */ 123 */
123 virtual void writePixels(int left, int top, int width, int height, 124 virtual void writePixels(int left, int top, int width, int height,
124 GrPixelConfig config, 125 GrPixelConfig config,
125 const void* buffer, 126 const void* buffer,
126 size_t rowBytes = 0, 127 size_t rowBytes = 0,
127 uint32_t pixelOpsFlags = 0) = 0; 128 uint32_t pixelOpsFlags = 0) = 0;
128 129
130 /**
131 * Write the contents of the surface to a PNG. Returns true if successful.
132 * @param filename Full path to desired file
133 */
134 bool savePixels(const char* filename);
135
129 protected: 136 protected:
130 GrSurface(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc) 137 GrSurface(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc)
131 : INHERITED(gpu, isWrapped) 138 : INHERITED(gpu, isWrapped)
132 , fDesc(desc) { 139 , fDesc(desc) {
133 } 140 }
134 141
135 GrTextureDesc fDesc; 142 GrTextureDesc fDesc;
136 143
137 private: 144 private:
138 typedef GrResource INHERITED; 145 typedef GrResource INHERITED;
139 }; 146 };
140 147
141 #endif // GrSurface_DEFINED 148 #endif // GrSurface_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrSurface.cpp » ('j') | src/gpu/GrSurface.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698