| 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 /** Helpers used in read/write pixels implementations. The paramters are adj
usted so that the |
| 21 read/write respects the bounds of a surface. If the input *rowBytes is 0
it will be |
| 22 the tight row bytes (based on width and bpp) on output. */ |
| 23 static bool AdjustReadPixelParams(int surfaceWidth, |
| 24 int surfaceHeight, |
| 25 size_t bpp, |
| 26 int* left, int* top, int* width, int* heig
ht, |
| 27 void** data, |
| 28 size_t* rowBytes); |
| 29 static bool AdjustWritePixelParams(int surfaceWidth, |
| 30 int surfaceHeight, |
| 31 size_t bpp, |
| 32 int* left, int* top, int* width, int* heig
ht, |
| 33 const void** data, |
| 34 size_t* rowBytes); |
| 20 /** | 35 /** |
| 21 * Derive a SkImageInfo from the surface's descriptor. The caller must provi
de the alpha type as | 36 * Derive a SkImageInfo from the surface's descriptor. The caller must provi
de the alpha type as |
| 22 * GrSurface has no equivalent. | 37 * GrSurface has no equivalent. |
| 23 */ | 38 */ |
| 24 SkImageInfo info(SkAlphaType alphaType) const { return fSurface->info(alphaT
ype); } | 39 SkImageInfo info(SkAlphaType alphaType) const { return fSurface->info(alphaT
ype); } |
| 25 | 40 |
| 26 /** | 41 /** |
| 27 * Write the contents of the surface to a PNG. Returns true if successful. | 42 * Write the contents of the surface to a PNG. Returns true if successful. |
| 28 * @param filename Full path to desired file | 43 * @param filename Full path to desired file |
| 29 */ | 44 */ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 47 friend class GrSurface; // to construct/copy this type. | 62 friend class GrSurface; // to construct/copy this type. |
| 48 }; | 63 }; |
| 49 | 64 |
| 50 inline GrSurfacePriv GrSurface::surfacePriv() { return GrSurfacePriv(this); } | 65 inline GrSurfacePriv GrSurface::surfacePriv() { return GrSurfacePriv(this); } |
| 51 | 66 |
| 52 inline const GrSurfacePriv GrSurface::surfacePriv() const { | 67 inline const GrSurfacePriv GrSurface::surfacePriv() const { |
| 53 return GrSurfacePriv(const_cast<GrSurface*>(this)); | 68 return GrSurfacePriv(const_cast<GrSurface*>(this)); |
| 54 } | 69 } |
| 55 | 70 |
| 56 #endif | 71 #endif |
| OLD | NEW |