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 #ifndef SkSurface_DEFINED | 8 #ifndef SkSurface_DEFINED |
9 #define SkSurface_DEFINED | 9 #define SkSurface_DEFINED |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 /** | 55 /** |
56 * The same as NewRasterDirect, but also accepts a call-back routine, which
is invoked | 56 * The same as NewRasterDirect, but also accepts a call-back routine, which
is invoked |
57 * when the surface is deleted, and is passed the pixel memory and the spec
ified context. | 57 * when the surface is deleted, and is passed the pixel memory and the spec
ified context. |
58 */ | 58 */ |
59 static SkSurface* NewRasterDirectReleaseProc(const SkImageInfo&, void* pixel
s, size_t rowBytes, | 59 static SkSurface* NewRasterDirectReleaseProc(const SkImageInfo&, void* pixel
s, size_t rowBytes, |
60 void (*releaseProc)(void* pixel
s, void* context), | 60 void (*releaseProc)(void* pixel
s, void* context), |
61 void* context, const SkSurfaceP
rops* = NULL); | 61 void* context, const SkSurfaceP
rops* = NULL); |
62 | 62 |
63 /** | 63 /** |
64 * Return a new surface, with the memory for the pixels automatically | 64 * Return a new surface, with the memory for the pixels automatically alloc
ated, but respecting |
65 * allocated. | 65 * the specified rowBytes. If rowBytes==0, then a default value will be cho
sen. If a non-zero |
| 66 * rowBytes is specified, then any images snapped off of this surface (via
newImageSnapshot()) |
| 67 * are guaranteed to have the same rowBytes. |
66 * | 68 * |
67 * If the requested surface cannot be created, or the request is not a | 69 * If the requested surface cannot be created, or the request is not a |
68 * supported configuration, NULL will be returned. | 70 * supported configuration, NULL will be returned. |
69 */ | 71 */ |
| 72 static SkSurface* NewRaster(const SkImageInfo&, size_t rowBytes, const SkSur
faceProps*); |
| 73 |
| 74 /** |
| 75 * Allocate a new surface, automatically computing the rowBytes. |
| 76 */ |
70 static SkSurface* NewRaster(const SkImageInfo&, const SkSurfaceProps* = NULL
); | 77 static SkSurface* NewRaster(const SkImageInfo&, const SkSurfaceProps* = NULL
); |
71 | 78 |
72 /** | 79 /** |
73 * Helper version of NewRaster. It creates a SkImageInfo with the | 80 * Helper version of NewRaster. It creates a SkImageInfo with the |
74 * specified width and height, and populates the rest of info to match | 81 * specified width and height, and populates the rest of info to match |
75 * pixels in SkPMColor format. | 82 * pixels in SkPMColor format. |
76 */ | 83 */ |
77 static SkSurface* NewRasterN32Premul(int width, int height, const SkSurfaceP
rops* props = NULL) { | 84 static SkSurface* NewRasterN32Premul(int width, int height, const SkSurfaceP
rops* props = NULL) { |
78 return NewRaster(SkImageInfo::MakeN32Premul(width, height), props); | 85 return NewRaster(SkImageInfo::MakeN32Premul(width, height), props); |
79 } | 86 } |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 private: | 288 private: |
282 const SkSurfaceProps fProps; | 289 const SkSurfaceProps fProps; |
283 const int fWidth; | 290 const int fWidth; |
284 const int fHeight; | 291 const int fHeight; |
285 uint32_t fGenerationID; | 292 uint32_t fGenerationID; |
286 | 293 |
287 typedef SkRefCnt INHERITED; | 294 typedef SkRefCnt INHERITED; |
288 }; | 295 }; |
289 | 296 |
290 #endif | 297 #endif |
OLD | NEW |