diff options
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/SkImage_Raster.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp index e4768af0ac..a1cd602a07 100644 --- a/src/image/SkImage_Raster.cpp +++ b/src/image/SkImage_Raster.cpp @@ -10,6 +10,7 @@ #include "SkBitmap.h" #include "SkCanvas.h" #include "SkData.h" +#include "SkDecodingImageGenerator.h" #include "SkMallocPixelRef.h" class SkImage_Raster : public SkImage_Base { @@ -69,6 +70,10 @@ public: SkShader::TileMode, const SkMatrix* localMatrix) const SK_OVERRIDE; + SkImage_Raster(const SkBitmap& bm) + : INHERITED(bm.width(), bm.height()) + , fBitmap(bm) {} + private: SkImage_Raster() : INHERITED(0, 0) {} @@ -198,6 +203,14 @@ SkImage* SkImage::NewRasterData(const SkImageInfo& info, SkData* data, size_t ro return SkNEW_ARGS(SkImage_Raster, (info, data, rowBytes)); } +SkImage* SkImage::NewFromGenerator(SkImageGenerator* generator) { + SkBitmap bitmap; + if (!SkInstallDiscardablePixelRef(generator, &bitmap)) { + return NULL; + } + return SkNEW_ARGS(SkImage_Raster, (bitmap)); +} + SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, size_t rowBytes) { return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); |