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

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

Issue 54363008: move SkImage::ColorType into SkColorType (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 | « include/core/SkImageDecoder.h ('k') | include/lazy/SkBitmapFactory.h » ('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 17 matching lines...) Expand all
28 public: 28 public:
29 SK_DECLARE_INST_COUNT(SkSurface) 29 SK_DECLARE_INST_COUNT(SkSurface)
30 30
31 /** 31 /**
32 * Create a new surface, using the specified pixels/rowbytes as its 32 * Create a new surface, using the specified pixels/rowbytes as its
33 * backend. 33 * backend.
34 * 34 *
35 * If the requested surface cannot be created, or the request is not a 35 * If the requested surface cannot be created, or the request is not a
36 * supported configuration, NULL will be returned. 36 * supported configuration, NULL will be returned.
37 */ 37 */
38 static SkSurface* NewRasterDirect(const SkImage::Info&, void* pixels, size_t rowBytes); 38 static SkSurface* NewRasterDirect(const SkImageInfo&, void* pixels, size_t r owBytes);
39 39
40 /** 40 /**
41 * Return a new surface, with the memory for the pixels automatically 41 * Return a new surface, with the memory for the pixels automatically
42 * allocated. 42 * allocated.
43 * 43 *
44 * If the requested surface cannot be created, or the request is not a 44 * If the requested surface cannot be created, or the request is not a
45 * supported configuration, NULL will be returned. 45 * supported configuration, NULL will be returned.
46 */ 46 */
47 static SkSurface* NewRaster(const SkImage::Info&); 47 static SkSurface* NewRaster(const SkImageInfo&);
48 48
49 /** 49 /**
50 * Helper version of NewRaster. It creates a SkImage::Info 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 SkImage::Info info = { 55 SkImageInfo info = {
56 width, height, SkImage::kPMColor_ColorType, kPremul_SkAlphaType 56 width, height, kPMColor_SkColorType, kPremul_SkAlphaType
57 }; 57 };
58 return NewRaster(info); 58 return NewRaster(info);
59 } 59 }
60 60
61 /** 61 /**
62 * Return a new surface whose contents will be recorded into a picture. 62 * 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 63 * When this surface is drawn into another canvas, its contents will be
64 * "replayed" into that canvas. 64 * "replayed" into that canvas.
65 */ 65 */
66 static SkSurface* NewPicture(int width, int height); 66 static SkSurface* NewPicture(int width, int height);
67 67
68 /** 68 /**
69 * Return a new surface using the specified render target. 69 * Return a new surface using the specified render target.
70 */ 70 */
71 static SkSurface* NewRenderTargetDirect(GrContext*, GrRenderTarget*); 71 static SkSurface* NewRenderTargetDirect(GrContext*, GrRenderTarget*);
72 72
73 /** 73 /**
74 * Return a new surface whose contents will be drawn to an offscreen 74 * Return a new surface whose contents will be drawn to an offscreen
75 * render target, allocated by the surface. 75 * render target, allocated by the surface.
76 */ 76 */
77 static SkSurface* NewRenderTarget(GrContext*, const SkImage::Info&, int samp leCount = 0); 77 static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sample Count = 0);
78 78
79 int width() const { return fWidth; } 79 int width() const { return fWidth; }
80 int height() const { return fHeight; } 80 int height() const { return fHeight; }
81 81
82 /** 82 /**
83 * Returns a unique non-zero, unique value identifying the content of this 83 * Returns a unique non-zero, unique value identifying the content of this
84 * surface. Each time the content is changed changed, either by drawing 84 * surface. Each time the content is changed changed, either by drawing
85 * into this surface, or explicitly calling notifyContentChanged()) this 85 * into this surface, or explicitly calling notifyContentChanged()) this
86 * method will return a new value. 86 * method will return a new value.
87 * 87 *
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 * pattern: 126 * pattern:
127 * 127 *
128 * SkSurface* A = SkSurface::New...(); 128 * SkSurface* A = SkSurface::New...();
129 * SkCanvas* canvasA = surfaceA->newCanvas(); 129 * SkCanvas* canvasA = surfaceA->newCanvas();
130 * ... 130 * ...
131 * SkSurface* surfaceB = surfaceA->newSurface(...); 131 * SkSurface* surfaceB = surfaceA->newSurface(...);
132 * SkCanvas* canvasB = surfaceB->newCanvas(); 132 * SkCanvas* canvasB = surfaceB->newCanvas();
133 * ... // draw using canvasB 133 * ... // draw using canvasB
134 * canvasA->drawSurface(surfaceB); // <--- this will always be optimal! 134 * canvasA->drawSurface(surfaceB); // <--- this will always be optimal!
135 */ 135 */
136 SkSurface* newSurface(const SkImage::Info&); 136 SkSurface* newSurface(const SkImageInfo&);
137 137
138 /** 138 /**
139 * Returns an image of the current state of the surface pixels up to this 139 * Returns an image of the current state of the surface pixels up to this
140 * point. Subsequent changes to the surface (by drawing into its canvas) 140 * point. Subsequent changes to the surface (by drawing into its canvas)
141 * will not be reflected in this image. 141 * will not be reflected in this image.
142 */ 142 */
143 SkImage* newImageSnapshot(); 143 SkImage* newImageSnapshot();
144 144
145 /** 145 /**
146 * Thought the caller could get a snapshot image explicitly, and draw that, 146 * Thought the caller could get a snapshot image explicitly, and draw that,
(...skipping 14 matching lines...) Expand all
161 161
162 private: 162 private:
163 const int fWidth; 163 const int fWidth;
164 const int fHeight; 164 const int fHeight;
165 uint32_t fGenerationID; 165 uint32_t fGenerationID;
166 166
167 typedef SkRefCnt INHERITED; 167 typedef SkRefCnt INHERITED;
168 }; 168 };
169 169
170 #endif 170 #endif
OLDNEW
« no previous file with comments | « include/core/SkImageDecoder.h ('k') | include/lazy/SkBitmapFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698