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

Side by Side Diff: include/core/SkSurface.h

Issue 2412633002: leave pixel memory uninitialized for opaque alpha type in SkSurface::MakeRaster (Closed)
Patch Set: Created 4 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 | « no previous file | src/image/SkSurface_Raster.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 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 /** 45 /**
46 * The same as NewRasterDirect, but also accepts a call-back routine, which is invoked 46 * The same as NewRasterDirect, but also accepts a call-back routine, which is invoked
47 * when the surface is deleted, and is passed the pixel memory and the spec ified context. 47 * when the surface is deleted, and is passed the pixel memory and the spec ified context.
48 */ 48 */
49 static sk_sp<SkSurface> MakeRasterDirectReleaseProc(const SkImageInfo&, void * pixels, size_t rowBytes, 49 static sk_sp<SkSurface> MakeRasterDirectReleaseProc(const SkImageInfo&, void * pixels, size_t rowBytes,
50 void (*releaseProc)(void* pixel s, void* context), 50 void (*releaseProc)(void* pixel s, void* context),
51 void* context, const SkSurfaceP rops* = nullptr); 51 void* context, const SkSurfaceP rops* = nullptr);
52 52
53 /** 53 /**
54 * Return a new surface, with the memory for the pixels automatically alloc ated and 54 * Return a new surface, with the memory for the pixels automatically alloc ated but respecting
55 * zero-initialized, but respecting the specified rowBytes. If rowBytes==0, then a default 55 * the specified rowBytes. If rowBytes==0, then a default value will be cho sen. If a non-zero
56 * value will be chosen. If a non-zero rowBytes is specified, then any imag es snapped off of 56 * rowBytes is specified, then any images snapped off of this surface (via makeImageSnapshot())
57 * this surface (via makeImageSnapshot()) are guaranteed to have the same r owBytes. 57 * are guaranteed to have the same rowBytes.
58 *
59 * If the requested alpha type is not opaque, then the surface's pixel memo ry will be
60 * zero-initialized. If it is opaque, then it will be left uninitialized, a nd the caller is
61 * responsible for initially clearing the surface.
58 * 62 *
59 * If the requested surface cannot be created, or the request is not a 63 * If the requested surface cannot be created, or the request is not a
60 * supported configuration, NULL will be returned. 64 * supported configuration, NULL will be returned.
61 */ 65 */
62 static sk_sp<SkSurface> MakeRaster(const SkImageInfo&, size_t rowBytes, cons t SkSurfaceProps*); 66 static sk_sp<SkSurface> MakeRaster(const SkImageInfo&, size_t rowBytes, cons t SkSurfaceProps*);
63 67
64 /** 68 /**
65 * Allocate a new surface, automatically computing the rowBytes. 69 * Allocate a new surface, automatically computing the rowBytes.
66 */ 70 */
67 static sk_sp<SkSurface> MakeRaster(const SkImageInfo& info, 71 static sk_sp<SkSurface> MakeRaster(const SkImageInfo& info,
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 private: 393 private:
390 const SkSurfaceProps fProps; 394 const SkSurfaceProps fProps;
391 const int fWidth; 395 const int fWidth;
392 const int fHeight; 396 const int fHeight;
393 uint32_t fGenerationID; 397 uint32_t fGenerationID;
394 398
395 typedef SkRefCnt INHERITED; 399 typedef SkRefCnt INHERITED;
396 }; 400 };
397 401
398 #endif 402 #endif
OLDNEW
« no previous file with comments | « no previous file | src/image/SkSurface_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698