diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-03-17 21:31:26 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-03-17 21:31:26 +0000 |
commit | a713f9c6f6a06d216d53e268b9c691941053dabf (patch) | |
tree | b30ac83502f95e32d621d06b2421da8799b5150d /src/utils | |
parent | f338d7c860bf0bca82cac793069522311a3dbb1a (diff) |
add new readPixels with direct memory parameters
BUG=skia:
R=scroggo@google.com, bsalomon@google.com, robertphillips@google.com, fmalita@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/199413013
git-svn-id: http://skia.googlecode.com/svn/trunk@13840 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/SkDeferredCanvas.cpp | 11 | ||||
-rw-r--r-- | src/utils/SkGatherPixelRefsAndRects.h | 6 | ||||
-rw-r--r-- | src/utils/SkPictureUtils.cpp | 7 |
3 files changed, 11 insertions, 13 deletions
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp index 9051874870..2e3f5bb6a5 100644 --- a/src/utils/SkDeferredCanvas.cpp +++ b/src/utils/SkDeferredCanvas.cpp @@ -171,9 +171,12 @@ public: protected: virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE; +#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y, SkCanvas::Config8888 config8888) SK_OVERRIDE; +#endif + virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y) SK_OVERRIDE; virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, int y) SK_OVERRIDE; // The following methods are no-ops on a deferred device @@ -506,12 +509,20 @@ SkSurface* SkDeferredDevice::newSurface(const SkImageInfo& info) { return this->immediateDevice()->newSurface(info); } +#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG bool SkDeferredDevice::onReadPixels( const SkBitmap& bitmap, int x, int y, SkCanvas::Config8888 config8888) { this->flushPendingCommands(kNormal_PlaybackMode); return fImmediateCanvas->readPixels(const_cast<SkBitmap*>(&bitmap), x, y, config8888); } +#endif + +bool SkDeferredDevice::onReadPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, + int x, int y) { + this->flushPendingCommands(kNormal_PlaybackMode); + return fImmediateCanvas->readPixels(info, pixels, rowBytes, x, y); +} class AutoImmediateDrawIfNeeded { public: diff --git a/src/utils/SkGatherPixelRefsAndRects.h b/src/utils/SkGatherPixelRefsAndRects.h index 1c9d6fc361..894b8f0fde 100644 --- a/src/utils/SkGatherPixelRefsAndRects.h +++ b/src/utils/SkGatherPixelRefsAndRects.h @@ -291,12 +291,6 @@ protected: virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE { return fEmptyBitmap; } - virtual bool onReadPixels(const SkBitmap& bitmap, - int x, int y, - SkCanvas::Config8888 config8888) SK_OVERRIDE { - NotSupported(); - return false; - } virtual void lockPixels() SK_OVERRIDE { NothingToDo(); } virtual void unlockPixels() SK_OVERRIDE { NothingToDo(); } virtual bool allowImageFilter(const SkImageFilter*) SK_OVERRIDE { return false; } diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp index 78d70ca4eb..fc1611d288 100644 --- a/src/utils/SkPictureUtils.cpp +++ b/src/utils/SkPictureUtils.cpp @@ -157,13 +157,6 @@ public: } protected: - virtual bool onReadPixels(const SkBitmap& bitmap, - int x, int y, - SkCanvas::Config8888 config8888) SK_OVERRIDE { - not_supported(); - return false; - } - virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE { not_supported(); } |