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

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

Issue 169363007: Use factories instead of directly creating SkImageInfo. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/DeferredCanvasTest.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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 * supported configuration, NULL will be returned. 45 * supported configuration, NULL will be returned.
46 */ 46 */
47 static SkSurface* NewRaster(const SkImageInfo&); 47 static SkSurface* NewRaster(const SkImageInfo&);
48 48
49 /** 49 /**
50 * Helper version of NewRaster. It creates a SkImageInfo with the 50 * Helper version of NewRaster. It creates a SkImageInfo with the
51 * specified width and height, and populates the rest of info to match 51 * specified width and height, and populates the rest of info to match
52 * pixels in SkPMColor format. 52 * pixels in SkPMColor format.
53 */ 53 */
54 static SkSurface* NewRasterPMColor(int width, int height) { 54 static SkSurface* NewRasterPMColor(int width, int height) {
55 SkImageInfo info = { 55 return NewRaster(SkImageInfo::MakeN32Premul(width, height));
56 width, height, kPMColor_SkColorType, kPremul_SkAlphaType
57 };
58 return NewRaster(info);
59 } 56 }
60 57
61 /** 58 /**
62 * Return a new surface whose contents will be recorded into a picture. 59 * Return a new surface whose contents will be recorded into a picture.
63 * When this surface is drawn into another canvas, its contents will be 60 * When this surface is drawn into another canvas, its contents will be
64 * "replayed" into that canvas. 61 * "replayed" into that canvas.
65 */ 62 */
66 static SkSurface* NewPicture(int width, int height); 63 static SkSurface* NewPicture(int width, int height);
67 64
68 /** 65 /**
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 171
175 private: 172 private:
176 const int fWidth; 173 const int fWidth;
177 const int fHeight; 174 const int fHeight;
178 uint32_t fGenerationID; 175 uint32_t fGenerationID;
179 176
180 typedef SkRefCnt INHERITED; 177 typedef SkRefCnt INHERITED;
181 }; 178 };
182 179
183 #endif 180 #endif
OLDNEW
« no previous file with comments | « no previous file | tests/DeferredCanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698