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 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 virtual bool isOpaque() const { return false; } | 57 virtual bool isOpaque() const { return false; } |
58 | 58 |
59 /** | 59 /** |
60 * Construct a new SkImage based on the given ImageGenerator. | 60 * Construct a new SkImage based on the given ImageGenerator. |
61 * This function will always take ownership of the passed | 61 * This function will always take ownership of the passed |
62 * ImageGenerator. Returns NULL on error. | 62 * ImageGenerator. Returns NULL on error. |
63 */ | 63 */ |
64 static SkImage* NewFromGenerator(SkImageGenerator*); | 64 static SkImage* NewFromGenerator(SkImageGenerator*); |
65 | 65 |
| 66 /** |
| 67 * Construct a new SkImage based on the specified encoded data. Returns NUL
L on failure, |
| 68 * which can mean that the format of the encoded data was not recognized/su
pported. |
| 69 * |
| 70 * Regardless of success or failure, the caller is responsible for managing
their ownership |
| 71 * of the data. |
| 72 */ |
| 73 static SkImage* NewFromData(SkData* data); |
| 74 |
66 int width() const { return fWidth; } | 75 int width() const { return fWidth; } |
67 int height() const { return fHeight; } | 76 int height() const { return fHeight; } |
68 uint32_t uniqueID() const { return fUniqueID; } | 77 uint32_t uniqueID() const { return fUniqueID; } |
69 | 78 |
70 /** | 79 /** |
71 * Return the GrTexture that stores the image pixels. Calling getTexture | 80 * Return the GrTexture that stores the image pixels. Calling getTexture |
72 * does not affect the reference count of the GrTexture object. | 81 * does not affect the reference count of the GrTexture object. |
73 * Will return NULL if the image does not use a texture. | 82 * Will return NULL if the image does not use a texture. |
74 */ | 83 */ |
75 GrTexture* getTexture(); | 84 GrTexture* getTexture(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 * Draw the image, cropped to the src rect, to the dst rect of a canvas. | 167 * Draw the image, cropped to the src rect, to the dst rect of a canvas. |
159 * If src is larger than the bounds of the image, the rest of the image is | 168 * If src is larger than the bounds of the image, the rest of the image is |
160 * filled with transparent black pixels. | 169 * filled with transparent black pixels. |
161 * | 170 * |
162 * See SkCanvas::drawBitmapRectToRect for similar behavior. | 171 * See SkCanvas::drawBitmapRectToRect for similar behavior. |
163 */ | 172 */ |
164 void drawRect(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint
*) const; | 173 void drawRect(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint
*) const; |
165 }; | 174 }; |
166 | 175 |
167 #endif | 176 #endif |
OLD | NEW |