diff options
author | reed <reed@google.com> | 2015-05-04 08:32:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-04 08:32:02 -0700 |
commit | f603fb3d0e5fa57c3f228d66945bef198b001135 (patch) | |
tree | 6d3013b43ae2f94277318b4c949ab1f6f1f18d10 /src/image | |
parent | ab622c7b8cc8c39f0a594e4392b9e31b7e1ddb26 (diff) |
make drawImage a virtual on SkDevice
default impl will turn the Image into a (raster) bitmap and call drawBitmap.
BUG=skia:3803
Review URL: https://codereview.chromium.org/1118823004
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/SkImage.cpp | 9 | ||||
-rw-r--r-- | src/image/SkImage_Base.h | 3 | ||||
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 9 | ||||
-rw-r--r-- | src/image/SkImage_Gpu.h | 3 | ||||
-rw-r--r-- | src/image/SkImage_Raster.cpp | 13 |
5 files changed, 0 insertions, 37 deletions
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index f427755d47..494e21004a 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -25,15 +25,6 @@ uint32_t SkImage::NextUniqueID() { return id; } -void SkImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const { - as_IB(this)->onDraw(canvas, x, y, paint); -} - -void SkImage::drawRect(SkCanvas* canvas, const SkRect* src, const SkRect& dst, - const SkPaint* paint) const { - as_IB(this)->onDrawRect(canvas, src, dst, paint); -} - const void* SkImage::peekPixels(SkImageInfo* info, size_t* rowBytes) const { SkImageInfo infoStorage; size_t rowBytesStorage; diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h index 512c80c44b..5daf4195e2 100644 --- a/src/image/SkImage_Base.h +++ b/src/image/SkImage_Base.h @@ -36,9 +36,6 @@ public: const SkSurfaceProps& props() const { return fProps; } - virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const = 0; - virtual void onDrawRect(SkCanvas*, const SkRect* src, - const SkRect& dst, const SkPaint*) const = 0; virtual SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const = 0; virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const { diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 7ccff17d9b..eec0d19760 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -26,15 +26,6 @@ SkShader* SkImage_Gpu::onNewShader(SkShader::TileMode tileX, return SkShader::CreateBitmapShader(fBitmap, tileX, tileY, localMatrix); } -void SkImage_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const { - canvas->drawBitmap(fBitmap, x, y, paint); -} - -void SkImage_Gpu::onDrawRect(SkCanvas* canvas, const SkRect* src, const SkRect& dst, - const SkPaint* paint) const { - canvas->drawBitmapRectToRect(fBitmap, src, dst, paint); -} - SkSurface* SkImage_Gpu::onNewSurface(const SkImageInfo& info, const SkSurfaceProps& props) const { GrContext* ctx = this->getTexture()->getContext(); // TODO: Change signature of onNewSurface to take a budgeted param. diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h index a771ddab24..7b38e60ea3 100644 --- a/src/image/SkImage_Gpu.h +++ b/src/image/SkImage_Gpu.h @@ -21,9 +21,6 @@ public: SkImage_Gpu(const SkBitmap&, int sampleCountForNewSurfaces, SkSurface::Budgeted); - void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const override; - void onDrawRect(SkCanvas*, const SkRect* src, const SkRect& dst, - const SkPaint*) const override; SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const override; GrTexture* onGetTexture() const override; bool getROPixels(SkBitmap*) const override; diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp index acf805829d..20ae62c9f7 100644 --- a/src/image/SkImage_Raster.cpp +++ b/src/image/SkImage_Raster.cpp @@ -53,8 +53,6 @@ public: SkImage_Raster(const SkImageInfo&, SkData*, size_t rb, const SkSurfaceProps*); virtual ~SkImage_Raster(); - void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) const override; - void onDrawRect(SkCanvas*, const SkRect*, const SkRect&, const SkPaint*) const override; SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const override; bool onReadPixels(const SkImageInfo&, void*, size_t, int srcX, int srcY) const override; const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const override; @@ -120,17 +118,6 @@ SkShader* SkImage_Raster::onNewShader(SkShader::TileMode tileX, SkShader::TileMo return SkShader::CreateBitmapShader(fBitmap, tileX, tileY, localMatrix); } -void SkImage_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const { - SkBitmap shallowCopy(fBitmap); - canvas->drawBitmap(shallowCopy, x, y, paint); -} - -void SkImage_Raster::onDrawRect(SkCanvas* canvas, const SkRect* src, const SkRect& dst, - const SkPaint* paint) const { - SkBitmap shallowCopy(fBitmap); - canvas->drawBitmapRectToRect(shallowCopy, src, dst, paint); -} - SkSurface* SkImage_Raster::onNewSurface(const SkImageInfo& info, const SkSurfaceProps& props) const { return SkSurface::NewRaster(info, &props); } |