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

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

Issue 1310633006: Add a SkPixelSerializer SkImage encode variant (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: separate encode method Created 5 years, 3 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/core/SkWriteBuffer.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 SkImage_DEFINED 8 #ifndef SkImage_DEFINED
9 #define SkImage_DEFINED 9 #define SkImage_DEFINED
10 10
11 #include "SkFilterQuality.h" 11 #include "SkFilterQuality.h"
12 #include "SkImageInfo.h" 12 #include "SkImageInfo.h"
13 #include "SkImageEncoder.h" 13 #include "SkImageEncoder.h"
14 #include "SkRefCnt.h" 14 #include "SkRefCnt.h"
15 #include "SkScalar.h" 15 #include "SkScalar.h"
16 #include "SkShader.h" 16 #include "SkShader.h"
17 17
18 class SkData; 18 class SkData;
19 class SkCanvas; 19 class SkCanvas;
20 class SkColorTable; 20 class SkColorTable;
21 class SkImageGenerator; 21 class SkImageGenerator;
22 class SkPaint; 22 class SkPaint;
23 class SkPicture; 23 class SkPicture;
24 class SkPixelSerializer;
24 class SkString; 25 class SkString;
25 class SkSurface; 26 class SkSurface;
26 class SkSurfaceProps; 27 class SkSurfaceProps;
27 class GrContext; 28 class GrContext;
28 class GrTexture; 29 class GrTexture;
29 30
30 /** 31 /**
31 * SkImage is an abstraction for drawing a rectagle of pixels, though the 32 * SkImage is an abstraction for drawing a rectagle of pixels, though the
32 * particular type of image could be actually storing its data on the GPU, or 33 * particular type of image could be actually storing its data on the GPU, or
33 * as drawing commands (picture or PDF or otherwise), ready to be played back 34 * as drawing commands (picture or PDF or otherwise), ready to be played back
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 217
217 /** 218 /**
218 * Encode the image's pixels and return the result as a new SkData, which 219 * Encode the image's pixels and return the result as a new SkData, which
219 * the caller must manage (i.e. call unref() when they are done). 220 * the caller must manage (i.e. call unref() when they are done).
220 * 221 *
221 * If the image type cannot be encoded, or the requested encoder type is 222 * If the image type cannot be encoded, or the requested encoder type is
222 * not supported, this will return NULL. 223 * not supported, this will return NULL.
223 */ 224 */
224 SkData* encode(SkImageEncoder::Type, int quality) const; 225 SkData* encode(SkImageEncoder::Type, int quality) const;
225 226
227 /**
228 * Same as the above, but using the SkPixelSerializer.
reed1 2015/09/02 13:59:57 // Can the serialize be null? // What happens if t
229 */
230 SkData* encode(SkPixelSerializer*) const;
231
226 SkData* encode() const { 232 SkData* encode() const {
227 return this->encode(SkImageEncoder::kPNG_Type, 100); 233 return this->encode(SkImageEncoder::kPNG_Type, 100);
228 } 234 }
229 235
230 /** 236 /**
231 * If the image already has its contents in encoded form (e.g. PNG or JPEG) , return a ref 237 * If the image already has its contents in encoded form (e.g. PNG or JPEG) , return a ref
232 * to that data (which the caller must call unref() on). The caller is resp onsible for calling 238 * to that data (which the caller must call unref() on). The caller is resp onsible for calling
233 * unref on the data when they are done. 239 * unref on the data when they are done.
234 * 240 *
235 * If the image does not already has its contents in encoded form, return N ULL. 241 * If the image does not already has its contents in encoded form, return N ULL.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 305
300 private: 306 private:
301 const int fWidth; 307 const int fWidth;
302 const int fHeight; 308 const int fHeight;
303 const uint32_t fUniqueID; 309 const uint32_t fUniqueID;
304 310
305 typedef SkRefCnt INHERITED; 311 typedef SkRefCnt INHERITED;
306 }; 312 };
307 313
308 #endif 314 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkWriteBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698