Bug 950143 - Remove the implicit conversion operator from nsIntSize to IntSize; r=roc

This commit is contained in:
Ms2ger 2013-12-31 10:06:12 +01:00
Родитель 6d9ac3b27a
Коммит fc0c5d7215
41 изменённых файлов: 118 добавлений и 92 удалений

Просмотреть файл

@ -4080,7 +4080,7 @@ CanvasRenderingContext2D::MarkContextClean()
bool
CanvasRenderingContext2D::ShouldForceInactiveLayer(LayerManager *aManager)
{
return !aManager->CanUseCanvasLayerForSize(gfxIntSize(mWidth, mHeight));
return !aManager->CanUseCanvasLayerForSize(IntSize(mWidth, mHeight));
}
}

Просмотреть файл

@ -18,6 +18,7 @@
namespace mozilla {
using namespace mozilla::gfx;
using layers::ImageContainer;
using layers::PlanarYCbCrImage;
using layers::PlanarYCbCrData;
@ -242,18 +243,18 @@ VideoData* VideoData::Create(VideoInfo& aInfo,
PlanarYCbCrData data;
data.mYChannel = Y.mData + Y.mOffset;
data.mYSize = gfxIntSize(Y.mWidth, Y.mHeight);
data.mYSize = IntSize(Y.mWidth, Y.mHeight);
data.mYStride = Y.mStride;
data.mYSkip = Y.mSkip;
data.mCbChannel = Cb.mData + Cb.mOffset;
data.mCrChannel = Cr.mData + Cr.mOffset;
data.mCbCrSize = gfxIntSize(Cb.mWidth, Cb.mHeight);
data.mCbCrSize = IntSize(Cb.mWidth, Cb.mHeight);
data.mCbCrStride = Cb.mStride;
data.mCbSkip = Cb.mSkip;
data.mCrSkip = Cr.mSkip;
data.mPicX = aPicture.x;
data.mPicY = aPicture.y;
data.mPicSize = gfxIntSize(aPicture.width, aPicture.height);
data.mPicSize = aPicture.Size().ToIntSize();
data.mStereoMode = aInfo.mStereoMode;
videoImage->SetDelayedConversion(true);
@ -373,7 +374,7 @@ VideoData* VideoData::Create(VideoInfo& aInfo,
GrallocImage* videoImage = static_cast<GrallocImage*>(v->mImage.get());
GrallocImage::GrallocData data;
data.mPicSize = gfxIntSize(aPicture.width, aPicture.height);
data.mPicSize = aPicture.Size().ToIntSize();
data.mGraphicBuffer = aBuffer;
videoImage->SetData(data);

Просмотреть файл

@ -27,6 +27,7 @@
using namespace mozilla::layers;
using namespace mozilla::dom;
using namespace mozilla::gfx;
namespace mozilla {
@ -895,7 +896,7 @@ SetImageToBlackPixel(PlanarYCbCrImage* aImage)
data.mCbChannel = blackPixel + 1;
data.mCrChannel = blackPixel + 2;
data.mYStride = data.mCbCrStride = 1;
data.mPicSize = data.mYSize = data.mCbCrSize = gfxIntSize(1, 1);
data.mPicSize = data.mYSize = data.mCbCrSize = IntSize(1, 1);
aImage->SetData(data);
}

Просмотреть файл

@ -38,6 +38,7 @@ PRLogModuleInfo *gOmxDecoderLog;
using namespace MPAPI;
using namespace mozilla;
using namespace mozilla::gfx;
namespace mozilla {
@ -828,7 +829,7 @@ bool OmxDecoder::ReadVideo(VideoFrame *aFrame, int64_t aTimeUs,
// GraphicBuffer's size and actual video size is different.
// See Bug 850566.
mozilla::layers::SurfaceDescriptorGralloc newDescriptor = descriptor->get_SurfaceDescriptorGralloc();
newDescriptor.size() = nsIntSize(mVideoWidth, mVideoHeight);
newDescriptor.size() = IntSize(mVideoWidth, mVideoHeight);
mozilla::layers::SurfaceDescriptor descWrapper(newDescriptor);
aFrame->mGraphicBuffer = new mozilla::layers::VideoGraphicBuffer(this, mVideoBuffer, descWrapper);

Просмотреть файл

@ -17,6 +17,8 @@
namespace mozilla {
using namespace mozilla::gfx;
typedef mozilla::layers::Image Image;
typedef mozilla::layers::PlanarYCbCrImage PlanarYCbCrImage;
@ -393,8 +395,8 @@ MediaPluginReader::ImageBufferCallback::CreateI420Image(size_t aWidth,
frameDesc.mCbChannel = buffer + frameSize;
frameDesc.mCrChannel = buffer + frameSize * 5 / 4;
frameDesc.mYSize = gfxIntSize(aWidth, aHeight);
frameDesc.mCbCrSize = gfxIntSize(aWidth / 2, aHeight / 2);
frameDesc.mYSize = IntSize(aWidth, aHeight);
frameDesc.mCbCrSize = IntSize(aWidth / 2, aHeight / 2);
frameDesc.mYStride = aWidth;
frameDesc.mCbCrStride = aWidth / 2;
@ -405,7 +407,7 @@ MediaPluginReader::ImageBufferCallback::CreateI420Image(size_t aWidth,
frameDesc.mPicX = 0;
frameDesc.mPicY = 0;
frameDesc.mPicSize = gfxIntSize(aWidth, aHeight);
frameDesc.mPicSize = IntSize(aWidth, aHeight);
yuvImage->SetDataNoCopy(frameDesc);

Просмотреть файл

@ -25,6 +25,8 @@
#define AUDIO_FRAME_LENGTH ((AUDIO_RATE * MediaEngine::DEFAULT_AUDIO_TIMER_MS) / 1000)
namespace mozilla {
using namespace mozilla::gfx;
NS_IMPL_ISUPPORTS1(MediaEngineDefaultVideoSource, nsITimerCallback)
/**
* Default video source.
@ -92,15 +94,15 @@ static void AllocateSolidColorFrame(layers::PlanarYCbCrData& aData,
memset(frame+yLen+cbLen, aCr, crLen);
aData.mYChannel = frame;
aData.mYSize = gfxIntSize(aWidth, aHeight);
aData.mYSize = IntSize(aWidth, aHeight);
aData.mYStride = aWidth;
aData.mCbCrStride = aWidth>>1;
aData.mCbChannel = frame + yLen;
aData.mCrChannel = aData.mCbChannel + cbLen;
aData.mCbCrSize = gfxIntSize(aWidth>>1, aHeight>>1);
aData.mCbCrSize = IntSize(aWidth>>1, aHeight>>1);
aData.mPicX = 0;
aData.mPicY = 0;
aData.mPicSize = gfxIntSize(aWidth, aHeight);
aData.mPicSize = IntSize(aWidth, aHeight);
aData.mStereoMode = STEREO_MODE_MONO;
}

Просмотреть файл

@ -18,6 +18,8 @@
#include "nsIPrefService.h"
namespace mozilla {
using namespace mozilla::gfx;
NS_IMPL_ISUPPORTS1(MediaEngineTabVideoSource, MediaEngineVideoSource)
MediaEngineTabVideoSource::MediaEngineTabVideoSource()
@ -171,7 +173,7 @@ NotifyPull(MediaStreamGraph*, SourceMediaStream* aSource, mozilla::TrackID aID,
void
MediaEngineTabVideoSource::Draw() {
nsIntSize size(mBufW, mBufH);
IntSize size(mBufW, mBufH);
nsresult rv;
float scale = 1.0;
@ -241,8 +243,8 @@ MediaEngineTabVideoSource::Draw() {
nsRefPtr<layers::ImageContainer> container = layers::LayerManager::CreateImageContainer();
nsRefPtr<gfxASurface> surf;
surf = new gfxImageSurface(static_cast<unsigned char*>(mData), size,
stride, format);
surf = new gfxImageSurface(static_cast<unsigned char*>(mData),
ThebesIntSize(size), stride, format);
if (surf->CairoStatus() != 0) {
return;
}

Просмотреть файл

@ -11,6 +11,8 @@
namespace mozilla {
using namespace mozilla::gfx;
#ifdef PR_LOGGING
extern PRLogModuleInfo* GetMediaManagerLog();
#define LOG(msg) PR_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg)
@ -77,15 +79,15 @@ MediaEngineWebRTCVideoSource::DeliverFrame(
layers::PlanarYCbCrData data;
data.mYChannel = frame;
data.mYSize = gfxIntSize(mWidth, mHeight);
data.mYSize = IntSize(mWidth, mHeight);
data.mYStride = mWidth * lumaBpp/ 8;
data.mCbCrStride = mWidth * chromaBpp / 8;
data.mCbChannel = frame + mHeight * data.mYStride;
data.mCrChannel = data.mCbChannel + mHeight * data.mCbCrStride / 2;
data.mCbCrSize = gfxIntSize(mWidth/ 2, mHeight/ 2);
data.mCbCrSize = IntSize(mWidth/ 2, mHeight/ 2);
data.mPicX = 0;
data.mPicY = 0;
data.mPicSize = gfxIntSize(mWidth, mHeight);
data.mPicSize = IntSize(mWidth, mHeight);
data.mStereoMode = STEREO_MODE_MONO;
videoImage->SetData(data);

Просмотреть файл

@ -46,6 +46,7 @@
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla::gfx;
using namespace android;
/**
@ -1693,7 +1694,7 @@ GonkFrameBuilder(Image* aImage, void* aBuffer, uint32_t aWidth, uint32_t aHeight
GrallocImage* videoImage = static_cast<GrallocImage*>(aImage);
GrallocImage::GrallocData data;
data.mGraphicBuffer = static_cast<layers::GraphicBufferLocked*>(aBuffer);
data.mPicSize = gfxIntSize(aWidth, aHeight);
data.mPicSize = IntSize(aWidth, aHeight);
videoImage->SetData(data);
}

Просмотреть файл

@ -180,7 +180,7 @@ nsPluginInstanceOwner::GetImageContainer()
data.mInverted = mInstance->Inverted();
LayoutDeviceRect r = GetPluginRect();
data.mSize = gfxIntSize(r.width, r.height);
data.mSize = gfx::IntSize(r.width, r.height);
SharedTextureImage* pluginImage = static_cast<SharedTextureImage*>(img.get());
pluginImage->SetData(data);
@ -1512,7 +1512,7 @@ already_AddRefed<ImageContainer> nsPluginInstanceOwner::GetImageContainerForVide
// The logic below for Honeycomb is just a guess, but seems to work. We don't have a separate
// inverted flag for video.
data.mInverted = AndroidBridge::Bridge()->IsHoneycomb() ? true : mInstance->Inverted();
data.mSize = gfxIntSize(aVideoInfo->mDimensions.width, aVideoInfo->mDimensions.height);
data.mSize = gfx::IntSize(aVideoInfo->mDimensions.width, aVideoInfo->mDimensions.height);
SharedTextureImage* pluginImage = static_cast<SharedTextureImage*>(img.get());
pluginImage->SetData(data);

Просмотреть файл

@ -36,6 +36,7 @@ using namespace mozilla;
using mozilla::ipc::ProcessChild;
using namespace mozilla::plugins;
using namespace mozilla::layers;
using namespace mozilla::gfx;
using namespace std;
#ifdef MOZ_WIDGET_GTK
@ -2578,7 +2579,7 @@ PluginInstanceChild::NPN_FinalizeAsyncSurface(NPAsyncSurface *surface)
RemoteImageData *data = mRemoteImageData;
if (data->mBitmap.mData == bitmapData->mRemotePtr) {
data->mBitmap.mData = nullptr;
data->mSize = gfxIntSize(0, 0);
data->mSize = IntSize(0, 0);
data->mWasUpdated = true;
}
}
@ -2593,7 +2594,7 @@ PluginInstanceChild::NPN_FinalizeAsyncSurface(NPAsyncSurface *surface)
RemoteImageData *data = mRemoteImageData;
if (data->mTextureHandle == surface->sharedHandle) {
data->mTextureHandle = nullptr;
data->mSize = gfxIntSize(0, 0);
data->mSize = IntSize(0, 0);
data->mWasUpdated = true;
}
}
@ -2619,7 +2620,7 @@ PluginInstanceChild::NPN_SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect
if (!surface) {
CrossProcessMutexAutoLock autoLock(*mRemoteImageDataMutex);
data->mBitmap.mData = nullptr;
data->mSize = gfxIntSize(0, 0);
data->mSize = IntSize(0, 0);
data->mWasUpdated = true;
} else {
switch (mDrawingModel) {
@ -2633,7 +2634,7 @@ PluginInstanceChild::NPN_SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect
CrossProcessMutexAutoLock autoLock(*mRemoteImageDataMutex);
data->mBitmap.mData = (unsigned char*)bitmapData->mRemotePtr;
data->mSize = gfxIntSize(surface->size.width, surface->size.height);
data->mSize = IntSize(surface->size.width, surface->size.height);
data->mFormat = surface->format == NPImageFormatBGRX32 ?
RemoteImageData::BGRX32 : RemoteImageData::BGRA32;
data->mBitmap.mStride = surface->bitmap.stride;
@ -2645,7 +2646,7 @@ PluginInstanceChild::NPN_SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect
{
CrossProcessMutexAutoLock autoLock(*mRemoteImageDataMutex);
data->mType = RemoteImageData::DXGI_TEXTURE_HANDLE;
data->mSize = gfxIntSize(surface->size.width, surface->size.height);
data->mSize = IntSize(surface->size.width, surface->size.height);
data->mFormat = surface->format == NPImageFormatBGRX32 ?
RemoteImageData::BGRX32 : RemoteImageData::BGRA32;
data->mTextureHandle = surface->sharedHandle;

Просмотреть файл

@ -644,7 +644,7 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect,
CairoImage* cairoImage = static_cast<CairoImage*>(image.get());
CairoImage::Data cairoData;
cairoData.mSurface = surface;
cairoData.mSize = surface->GetSize();
cairoData.mSize = surface->GetSize().ToIntSize();
cairoImage->SetData(cairoData);
container->SetCurrentImage(cairoImage);

Просмотреть файл

@ -59,15 +59,15 @@ TileGenFunc(GLContext* gl,
return nullptr;
}
}
already_AddRefed<TextureImage>
already_AddRefed<TextureImage>
TextureImage::Create(GLContext* gl,
const nsIntSize& size,
TextureImage::ContentType contentType,
GLenum wrapMode,
TextureImage::Flags flags)
{
return CreateTextureImage(gl, size, contentType, wrapMode, flags);
return Create(gl, size.ToIntSize(), contentType, wrapMode, flags);
}
// Moz2D equivalent...
@ -78,7 +78,7 @@ TextureImage::Create(GLContext* gl,
GLenum wrapMode,
TextureImage::Flags flags)
{
return Create(gl, ThebesIntSize(size), contentType, wrapMode, flags);
return CreateTextureImage(gl, size, contentType, wrapMode, flags);
}
bool
@ -275,7 +275,7 @@ gfx::IntSize TextureImage::GetSize() const {
TextureImage::TextureImage(const gfx::IntSize& aSize,
GLenum aWrapMode, ContentType aContentType,
Flags aFlags)
: mSize(ThebesIntSize(aSize))
: mSize(aSize)
, mWrapMode(aWrapMode)
, mContentType(aContentType)
, mFilter(GraphicsFilter::FILTER_GOOD)

Просмотреть файл

@ -223,7 +223,7 @@ protected:
GLenum aWrapMode, ContentType aContentType,
Flags aFlags = NoFlags,
ImageFormat aImageFormat = gfxImageFormatUnknown)
: mSize(aSize)
: mSize(aSize.ToIntSize())
, mWrapMode(aWrapMode)
, mContentType(aContentType)
, mImageFormat(aImageFormat)

Просмотреть файл

@ -75,7 +75,7 @@ SharedSurface_Gralloc::Create(GLContext* prodGL,
gfxContentType type = hasAlpha ? GFX_CONTENT_COLOR_ALPHA
: GFX_CONTENT_COLOR;
if (!allocator->AllocSurfaceDescriptorWithCaps(size, type, USING_GL_RENDERING_ONLY, &baseDesc))
if (!allocator->AllocSurfaceDescriptorWithCaps(size.ToIntSize(), type, USING_GL_RENDERING_ONLY, &baseDesc))
return false;
if (baseDesc.type() != SurfaceDescriptor::TSurfaceDescriptorGralloc) {

Просмотреть файл

@ -317,7 +317,7 @@ ImageContainer::LockCurrentAsSurface(gfx::IntSize *aSize, Image** aCurrentImage)
gfxImageFormatARGB32 :
gfxImageFormatRGB24);
*aSize = newSurf->GetSize();
*aSize = newSurf->GetSize().ToIntSize();
return newSurf.forget();
}
@ -382,7 +382,7 @@ ImageContainer::GetCurrentSize()
}
if (!mActiveImage) {
return gfx::IntSize(0,0);
return gfx::IntSize(0, 0);
}
return mActiveImage->GetSize();

Просмотреть файл

@ -273,7 +273,7 @@ ClientLayerManager::MakeSnapshotIfRequired()
nsIntRect bounds;
mWidget->GetBounds(bounds);
SurfaceDescriptor inSnapshot, snapshot;
if (mForwarder->AllocSurfaceDescriptor(bounds.Size(),
if (mForwarder->AllocSurfaceDescriptor(bounds.Size().ToIntSize(),
GFX_CONTENT_COLOR_ALPHA,
&inSnapshot) &&
// The compositor will usually reuse |snapshot| and return

Просмотреть файл

@ -1147,8 +1147,8 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
FillSurface(onBlack, result.mRegionToDraw, nsIntPoint(drawBounds.x, drawBounds.y), gfxRGBA(0.0, 0.0, 0.0, 1.0));
FillSurface(onWhite, result.mRegionToDraw, nsIntPoint(drawBounds.x, drawBounds.y), gfxRGBA(1.0, 1.0, 1.0, 1.0));
MOZ_ASSERT(gfxPlatform::GetPlatform()->SupportsAzureContent());
RefPtr<DrawTarget> onBlackDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onBlack, onBlack->GetSize());
RefPtr<DrawTarget> onWhiteDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onWhite, onWhite->GetSize());
RefPtr<DrawTarget> onBlackDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onBlack, onBlack->GetSize().ToIntSize());
RefPtr<DrawTarget> onWhiteDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onWhite, onWhite->GetSize().ToIntSize());
RefPtr<DrawTarget> dt = Factory::CreateDualDrawTarget(onBlackDT, onWhiteDT);
result.mContext = new gfxContext(dt);
} else {
@ -1157,7 +1157,7 @@ ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
} else {
nsRefPtr<gfxASurface> surf = GetUpdateSurface(BUFFER_BLACK, result.mRegionToDraw);
MOZ_ASSERT(gfxPlatform::GetPlatform()->SupportsAzureContent());
RefPtr<DrawTarget> dt = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(surf, surf->GetSize());
RefPtr<DrawTarget> dt = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(surf, surf->GetSize().ToIntSize());
result.mContext = new gfxContext(dt);
}
if (!result.mContext) {
@ -1226,7 +1226,7 @@ ContentClientIncremental::GetUpdateSurface(BufferType aType,
return nullptr;
}
SurfaceDescriptor desc;
if (!mForwarder->AllocSurfaceDescriptor(gfxIntSize(rgnSize.width, rgnSize.height),
if (!mForwarder->AllocSurfaceDescriptor(rgnSize.Size().ToIntSize(),
mContentType,
&desc)) {
NS_WARNING("creating SurfaceDescriptor failed!");

Просмотреть файл

@ -533,8 +533,8 @@ BufferTextureClient::UpdateYCbCr(const PlanarYCbCrData& aData)
YCbCrImageDataSerializer serializer(GetBuffer());
MOZ_ASSERT(serializer.IsValid());
if (!serializer.CopyData(aData.mYChannel, aData.mCbChannel, aData.mCrChannel,
ThebesIntSize(aData.mYSize), aData.mYStride,
ThebesIntSize(aData.mCbCrSize), aData.mCbCrStride,
aData.mYSize, aData.mYStride,
aData.mCbCrSize, aData.mCbCrStride,
aData.mYSkip, aData.mCbSkip)) {
NS_WARNING("Failed to copy image data!");
return false;
@ -635,8 +635,8 @@ DeprecatedTextureClientShmem::EnsureAllocated(gfx::IntSize aSize,
mContentType = aContentType;
mSize = aSize;
if (!mForwarder->AllocSurfaceDescriptor(gfxIntSize(mSize.width, mSize.height),
mContentType, &mDescriptor)) {
if (!mForwarder->AllocSurfaceDescriptor(mSize, mContentType,
&mDescriptor)) {
NS_WARNING("creating SurfaceDescriptor failed!");
}
if (mContentType == GFX_CONTENT_COLOR_ALPHA) {
@ -885,8 +885,8 @@ AutoLockYCbCrClient::Update(PlanarYCbCrImage* aImage)
YCbCrImageDataSerializer serializer(shmem.get<uint8_t>());
if (!serializer.CopyData(data->mYChannel, data->mCbChannel, data->mCrChannel,
ThebesIntSize(data->mYSize), data->mYStride,
ThebesIntSize(data->mCbCrSize), data->mCbCrStride,
data->mYSize, data->mYStride,
data->mCbCrSize, data->mCbCrStride,
data->mYSkip, data->mCbSkip)) {
NS_WARNING("Failed to copy image data!");
return false;

Просмотреть файл

@ -523,7 +523,7 @@ ContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData,
// Correct for rotation
destRegion.MoveBy(aData.rotation());
IntSize size = aData.rect().Size();
IntSize size = aData.rect().Size().ToIntSize();
nsIntRect destBounds = destRegion.GetBounds();
destRegion.MoveBy((destBounds.x >= size.width) ? -size.width : 0,
(destBounds.y >= size.height) ? -size.height : 0);
@ -620,7 +620,7 @@ DeprecatedContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData,
// Correct for rotation
destRegion.MoveBy(aData.rotation());
IntSize size = aData.rect().Size();
IntSize size = aData.rect().Size().ToIntSize();
nsIntRect destBounds = destRegion.GetBounds();
destRegion.MoveBy((destBounds.x >= size.width) ? -size.width : 0,
(destBounds.y >= size.height) ? -size.height : 0);

Просмотреть файл

@ -414,7 +414,7 @@ ImageLayerD3D10::GetAsTexture(gfx::IntSize* aSize)
return nullptr;
}
*aSize = gfx::ThebesIntSize(image->GetSize());
*aSize = image->GetSize();
bool dontCare;
nsRefPtr<ID3D10ShaderResourceView> result = GetImageSRView(image, dontCare);
return result.forget();

Просмотреть файл

@ -788,7 +788,7 @@ CompositorD3D11::UpdateRenderTarget()
}
mDefaultRT = new CompositingRenderTargetD3D11(backBuf, IntPoint(0, 0));
mDefaultRT->SetSize(mSize);
mDefaultRT->SetSize(mSize.ToIntSize());
}
bool

Просмотреть файл

@ -568,7 +568,7 @@ ImageLayerD3D9::GetAsTexture(gfx::IntSize* aSize)
}
bool dontCare;
*aSize = gfx::ThebesIntSize(image->GetSize());
*aSize = image->GetSize();
nsRefPtr<IDirect3DTexture9> result = GetTexture(image, dontCare);
return result.forget();
}

Просмотреть файл

@ -76,7 +76,7 @@ TakeAndDestroyXlibSurface(SurfaceDescriptor* aSurface)
SurfaceDescriptorX11::SurfaceDescriptorX11(gfxXlibSurface* aSurf)
: mId(aSurf->XDrawable())
, mSize(aSurf->GetSize())
, mSize(aSurf->GetSize().ToIntSize())
{
const XRenderPictFormat *pictFormat = aSurf->XRenderFormat();
if (pictFormat) {

Просмотреть файл

@ -669,8 +669,8 @@ ShadowLayerForwarder::GetDescriptorSurfaceSize(
}
nsRefPtr<gfxASurface> surface = OpenDescriptor(aMode, aDescriptor);
size = surface->GetSize();
*aSurface = surface.forget().get();
size = surface->GetSize().ToIntSize();
surface.forget(aSurface);
return size;
}
@ -829,7 +829,7 @@ gfx::IntSize
AutoOpenSurface::Size()
{
if (mSurface) {
return mSurface->GetSize();
return mSurface->GetSize().ToIntSize();
}
return ShadowLayerForwarder::GetDescriptorSurfaceSize(
mDescriptor, mMode, getter_AddRefs(mSurface));

Просмотреть файл

@ -246,9 +246,9 @@ DeprecatedSharedPlanarYCbCrImage::SetData(const PlanarYCbCrData& aData)
YCbCrImageDataSerializer serializer(mShmem.get<uint8_t>());
MOZ_ASSERT(aData.mCbSkip == aData.mCrSkip);
if (!serializer.CopyData(aData.mYChannel, aData.mCbChannel, aData.mCrChannel,
ThebesIntSize(aData.mYSize), aData.mYStride,
ThebesIntSize(aData.mCbCrSize), aData.mCbCrStride,
aData.mYSkip, aData.mCbSkip)) {
aData.mYSize, aData.mYStride,
aData.mCbCrSize, aData.mCbCrStride,
aData.mYSkip, aData.mCbSkip)) {
NS_WARNING("Failed to copy image data!");
}
mData.mYChannel = serializer.GetYData();

Просмотреть файл

@ -74,7 +74,7 @@ CreateSharedRGBImage(ImageContainer *aImageContainer,
if (gfxPlatform::GetPlatform()->UseDeprecatedTextures()) {
nsRefPtr<DeprecatedSharedRGBImage> rgbImageDep = static_cast<DeprecatedSharedRGBImage*>(image.get());
rgbImageDep->mSize = gfxIntSize(aSize.width, aSize.height);
rgbImageDep->mSize = aSize.ToIntSize();
rgbImageDep->mImageFormat = aImageFormat;
if (!rgbImageDep->AllocateBuffer(aSize, aImageFormat)) {
@ -218,7 +218,7 @@ SharedRGBImage::GetBuffer()
gfx::IntSize
SharedRGBImage::GetSize()
{
return ThebesIntSize(mSize);
return mSize;
}
size_t

Просмотреть файл

@ -16,6 +16,7 @@
namespace mozilla {
namespace layers {
using namespace mozilla::gfx;
using namespace android;
class GraphicBufferLockedTextureClientData : public TextureClientData {
@ -61,7 +62,8 @@ public:
// We just need to wrap the actor in a SurfaceDescriptor because that's what
// ISurfaceAllocator uses as input, we don't care about the other parameters.
SurfaceDescriptor sd = SurfaceDescriptorGralloc(nullptr, mGrallocActor,
nsIntSize(0,0), false, false);
IntSize(0, 0),
false, false);
allocator->DestroySharedSurface(&sd);
mGrallocActor = nullptr;
}
@ -121,7 +123,8 @@ GrallocTextureClientOGL::~GrallocTextureClientOGL()
// We just need to wrap the actor in a SurfaceDescriptor because that's what
// ISurfaceAllocator uses as input, we don't care about the other parameters.
SurfaceDescriptor sd = SurfaceDescriptorGralloc(nullptr, mGrallocActor,
nsIntSize(0,0), false, false);
IntSize(0, 0),
false, false);
mCompositable->GetForwarder()->DestroySharedSurface(&sd);
}
}

Просмотреть файл

@ -38,8 +38,7 @@ SharedTextureClientOGL::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
if (!IsAllocated()) {
return false;
}
nsIntSize nsSize(mSize.width, mSize.height);
aOutDescriptor = SharedTextureDescriptor(mShareType, mHandle, nsSize, mInverted);
aOutDescriptor = SharedTextureDescriptor(mShareType, mHandle, mSize, mInverted);
return true;
}

Просмотреть файл

@ -236,7 +236,7 @@ TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
}
MOZ_ASSERT(aSurface);
nsIntSize size = ThebesIntSize(aSurface->GetSize());
IntSize size = aSurface->GetSize();
if (!mTexImage ||
mTexImage->GetSize() != size ||
mTexImage->GetContentType() != gfx::ContentForFormat(aSurface->GetFormat())) {
@ -501,15 +501,15 @@ TextureImageDeprecatedTextureHostOGL::EnsureBuffer(const nsIntSize& aSize,
gfxContentType aContentType)
{
if (!mTexture ||
mTexture->GetSize() != aSize ||
mTexture->GetSize() != aSize.ToIntSize() ||
mTexture->GetContentType() != aContentType) {
mTexture = CreateTextureImage(mGL,
aSize,
aSize.ToIntSize(),
aContentType,
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
FlagsToGLFlags(mFlags));
}
mTexture->Resize(aSize);
mTexture->Resize(aSize.ToIntSize());
}
void

Просмотреть файл

@ -37,7 +37,10 @@ struct nsIntSize : public mozilla::gfx::BaseSize<int32_t, nsIntSize> {
nsIntSize(int32_t aWidth, int32_t aHeight) : Super(aWidth, aHeight) {}
inline nsSize ToAppUnits(nscoord aAppUnitsPerPixel) const;
operator mozilla::gfx::IntSize() const { return mozilla::gfx::IntSize(width, height); };
mozilla::gfx::IntSize ToIntSize() const
{
return mozilla::gfx::IntSize(width, height);
};
};
inline nsIntSize

Просмотреть файл

@ -242,9 +242,9 @@ TEST(Layers, TextureYCbCrSerialization) {
clientData.mYChannel = ySurface->Data();
clientData.mCbChannel = cbSurface->Data();
clientData.mCrChannel = crSurface->Data();
clientData.mYSize = ySurface->GetSize();
clientData.mPicSize = ySurface->GetSize();
clientData.mCbCrSize = cbSurface->GetSize();
clientData.mYSize = ySurface->GetSize().ToIntSize();
clientData.mPicSize = ySurface->GetSize().ToIntSize();
clientData.mCbCrSize = cbSurface->GetSize().ToIntSize();
clientData.mYStride = ySurface->Stride();
clientData.mCbCrStride = cbSurface->Stride();
clientData.mStereoMode = STEREO_MODE_MONO;

Просмотреть файл

@ -851,7 +851,7 @@ VectorImage::CreateDrawableAndShow(const SVGDrawingParameters& aParams)
// Try to create an offscreen surface.
mozilla::RefPtr<mozilla::gfx::DrawTarget> target =
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(aParams.imageRect.Size(), gfx::FORMAT_B8G8R8A8);
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(aParams.imageRect.Size().ToIntSize(), gfx::FORMAT_B8G8R8A8);
// If we couldn't create the draw target, it was probably because it would end
// up way too big. Generally it also wouldn't fit in the cache, but the prefs

Просмотреть файл

@ -3788,8 +3788,8 @@ ContainerState::SetupMaskLayer(Layer *aLayer, const DisplayItemClip& aClip,
GetMaskLayerImageCache()->FindImageFor(&lookupKey);
if (!container) {
nsIntSize surfaceSizeInt = nsIntSize(NSToIntCeil(surfaceSize.width),
NSToIntCeil(surfaceSize.height));
IntSize surfaceSizeInt(NSToIntCeil(surfaceSize.width),
NSToIntCeil(surfaceSize.height));
// no existing mask image, so build a new one
nsRefPtr<gfxASurface> surface =
aLayer->Manager()->CreateOptimalMaskSurface(surfaceSizeInt);

Просмотреть файл

@ -8,6 +8,7 @@
#include "nsObjectFrame.h"
#include "gfx2DGlue.h"
#include "mozilla/BasicEvents.h"
#ifdef XP_WIN
// This is needed for DoublePassRenderingEvent.
@ -145,6 +146,7 @@ extern "C" {
#endif /* #if defined(XP_MACOSX) && !defined(__LP64__) */
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::layers;
class PluginBackgroundSink : public ReadbackSink {
@ -1527,7 +1529,7 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
scaleFactor = 1.0;
}
int intScaleFactor = ceil(scaleFactor);
gfxIntSize size(window->width * intScaleFactor, window->height * intScaleFactor);
IntSize size(window->width * intScaleFactor, window->height * intScaleFactor);
nsRect area = GetContentRectRelativeToSelf() + aItem->ToReferenceFrame();
gfxRect r = nsLayoutUtils::RectToGfxRect(area, PresContext()->AppUnitsPerDevPixel());
@ -1612,11 +1614,11 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
NS_ASSERTION(layer->GetType() == Layer::TYPE_READBACK, "Bad layer type");
ReadbackLayer* readback = static_cast<ReadbackLayer*>(layer.get());
if (readback->GetSize() != nsIntSize(size.width, size.height)) {
if (readback->GetSize() != ThebesIntSize(size)) {
// This will destroy any old background sink and notify us that the
// background is now unknown
readback->SetSink(nullptr);
readback->SetSize(nsIntSize(size.width, size.height));
readback->SetSize(ThebesIntSize(size));
if (mBackgroundSink) {
// Maybe we still have a background sink associated with another
@ -1639,7 +1641,7 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
transform.Translate(r.TopLeft() + aContainerParameters.mOffset);
layer->SetBaseTransform(gfx3DMatrix::From2D(transform));
layer->SetVisibleRegion(nsIntRect(0, 0, size.width, size.height));
layer->SetVisibleRegion(ThebesIntRect(IntRect(IntPoint(0, 0), size)));
return layer.forget();
}

Просмотреть файл

@ -31,6 +31,7 @@
using namespace mozilla;
using namespace mozilla::layers;
using namespace mozilla::dom;
using namespace mozilla::gfx;
nsIFrame*
NS_NewHTMLVideoFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
@ -198,8 +199,8 @@ nsVideoFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
if (r.IsEmpty()) {
return nullptr;
}
gfxIntSize scaleHint(static_cast<int32_t>(r.Width()),
static_cast<int32_t>(r.Height()));
IntSize scaleHint(static_cast<int32_t>(r.Width()),
static_cast<int32_t>(r.Height()));
container->SetScaleHint(scaleHint);
nsRefPtr<ImageLayer> layer = static_cast<ImageLayer*>

Просмотреть файл

@ -42,6 +42,7 @@
#include "mozilla/gfx/Point.h"
using namespace mozilla;
using namespace mozilla::gfx;
// Logging context
MOZ_MTLOG_MODULE("mediapipeline")
@ -1212,15 +1213,15 @@ void MediaPipelineReceiveVideo::PipelineListener::RenderVideoFrame(
layers::PlanarYCbCrData data;
data.mYChannel = frame;
data.mYSize = gfxIntSize(width_, height_);
data.mYSize = IntSize(width_, height_);
data.mYStride = width_ * lumaBpp/ 8;
data.mCbCrStride = width_ * chromaBpp / 8;
data.mCbChannel = frame + height_ * data.mYStride;
data.mCrChannel = data.mCbChannel + height_ * data.mCbCrStride / 2;
data.mCbCrSize = gfxIntSize(width_/ 2, height_/ 2);
data.mCbCrSize = IntSize(width_/ 2, height_/ 2);
data.mPicX = 0;
data.mPicY = 0;
data.mPicSize = gfxIntSize(width_, height_);
data.mPicSize = IntSize(width_, height_);
data.mStereoMode = STEREO_MODE_MONO;
videoImage->SetData(data);

Просмотреть файл

@ -94,6 +94,7 @@ Fake_AudioGenerator(DOMMediaStream* aStream) : mStream(aStream), mCount(0) {
class Fake_VideoGenerator {
public:
typedef mozilla::DOMMediaStream DOMMediaStream;
typedef mozilla::gfx::IntSize IntSize;
Fake_VideoGenerator(DOMMediaStream* aStream) {
mStream = aStream;
@ -135,15 +136,15 @@ class Fake_VideoGenerator {
mozilla::layers::PlanarYCbCrData data;
data.mYChannel = frame;
data.mYSize = gfxIntSize(WIDTH, HEIGHT);
data.mYSize = IntSize(WIDTH, HEIGHT);
data.mYStride = (int32_t) (WIDTH * lumaBpp / 8.0);
data.mCbCrStride = (int32_t) (WIDTH * chromaBpp / 8.0);
data.mCbChannel = frame + HEIGHT * data.mYStride;
data.mCrChannel = data.mCbChannel + HEIGHT * data.mCbCrStride / 2;
data.mCbCrSize = gfxIntSize(WIDTH / 2, HEIGHT / 2);
data.mCbCrSize = IntSize(WIDTH / 2, HEIGHT / 2);
data.mPicX = 0;
data.mPicY = 0;
data.mPicSize = gfxIntSize(WIDTH, HEIGHT);
data.mPicSize = IntSize(WIDTH, HEIGHT);
data.mStereoMode = mozilla::STEREO_MODE_MONO;
// SetData copies data, so we can free the frame

Просмотреть файл

@ -37,6 +37,8 @@
#define ATRACE_BUFFER_INDEX(index)
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::layers;
namespace android {
@ -410,7 +412,7 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence,
status_t error;
ibc = ImageBridgeChild::GetSingleton();
ST_LOGD("dequeueBuffer: about to alloc surface descriptor");
ibc->AllocSurfaceDescriptorGralloc(gfxIntSize(w, h),
ibc->AllocSurfaceDescriptorGralloc(IntSize(w, h),
format,
usage,
&desc);

Просмотреть файл

@ -32,6 +32,8 @@
#define CNW_LOGE(...) {(void)printf_stderr(__VA_ARGS__);}
using namespace android;
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::layers;
GonkNativeWindow::GonkNativeWindow() :
@ -338,7 +340,7 @@ status_t GonkNativeWindow::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
status_t error;
ibc = ImageBridgeChild::GetSingleton();
CNW_LOGD("dequeueBuffer: about to alloc surface descriptor");
ibc->AllocSurfaceDescriptorGralloc(gfxIntSize(w, h),
ibc->AllocSurfaceDescriptorGralloc(IntSize(w, h),
format,
usage,
&desc);

Просмотреть файл

@ -2289,8 +2289,7 @@ nsWindow::UpdateAlpha(gfxPattern* aPattern, nsIntRect aBoundsRect)
UpdateTranslucentWindowAlphaInternal(aBoundsRect, imageBuffer, stride);
} else {
nsRefPtr<gfxImageSurface> img =
new gfxImageSurface(ThebesIntSize(aBoundsRect.Size()),
gfxImageFormatA8);
new gfxImageSurface(aBoundsRect.Size(), gfxImageFormatA8);
if (img && !img->CairoStatus()) {
img->SetDeviceOffset(-aBoundsRect.TopLeft());