Chromium Code Reviews| 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 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |