Bug 786103 - Advance the aSrc and aDst pointers when copying video planes. r=roc a=bajaj
authorChris Peterson <cpeterson@mozilla.com>
Tue, 04 Sep 2012 10:10:06 -0700
changeset 109158 8a23501c1cf04ed83209506cdbf969fde9ccf5f9
parent 109157 38bf74b400b7e72d59a68fa1dd250f00d4456487
child 109159 5bbf21722e917f829c27fc8476820f1cd6df53c8
push idunknown
push userunknown
push dateunknown
reviewersroc, bajaj
bugs786103
milestone17.0a2
Bug 786103 - Advance the aSrc and aDst pointers when copying video planes. r=roc a=bajaj
gfx/layers/ImageContainer.cpp
--- a/gfx/layers/ImageContainer.cpp
+++ b/gfx/layers/ImageContainer.cpp
@@ -407,36 +407,36 @@ PlanarYCbCrImage::~PlanarYCbCrImage()
 
 uint8_t* 
 PlanarYCbCrImage::AllocateBuffer(uint32_t aSize)
 {
   return mRecycleBin->GetBuffer(aSize); 
 }
 
 static void
-CopyPlane(uint8_t *aDst, uint8_t *aSrc,
+CopyPlane(uint8_t *aDst, const uint8_t *aSrc,
           const gfxIntSize &aSize, int32_t aStride, int32_t aSkip)
 {
   if (!aSkip) {
     // Fast path: planar input.
     memcpy(aDst, aSrc, aSize.height * aStride);
   } else {
     int32_t height = aSize.height;
     int32_t width = aSize.width;
     for (int y = 0; y < height; ++y) {
-      uint8_t *src = aSrc;
+      const uint8_t *src = aSrc;
       uint8_t *dst = aDst;
       // Slow path
       for (int x = 0; x < width; ++x) {
         *dst++ = *src++;
         src += aSkip;
       }
+      aSrc += aStride;
+      aDst += aStride;
     }
-    aSrc += aStride;
-    aDst += aStride;
   }
 }
 
 void
 PlanarYCbCrImage::CopyData(const Data& aData)
 {
   mData = aData;