mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-22 10:27:03 +00:00
Bug 950677 - Change gfxIntSize to gfx::IntSize in ImageContainer.h. r=nical
This commit is contained in:
parent
cbeb6d06cc
commit
7a84faef28
@ -110,12 +110,11 @@ GrallocImage::SetData(const Data& aData)
|
||||
}
|
||||
|
||||
uint8_t* yChannel = static_cast<uint8_t*>(vaddr);
|
||||
gfxIntSize ySize = gfxIntSize(aData.mYSize.width,
|
||||
aData.mYSize.height);
|
||||
gfx::IntSize ySize = aData.mYSize;
|
||||
int32_t yStride = graphicBuffer->getStride();
|
||||
|
||||
uint8_t* vChannel = yChannel + (yStride * ySize.height);
|
||||
gfxIntSize uvSize = gfxIntSize(ySize.width / 2,
|
||||
gfx::IntSize uvSize = gfx::IntSize(ySize.width / 2,
|
||||
ySize.height / 2);
|
||||
// Align to 16 bytes boundary
|
||||
int32_t uvStride = ((yStride / 2) + 15) & ~0x0F;
|
||||
|
@ -310,7 +310,9 @@ ImageContainer::LockCurrentAsSurface(gfx::IntSize *aSize, Image** aCurrentImage)
|
||||
|
||||
if (mActiveImage->GetFormat() == REMOTE_IMAGE_BITMAP) {
|
||||
nsRefPtr<gfxImageSurface> newSurf =
|
||||
new gfxImageSurface(mRemoteData->mBitmap.mData, mRemoteData->mSize, mRemoteData->mBitmap.mStride,
|
||||
new gfxImageSurface(mRemoteData->mBitmap.mData,
|
||||
ThebesIntSize(mRemoteData->mSize),
|
||||
mRemoteData->mBitmap.mStride,
|
||||
mRemoteData->mFormat == RemoteImageData::BGRX32 ?
|
||||
gfxImageFormatARGB32 :
|
||||
gfxImageFormatRGB24);
|
||||
@ -380,7 +382,7 @@ ImageContainer::GetCurrentSize()
|
||||
}
|
||||
|
||||
if (!mActiveImage) {
|
||||
return gfxIntSize(0,0);
|
||||
return gfx::IntSize(0,0);
|
||||
}
|
||||
|
||||
return mActiveImage->GetSize();
|
||||
@ -464,7 +466,7 @@ PlanarYCbCrImage::AllocateBuffer(uint32_t aSize)
|
||||
|
||||
static void
|
||||
CopyPlane(uint8_t *aDst, const uint8_t *aSrc,
|
||||
const gfxIntSize &aSize, int32_t aStride, int32_t aSkip)
|
||||
const gfx::IntSize &aSize, int32_t aStride, int32_t aSkip)
|
||||
{
|
||||
if (!aSkip) {
|
||||
// Fast path: planar input.
|
||||
@ -581,7 +583,7 @@ already_AddRefed<gfxASurface>
|
||||
RemoteBitmapImage::GetAsSurface()
|
||||
{
|
||||
nsRefPtr<gfxImageSurface> newSurf =
|
||||
new gfxImageSurface(mSize,
|
||||
new gfxImageSurface(ThebesIntSize(mSize),
|
||||
mFormat == RemoteImageData::BGRX32 ? gfxImageFormatRGB24 : gfxImageFormatARGB32);
|
||||
|
||||
for (int y = 0; y < mSize.height; y++) {
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <sys/types.h> // for int32_t
|
||||
#include "ImageTypes.h" // for ImageFormat, etc
|
||||
#include "gfxASurface.h" // for gfxASurface, etc
|
||||
#include "gfxPoint.h" // for gfxIntSize
|
||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
|
||||
#include "mozilla/Mutex.h" // for Mutex
|
||||
#include "mozilla/ReentrantMonitor.h" // for ReentrantMonitorAutoEnter, etc
|
||||
@ -305,7 +304,7 @@ struct RemoteImageData {
|
||||
bool mWasUpdated;
|
||||
Type mType;
|
||||
Format mFormat;
|
||||
gfxIntSize mSize;
|
||||
gfx::IntSize mSize;
|
||||
union {
|
||||
struct {
|
||||
/* This pointer is set by a remote process, however it will be set to
|
||||
@ -511,7 +510,7 @@ public:
|
||||
* Can be called on any thread. This method takes mReentrantMonitor
|
||||
* when accessing thread-shared state.
|
||||
*/
|
||||
void SetScaleHint(const gfxIntSize& aScaleHint)
|
||||
void SetScaleHint(const gfx::IntSize& aScaleHint)
|
||||
{ mScaleHint = aScaleHint; }
|
||||
|
||||
void SetImageFactory(ImageFactory *aFactory)
|
||||
@ -638,7 +637,7 @@ protected:
|
||||
// create images for this container.
|
||||
nsRefPtr<ImageFactory> mImageFactory;
|
||||
|
||||
gfxIntSize mScaleHint;
|
||||
gfx::IntSize mScaleHint;
|
||||
|
||||
nsRefPtr<BufferRecycleBin> mRecycleBin;
|
||||
|
||||
@ -706,19 +705,19 @@ struct PlanarYCbCrData {
|
||||
// Luminance buffer
|
||||
uint8_t* mYChannel;
|
||||
int32_t mYStride;
|
||||
gfxIntSize mYSize;
|
||||
gfx::IntSize mYSize;
|
||||
int32_t mYSkip;
|
||||
// Chroma buffers
|
||||
uint8_t* mCbChannel;
|
||||
uint8_t* mCrChannel;
|
||||
int32_t mCbCrStride;
|
||||
gfxIntSize mCbCrSize;
|
||||
gfx::IntSize mCbCrSize;
|
||||
int32_t mCbSkip;
|
||||
int32_t mCrSkip;
|
||||
// Picture region
|
||||
uint32_t mPicX;
|
||||
uint32_t mPicY;
|
||||
gfxIntSize mPicSize;
|
||||
gfx::IntSize mPicSize;
|
||||
StereoMode mStereoMode;
|
||||
|
||||
nsIntRect GetPictureRect() const {
|
||||
@ -865,7 +864,7 @@ class CairoImage : public Image {
|
||||
public:
|
||||
struct Data {
|
||||
gfxASurface* mSurface;
|
||||
gfxIntSize mSize;
|
||||
gfx::IntSize mSize;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -891,7 +890,7 @@ public:
|
||||
CairoImage() : Image(nullptr, CAIRO_SURFACE) {}
|
||||
|
||||
nsCountedRef<nsMainThreadSurfaceRef> mSurface;
|
||||
gfxIntSize mSize;
|
||||
gfx::IntSize mSize;
|
||||
};
|
||||
|
||||
class RemoteBitmapImage : public Image {
|
||||
@ -904,7 +903,7 @@ public:
|
||||
|
||||
unsigned char *mData;
|
||||
int mStride;
|
||||
gfxIntSize mSize;
|
||||
gfx::IntSize mSize;
|
||||
RemoteImageData::Format mFormat;
|
||||
};
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "mozilla/layers/TextureClient.h"
|
||||
#include <stdint.h> // for uint8_t, uint32_t, etc
|
||||
#include "Layers.h" // for Layer, etc
|
||||
#include "gfx2DGlue.h"
|
||||
#include "gfxContext.h" // for gfxContext, etc
|
||||
#include "gfxPlatform.h" // for gfxPlatform
|
||||
#include "gfxPoint.h" // for gfxIntSize, gfxSize
|
||||
@ -506,8 +507,8 @@ BufferTextureClient::UpdateYCbCr(const PlanarYCbCrData& aData)
|
||||
YCbCrImageDataSerializer serializer(GetBuffer());
|
||||
MOZ_ASSERT(serializer.IsValid());
|
||||
if (!serializer.CopyData(aData.mYChannel, aData.mCbChannel, aData.mCrChannel,
|
||||
aData.mYSize, aData.mYStride,
|
||||
aData.mCbCrSize, aData.mCbCrStride,
|
||||
ThebesIntSize(aData.mYSize), aData.mYStride,
|
||||
ThebesIntSize(aData.mCbCrSize), aData.mCbCrStride,
|
||||
aData.mYSkip, aData.mCbSkip)) {
|
||||
NS_WARNING("Failed to copy image data!");
|
||||
return false;
|
||||
@ -858,8 +859,8 @@ AutoLockYCbCrClient::Update(PlanarYCbCrImage* aImage)
|
||||
|
||||
YCbCrImageDataSerializer serializer(shmem.get<uint8_t>());
|
||||
if (!serializer.CopyData(data->mYChannel, data->mCbChannel, data->mCrChannel,
|
||||
data->mYSize, data->mYStride,
|
||||
data->mCbCrSize, data->mCbCrStride,
|
||||
ThebesIntSize(data->mYSize), data->mYStride,
|
||||
ThebesIntSize(data->mCbCrSize), data->mCbCrStride,
|
||||
data->mYSkip, data->mCbSkip)) {
|
||||
NS_WARNING("Failed to copy image data!");
|
||||
return false;
|
||||
@ -886,8 +887,8 @@ bool AutoLockYCbCrClient::EnsureDeprecatedTextureClient(PlanarYCbCrImage* aImage
|
||||
} else {
|
||||
ipc::Shmem& shmem = mDescriptor->get_YCbCrImage().data();
|
||||
YCbCrImageDataSerializer serializer(shmem.get<uint8_t>());
|
||||
if (serializer.GetYSize() != data->mYSize ||
|
||||
serializer.GetCbCrSize() != data->mCbCrSize) {
|
||||
if (ToIntSize(serializer.GetYSize()) != data->mYSize ||
|
||||
ToIntSize(serializer.GetCbCrSize()) != data->mCbCrSize) {
|
||||
needsAllocation = true;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "SharedPlanarYCbCrImage.h"
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdio.h> // for printf
|
||||
#include "gfx2DGlue.h" // for Moz2D transition helpers
|
||||
#include "ISurfaceAllocator.h" // for ISurfaceAllocator, etc
|
||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
||||
#include "mozilla/gfx/Types.h" // for SurfaceFormat::FORMAT_YUV
|
||||
@ -245,8 +246,8 @@ 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,
|
||||
aData.mYSize, aData.mYStride,
|
||||
aData.mCbCrSize, aData.mCbCrStride,
|
||||
ThebesIntSize(aData.mYSize), aData.mYStride,
|
||||
ThebesIntSize(aData.mCbCrSize), aData.mCbCrStride,
|
||||
aData.mYSkip, aData.mCbSkip)) {
|
||||
NS_WARNING("Failed to copy image data!");
|
||||
}
|
||||
|
@ -150,8 +150,8 @@ void TestTextureClientYCbCr(TextureClient* client, PlanarYCbCrData& ycbcrData) {
|
||||
// client allocation
|
||||
ASSERT_TRUE(client->AsTextureClientYCbCr() != nullptr);
|
||||
TextureClientYCbCr* texture = client->AsTextureClientYCbCr();
|
||||
texture->AllocateForYCbCr(ToIntSize(ycbcrData.mYSize),
|
||||
ToIntSize(ycbcrData.mCbCrSize),
|
||||
texture->AllocateForYCbCr(ycbcrData.mYSize,
|
||||
ycbcrData.mCbCrSize,
|
||||
ycbcrData.mStereoMode);
|
||||
ASSERT_TRUE(client->IsAllocated());
|
||||
|
||||
|
@ -698,7 +698,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 &&
|
||||
aSuggestedSize != aData.mPicSize;
|
||||
ToIntSize(aSuggestedSize) != aData.mPicSize;
|
||||
|
||||
if (aSuggestedFormat == gfxImageFormatRGB16_565) {
|
||||
#if defined(HAVE_YCBCR_TO_RGB565)
|
||||
@ -734,7 +734,7 @@ gfxUtils::GetYCbCrToRGBDestFormatAndSize(const PlanarYCbCrData& aData,
|
||||
prescale = false;
|
||||
}
|
||||
if (!prescale) {
|
||||
aSuggestedSize = aData.mPicSize;
|
||||
ToIntSize(aSuggestedSize) = aData.mPicSize;
|
||||
}
|
||||
}
|
||||
|
||||
@ -758,7 +758,7 @@ gfxUtils::ConvertYCbCrToRGB(const PlanarYCbCrData& aData,
|
||||
aData.mCbCrSize.height);
|
||||
|
||||
// Convert from YCbCr to RGB now, scaling the image if needed.
|
||||
if (aDestSize != aData.mPicSize) {
|
||||
if (ToIntSize(aDestSize) != aData.mPicSize) {
|
||||
#if defined(HAVE_YCBCR_TO_RGB565)
|
||||
if (aDestFormat == gfxImageFormatRGB16_565) {
|
||||
ScaleYCbCrToRGB565(aData.mYChannel,
|
||||
|
@ -86,7 +86,7 @@ ConvertYCbCrToRGB(const layers::PlanarYCbCrData& aData,
|
||||
aData.mCbCrSize.height);
|
||||
|
||||
// Convert from YCbCr to RGB now, scaling the image if needed.
|
||||
if (aDestSize != ToIntSize(aData.mPicSize)) {
|
||||
if (aDestSize != aData.mPicSize) {
|
||||
#if defined(HAVE_YCBCR_TO_RGB565)
|
||||
if (aDestFormat == FORMAT_R5G6B5) {
|
||||
ScaleYCbCrToRGB565(aData.mYChannel,
|
||||
|
Loading…
x
Reference in New Issue
Block a user