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

Side by Side Diff: src/gpu/GrSurfacePriv.h

Issue 665913002: Move code to dump GrSurface as a png to helper files (Closed) Base URL: https://skia.googlesource.com/skia.git@separate-image-encoder-01-skimage
Patch Set: address review comments Created 6 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
« no previous file with comments | « src/gpu/GrSurface.cpp ('k') | src/gpu/GrTextStrike.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 #ifndef GrSurfacePriv_DEFINED 8 #ifndef GrSurfacePriv_DEFINED
9 #define GrSurfacePriv_DEFINED 9 #define GrSurfacePriv_DEFINED
10 10
11 #include "GrSurface.h" 11 #include "GrSurface.h"
12 #include "SkImagesSupport.h"
12 13
13 /** Class that adds methods to GrSurface that are only intended for use internal to Skia. 14 /** Class that adds methods to GrSurface that are only intended for use internal to Skia.
14 This class is purely a privileged window into GrSurface. It should never hav e additional data 15 This class is purely a privileged window into GrSurface. It should never hav e additional data
15 members or virtual methods. 16 members or virtual methods.
16 Non-static methods that are not trivial inlines should be spring-boarded (e. g. declared and 17 Non-static methods that are not trivial inlines should be spring-boarded (e. g. declared and
17 implemented privately in GrSurface with a inline public method here). */ 18 implemented privately in GrSurface with a inline public method here). */
18 class GrSurfacePriv { 19 class GrSurfacePriv {
19 public: 20 public:
20 /** 21 /**
21 * Derive a SkImageInfo from the surface's descriptor. This is lossy as Imag eInfo has fields not 22 * Derive a SkImageInfo from the surface's descriptor. This is lossy as Imag eInfo has fields not
22 * known to GrSurface (e.g. alphaType). 23 * known to GrSurface (e.g. alphaType).
23 */ 24 */
24 SkImageInfo info() const { return fSurface->info(); } 25 SkImageInfo info() const { return fSurface->info(); }
25 26
26 /** 27 /**
27 * Checks whether this GrSurface refers to the same GPU object as other. Thi s 28 * Checks whether this GrSurface refers to the same GPU object as other. Thi s
28 * catches the case where a GrTexture and GrRenderTarget refer to the same 29 * catches the case where a GrTexture and GrRenderTarget refer to the same
29 * GPU memory. 30 * GPU memory.
30 */ 31 */
31 bool isSameAs(const GrSurface* other) const { return fSurface->isSameAs(othe r); } 32 bool isSameAs(const GrSurface* other) const { return fSurface->isSameAs(othe r); }
32 33
33 /**
34 * Write the contents of the surface to a PNG. Returns true if successful.
35 * @param filename Full path to desired file
36 */
37 bool savePixels(const char* filename) { return fSurface->savePixels(filename ); }
38
39 bool hasPendingRead() const { return fSurface->hasPendingRead(); } 34 bool hasPendingRead() const { return fSurface->hasPendingRead(); }
40 bool hasPendingWrite() const { return fSurface->hasPendingWrite(); } 35 bool hasPendingWrite() const { return fSurface->hasPendingWrite(); }
41 bool hasPendingIO() const { return fSurface->hasPendingIO(); } 36 bool hasPendingIO() const { return fSurface->hasPendingIO(); }
42 37
43 private: 38 private:
44 GrSurfacePriv(GrSurface* surface) : fSurface(surface) { } 39 GrSurfacePriv(GrSurface* surface) : fSurface(surface) { }
45 GrSurfacePriv(const GrSurfacePriv& that) : fSurface(that.fSurface) { } 40 GrSurfacePriv(const GrSurfacePriv& that) : fSurface(that.fSurface) { }
46 GrSurfacePriv& operator=(const GrSurface&); // unimpl 41 GrSurfacePriv& operator=(const GrSurface&); // unimpl
47 42
48 // No taking addresses of this type. 43 // No taking addresses of this type.
49 const GrSurfacePriv* operator&() const; 44 const GrSurfacePriv* operator&() const;
50 GrSurfacePriv* operator&(); 45 GrSurfacePriv* operator&();
51 46
52 GrSurface* fSurface; 47 GrSurface* fSurface;
53 48
54 friend class GrSurface; // to construct/copy this type. 49 friend class GrSurface; // to construct/copy this type.
55 }; 50 };
56 51
57 inline GrSurfacePriv GrSurface::surfacePriv() { return GrSurfacePriv(this); } 52 inline GrSurfacePriv GrSurface::surfacePriv() { return GrSurfacePriv(this); }
58 53
59 inline const GrSurfacePriv GrSurface::surfacePriv() const { 54 inline const GrSurfacePriv GrSurface::surfacePriv() const {
60 return GrSurfacePriv(const_cast<GrSurface*>(this)); 55 return GrSurfacePriv(const_cast<GrSurface*>(this));
61 } 56 }
62 57
63 #endif 58 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrSurface.cpp ('k') | src/gpu/GrTextStrike.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698