mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1132854 - Remove the gfx::ToIntSize conversion helper. r=Bas
This commit is contained in:
parent
3c89238807
commit
0b1f75bea0
@ -299,7 +299,7 @@ CanvasImageCache::Lookup(Element* aImage,
|
||||
|
||||
gImageCache->MarkUsed(entry->mData);
|
||||
|
||||
*aSize = gfx::ToIntSize(entry->mData->mSize);
|
||||
*aSize = entry->mData->mSize;
|
||||
return entry->mData->mSourceSurface;
|
||||
}
|
||||
|
||||
|
@ -4320,7 +4320,7 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
|
||||
return;
|
||||
}
|
||||
|
||||
imgSize = gfx::ToIntSize(res.mSize);
|
||||
imgSize = res.mSize;
|
||||
|
||||
// Scale sw/sh based on aspect ratio
|
||||
if (image.IsHTMLVideoElement()) {
|
||||
|
@ -113,7 +113,7 @@ CreateDrawTargetForSurface(gfxASurface *aSurface)
|
||||
}
|
||||
RefPtr<DrawTarget> drawTarget =
|
||||
Factory::CreateDrawTargetForCairoSurface(aSurface->CairoSurface(),
|
||||
ToIntSize(gfxIntSize(aSurface->GetSize())),
|
||||
aSurface->GetSize(),
|
||||
&format);
|
||||
aSurface->SetData(&kDrawTarget, drawTarget, nullptr);
|
||||
return drawTarget;
|
||||
|
@ -296,7 +296,7 @@ GLContextProviderCGL::CreateOffscreen(const gfxIntSize& size,
|
||||
bool requireCompatProfile)
|
||||
{
|
||||
nsRefPtr<GLContext> glContext = CreateHeadless(requireCompatProfile);
|
||||
if (!glContext->InitOffscreen(ToIntSize(size), caps))
|
||||
if (!glContext->InitOffscreen(size, caps))
|
||||
return nullptr;
|
||||
|
||||
return glContext.forget();
|
||||
|
@ -904,7 +904,7 @@ GLContextProviderEGL::CreateOffscreen(const gfxIntSize& size,
|
||||
if (!glContext)
|
||||
return nullptr;
|
||||
|
||||
if (!glContext->InitOffscreen(ToIntSize(size), caps))
|
||||
if (!glContext->InitOffscreen(size, caps))
|
||||
return nullptr;
|
||||
|
||||
return glContext.forget();
|
||||
|
@ -1234,7 +1234,7 @@ GLContextProviderGLX::CreateOffscreen(const gfxIntSize& size,
|
||||
if (!glContext)
|
||||
return nullptr;
|
||||
|
||||
if (!glContext->InitOffscreen(ToIntSize(size), caps))
|
||||
if (!glContext->InitOffscreen(size, caps))
|
||||
return nullptr;
|
||||
|
||||
return glContext.forget();
|
||||
|
@ -640,7 +640,7 @@ GLContextProviderWGL::CreateHeadless(bool)
|
||||
}
|
||||
|
||||
already_AddRefed<GLContext>
|
||||
GLContextProviderWGL::CreateOffscreen(const gfxIntSize& size,
|
||||
GLContextProviderWGL::CreateOffscreen(const IntSize& size,
|
||||
const SurfaceCaps& caps,
|
||||
bool requireCompatProfile)
|
||||
{
|
||||
@ -648,7 +648,7 @@ GLContextProviderWGL::CreateOffscreen(const gfxIntSize& size,
|
||||
if (!glContext)
|
||||
return nullptr;
|
||||
|
||||
if (!glContext->InitOffscreen(ToIntSize(size), caps))
|
||||
if (!glContext->InitOffscreen(size, caps))
|
||||
return nullptr;
|
||||
|
||||
return glContext.forget();
|
||||
|
@ -126,7 +126,7 @@ DIBTextureHost::DIBTextureHost(TextureFlags aFlags,
|
||||
dont_AddRef(reinterpret_cast<gfxWindowsSurface*>(aDescriptor.surface()));
|
||||
MOZ_ASSERT(mSurface);
|
||||
|
||||
mSize = ToIntSize(mSurface->GetSize());
|
||||
mSize = mSurface->GetSize();
|
||||
mFormat = ImageFormatToSurfaceFormat(
|
||||
gfxPlatform::GetPlatform()->OptimalFormatForContent(mSurface->GetContentType()));
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
#include "mozilla/layers/YCbCrImageDataSerializer.h"
|
||||
#include <string.h> // for memcpy
|
||||
#include "gfx2DGlue.h" // for ToIntSize
|
||||
#include "mozilla/gfx/2D.h" // for DataSourceSurface, Factory
|
||||
#include "mozilla/gfx/BaseSize.h" // for BaseSize
|
||||
#include "mozilla/gfx/Logging.h" // for gfxDebug
|
||||
|
@ -639,7 +639,7 @@ Transform(const gfxImageSurface* aDest,
|
||||
return;
|
||||
}
|
||||
|
||||
IntSize destSize = ToIntSize(aDest->GetSize());
|
||||
IntSize destSize = aDest->GetSize();
|
||||
SkImageInfo destInfo = SkImageInfo::Make(destSize.width,
|
||||
destSize.height,
|
||||
kBGRA_8888_SkColorType,
|
||||
@ -697,7 +697,7 @@ Transform(const gfxImageSurface* aDest,
|
||||
const gfx3DMatrix& aTransform,
|
||||
gfxPoint aDestOffset)
|
||||
{
|
||||
IntSize destSize = ToIntSize(aDest->GetSize());
|
||||
IntSize destSize = aDest->GetSize();
|
||||
pixman_image_t* dest = pixman_image_create_bits(aDest->Format() == gfxImageFormat::ARGB32 ? PIXMAN_a8r8g8b8 : PIXMAN_x8r8g8b8,
|
||||
destSize.width,
|
||||
destSize.height,
|
||||
|
@ -144,7 +144,7 @@ TextureClientX11::BorrowDrawTarget()
|
||||
}
|
||||
|
||||
if (!mDrawTarget) {
|
||||
IntSize size = ToIntSize(mSurface->GetSize());
|
||||
IntSize size = mSurface->GetSize();
|
||||
mDrawTarget = Factory::CreateDrawTargetForCairoSurface(mSurface->CairoSurface(), size);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ X11TextureSourceBasic::X11TextureSourceBasic(BasicCompositor* aCompositor, gfxXl
|
||||
IntSize
|
||||
X11TextureSourceBasic::GetSize() const
|
||||
{
|
||||
return ToIntSize(mSurface->GetSize());
|
||||
return mSurface->GetSize();
|
||||
}
|
||||
|
||||
SurfaceFormat
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "CompositableHost.h" // for CompositableHost
|
||||
#include "LayersLogging.h" // for AppendToString
|
||||
#include "gfx2DGlue.h" // for ToIntSize
|
||||
#include "mozilla/gfx/2D.h" // for DataSourceSurface, Factory
|
||||
#include "mozilla/ipc/Shmem.h" // for Shmem
|
||||
#include "mozilla/layers/CompositableTransactionParent.h" // for CompositableParentManager
|
||||
|
@ -83,7 +83,7 @@ X11TextureHost::GetFormat() const
|
||||
IntSize
|
||||
X11TextureHost::GetSize() const
|
||||
{
|
||||
return ToIntSize(mSurface->GetSize());
|
||||
return mSurface->GetSize();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ private:
|
||||
void SetPSForEffect(Effect *aEffect, MaskType aMaskType, gfx::SurfaceFormat aFormat);
|
||||
void PaintToTarget();
|
||||
|
||||
virtual gfx::IntSize GetWidgetSize() const override { return gfx::ToIntSize(mSize); }
|
||||
virtual gfx::IntSize GetWidgetSize() const override { return mSize; }
|
||||
|
||||
RefPtr<ID3D11DeviceContext> mContext;
|
||||
RefPtr<ID3D11Device> mDevice;
|
||||
@ -179,7 +179,7 @@ private:
|
||||
|
||||
nsIWidget* mWidget;
|
||||
|
||||
nsIntSize mSize;
|
||||
gfx::IntSize mSize;
|
||||
|
||||
HWND mHwnd;
|
||||
|
||||
|
@ -152,7 +152,7 @@ private:
|
||||
|
||||
virtual gfx::IntSize GetWidgetSize() const override
|
||||
{
|
||||
return gfx::ToIntSize(mSize);
|
||||
return mSize;
|
||||
}
|
||||
|
||||
/* Device manager instance for this compositor */
|
||||
|
@ -447,7 +447,7 @@ DataTextureSourceD3D9::Update(gfxWindowsSurface* aSurface)
|
||||
NS_WARNING("No D3D device to update the texture.");
|
||||
return false;
|
||||
}
|
||||
mSize = ToIntSize(aSurface->GetSize());
|
||||
mSize = aSurface->GetSize();
|
||||
|
||||
uint32_t bpp = 0;
|
||||
|
||||
|
@ -49,8 +49,7 @@ CreateSharedRGBImage(ImageContainer *aImageContainer,
|
||||
}
|
||||
|
||||
nsRefPtr<SharedRGBImage> rgbImage = static_cast<SharedRGBImage*>(image.get());
|
||||
if (!rgbImage->Allocate(gfx::ToIntSize(aSize),
|
||||
gfx::ImageFormatToSurfaceFormat(aImageFormat))) {
|
||||
if (!rgbImage->Allocate(aSize, gfx::ImageFormatToSurfaceFormat(aImageFormat))) {
|
||||
NS_WARNING("Failed to allocate a shared image");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ public:
|
||||
private:
|
||||
virtual gfx::IntSize GetWidgetSize() const override
|
||||
{
|
||||
return gfx::ToIntSize(mWidgetSize);
|
||||
return mWidgetSize;
|
||||
}
|
||||
|
||||
bool InitializeVR();
|
||||
@ -321,7 +321,7 @@ private:
|
||||
|
||||
/** Widget associated with this compositor */
|
||||
nsIWidget *mWidget;
|
||||
nsIntSize mWidgetSize;
|
||||
gfx::IntSize mWidgetSize;
|
||||
nsRefPtr<GLContext> mGLContext;
|
||||
UniquePtr<GLBlitTextureImageHelper> mBlitTextureImageHelper;
|
||||
gfx::Matrix4x4 mProjMatrix;
|
||||
|
@ -60,7 +60,7 @@ X11TextureSourceOGL::BindTexture(GLenum aTextureUnit, gfx::Filter aFilter)
|
||||
IntSize
|
||||
X11TextureSourceOGL::GetSize() const
|
||||
{
|
||||
return ToIntSize(mSurface->GetSize());
|
||||
return mSurface->GetSize();
|
||||
}
|
||||
|
||||
SurfaceFormat
|
||||
|
@ -148,7 +148,7 @@ void TestTextureClientSurface(TextureClient* texture, gfxImageSurface* surface)
|
||||
|
||||
// client allocation
|
||||
ASSERT_TRUE(texture->CanExposeDrawTarget());
|
||||
texture->AllocateForSurface(ToIntSize(surface->GetSize()));
|
||||
texture->AllocateForSurface(surface->GetSize());
|
||||
ASSERT_TRUE(texture->IsAllocated());
|
||||
|
||||
ASSERT_TRUE(texture->Lock(OpenMode::OPEN_READ_WRITE));
|
||||
|
@ -81,11 +81,6 @@ inline Size ToSize(const gfxSize &aSize)
|
||||
return Size(Float(aSize.width), Float(aSize.height));
|
||||
}
|
||||
|
||||
inline IntSize ToIntSize(const gfxIntSize &aSize)
|
||||
{
|
||||
return IntSize(aSize.width, aSize.height);
|
||||
}
|
||||
|
||||
inline Filter ToFilter(GraphicsFilter aFilter)
|
||||
{
|
||||
switch (aFilter) {
|
||||
|
@ -837,7 +837,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
|
||||
surf.mFormat = format;
|
||||
surf.mType = NativeSurfaceType::CAIRO_SURFACE;
|
||||
surf.mSurface = aSurface->CairoSurface();
|
||||
surf.mSize = ToIntSize(aSurface->GetSize());
|
||||
surf.mSize = aSurface->GetSize();
|
||||
// We return here regardless of whether CreateSourceSurfaceFromNativeSurface
|
||||
// succeeds or not since we don't expect to be able to do any better below
|
||||
// if it fails.
|
||||
@ -862,7 +862,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
|
||||
surf.mFormat = format;
|
||||
surf.mType = NativeSurfaceType::D3D10_TEXTURE;
|
||||
surf.mSurface = static_cast<gfxD2DSurface*>(aSurface)->GetTexture();
|
||||
surf.mSize = ToIntSize(aSurface->GetSize());
|
||||
surf.mSize = aSurface->GetSize();
|
||||
mozilla::gfx::DrawTarget *dt = static_cast<mozilla::gfx::DrawTarget*>(aSurface->GetData(&kDrawTarget));
|
||||
if (dt) {
|
||||
dt->Flush();
|
||||
@ -910,7 +910,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
|
||||
surf.mFormat = format;
|
||||
surf.mType = NativeSurfaceType::CAIRO_SURFACE;
|
||||
surf.mSurface = aSurface->CairoSurface();
|
||||
surf.mSize = ToIntSize(aSurface->GetSize());
|
||||
surf.mSize = aSurface->GetSize();
|
||||
RefPtr<DrawTarget> drawTarget =
|
||||
Factory::CreateDrawTarget(BackendType::CAIRO, IntSize(1, 1), format);
|
||||
if (!drawTarget) {
|
||||
@ -956,7 +956,7 @@ gfxPlatform::GetWrappedDataSourceSurface(gfxASurface* aSurface)
|
||||
RefPtr<DataSourceSurface> result =
|
||||
Factory::CreateWrappingDataSourceSurface(image->Data(),
|
||||
image->Stride(),
|
||||
ToIntSize(image->GetSize()),
|
||||
image->GetSize(),
|
||||
ImageFormatToSurfaceFormat(image->Format()));
|
||||
|
||||
if (!result) {
|
||||
|
@ -441,8 +441,7 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable,
|
||||
gfxIntSize size(int32_t(needed.Width()), int32_t(needed.Height()));
|
||||
|
||||
RefPtr<DrawTarget> target =
|
||||
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(ToIntSize(size),
|
||||
aFormat);
|
||||
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(size, aFormat);
|
||||
if (!target) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -869,7 +868,7 @@ gfxUtils::GetYCbCrToRGBDestFormatAndSize(const PlanarYCbCrData& aData,
|
||||
// 'prescale' is true if the scaling is to be done as part of the
|
||||
// YCbCr to RGB conversion rather than on the RGB data when rendered.
|
||||
bool prescale = aSuggestedSize.width > 0 && aSuggestedSize.height > 0 &&
|
||||
ToIntSize(aSuggestedSize) != aData.mPicSize;
|
||||
aSuggestedSize != aData.mPicSize;
|
||||
|
||||
if (aSuggestedFormat == gfxImageFormat::RGB16_565) {
|
||||
#if defined(HAVE_YCBCR_TO_RGB565)
|
||||
@ -905,7 +904,7 @@ gfxUtils::GetYCbCrToRGBDestFormatAndSize(const PlanarYCbCrData& aData,
|
||||
prescale = false;
|
||||
}
|
||||
if (!prescale) {
|
||||
ToIntSize(aSuggestedSize) = aData.mPicSize;
|
||||
aSuggestedSize = aData.mPicSize;
|
||||
}
|
||||
}
|
||||
|
||||
@ -929,7 +928,7 @@ gfxUtils::ConvertYCbCrToRGB(const PlanarYCbCrData& aData,
|
||||
aData.mCbCrSize.height);
|
||||
|
||||
// Convert from YCbCr to RGB now, scaling the image if needed.
|
||||
if (ToIntSize(aDestSize) != aData.mPicSize) {
|
||||
if (aDestSize != aData.mPicSize) {
|
||||
#if defined(HAVE_YCBCR_TO_RGB565)
|
||||
if (aDestFormat == gfxImageFormat::RGB16_565) {
|
||||
ScaleYCbCrToRGB565(aData.mYChannel,
|
||||
|
@ -272,7 +272,7 @@ gfxWindowsNativeDrawing::PaintToContext()
|
||||
RefPtr<DataSourceSurface> source =
|
||||
Factory::CreateWrappingDataSourceSurface(black->Data(),
|
||||
black->Stride(),
|
||||
ToIntSize(black->GetSize()),
|
||||
black->GetSize(),
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
|
||||
mContext->Save();
|
||||
|
@ -573,7 +573,7 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
|
||||
native.mFormat = moz2DFormat;
|
||||
native.mType = NativeSurfaceType::CAIRO_SURFACE;
|
||||
native.mSurface = tempXlibSurface;
|
||||
native.mSize = ToIntSize(size);
|
||||
native.mSize = size;
|
||||
RefPtr<SourceSurface> sourceSurface =
|
||||
drawTarget->CreateSourceSurfaceFromNativeSurface(native);
|
||||
if (sourceSurface) {
|
||||
@ -615,7 +615,7 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
|
||||
native.mFormat = moz2DFormat;
|
||||
native.mType = NativeSurfaceType::CAIRO_SURFACE;
|
||||
native.mSurface = paintSurface->CairoSurface();
|
||||
native.mSize = ToIntSize(size);
|
||||
native.mSize = size;
|
||||
RefPtr<SourceSurface> sourceSurface =
|
||||
drawTarget->CreateSourceSurfaceFromNativeSurface(native);
|
||||
if (sourceSurface) {
|
||||
|
@ -98,7 +98,7 @@ OrientedImage::GetFrame(uint32_t aWhichFrame,
|
||||
// Create a surface to draw into.
|
||||
RefPtr<DrawTarget> target =
|
||||
gfxPlatform::GetPlatform()->
|
||||
CreateOffscreenContentDrawTarget(ToIntSize(size), surfaceFormat);
|
||||
CreateOffscreenContentDrawTarget(size, surfaceFormat);
|
||||
if (!target) {
|
||||
NS_ERROR("Could not create a DrawTarget");
|
||||
return nullptr;
|
||||
|
@ -353,7 +353,7 @@ nsFilterInstance::BuildSourcePaint(SourceInfo *aSource,
|
||||
|
||||
RefPtr<DrawTarget> offscreenDT =
|
||||
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(
|
||||
ToIntSize(neededRect.Size()), SurfaceFormat::B8G8R8A8);
|
||||
neededRect.Size(), SurfaceFormat::B8G8R8A8);
|
||||
if (!offscreenDT) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -417,7 +417,7 @@ nsFilterInstance::BuildSourceImage(DrawTarget* aTargetDT)
|
||||
|
||||
RefPtr<DrawTarget> offscreenDT =
|
||||
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(
|
||||
ToIntSize(neededRect.Size()), SurfaceFormat::B8G8R8A8);
|
||||
neededRect.Size(), SurfaceFormat::B8G8R8A8);
|
||||
if (!offscreenDT) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -242,8 +242,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gfxContext* aContext,
|
||||
|
||||
bool resultOverflows;
|
||||
IntSize maskSurfaceSize =
|
||||
ToIntSize(nsSVGUtils::ConvertToSurfaceSize(maskSurfaceRect.Size(),
|
||||
&resultOverflows));
|
||||
nsSVGUtils::ConvertToSurfaceSize(maskSurfaceRect.Size(), &resultOverflows);
|
||||
|
||||
if (resultOverflows || maskSurfaceSize.IsEmpty()) {
|
||||
// XXXjwatt we should return an empty surface so we don't paint aMaskedFrame!
|
||||
|
@ -484,8 +484,7 @@ nsresult nsCocoaUtils::CreateNSImageFromImageContainer(imgIContainer *aImage, ui
|
||||
ceil(height * scaleFactor));
|
||||
|
||||
RefPtr<DrawTarget> drawTarget = gfxPlatform::GetPlatform()->
|
||||
CreateOffscreenContentDrawTarget(ToIntSize(scaledSize),
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
CreateOffscreenContentDrawTarget(scaledSize, SurfaceFormat::B8G8R8A8);
|
||||
if (!drawTarget) {
|
||||
NS_ERROR("Failed to create DrawTarget");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -2383,7 +2383,7 @@ nsWindow::UpdateAlpha(gfxPattern* aPattern, nsIntRect aBoundsRect)
|
||||
int32_t bufferSize = stride * aBoundsRect.height;
|
||||
nsAutoArrayPtr<uint8_t> imageBuffer(new (std::nothrow) uint8_t[bufferSize]);
|
||||
RefPtr<DrawTarget> drawTarget = gfxPlatform::GetPlatform()->
|
||||
CreateDrawTargetForData(imageBuffer, ToIntSize(aBoundsRect.Size()),
|
||||
CreateDrawTargetForData(imageBuffer, aBoundsRect.Size(),
|
||||
stride, SurfaceFormat::A8);
|
||||
|
||||
if (drawTarget) {
|
||||
|
@ -6841,7 +6841,7 @@ void nsWindow::SetupTranslucentWindowMemoryBitmap(nsTransparencyMode aMode)
|
||||
void nsWindow::ClearTranslucentWindow()
|
||||
{
|
||||
if (mTransparentSurface) {
|
||||
IntSize size = ToIntSize(mTransparentSurface->GetSize());
|
||||
IntSize size = mTransparentSurface->GetSize();
|
||||
RefPtr<DrawTarget> drawTarget = gfxPlatform::GetPlatform()->
|
||||
CreateDrawTargetForSurface(mTransparentSurface, size);
|
||||
drawTarget->ClearRect(Rect(0, 0, size.width, size.height));
|
||||
|
Loading…
Reference in New Issue
Block a user