diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2011-08-22 13:20:28 -0700 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2011-08-22 13:37:31 -0700 |
commit | 1af71ac3df81a9b312f5375ae3cb6c33c129227b (patch) | |
tree | 3f31b18e0295d3b397b8030047ecf78ce92063e4 /Source/WebCore | |
parent | 77e5b594dd717e27b1a8be2b521f738cf5941ae1 (diff) | |
download | external_webkit-1af71ac3df81a9b312f5375ae3cb6c33c129227b.zip external_webkit-1af71ac3df81a9b312f5375ae3cb6c33c129227b.tar.gz external_webkit-1af71ac3df81a9b312f5375ae3cb6c33c129227b.tar.bz2 |
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
Diffstat (limited to 'Source/WebCore')
-rw-r--r-- | Source/WebCore/platform/graphics/android/TransferQueue.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
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<uint8_t*>(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! |