Bug 952033 - Part b: Use IntSize in CreateOffscreenSurface; r=roc

This commit is contained in:
Ms2ger 2014-02-09 09:04:38 +01:00
parent f70eb58dd6
commit 42aa546e2f
33 changed files with 101 additions and 71 deletions

View File

@ -3463,7 +3463,7 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x,
thebes->Scale(matrix._11, matrix._22);
} else {
drawSurf =
gfxPlatform::GetPlatform()->CreateOffscreenSurface(gfxIntSize(ceil(sw), ceil(sh)),
gfxPlatform::GetPlatform()->CreateOffscreenSurface(IntSize(ceil(sw), ceil(sh)),
gfxContentType::COLOR_ALPHA);
if (!drawSurf) {
error.Throw(NS_ERROR_FAILURE);

View File

@ -209,7 +209,8 @@ already_AddRefed<gfxASurface>
BasicTextureImage::GetSurfaceForUpdate(const gfxIntSize& aSize, ImageFormat aFmt)
{
return gfxPlatform::GetPlatform()->
CreateOffscreenSurface(aSize, gfxASurface::ContentFromFormat(aFmt));
CreateOffscreenSurface(aSize.ToIntSize(),
gfxASurface::ContentFromFormat(aFmt));
}
bool
@ -512,7 +513,8 @@ TiledTextureImage::BeginUpdate(nsIntRegion& aRegion)
(GetContentType() == gfxContentType::COLOR) ?
gfxImageFormat::RGB24 : gfxImageFormat::ARGB32;
mUpdateSurface = gfxPlatform::GetPlatform()->
CreateOffscreenSurface(gfxIntSize(bounds.width, bounds.height), gfxASurface::ContentFromFormat(format));
CreateOffscreenSurface(bounds.Size().ToIntSize(),
gfxASurface::ContentFromFormat(format));
mUpdateSurface->SetDeviceOffset(gfxPoint(-bounds.x, -bounds.y));
return mUpdateSurface;

View File

@ -5,11 +5,15 @@
#include "TextureImageCGL.h"
#include "GLContext.h"
#include "gfx2DGlue.h"
#include "gfxQuartzSurface.h"
#include "gfxPlatform.h"
#include "gfxFailure.h"
namespace mozilla {
using namespace gfx;
namespace gl {
TextureImageCGL::TextureImageCGL(GLuint aTexture,
@ -37,7 +41,7 @@ TextureImageCGL::~TextureImageCGL()
already_AddRefed<gfxASurface>
TextureImageCGL::GetSurfaceForUpdate(const gfxIntSize& aSize, ImageFormat aFmt)
{
gfxIntSize size(aSize.width + 1, aSize.height + 1);
IntSize size(aSize.width + 1, aSize.height + 1);
mGLContext->MakeCurrent();
if (!mGLContext->
IsExtensionSupported(GLContext::ARB_pixel_buffer_object))
@ -78,7 +82,7 @@ TextureImageCGL::GetSurfaceForUpdate(const gfxIntSize& aSize, ImageFormat aFmt)
}
nsRefPtr<gfxQuartzSurface> surf =
new gfxQuartzSurface(data, size, size.width * 4, aFmt);
new gfxQuartzSurface(data, ThebesIntSize(size), size.width * 4, aFmt);
mBoundPixelBuffer = true;
return surf.forget();

View File

@ -118,7 +118,7 @@ LayerManager::CreateOptimalSurface(const gfx::IntSize &aSize,
gfxImageFormat aFormat)
{
return gfxPlatform::GetPlatform()->
CreateOffscreenSurface(gfx::ThebesIntSize(aSize), gfxASurface::ContentFromFormat(aFormat));
CreateOffscreenSurface(aSize, gfxASurface::ContentFromFormat(aFormat));
}
already_AddRefed<gfxASurface>

View File

@ -121,8 +121,7 @@ TextureClientX11::AllocateForSurface(IntSize aSize, TextureAllocationFlags aText
//MOZ_ASSERT(mFormat != gfx::FORMAT_YUV, "This TextureClient cannot use YCbCr data");
gfxContentType contentType = ContentForFormat(mFormat);
gfxIntSize size = ThebesIntSize(aSize);
nsRefPtr<gfxASurface> surface = gfxPlatform::GetPlatform()->CreateOffscreenSurface(size, contentType);
nsRefPtr<gfxASurface> surface = gfxPlatform::GetPlatform()->CreateOffscreenSurface(aSize, contentType);
if (!surface || surface->GetType() != gfxSurfaceType::Xlib) {
NS_ERROR("creating Xlib surface failed!");
return false;

View File

@ -135,7 +135,7 @@ ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfx::IntSize& aSize,
gfxPlatform* platform = gfxPlatform::GetPlatform();
nsRefPtr<gfxASurface> buffer =
platform->CreateOffscreenSurface(gfx::ThebesIntSize(aSize), aContent);
platform->CreateOffscreenSurface(aSize, aContent);
if (!buffer ||
buffer->GetType() != gfxSurfaceType::Xlib) {
NS_ERROR("creating Xlib front/back surfaces failed!");

View File

@ -188,7 +188,7 @@ MakeContext ()
nsRefPtr<gfxASurface> surface;
surface = gfxPlatform::GetPlatform()->
CreateOffscreenSurface(gfxIntSize(size, size),
CreateOffscreenSurface(IntSize(size, size),
gfxASurface::ContentFromFormat(gfxImageFormat::RGB24));
nsRefPtr<gfxContext> ctx = new gfxContext(surface);
return ctx.forget();

View File

@ -40,7 +40,7 @@ MakeContext ()
nsRefPtr<gfxASurface> surface;
surface = gfxPlatform::GetPlatform()->
CreateOffscreenSurface(gfxIntSize(size, size),
CreateOffscreenSurface(IntSize(size, size),
gfxASurface::ContentFromFormat(gfxImageFormat::RGB24));
nsRefPtr<gfxContext> ctx = new gfxContext(surface);
return ctx.forget();

View File

@ -81,7 +81,7 @@ MakeContext ()
nsRefPtr<gfxASurface> surface;
surface = gfxPlatform::GetPlatform()->
CreateOffscreenSurface(gfxIntSize(size, size),
CreateOffscreenSurface(IntSize(size, size),
gfxASurface::ContentFromFormat(gfxImageFormat::RGB24));
nsRefPtr<gfxContext> ctx = new gfxContext(surface);
return ctx.forget();

View File

@ -10,6 +10,7 @@
#include "mozilla/gfx/2D.h"
#include "mozilla/Preferences.h"
#include "gfx2DGlue.h"
#include "gfxFT2FontList.h"
#include "gfxImageSurface.h"
#include "mozilla/dom/ContentChild.h"
@ -135,11 +136,12 @@ gfxAndroidPlatform::~gfxAndroidPlatform()
}
already_AddRefed<gfxASurface>
gfxAndroidPlatform::CreateOffscreenSurface(const gfxIntSize& size,
gfxContentType contentType)
gfxAndroidPlatform::CreateOffscreenSurface(const IntSize& size,
gfxContentType contentType)
{
nsRefPtr<gfxASurface> newSurface;
newSurface = new gfxImageSurface(size, OptimalFormatForContent(contentType));
newSurface = new gfxImageSurface(ThebesIntSize(size),
OptimalFormatForContent(contentType));
return newSurface.forget();
}

View File

@ -33,7 +33,7 @@ public:
}
virtual already_AddRefed<gfxASurface>
CreateOffscreenSurface(const gfxIntSize& size,
CreateOffscreenSurface(const IntSize& size,
gfxContentType contentType);
virtual already_AddRefed<gfxASurface>
OptimizeImage(gfxImageSurface *aSurface,

View File

@ -196,7 +196,8 @@ already_AddRefed<gfxSurfaceDrawable>
gfxCallbackDrawable::MakeSurfaceDrawable(const GraphicsFilter aFilter)
{
nsRefPtr<gfxASurface> surface =
gfxPlatform::GetPlatform()->CreateOffscreenSurface(mSize, gfxContentType::COLOR_ALPHA);
gfxPlatform::GetPlatform()->CreateOffscreenSurface(mSize.ToIntSize(),
gfxContentType::COLOR_ALPHA);
if (!surface || surface->CairoStatus() != 0)
return nullptr;

View File

@ -49,29 +49,30 @@ gfxOS2Platform::~gfxOS2Platform()
}
already_AddRefed<gfxASurface>
gfxOS2Platform::CreateOffscreenSurface(const gfxIntSize& aSize,
gfxOS2Platform::CreateOffscreenSurface(const IntSize& aSize,
gfxContentType contentType)
{
#ifdef DEBUG_thebes_2
printf("gfxOS2Platform::CreateOffscreenSurface(%d/%d, %d)\n",
aSize.width, aSize.height, aImageFormat);
#endif
gfxASurface *newSurface = nullptr;
nsRefPtr<gfxASurface> newSurface;
// we only ever seem to get aImageFormat=0 or gfxImageFormat::ARGB32 but
// I don't really know if we need to differ between ARGB32 and RGB24 here
if (contentType == gfxContentType::COLOR_ALPHA ||
contentType == gfxContentType::COLOR)
{
newSurface = new gfxOS2Surface(aSize, OptimalFormatForContent(contentType));
newSurface = new gfxOS2Surface(ThebesIntSize(aSize),
OptimalFormatForContent(contentType));
} else if (contentType == gfxContentType::ALPHA) {
newSurface = new gfxImageSurface(aSize, OptimalFormatForContent(contentType));
newSurface = new gfxImageSurface(ThebesIntSize(aSize),
OptimalFormatForContent(contentType));
} else {
return nullptr;
}
NS_IF_ADDREF(newSurface);
return newSurface;
return newSurface.forget();
}
nsresult

View File

@ -26,9 +26,9 @@ public:
return (gfxOS2Platform*) gfxPlatform::GetPlatform();
}
already_AddRefed<gfxASurface>
CreateOffscreenSurface(const gfxIntSize& size,
gfxContentType contentType);
virtual already_AddRefed<gfxASurface>
CreateOffscreenSurface(const IntSize& size,
gfxContentType contentType) MOZ_OVERRIDE;
nsresult GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,

View File

@ -440,7 +440,7 @@ gfxPlatform::Init()
#endif
gPlatform->mScreenReferenceSurface =
gPlatform->CreateOffscreenSurface(gfxIntSize(1,1),
gPlatform->CreateOffscreenSurface(IntSize(1, 1),
gfxContentType::COLOR_ALPHA);
if (!gPlatform->mScreenReferenceSurface) {
NS_RUNTIMEABORT("Could not initialize mScreenReferenceSurface");
@ -633,7 +633,7 @@ already_AddRefed<gfxASurface>
gfxPlatform::OptimizeImage(gfxImageSurface *aSurface,
gfxImageFormat format)
{
const gfxIntSize& surfaceSize = aSurface->GetSize();
IntSize surfaceSize = aSurface->GetSize().ToIntSize();
#ifdef XP_WIN
if (gfxWindowsPlatform::GetPlatform()->GetRenderMode() ==
@ -992,7 +992,7 @@ gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSi
// CreateOffscreenSurface() and CreateDrawTargetForSurface() for all
// backends).
if (aBackend == BackendType::CAIRO) {
nsRefPtr<gfxASurface> surf = CreateOffscreenSurface(ThebesIntSize(aSize),
nsRefPtr<gfxASurface> surf = CreateOffscreenSurface(aSize,
ContentForFormat(aFormat));
if (!surf || surf->CairoStatus()) {
return nullptr;

View File

@ -158,6 +158,8 @@ GetBackendName(mozilla::gfx::BackendType aBackend)
class gfxPlatform {
public:
typedef mozilla::gfx::IntSize IntSize;
/**
* Return a pointer to the current active platform.
* This is a singleton; it contains mostly convenience
@ -176,8 +178,9 @@ public:
* Create an offscreen surface of the given dimensions
* and image format.
*/
virtual already_AddRefed<gfxASurface> CreateOffscreenSurface(const gfxIntSize& size,
gfxContentType contentType) = 0;
virtual already_AddRefed<gfxASurface>
CreateOffscreenSurface(const IntSize& size,
gfxContentType contentType) = 0;
/**
* Create an offscreen surface of the given dimensions and image format which

View File

@ -11,6 +11,7 @@
#include "nsUnicharUtils.h"
#include "nsUnicodeProperties.h"
#include "gfx2DGlue.h"
#include "gfxFontconfigUtils.h"
#include "gfxPangoFonts.h"
#include "gfxContext.h"
@ -85,7 +86,7 @@ gfxPlatformGtk::~gfxPlatformGtk()
}
already_AddRefed<gfxASurface>
gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
gfxPlatformGtk::CreateOffscreenSurface(const IntSize& size,
gfxContentType contentType)
{
nsRefPtr<gfxASurface> newSurface;
@ -104,12 +105,13 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
imageFormat);
if (xrenderFormat) {
newSurface = gfxXlibSurface::Create(screen, xrenderFormat, size);
newSurface = gfxXlibSurface::Create(screen, xrenderFormat,
ThebesIntSize(size));
}
} else {
// We're not going to use XRender, so we don't need to
// search for a render format
newSurface = new gfxImageSurface(size, imageFormat);
newSurface = new gfxImageSurface(ThebesIntSize(size), imageFormat);
// The gfxImageSurface ctor zeroes this for us, no need to
// waste time clearing again
needsClear = false;
@ -121,7 +123,7 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
// We couldn't create a native surface for whatever reason;
// e.g., no display, no RENDER, bad size, etc.
// Fall back to image surface for the data.
newSurface = new gfxImageSurface(size, imageFormat);
newSurface = new gfxImageSurface(ThebesIntSize(size), imageFormat);
}
if (newSurface->CairoStatus()) {

View File

@ -27,8 +27,9 @@ public:
return (gfxPlatformGtk*) gfxPlatform::GetPlatform();
}
already_AddRefed<gfxASurface> CreateOffscreenSurface(const gfxIntSize& size,
gfxContentType contentType);
virtual already_AddRefed<gfxASurface>
CreateOffscreenSurface(const IntSize& size,
gfxContentType contentType) MOZ_OVERRIDE;
mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);

View File

@ -90,11 +90,12 @@ gfxPlatformMac::CreatePlatformFontList()
}
already_AddRefed<gfxASurface>
gfxPlatformMac::CreateOffscreenSurface(const gfxIntSize& size,
gfxPlatformMac::CreateOffscreenSurface(const IntSize& size,
gfxContentType contentType)
{
nsRefPtr<gfxASurface> newSurface =
new gfxQuartzSurface(size, OptimalFormatForContent(contentType));
new gfxQuartzSurface(ThebesIntSize(size),
OptimalFormatForContent(contentType));
return newSurface.forget();
}
@ -102,7 +103,8 @@ already_AddRefed<gfxASurface>
gfxPlatformMac::CreateOffscreenImageSurface(const gfxIntSize& aSize,
gfxContentType aContentType)
{
nsRefPtr<gfxASurface> surface = CreateOffscreenSurface(aSize, aContentType);
nsRefPtr<gfxASurface> surface =
CreateOffscreenSurface(aSize.ToIntSize(), aContentType);
#ifdef DEBUG
nsRefPtr<gfxImageSurface> imageSurface = surface->GetAsImageSurface();
NS_ASSERTION(imageSurface, "Surface cannot be converted to a gfxImageSurface");

View File

@ -25,8 +25,10 @@ public:
return (gfxPlatformMac*) gfxPlatform::GetPlatform();
}
already_AddRefed<gfxASurface> CreateOffscreenSurface(const gfxIntSize& size,
gfxContentType contentType);
virtual already_AddRefed<gfxASurface>
CreateOffscreenSurface(const IntSize& size,
gfxContentType contentType) MOZ_OVERRIDE;
virtual already_AddRefed<gfxASurface>
CreateOffscreenImageSurface(const gfxIntSize& aSize,
gfxContentType aContentType);

View File

@ -166,7 +166,7 @@ gfxQtPlatform::GetXScreen(QWidget* aWindow)
#endif
already_AddRefed<gfxASurface>
gfxQtPlatform::CreateOffscreenSurface(const gfxIntSize& size,
gfxQtPlatform::CreateOffscreenSurface(const IntSize& size,
gfxContentType contentType)
{
nsRefPtr<gfxASurface> newSurface = nullptr;
@ -175,14 +175,14 @@ gfxQtPlatform::CreateOffscreenSurface(const gfxIntSize& size,
#ifdef CAIRO_HAS_QT_SURFACE
if (mRenderMode == RENDER_QPAINTER) {
newSurface = new gfxQPainterSurface(size, imageFormat);
newSurface = new gfxQPainterSurface(ThebesIntSize(size), imageFormat);
return newSurface.forget();
}
#endif
if ((mRenderMode == RENDER_BUFFERED || mRenderMode == RENDER_DIRECT) &&
sDefaultQtPaintEngineType != QPaintEngine::X11) {
newSurface = new gfxImageSurface(size, imageFormat);
newSurface = new gfxImageSurface(ThebesIntSize(size), imageFormat);
return newSurface.forget();
}
@ -191,7 +191,8 @@ gfxQtPlatform::CreateOffscreenSurface(const gfxIntSize& size,
gfxXlibSurface::FindRenderFormat(GetXDisplay(), imageFormat);
Screen* screen = GetXScreen();
newSurface = gfxXlibSurface::Create(screen, xrenderFormat, size);
newSurface = gfxXlibSurface::Create(screen, xrenderFormat,
ThebesIntSize(size));
#endif
if (newSurface) {

View File

@ -38,8 +38,9 @@ public:
return (gfxQtPlatform*) gfxPlatform::GetPlatform();
}
already_AddRefed<gfxASurface> CreateOffscreenSurface(const gfxIntSize& size,
gfxContentType contentType);
virtual already_AddRefed<gfxASurface>
CreateOffscreenSurface(const IntSize& size,
gfxContentType contentType) MOZ_OVERRIDE;
mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);

View File

@ -650,23 +650,26 @@ gfxWindowsPlatform::CreatePlatformFontList()
}
already_AddRefed<gfxASurface>
gfxWindowsPlatform::CreateOffscreenSurface(const gfxIntSize& size,
gfxWindowsPlatform::CreateOffscreenSurface(const IntSize& size,
gfxContentType contentType)
{
nsRefPtr<gfxASurface> surf = nullptr;
#ifdef CAIRO_HAS_WIN32_SURFACE
if (mRenderMode == RENDER_GDI)
surf = new gfxWindowsSurface(size, OptimalFormatForContent(contentType));
surf = new gfxWindowsSurface(ThebesIntSize(size),
OptimalFormatForContent(contentType));
#endif
#ifdef CAIRO_HAS_D2D_SURFACE
if (mRenderMode == RENDER_DIRECT2D)
surf = new gfxD2DSurface(size, OptimalFormatForContent(contentType));
surf = new gfxD2DSurface(ThebesIntSize(size),
OptimalFormatForContent(contentType));
#endif
if (!surf || surf->CairoStatus()) {
surf = new gfxImageSurface(size, OptimalFormatForContent(contentType));
surf = new gfxImageSurface(ThebesIntSize(size),
OptimalFormatForContent(contentType));
}
return surf.forget();
@ -684,7 +687,8 @@ gfxWindowsPlatform::CreateOffscreenImageSurface(const gfxIntSize& aSize,
}
#endif
nsRefPtr<gfxASurface> surface = CreateOffscreenSurface(aSize, aContentType);
nsRefPtr<gfxASurface> surface = CreateOffscreenSurface(aSize.ToIntSize(),
aContentType);
#ifdef DEBUG
nsRefPtr<gfxImageSurface> imageSurface = surface->GetAsImageSurface();
NS_ASSERTION(imageSurface, "Surface cannot be converted to a gfxImageSurface");

View File

@ -125,8 +125,9 @@ public:
virtual gfxPlatformFontList* CreatePlatformFontList();
already_AddRefed<gfxASurface> CreateOffscreenSurface(const gfxIntSize& size,
gfxContentType contentType);
virtual already_AddRefed<gfxASurface>
CreateOffscreenSurface(const IntSize& size,
gfxContentType contentType) MOZ_OVERRIDE;
virtual already_AddRefed<gfxASurface>
CreateOffscreenImageSurface(const gfxIntSize& aSize,
gfxContentType aContentType);

View File

@ -9,6 +9,7 @@
#include "prenv.h"
#include "gfx2DGlue.h"
#include "gfxPlatform.h"
#include "gfxUtils.h"
@ -31,6 +32,7 @@ static bool gDisableOptimize = false;
#endif
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::image;
// Returns true if an image of aWidth x aHeight is allowed and legal.
@ -343,10 +345,10 @@ imgFrame::SurfaceForDrawing(bool aDoPadding,
gfxRect& aSourceRect,
gfxRect& aImageRect)
{
gfxIntSize size(int32_t(aImageRect.Width()), int32_t(aImageRect.Height()));
IntSize size(int32_t(aImageRect.Width()), int32_t(aImageRect.Height()));
if (!aDoPadding && !aDoPartialDecode) {
NS_ASSERTION(!mSinglePixel, "This should already have been handled");
return SurfaceWithFormat(new gfxSurfaceDrawable(ThebesSurface(), size), mFormat);
return SurfaceWithFormat(new gfxSurfaceDrawable(ThebesSurface(), ThebesIntSize(size)), mFormat);
}
gfxRect available = gfxRect(mDecoded.x, mDecoded.y, mDecoded.width, mDecoded.height);
@ -372,7 +374,7 @@ imgFrame::SurfaceForDrawing(bool aDoPadding,
tmpCtx.Rectangle(available);
tmpCtx.Fill();
return SurfaceWithFormat(new gfxSurfaceDrawable(surface, size), format);
return SurfaceWithFormat(new gfxSurfaceDrawable(surface, ThebesIntSize(size)), format);
}
// Not tiling, and we have a surface, so we can account for

View File

@ -2202,7 +2202,7 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder,
nsRefPtr<gfxASurface> surf;
if (gfxUtils::sDumpPainting) {
surf = gfxPlatform::GetPlatform()->CreateOffscreenSurface(itemVisibleRect.Size(),
surf = gfxPlatform::GetPlatform()->CreateOffscreenSurface(itemVisibleRect.Size().ToIntSize(),
gfxContentType::COLOR_ALPHA);
surf->SetDeviceOffset(-itemVisibleRect.TopLeft());
context = new gfxContext(surf);
@ -3392,7 +3392,7 @@ static void DebugPaintItem(nsRenderingContext* aDest, nsDisplayItem *aItem, nsDi
bounds.ScaleInverse(aDest->AppUnitsPerDevPixel());
nsRefPtr<gfxASurface> surf =
gfxPlatform::GetPlatform()->CreateOffscreenSurface(gfxIntSize(bounds.width, bounds.height),
gfxPlatform::GetPlatform()->CreateOffscreenSurface(IntSize(bounds.width, bounds.height),
gfxContentType::COLOR_ALPHA);
surf->SetDeviceOffset(-bounds.TopLeft());
nsRefPtr<gfxContext> context = new gfxContext(surf);

View File

@ -4737,7 +4737,7 @@ nsImageRenderer::DrawBorderImageComponent(nsPresContext* aPresContext,
presContext->CSSPixelsToDevPixels(aSrc.width),
presContext->CSSPixelsToDevPixels(aSrc.height));
nsRefPtr<gfxASurface> srcSlice = gfxPlatform::GetPlatform()->
CreateOffscreenSurface(gfxIntSize(srcRect.width, srcRect.height),
CreateOffscreenSurface(IntSize(srcRect.width, srcRect.height),
gfxContentType::COLOR_ALPHA);
nsRefPtr<gfxContext> ctx = new gfxContext(srcSlice);

View File

@ -177,6 +177,7 @@
using namespace mozilla;
using namespace mozilla::css;
using namespace mozilla::dom;
using namespace mozilla::gfx;
using namespace mozilla::layers;
using namespace mozilla::gfx;
@ -8922,7 +8923,7 @@ DumpToPNG(nsIPresShell* shell, nsAString& name) {
nsRefPtr<gfxASurface> surface =
gfxPlatform::GetPlatform()->
CreateOffscreenSurface(gfxIntSize(width, height),
CreateOffscreenSurface(IntSize(width, height),
gfxASurface::ContentFromFormat(gfxImageFormat::ARGB32));
NS_ENSURE_TRUE(surface, NS_ERROR_OUT_OF_MEMORY);

View File

@ -530,7 +530,7 @@ nsSVGFilterInstance::BuildSourcePaint(SourceInfo *aSource,
nsRefPtr<gfxContext> ctx;
if (aTargetSurface) {
offscreenSurface = gfxPlatform::GetPlatform()->CreateOffscreenSurface(
neededRect.Size(), gfxContentType::COLOR_ALPHA);
neededRect.Size().ToIntSize(), gfxContentType::COLOR_ALPHA);
if (!offscreenSurface || offscreenSurface->CairoStatus()) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -617,7 +617,7 @@ nsSVGFilterInstance::BuildSourceImage(gfxASurface* aTargetSurface,
nsRefPtr<gfxContext> ctx;
if (aTargetSurface) {
offscreenSurface = gfxPlatform::GetPlatform()->CreateOffscreenSurface(
neededRect.Size(), gfxContentType::COLOR_ALPHA);
neededRect.Size().ToIntSize(), gfxContentType::COLOR_ALPHA);
if (!offscreenSurface || offscreenSurface->CairoStatus()) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -698,7 +698,7 @@ nsSVGFilterInstance::Render(gfxContext* aContext)
RefPtr<DrawTarget> dt;
if (aContext->IsCairo()) {
resultImage =
gfxPlatform::GetPlatform()->CreateOffscreenSurface(filterRect.Size(),
gfxPlatform::GetPlatform()->CreateOffscreenSurface(filterRect.Size().ToIntSize(),
gfxContentType::COLOR_ALPHA);
if (!resultImage || resultImage->CairoStatus())
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -337,9 +337,9 @@ nsSVGPatternFrame::PaintPattern(gfxASurface** surface,
gfxRect transformedBBox = patternTransform.TransformBounds(bbox);
bool resultOverflows;
gfxIntSize surfaceSize =
IntSize surfaceSize =
nsSVGUtils::ConvertToSurfaceSize(
transformedBBox.Size(), &resultOverflows);
transformedBBox.Size(), &resultOverflows).ToIntSize();
// 0 disables rendering, < 0 is an error
if (surfaceSize.width <= 0 || surfaceSize.height <= 0)

View File

@ -300,7 +300,8 @@ UpdateOffScreenBuffers(int aDepth, QSize aSize, QWidget* aWidget = nullptr)
#endif
gBufferSurface = gfxPlatform::GetPlatform()->
CreateOffscreenSurface(gBufferMaxSize, gfxASurface::ContentFromFormat(format));
CreateOffscreenSurface(gBufferMaxSize.ToIntSize(),
gfxASurface::ContentFromFormat(format));
return true;
}

View File

@ -24,6 +24,7 @@
using namespace mozilla::dom;
using namespace mozilla::hal;
using namespace mozilla::gfx;
using namespace mozilla::layers;
using namespace mozilla::widget;
@ -103,7 +104,7 @@ PuppetWidget::Create(nsIWidget *aParent,
mVisible = true;
mSurface = gfxPlatform::GetPlatform()
->CreateOffscreenSurface(gfxIntSize(1, 1),
->CreateOffscreenSurface(IntSize(1, 1),
gfxASurface::ContentFromFormat(gfxImageFormat::ARGB32));
mIMEComposing = false;

View File

@ -618,8 +618,7 @@ nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext,
RefPtr<DrawTarget> dt =
gfxPlatform::GetPlatform()->
CreateOffscreenContentDrawTarget(IntSize(destSize.width, destSize.height),
CreateOffscreenContentDrawTarget(destSize.ToIntSize(),
SurfaceFormat::B8G8R8A8);
if (!dt)
return NS_ERROR_FAILURE;