From 3cec9dbf001821071e85647b0f6df23548d24668 Mon Sep 17 00:00:00 2001 From: Bob Owen Date: Sun, 2 Dec 2018 14:19:52 +0000 Subject: [PATCH] Bug 1464032 Part 13: Make the recording of surface data more efficient. r=rhunt --- gfx/2d/RecordedEventImpl.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gfx/2d/RecordedEventImpl.h b/gfx/2d/RecordedEventImpl.h index 07d084897e36..42ac18b9d215 100644 --- a/gfx/2d/RecordedEventImpl.h +++ b/gfx/2d/RecordedEventImpl.h @@ -2803,9 +2803,10 @@ void RecordedSourceSurfaceCreation::Record(S& aStream) const { WriteElement(aStream, mSize); WriteElement(aStream, mFormat); MOZ_ASSERT(mData); - for (int y = 0; y < mSize.height; y++) { - aStream.write((const char*)mData + y * mStride, - BytesPerPixel(mFormat) * mSize.width); + size_t dataFormatWidth = BytesPerPixel(mFormat) * mSize.width; + const char* endSrc = (const char*)(mData + (mSize.height * mStride)); + for (const char* src = (const char*)mData; src < endSrc; src += mStride) { + aStream.write(src, dataFormatWidth); } }