Bug 1006198 - Use 8byte aligned surface for CopyableCanvasLayer since that's the max WebGL supports for readback. r=nical

This commit is contained in:
Matt Woodrow 2014-05-13 14:20:27 +12:00
Родитель 0dabff9cf3
Коммит 4fe1979c07
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -17,6 +17,7 @@
#include "gfxUtils.h" // for gfxUtils
#include "gfx2DGlue.h" // for thebes --> moz2d transition
#include "mozilla/gfx/BaseSize.h" // for BaseSize
#include "mozilla/gfx/Tools.h"
#include "nsDebug.h" // for NS_ASSERTION, NS_WARNING, etc
#include "nsISupportsImpl.h" // for gfxContext::AddRef, etc
#include "nsRect.h" // for nsIntRect
@ -170,7 +171,9 @@ CopyableCanvasLayer::GetTempSurface(const IntSize& aSize,
aSize != mCachedTempSurface->GetSize() ||
aFormat != mCachedTempSurface->GetFormat())
{
mCachedTempSurface = Factory::CreateDataSourceSurface(aSize, aFormat);
// Create a surface aligned to 8 bytes since that's the highest alignment WebGL can handle.
uint32_t stride = GetAlignedStride<8>(aSize.width * BytesPerPixel(aFormat));
mCachedTempSurface = Factory::CreateDataSourceSurfaceWithStride(aSize, aFormat, stride);
}
return mCachedTempSurface;