OLD | NEW |
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 | 12 |
13 /** Class that adds methods to GrSurface that are only intended for use internal
to Skia. | 13 /** 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 | 14 This class is purely a privileged window into GrSurface. It should never hav
e additional data |
15 members or virtual methods. | 15 members or virtual methods. |
16 Non-static methods that are not trivial inlines should be spring-boarded (e.
g. declared and | 16 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). */ | 17 implemented privately in GrSurface with a inline public method here). */ |
18 class GrSurfacePriv { | 18 class GrSurfacePriv { |
19 public: | 19 public: |
20 /** | 20 /** |
21 * Derive a SkImageInfo from the surface's descriptor. This is lossy as Imag
eInfo has fields not | 21 * Derive a SkImageInfo from the surface's descriptor. This is lossy as Imag
eInfo has fields not |
22 * known to GrSurface (e.g. alphaType). | 22 * known to GrSurface (e.g. alphaType). |
23 */ | 23 */ |
24 SkImageInfo info() const { return fSurface->info(); } | 24 SkImageInfo info() const { return fSurface->info(); } |
25 | 25 |
26 /** | 26 /** |
27 * 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 * GPU memory. | |
30 */ | |
31 bool isSameAs(const GrSurface* other) const { return fSurface->isSameAs(othe
r); } | |
32 | |
33 /** | |
34 * Write the contents of the surface to a PNG. Returns true if successful. | 27 * Write the contents of the surface to a PNG. Returns true if successful. |
35 * @param filename Full path to desired file | 28 * @param filename Full path to desired file |
36 */ | 29 */ |
37 bool savePixels(const char* filename) { return fSurface->savePixels(filename
); } | 30 bool savePixels(const char* filename) { return fSurface->savePixels(filename
); } |
38 | 31 |
39 bool hasPendingRead() const { return fSurface->hasPendingRead(); } | 32 bool hasPendingRead() const { return fSurface->hasPendingRead(); } |
40 bool hasPendingWrite() const { return fSurface->hasPendingWrite(); } | 33 bool hasPendingWrite() const { return fSurface->hasPendingWrite(); } |
41 bool hasPendingIO() const { return fSurface->hasPendingIO(); } | 34 bool hasPendingIO() const { return fSurface->hasPendingIO(); } |
42 | 35 |
43 private: | 36 private: |
(...skipping 10 matching lines...) Expand all Loading... |
54 friend class GrSurface; // to construct/copy this type. | 47 friend class GrSurface; // to construct/copy this type. |
55 }; | 48 }; |
56 | 49 |
57 inline GrSurfacePriv GrSurface::surfacePriv() { return GrSurfacePriv(this); } | 50 inline GrSurfacePriv GrSurface::surfacePriv() { return GrSurfacePriv(this); } |
58 | 51 |
59 inline const GrSurfacePriv GrSurface::surfacePriv() const { | 52 inline const GrSurfacePriv GrSurface::surfacePriv() const { |
60 return GrSurfacePriv(const_cast<GrSurface*>(this)); | 53 return GrSurfacePriv(const_cast<GrSurface*>(this)); |
61 } | 54 } |
62 | 55 |
63 #endif | 56 #endif |
OLD | NEW |