From 1af71ac3df81a9b312f5375ae3cb6c33c129227b Mon Sep 17 00:00:00 2001 From: Teng-Hui Zhu Date: Mon, 22 Aug 2011 13:20:28 -0700 Subject: Merge the line by line copy into one when appropiate When the stride is the same as the bitmap width, we can just use single memcpy to copy the whole content. bug:5196685 Change-Id: I01c9a673c8e95e14eb23f3d7df4002c886b7554d --- .../WebCore/platform/graphics/android/TransferQueue.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'Source/WebCore/platform/graphics/android/TransferQueue.cpp') diff --git a/Source/WebCore/platform/graphics/android/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/TransferQueue.cpp index 8b4b596..00c9e68 100644 --- a/Source/WebCore/platform/graphics/android/TransferQueue.cpp +++ b/Source/WebCore/platform/graphics/android/TransferQueue.cpp @@ -316,12 +316,16 @@ void TransferQueue::updateQueueWithBitmap(const TileRenderInfo* renderInfo, if (!x && !y && bitmap.width() == width && bitmap.height() == height) { bitmap.lockPixels(); uint8_t* bitmapOrigin = static_cast(bitmap.getPixels()); - // Copied line by line since we need to handle the offsets and stride. - for (row = 0 ; row < bitmap.height(); row ++) { - uint8_t* dst = &(img[(buffer.stride * (row + x) + y) * bpp]); - uint8_t* src = &(bitmapOrigin[bitmap.width() * row * bpp]); - memcpy(dst, src, bpp * bitmap.width()); - } + if (buffer.stride != bitmap.width()) + // Copied line by line since we need to handle the offsets and stride. + for (row = 0 ; row < bitmap.height(); row ++) { + uint8_t* dst = &(img[buffer.stride * row * bpp]); + uint8_t* src = &(bitmapOrigin[bitmap.width() * row * bpp]); + memcpy(dst, src, bpp * bitmap.width()); + } + else + memcpy(img, bitmapOrigin, bpp * bitmap.width() * bitmap.height()); + bitmap.unlockPixels(); } else { // TODO: implement the partial invalidate here! -- cgit v1.1