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;