Bug 1464032 Part 13: Make the recording of surface data more efficient. r=rhunt
authorBob Owen <bobowencode@gmail.com>
Sun, 02 Dec 2018 14:19:52 +0000
changeset 477764 09b2e60abc85df3ae4e8a29a01655383acab14bf
parent 477763 4357d695b8d5dd901788d922b73e89f16c45b2c9
child 477765 2fd1ba3d96cd90f32b2858569580cc1c6da976e6
push id113373
push userbobowencode@gmail.com
push dateFri, 07 Jun 2019 11:10:59 +0000
treeherdermozilla-inbound@2195b79ea888 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt
bugs1464032
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1464032 Part 13: Make the recording of surface data more efficient. r=rhunt
gfx/2d/RecordedEventImpl.h
--- a/gfx/2d/RecordedEventImpl.h
+++ b/gfx/2d/RecordedEventImpl.h
@@ -2798,19 +2798,20 @@ inline bool RecordedSourceSurfaceCreatio
 }
 
 template <class S>
 void RecordedSourceSurfaceCreation::Record(S& aStream) const {
   WriteElement(aStream, mRefPtr);
   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);
   }
 }
 
 template <class S>
 RecordedSourceSurfaceCreation::RecordedSourceSurfaceCreation(S& aStream)
     : RecordedEventDerived(SOURCESURFACECREATION), mDataOwned(true) {
   ReadElement(aStream, mRefPtr);
   ReadElement(aStream, mSize);