diff options
author | Mike Reed <reed@google.com> | 2017-04-12 11:07:35 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-12 11:07:43 +0000 |
commit | 8f30709e93ba377a0bf77f24aeae890d38b66e52 (patch) | |
tree | 842dcdedeb2daf66215ce68c76e5f0af4ddadda2 /src | |
parent | a00f34774712598cdee89b6a6fbdedb68cb9c193 (diff) |
Revert "Revert "remove unused SkBitmap::copyPixelsTo""
This reverts commit 7bfdfda809e7273d7c962cc62ef9390b5007fb5a.
Reason for revert: google3 has been updated
Original change's description:
> Revert "remove unused SkBitmap::copyPixelsTo"
>
> This reverts commit 0f3fdfacf32261f943dcac5cdfd14475011f40db.
>
> Reason for revert: Blink-headless in Google3 needs an update too.
>
> Original change's description:
> > remove unused SkBitmap::copyPixelsTo
> >
> > Needs https://codereview.chromium.org/2812853002/ to land first
> >
> > Bug: skia:6465
> > Change-Id: I531e33b2848cd995f20844786ed1a8d34d63fb64
> > Reviewed-on: https://skia-review.googlesource.com/13171
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Mike Reed <reed@google.com>
> >
>
> TBR=reed@google.com,reviews@skia.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
>
> Change-Id: I5e7c4b0d05772e4948cb1dffdcc40e095fbdba41
> Reviewed-on: https://skia-review.googlesource.com/13185
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>
>
TBR=mtklein@google.com,reviews@skia.org,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: Id441cec351fe580cbb00739ca9544aa5276cf16a
Reviewed-on: https://skia-review.googlesource.com/13224
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkBitmap.cpp | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index 9b8ea7f96c..30c06debcc 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -468,61 +468,6 @@ bool SkBitmap::HeapAllocator::allocPixelRef(SkBitmap* dst, /////////////////////////////////////////////////////////////////////////////// -static bool copy_pixels_to(const SkPixmap& src, void* const dst, size_t dstSize, - size_t dstRowBytes, bool preserveDstPad) { - const SkImageInfo& info = src.info(); - - if (0 == dstRowBytes) { - dstRowBytes = src.rowBytes(); - } - if (dstRowBytes < info.minRowBytes()) { - return false; - } - - if (!preserveDstPad && static_cast<uint32_t>(dstRowBytes) == src.rowBytes()) { - size_t safeSize = src.getSafeSize(); - if (safeSize > dstSize || safeSize == 0) - return false; - else { - // This implementation will write bytes beyond the end of each row, - // excluding the last row, if the bitmap's stride is greater than - // strictly required by the current config. - memcpy(dst, src.addr(), safeSize); - return true; - } - } else { - // If destination has different stride than us, then copy line by line. - if (info.getSafeSize(dstRowBytes) > dstSize) { - return false; - } else { - // Just copy what we need on each line. - size_t rowBytes = info.minRowBytes(); - const uint8_t* srcP = reinterpret_cast<const uint8_t*>(src.addr()); - uint8_t* dstP = reinterpret_cast<uint8_t*>(dst); - for (int row = 0; row < info.height(); ++row) { - memcpy(dstP, srcP, rowBytes); - srcP += src.rowBytes(); - dstP += dstRowBytes; - } - - return true; - } - } -} - -bool SkBitmap::copyPixelsTo(void* dst, size_t dstSize, size_t dstRB, bool preserveDstPad) const { - if (nullptr == dst) { - return false; - } - SkAutoPixmapUnlock result; - if (!this->requestLock(&result)) { - return false; - } - return copy_pixels_to(result.pixmap(), dst, dstSize, dstRB, preserveDstPad); -} - -/////////////////////////////////////////////////////////////////////////////// - bool SkBitmap::isImmutable() const { return fPixelRef ? fPixelRef->isImmutable() : false; } |