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 107388 5560ff65b090bcde611394c2b741bc2d8183f286
parent 107387 cd720de0b57eddd8c833e8c4943cfbbebffcbfb5
child 107389 47825c36d6e8c141700931ce924fea316d51efd6
push id23486
push usergraememcc_firefox@graeme-online.co.uk
push dateWed, 19 Sep 2012 14:18:40 +0000
treeherdermozilla-central@0c8ac138706e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs791167
milestone18.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 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);