Bug 791167: stride*height is the size of the region. r=roc
authorChris Jones <jones.chris.g@gmail.com>
Tue, 18 Sep 2012 10:00:45 -0700
changeset 110984 5560ff65b090bcde611394c2b741bc2d8183f286
parent 110983 cd720de0b57eddd8c833e8c4943cfbbebffcbfb5
child 110985 47825c36d6e8c141700931ce924fea316d51efd6
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs791167
milestone18.0a1
Bug 791167: stride*height is the size of the region. r=roc
gfx/layers/GrallocImages.cpp
--- a/gfx/layers/GrallocImages.cpp
+++ b/gfx/layers/GrallocImages.cpp
@@ -74,28 +74,28 @@ GrallocPlanarYCbCrImage::SetData(const D
   // Align to 16 bytes boundary
   int32_t uvStride = ((yStride / 2) + 15) & ~0x0F;
   uint8_t* uChannel = vChannel + (uvStride * uvSize.height);
 
   // Memory outside of the image width may not writable. If the stride
   // equals to the image width then we can use only one copy.
   if (yStride == mData.mYStride &&
       yStride == ySize.width) {
-    memcpy(yChannel, mData.mYChannel, yStride * ySize.width);
+    memcpy(yChannel, mData.mYChannel, yStride * ySize.height);
   } else {
     for (int i = 0; i < ySize.height; i++) {
       memcpy(yChannel + i * yStride,
              mData.mYChannel + i * mData.mYStride,
              ySize.width);
     }
   }
   if (uvStride == mData.mCbCrStride &&
       uvStride == uvSize.width) {
-    memcpy(uChannel, mData.mCbChannel, uvStride * uvSize.width);
-    memcpy(vChannel, mData.mCrChannel, uvStride * uvSize.width);
+    memcpy(uChannel, mData.mCbChannel, uvStride * uvSize.height);
+    memcpy(vChannel, mData.mCrChannel, uvStride * uvSize.height);
   } else {
     for (int i = 0; i < uvSize.height; i++) {
       memcpy(uChannel + i * uvStride,
              mData.mCbChannel + i * mData.mCbCrStride,
              uvSize.width);
       memcpy(vChannel + i * uvStride,
              mData.mCrChannel + i * mData.mCbCrStride,
              uvSize.width);