Bug 1025537 - Stop using gfxImageSurface in gfxBlur and gfxPlatform::CreateDrawTargetForData. r=mattwoodrow

This commit is contained in:
Jonathan Watt 2014-06-26 08:40:12 +01:00
parent 9207dbc8c0
commit 8954b72140
2 changed files with 12 additions and 14 deletions

View File

@ -5,7 +5,6 @@
#include "gfxBlur.h"
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "gfxPlatform.h"
#include "mozilla/gfx/Blur.h"
@ -70,15 +69,7 @@ gfxAlphaBoxBlur::Init(const gfxRect& aRect,
mBlur->GetStride(),
SurfaceFormat::A8);
if (!dt) {
nsRefPtr<gfxImageSurface> image =
new gfxImageSurface(mData,
gfxIntSize(size.width, size.height),
mBlur->GetStride(),
gfxImageFormat::A8);
dt = Factory::CreateDrawTargetForCairoSurface(image->CairoSurface(), size);
if (!dt) {
return nullptr;
}
return nullptr;
}
IntRect irect = mBlur->GetRect();

View File

@ -1018,11 +1018,18 @@ TemporaryRef<DrawTarget>
gfxPlatform::CreateDrawTargetForData(unsigned char* aData, const IntSize& aSize, int32_t aStride, SurfaceFormat aFormat)
{
NS_ASSERTION(mContentBackend != BackendType::NONE, "No backend.");
if (mContentBackend == BackendType::CAIRO) {
nsRefPtr<gfxImageSurface> image = new gfxImageSurface(aData, gfxIntSize(aSize.width, aSize.height), aStride, SurfaceFormatToImageFormat(aFormat));
return Factory::CreateDrawTargetForCairoSurface(image->CairoSurface(), aSize);
RefPtr<DrawTarget> dt = Factory::CreateDrawTargetForData(mContentBackend,
aData, aSize,
aStride, aFormat);
if (!dt) {
// Factory::CreateDrawTargetForData does not support mContentBackend; retry
// with BackendType::CAIRO:
dt = Factory::CreateDrawTargetForData(BackendType::CAIRO,
aData, aSize,
aStride, aFormat);
}
return Factory::CreateDrawTargetForData(mContentBackend, aData, aSize, aStride, aFormat);
return dt.forget();
}
/* static */ BackendType