From 0c8db7cb1eff3bdb673caacc33d21212ac2dcff4 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Wed, 31 Aug 2011 14:03:34 +1200 Subject: [PATCH] Bug 682615 - Use fallible new for BasicPlanarYCbCrImage. r=roc --- gfx/layers/ImageLayers.h | 5 +++++ gfx/layers/basic/BasicImages.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gfx/layers/ImageLayers.h b/gfx/layers/ImageLayers.h index fd1868916c9..f1ebe3c47fe 100644 --- a/gfx/layers/ImageLayers.h +++ b/gfx/layers/ImageLayers.h @@ -452,6 +452,11 @@ public: PRUint8 *CopyData(Data& aDest, gfxIntSize& aDestSize, PRUint32& aDestBufferSize, const Data& aData); + /** + * Return a buffer to store image data in. + * The default implementation returns memory that can + * be freed wit delete[] + */ virtual PRUint8* AllocateBuffer(PRUint32 aSize); /** diff --git a/gfx/layers/basic/BasicImages.cpp b/gfx/layers/basic/BasicImages.cpp index 21ea307354a..065596b82d1 100644 --- a/gfx/layers/basic/BasicImages.cpp +++ b/gfx/layers/basic/BasicImages.cpp @@ -206,7 +206,7 @@ BasicPlanarYCbCrImage::SetData(const Data& aData) prescale ? mScaleHint.height : aData.mPicSize.height); mStride = gfxASurface::FormatStrideForWidth(format, size.width); - mBuffer = new PRUint8[size.height * mStride]; + mBuffer = AllocateBuffer(size.height * mStride); if (!mBuffer) { // out of memory return;