| 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 30 matching lines...) Expand all Loading... |
| 41 class SK_API SkImage : public SkRefCnt { | 41 class SK_API SkImage : public SkRefCnt { |
| 42 public: | 42 public: |
| 43 SK_DECLARE_INST_COUNT(SkImage) | 43 SK_DECLARE_INST_COUNT(SkImage) |
| 44 | 44 |
| 45 typedef SkImageInfo Info; | 45 typedef SkImageInfo Info; |
| 46 | 46 |
| 47 static SkImage* NewRasterCopy(const Info&, const void* pixels, size_t rowByt
es); | 47 static SkImage* NewRasterCopy(const Info&, const void* pixels, size_t rowByt
es); |
| 48 static SkImage* NewRasterData(const Info&, SkData* pixels, size_t rowBytes); | 48 static SkImage* NewRasterData(const Info&, SkData* pixels, size_t rowBytes); |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * GrTexture is a more logical parameter for this factory, but its | |
| 52 * interactions with scratch cache still has issues, so for now we take | |
| 53 * SkBitmap instead. This will be changed in the future. skbug.com/1449 | |
| 54 */ | |
| 55 static SkImage* NewTexture(const SkBitmap&); | |
| 56 | |
| 57 virtual bool isOpaque() const { return false; } | |
| 58 | |
| 59 /** | |
| 60 * Construct a new SkImage based on the given ImageGenerator. | 51 * Construct a new SkImage based on the given ImageGenerator. |
| 61 * This function will always take ownership of the passed | 52 * This function will always take ownership of the passed |
| 62 * ImageGenerator. Returns NULL on error. | 53 * ImageGenerator. Returns NULL on error. |
| 63 */ | 54 */ |
| 64 static SkImage* NewFromGenerator(SkImageGenerator*); | 55 static SkImage* NewFromGenerator(SkImageGenerator*); |
| 65 | 56 |
| 66 /** | 57 /** |
| 67 * Construct a new SkImage based on the specified encoded data. Returns NUL
L on failure, | 58 * 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. | 59 * which can mean that the format of the encoded data was not recognized/su
pported. |
| 69 * | 60 * |
| 70 * Regardless of success or failure, the caller is responsible for managing
their ownership | 61 * Regardless of success or failure, the caller is responsible for managing
their ownership |
| 71 * of the data. | 62 * of the data. |
| 72 */ | 63 */ |
| 73 static SkImage* NewFromData(SkData* data); | 64 static SkImage* NewFromData(SkData* data); |
| 74 | 65 |
| 75 int width() const { return fWidth; } | 66 int width() const { return fWidth; } |
| 76 int height() const { return fHeight; } | 67 int height() const { return fHeight; } |
| 77 uint32_t uniqueID() const { return fUniqueID; } | 68 uint32_t uniqueID() const { return fUniqueID; } |
| 69 virtual bool isOpaque() const { return false; } |
| 78 | 70 |
| 79 /** | 71 /** |
| 80 * Return the GrTexture that stores the image pixels. Calling getTexture | 72 * Return the GrTexture that stores the image pixels. Calling getTexture |
| 81 * does not affect the reference count of the GrTexture object. | 73 * does not affect the reference count of the GrTexture object. |
| 82 * Will return NULL if the image does not use a texture. | 74 * Will return NULL if the image does not use a texture. |
| 83 */ | 75 */ |
| 84 GrTexture* getTexture(); | 76 GrTexture* getTexture(); |
| 85 | 77 |
| 86 virtual SkShader* newShader(SkShader::TileMode, | 78 virtual SkShader* newShader(SkShader::TileMode, |
| 87 SkShader::TileMode, | 79 SkShader::TileMode, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 * Draw the image, cropped to the src rect, to the dst rect of a canvas. | 159 * Draw the image, cropped to the src rect, to the dst rect of a canvas. |
| 168 * If src is larger than the bounds of the image, the rest of the image is | 160 * If src is larger than the bounds of the image, the rest of the image is |
| 169 * filled with transparent black pixels. | 161 * filled with transparent black pixels. |
| 170 * | 162 * |
| 171 * See SkCanvas::drawBitmapRectToRect for similar behavior. | 163 * See SkCanvas::drawBitmapRectToRect for similar behavior. |
| 172 */ | 164 */ |
| 173 void drawRect(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint
*) const; | 165 void drawRect(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint
*) const; |
| 174 }; | 166 }; |
| 175 | 167 |
| 176 #endif | 168 #endif |
| OLD | NEW |