From d271c7e26cc7be64c2316eca7c0064a4fe8fcbec Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Fri, 27 Sep 2013 17:21:09 +0200 Subject: [PATCH] Bug 921132 - Make CopyDataToCairoSurface respect stride. r=ncameron --- gfx/2d/DrawTargetCairo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gfx/2d/DrawTargetCairo.cpp b/gfx/2d/DrawTargetCairo.cpp index a8d22a9b050..6391b53f1b4 100644 --- a/gfx/2d/DrawTargetCairo.cpp +++ b/gfx/2d/DrawTargetCairo.cpp @@ -902,6 +902,7 @@ CopyDataToCairoSurface(cairo_surface_t* aSurface, int32_t aPixelWidth) { unsigned char* surfData = cairo_image_surface_get_data(aSurface); + int surfStride = cairo_image_surface_get_stride(aSurface); // In certain scenarios, requesting larger than 8k image fails. Bug 803568 // covers the details of how to run into it, but the full detailed // investigation hasn't been done to determine the underlying cause. We @@ -910,7 +911,7 @@ CopyDataToCairoSurface(cairo_surface_t* aSurface, return; } for (int32_t y = 0; y < aSize.height; ++y) { - memcpy(surfData + y * aSize.width * aPixelWidth, + memcpy(surfData + y * surfStride, aData + y * aStride, aSize.width * aPixelWidth); }