diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index c5c866b0ab..e98a294bde 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -243,23 +243,6 @@ public: bool copyPixelsTo(void* const dst, size_t dstSize, int dstRowBytes = -1) const; - /** Copies the pixels at location src to the bitmap's pixel buffer. - Returns true if copy if possible (bitmap buffer is large enough), - false otherwise. - - Like copyPixelsTo, this function may write values beyond the end of - each row, although never outside the defined buffer. - - Always returns false for RLE formats. - - @param src Location of the source buffer. - @param srcSize Height of source buffer in pixels. - @param srcRowBytes Width of each line in the buffer. If -1, uses i - bitmap's internal stride. - */ - bool copyPixelsFrom(const void* const src, size_t srcSize, - int srcRowBytes = -1); - /** Use the standard HeapAllocator to create the pixelref that manages the pixel memory. It will be sized based on the current width/height/config. If this is called multiple times, a new pixelref object will be created diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index 6e4639f285..9683654db6 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -502,41 +502,6 @@ bool SkBitmap::copyPixelsTo(void* const dst, size_t dstSize, int dstRowBytes) } } -bool SkBitmap::copyPixelsFrom(const void* const src, size_t srcSize, - int srcRowBytes) { - - if (srcRowBytes == -1) - srcRowBytes = fRowBytes; - SkASSERT(srcRowBytes >= 0); - - size_t safeSize = getSafeSize(); - uint32_t rowBytes = ComputeRowBytes(getConfig(), fWidth); - if (getConfig() == kRLE_Index8_Config || src == NULL || - static_cast(srcRowBytes) < rowBytes || - safeSize == 0 || - srcSize < ComputeSafeSize(getConfig(), fWidth, fHeight, srcRowBytes)) { - return false; - } - - SkAutoLockPixels lock(*this); - if (static_cast(srcRowBytes) == fRowBytes) { - // 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(getPixels(), src, safeSize); - } else { - // Just copy the bytes we need on each line. - const uint8_t* srcP = reinterpret_cast(src); - uint8_t* dstP = reinterpret_cast(getPixels()); - for (uint32_t row = 0; row < fHeight; - row++, srcP += srcRowBytes, dstP += fRowBytes) { - memcpy(dstP, srcP, rowBytes); - } - } - - return true; -} - /////////////////////////////////////////////////////////////////////////////// bool SkBitmap::isOpaque() const {