Bug 877115 - Moz2Dify GLContext and GLTextureImage. r=nical
This commit is contained in:
@@ -1994,7 +1994,7 @@ GLContext::BlitTextureImage(TextureImage *aSrc, const nsIntRect& aSrcRect,
|
|||||||
do {
|
do {
|
||||||
// calculate portion of the tile that is going to be painted to
|
// calculate portion of the tile that is going to be painted to
|
||||||
nsIntRect dstSubRect;
|
nsIntRect dstSubRect;
|
||||||
nsIntRect dstTextureRect = aDst->GetTileRect();
|
nsIntRect dstTextureRect = ThebesIntRect(aDst->GetTileRect());
|
||||||
dstSubRect.IntersectRect(aDstRect, dstTextureRect);
|
dstSubRect.IntersectRect(aDstRect, dstTextureRect);
|
||||||
|
|
||||||
// this tile is not part of the destination rectangle aDstRect
|
// this tile is not part of the destination rectangle aDstRect
|
||||||
@@ -2016,7 +2016,7 @@ GLContext::BlitTextureImage(TextureImage *aSrc, const nsIntRect& aSrcRect,
|
|||||||
do {
|
do {
|
||||||
// calculate portion of the source tile that is in the source rect
|
// calculate portion of the source tile that is in the source rect
|
||||||
nsIntRect srcSubRect;
|
nsIntRect srcSubRect;
|
||||||
nsIntRect srcTextureRect = aSrc->GetTileRect();
|
nsIntRect srcTextureRect = ThebesIntRect(aSrc->GetTileRect());
|
||||||
srcSubRect.IntersectRect(aSrcRect, srcTextureRect);
|
srcSubRect.IntersectRect(aSrcRect, srcTextureRect);
|
||||||
|
|
||||||
// this tile is not part of the source rect
|
// this tile is not part of the source rect
|
||||||
|
|||||||
@@ -23,6 +23,17 @@ TextureImage::Create(GLContext* gl,
|
|||||||
return gl->CreateTextureImage(size, contentType, wrapMode, flags);
|
return gl->CreateTextureImage(size, contentType, wrapMode, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Moz2D equivalent...
|
||||||
|
already_AddRefed<TextureImage>
|
||||||
|
TextureImage::Create(GLContext* gl,
|
||||||
|
const gfx::IntSize& size,
|
||||||
|
TextureImage::ContentType contentType,
|
||||||
|
GLenum wrapMode,
|
||||||
|
TextureImage::Flags flags)
|
||||||
|
{
|
||||||
|
return Create(gl, ThebesIntSize(size), contentType, wrapMode, flags);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TextureImage::UpdateFromDataSource(gfx::DataSourceSurface *aSurface,
|
TextureImage::UpdateFromDataSource(gfx::DataSourceSurface *aSurface,
|
||||||
const nsIntRegion* aDestRegion,
|
const nsIntRegion* aDestRegion,
|
||||||
@@ -42,6 +53,14 @@ TextureImage::UpdateFromDataSource(gfx::DataSourceSurface *aSurface,
|
|||||||
return DirectUpdate(thebesSurf, destRegion, thebesSrcPoint);
|
return DirectUpdate(thebesSurf, destRegion, thebesSrcPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gfx::IntRect TextureImage::GetTileRect() {
|
||||||
|
return gfx::IntRect(gfx::IntPoint(0,0), ToIntSize(mSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx::IntRect TextureImage::GetSrcTileRect() {
|
||||||
|
return GetTileRect();
|
||||||
|
}
|
||||||
|
|
||||||
BasicTextureImage::~BasicTextureImage()
|
BasicTextureImage::~BasicTextureImage()
|
||||||
{
|
{
|
||||||
GLContext *ctx = mGLContext;
|
GLContext *ctx = mGLContext;
|
||||||
@@ -208,6 +227,49 @@ BasicTextureImage::Resize(const nsIntSize& aSize)
|
|||||||
mSize = aSize;
|
mSize = aSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Moz2D equivalents...
|
||||||
|
void TextureImage::Resize(const gfx::IntSize& aSize) {
|
||||||
|
Resize(ThebesIntSize(aSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx::IntSize TextureImage::GetSize() const {
|
||||||
|
return ToIntSize(mSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureImage::TextureImage(const gfx::IntSize& aSize,
|
||||||
|
GLenum aWrapMode, ContentType aContentType,
|
||||||
|
Flags aFlags)
|
||||||
|
: mSize(ThebesIntSize(aSize))
|
||||||
|
, mWrapMode(aWrapMode)
|
||||||
|
, mContentType(aContentType)
|
||||||
|
, mFilter(gfxPattern::FILTER_GOOD)
|
||||||
|
, mFlags(aFlags)
|
||||||
|
{}
|
||||||
|
|
||||||
|
BasicTextureImage::BasicTextureImage(GLuint aTexture,
|
||||||
|
const gfx::IntSize& aSize,
|
||||||
|
GLenum aWrapMode,
|
||||||
|
ContentType aContentType,
|
||||||
|
GLContext* aContext,
|
||||||
|
TextureImage::Flags aFlags,
|
||||||
|
TextureImage::ImageFormat aImageFormat)
|
||||||
|
: TextureImage(ThebesIntSize(aSize), aWrapMode, aContentType, aFlags, aImageFormat)
|
||||||
|
, mTexture(aTexture)
|
||||||
|
, mTextureState(Created)
|
||||||
|
, mGLContext(aContext)
|
||||||
|
, mUpdateOffset(0, 0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
already_AddRefed<TextureImage>
|
||||||
|
CreateBasicTextureImage(GLContext* aGL,
|
||||||
|
const gfx::IntSize& aSize,
|
||||||
|
TextureImage::ContentType aContentType,
|
||||||
|
GLenum aWrapMode,
|
||||||
|
TextureImage::Flags aFlags)
|
||||||
|
{
|
||||||
|
return CreateBasicTextureImage(aGL, ThebesIntSize(aSize), aContentType, aWrapMode, aFlags);
|
||||||
|
}
|
||||||
|
|
||||||
TiledTextureImage::TiledTextureImage(GLContext* aGL,
|
TiledTextureImage::TiledTextureImage(GLContext* aGL,
|
||||||
nsIntSize aSize,
|
nsIntSize aSize,
|
||||||
TextureImage::ContentType aContentType,
|
TextureImage::ContentType aContentType,
|
||||||
@@ -257,7 +319,7 @@ TiledTextureImage::DirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion,
|
|||||||
int oldCurrentImage = mCurrentImage;
|
int oldCurrentImage = mCurrentImage;
|
||||||
BeginTileIteration();
|
BeginTileIteration();
|
||||||
do {
|
do {
|
||||||
nsIntRect tileRect = GetSrcTileRect();
|
nsIntRect tileRect = ThebesIntRect(GetSrcTileRect());
|
||||||
int xPos = tileRect.x;
|
int xPos = tileRect.x;
|
||||||
int yPos = tileRect.y;
|
int yPos = tileRect.y;
|
||||||
|
|
||||||
@@ -313,7 +375,8 @@ TiledTextureImage::GetUpdateRegion(nsIntRegion& aForRegion)
|
|||||||
for (unsigned i = 0; i < mImages.Length(); i++) {
|
for (unsigned i = 0; i < mImages.Length(); i++) {
|
||||||
int xPos = (i % mColumns) * mTileSize;
|
int xPos = (i % mColumns) * mTileSize;
|
||||||
int yPos = (i / mColumns) * mTileSize;
|
int yPos = (i / mColumns) * mTileSize;
|
||||||
nsIntRect imageRect = nsIntRect(nsIntRect(nsIntPoint(xPos,yPos), mImages[i]->GetSize()));
|
nsIntRect imageRect = nsIntRect(nsIntPoint(xPos,yPos),
|
||||||
|
ThebesIntSize(mImages[i]->GetSize()));
|
||||||
|
|
||||||
if (aForRegion.Intersects(imageRect)) {
|
if (aForRegion.Intersects(imageRect)) {
|
||||||
// Make a copy of the region
|
// Make a copy of the region
|
||||||
@@ -355,7 +418,9 @@ TiledTextureImage::BeginUpdate(nsIntRegion& aRegion)
|
|||||||
for (unsigned i = 0; i < mImages.Length(); i++) {
|
for (unsigned i = 0; i < mImages.Length(); i++) {
|
||||||
int xPos = (i % mColumns) * mTileSize;
|
int xPos = (i % mColumns) * mTileSize;
|
||||||
int yPos = (i / mColumns) * mTileSize;
|
int yPos = (i / mColumns) * mTileSize;
|
||||||
nsIntRegion imageRegion = nsIntRegion(nsIntRect(nsIntPoint(xPos,yPos), mImages[i]->GetSize()));
|
nsIntRegion imageRegion =
|
||||||
|
nsIntRegion(nsIntRect(nsIntPoint(xPos,yPos),
|
||||||
|
ThebesIntSize(mImages[i]->GetSize())));
|
||||||
|
|
||||||
// a single Image can handle this update request
|
// a single Image can handle this update request
|
||||||
if (imageRegion.Contains(aRegion)) {
|
if (imageRegion.Contains(aRegion)) {
|
||||||
@@ -410,7 +475,8 @@ TiledTextureImage::EndUpdate()
|
|||||||
for (unsigned i = 0; i < mImages.Length(); i++) {
|
for (unsigned i = 0; i < mImages.Length(); i++) {
|
||||||
int xPos = (i % mColumns) * mTileSize;
|
int xPos = (i % mColumns) * mTileSize;
|
||||||
int yPos = (i / mColumns) * mTileSize;
|
int yPos = (i / mColumns) * mTileSize;
|
||||||
nsIntRect imageRect = nsIntRect(nsIntPoint(xPos,yPos), mImages[i]->GetSize());
|
nsIntRect imageRect = nsIntRect(nsIntPoint(xPos,yPos),
|
||||||
|
ThebesIntSize(mImages[i]->GetSize()));
|
||||||
|
|
||||||
nsIntRegion subregion;
|
nsIntRegion subregion;
|
||||||
subregion.And(mUpdateRegion, imageRect);
|
subregion.And(mUpdateRegion, imageRect);
|
||||||
@@ -460,25 +526,25 @@ void TiledTextureImage::SetIterationCallback(TileIterationCallback aCallback,
|
|||||||
mIterationCallbackData = aCallbackData;
|
mIterationCallbackData = aCallbackData;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRect TiledTextureImage::GetTileRect()
|
gfx::IntRect TiledTextureImage::GetTileRect()
|
||||||
{
|
{
|
||||||
if (!GetTileCount()) {
|
if (!GetTileCount()) {
|
||||||
return nsIntRect();
|
return gfx::IntRect();
|
||||||
}
|
}
|
||||||
nsIntRect rect = mImages[mCurrentImage]->GetTileRect();
|
gfx::IntRect rect = mImages[mCurrentImage]->GetTileRect();
|
||||||
unsigned int xPos = (mCurrentImage % mColumns) * mTileSize;
|
unsigned int xPos = (mCurrentImage % mColumns) * mTileSize;
|
||||||
unsigned int yPos = (mCurrentImage / mColumns) * mTileSize;
|
unsigned int yPos = (mCurrentImage / mColumns) * mTileSize;
|
||||||
rect.MoveBy(xPos, yPos);
|
rect.MoveBy(xPos, yPos);
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRect TiledTextureImage::GetSrcTileRect()
|
gfx::IntRect TiledTextureImage::GetSrcTileRect()
|
||||||
{
|
{
|
||||||
nsIntRect rect = GetTileRect();
|
gfx::IntRect rect = GetTileRect();
|
||||||
unsigned int srcY = mFlags & NeedsYFlip
|
unsigned int srcY = mFlags & NeedsYFlip
|
||||||
? mSize.height - rect.height - rect.y
|
? mSize.height - rect.height - rect.y
|
||||||
: rect.y;
|
: rect.y;
|
||||||
return nsIntRect(rect.x, srcY, rect.width, rect.height);
|
return gfx::IntRect(rect.x, srcY, rect.width, rect.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -67,6 +67,13 @@ public:
|
|||||||
TextureImage::ContentType aContentType,
|
TextureImage::ContentType aContentType,
|
||||||
GLenum aWrapMode,
|
GLenum aWrapMode,
|
||||||
TextureImage::Flags aFlags = TextureImage::NoFlags);
|
TextureImage::Flags aFlags = TextureImage::NoFlags);
|
||||||
|
// Moz2D equivalent...
|
||||||
|
static already_AddRefed<TextureImage> Create(
|
||||||
|
GLContext* gl,
|
||||||
|
const gfx::IntSize& aSize,
|
||||||
|
TextureImage::ContentType aContentType,
|
||||||
|
GLenum aWrapMode,
|
||||||
|
TextureImage::Flags aFlags = TextureImage::NoFlags);
|
||||||
|
|
||||||
virtual ~TextureImage() {}
|
virtual ~TextureImage() {}
|
||||||
|
|
||||||
@@ -133,9 +140,7 @@ public:
|
|||||||
void* aCallbackData) {
|
void* aCallbackData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual nsIntRect GetTileRect() {
|
virtual gfx::IntRect GetTileRect();
|
||||||
return nsIntRect(nsIntPoint(0,0), mSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual GLuint GetTextureID() = 0;
|
virtual GLuint GetTextureID() = 0;
|
||||||
|
|
||||||
@@ -157,6 +162,8 @@ public:
|
|||||||
BeginUpdate(r);
|
BeginUpdate(r);
|
||||||
EndUpdate();
|
EndUpdate();
|
||||||
}
|
}
|
||||||
|
// Moz2D equivalent...
|
||||||
|
void Resize(const gfx::IntSize& aSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark this texture as having valid contents. Call this after modifying
|
* Mark this texture as having valid contents. Call this after modifying
|
||||||
@@ -229,7 +236,8 @@ public:
|
|||||||
virtual already_AddRefed<gfxASurface> GetBackingSurface()
|
virtual already_AddRefed<gfxASurface> GetBackingSurface()
|
||||||
{ return nullptr; }
|
{ return nullptr; }
|
||||||
|
|
||||||
const nsIntSize& GetSize() const { return mSize; }
|
|
||||||
|
gfx::IntSize GetSize() const;
|
||||||
ContentType GetContentType() const { return mContentType; }
|
ContentType GetContentType() const { return mContentType; }
|
||||||
ImageFormat GetImageFormat() const { return mImageFormat; }
|
ImageFormat GetImageFormat() const { return mImageFormat; }
|
||||||
virtual bool InUpdate() const = 0;
|
virtual bool InUpdate() const = 0;
|
||||||
@@ -264,9 +272,12 @@ protected:
|
|||||||
, mFlags(aFlags)
|
, mFlags(aFlags)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual nsIntRect GetSrcTileRect() {
|
// Moz2D equivalent...
|
||||||
return nsIntRect(nsIntPoint(0,0), mSize);
|
TextureImage(const gfx::IntSize& aSize,
|
||||||
}
|
GLenum aWrapMode, ContentType aContentType,
|
||||||
|
Flags aFlags = NoFlags);
|
||||||
|
|
||||||
|
virtual gfx::IntRect GetSrcTileRect();
|
||||||
|
|
||||||
nsIntSize mSize;
|
nsIntSize mSize;
|
||||||
GLenum mWrapMode;
|
GLenum mWrapMode;
|
||||||
@@ -306,6 +317,14 @@ public:
|
|||||||
, mUpdateOffset(0, 0)
|
, mUpdateOffset(0, 0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
BasicTextureImage(GLuint aTexture,
|
||||||
|
const gfx::IntSize& aSize,
|
||||||
|
GLenum aWrapMode,
|
||||||
|
ContentType aContentType,
|
||||||
|
GLContext* aContext,
|
||||||
|
TextureImage::Flags aFlags = TextureImage::NoFlags,
|
||||||
|
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown);
|
||||||
|
|
||||||
virtual void BindTexture(GLenum aTextureUnit);
|
virtual void BindTexture(GLenum aTextureUnit);
|
||||||
|
|
||||||
virtual gfxASurface* BeginUpdate(nsIntRegion& aRegion);
|
virtual gfxASurface* BeginUpdate(nsIntRegion& aRegion);
|
||||||
@@ -369,7 +388,7 @@ public:
|
|||||||
virtual bool NextTile();
|
virtual bool NextTile();
|
||||||
virtual void SetIterationCallback(TileIterationCallback aCallback,
|
virtual void SetIterationCallback(TileIterationCallback aCallback,
|
||||||
void* aCallbackData);
|
void* aCallbackData);
|
||||||
virtual nsIntRect GetTileRect();
|
virtual gfx::IntRect GetTileRect();
|
||||||
virtual GLuint GetTextureID() {
|
virtual GLuint GetTextureID() {
|
||||||
return mImages[mCurrentImage]->GetTextureID();
|
return mImages[mCurrentImage]->GetTextureID();
|
||||||
}
|
}
|
||||||
@@ -379,7 +398,7 @@ public:
|
|||||||
virtual void ApplyFilter();
|
virtual void ApplyFilter();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual nsIntRect GetSrcTileRect();
|
virtual gfx::IntRect GetSrcTileRect();
|
||||||
|
|
||||||
unsigned int mCurrentImage;
|
unsigned int mCurrentImage;
|
||||||
TileIterationCallback mIterationCallback;
|
TileIterationCallback mIterationCallback;
|
||||||
@@ -411,6 +430,13 @@ CreateBasicTextureImage(GLContext* aGL,
|
|||||||
TextureImage::Flags aFlags,
|
TextureImage::Flags aFlags,
|
||||||
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown);
|
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown);
|
||||||
|
|
||||||
|
already_AddRefed<TextureImage>
|
||||||
|
CreateBasicTextureImage(GLContext* aGL,
|
||||||
|
const gfx::IntSize& aSize,
|
||||||
|
TextureImage::ContentType aContentType,
|
||||||
|
GLenum aWrapMode,
|
||||||
|
TextureImage::Flags aFlags);
|
||||||
|
|
||||||
} // namespace gl
|
} // namespace gl
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
|||||||
@@ -178,10 +178,9 @@ TextureImageTextureSourceOGL::GetSize() const
|
|||||||
{
|
{
|
||||||
if (mTexImage) {
|
if (mTexImage) {
|
||||||
if (mIterating) {
|
if (mIterating) {
|
||||||
nsIntRect rect = mTexImage->GetTileRect();
|
return mTexImage->GetTileRect().Size();
|
||||||
return gfx::IntSize(rect.width, rect.height);
|
|
||||||
}
|
}
|
||||||
return gfx::IntSize(mTexImage->GetSize().width, mTexImage->GetSize().height);
|
return mTexImage->GetSize();
|
||||||
}
|
}
|
||||||
NS_WARNING("Trying to query the size of an empty TextureSource.");
|
NS_WARNING("Trying to query the size of an empty TextureSource.");
|
||||||
return gfx::IntSize(0, 0);
|
return gfx::IntSize(0, 0);
|
||||||
@@ -194,6 +193,11 @@ TextureImageTextureSourceOGL::GetFormat() const
|
|||||||
return mTexImage->GetTextureFormat();
|
return mTexImage->GetTextureFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsIntRect TextureImageTextureSourceOGL::GetTileRect()
|
||||||
|
{
|
||||||
|
return ThebesIntRect(mTexImage->GetTileRect());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TextureImageTextureSourceOGL::BindTexture(GLenum aTextureUnit)
|
TextureImageTextureSourceOGL::BindTexture(GLenum aTextureUnit)
|
||||||
{
|
{
|
||||||
@@ -358,14 +362,18 @@ TextureImageDeprecatedTextureHostOGL::GetSize() const
|
|||||||
{
|
{
|
||||||
if (mTexture) {
|
if (mTexture) {
|
||||||
if (mIterating) {
|
if (mIterating) {
|
||||||
nsIntRect rect = mTexture->GetTileRect();
|
return mTexture->GetTileRect().Size();
|
||||||
return gfx::IntSize(rect.width, rect.height);
|
|
||||||
}
|
}
|
||||||
return gfx::IntSize(mTexture->GetSize().width, mTexture->GetSize().height);
|
return mTexture->GetSize();
|
||||||
}
|
}
|
||||||
return gfx::IntSize(0, 0);
|
return gfx::IntSize(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsIntRect TextureImageDeprecatedTextureHostOGL::GetTileRect()
|
||||||
|
{
|
||||||
|
return ThebesIntRect(mTexture->GetTileRect());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TextureImageDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
TextureImageDeprecatedTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -157,10 +157,7 @@ public:
|
|||||||
mIterating = false;
|
mIterating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual nsIntRect GetTileRect() MOZ_OVERRIDE
|
virtual nsIntRect GetTileRect() MOZ_OVERRIDE;
|
||||||
{
|
|
||||||
return mTexImage->GetTileRect();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual size_t GetTileCount() MOZ_OVERRIDE
|
virtual size_t GetTileCount() MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
@@ -397,10 +394,7 @@ public:
|
|||||||
mIterating = false;
|
mIterating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRect GetTileRect() MOZ_OVERRIDE
|
nsIntRect GetTileRect() MOZ_OVERRIDE;
|
||||||
{
|
|
||||||
return mTexture->GetTileRect();
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t GetTileCount() MOZ_OVERRIDE
|
size_t GetTileCount() MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "ThebesLayerOGL.h"
|
#include "ThebesLayerOGL.h"
|
||||||
#include "gfxUtils.h"
|
#include "gfxUtils.h"
|
||||||
#include "gfxTeeSurface.h"
|
#include "gfxTeeSurface.h"
|
||||||
|
#include "gfx2DGlue.h"
|
||||||
#include "gfxPlatform.h"
|
#include "gfxPlatform.h"
|
||||||
|
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
@@ -91,7 +92,7 @@ public:
|
|||||||
|
|
||||||
nsIntSize GetSize() {
|
nsIntSize GetSize() {
|
||||||
if (mTexImage)
|
if (mTexImage)
|
||||||
return mTexImage->GetSize();
|
return ThebesIntSize(mTexImage->GetSize());
|
||||||
return nsIntSize(0, 0);
|
return nsIntSize(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +205,7 @@ ThebesLayerBufferOGL::RenderTo(const nsIntPoint& aOffset,
|
|||||||
region.MoveBy(-origin); // translate into TexImage space, buffer origin might not be at texture (0,0)
|
region.MoveBy(-origin); // translate into TexImage space, buffer origin might not be at texture (0,0)
|
||||||
|
|
||||||
// Figure out the intersecting draw region
|
// Figure out the intersecting draw region
|
||||||
nsIntSize texSize = mTexImage->GetSize();
|
nsIntSize texSize = ThebesIntSize(mTexImage->GetSize());
|
||||||
nsIntRect textureRect = nsIntRect(0, 0, texSize.width, texSize.height);
|
nsIntRect textureRect = nsIntRect(0, 0, texSize.width, texSize.height);
|
||||||
textureRect.MoveBy(region.GetBounds().TopLeft());
|
textureRect.MoveBy(region.GetBounds().TopLeft());
|
||||||
nsIntRegion subregion;
|
nsIntRegion subregion;
|
||||||
@@ -236,10 +237,10 @@ ThebesLayerBufferOGL::RenderTo(const nsIntPoint& aOffset,
|
|||||||
bool usingTiles = (mTexImage->GetTileCount() > 1);
|
bool usingTiles = (mTexImage->GetTileCount() > 1);
|
||||||
do {
|
do {
|
||||||
if (mTexImageOnWhite) {
|
if (mTexImageOnWhite) {
|
||||||
NS_ASSERTION(mTexImageOnWhite->GetTileRect() == mTexImage->GetTileRect(), "component alpha textures should be the same size.");
|
NS_ASSERTION(ThebesIntRect(mTexImageOnWhite->GetTileRect()) == ThebesIntRect(mTexImage->GetTileRect()), "component alpha textures should be the same size.");
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRect tileRect = mTexImage->GetTileRect();
|
nsIntRect tileRect = ThebesIntRect(mTexImage->GetTileRect());
|
||||||
|
|
||||||
// Bind textures.
|
// Bind textures.
|
||||||
TextureImage::ScopedBindTexture texBind(mTexImage, LOCAL_GL_TEXTURE0);
|
TextureImage::ScopedBindTexture texBind(mTexImage, LOCAL_GL_TEXTURE0);
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ inline Rect ToRect(const gfxRect &aRect)
|
|||||||
Float(aRect.width), Float(aRect.height));
|
Float(aRect.width), Float(aRect.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline IntRect ToIntRect(const nsIntRect &aRect)
|
||||||
|
{
|
||||||
|
return IntRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||||
|
}
|
||||||
|
|
||||||
inline Color ToColor(const gfxRGBA &aRGBA)
|
inline Color ToColor(const gfxRGBA &aRGBA)
|
||||||
{
|
{
|
||||||
return Color(Float(aRGBA.r), Float(aRGBA.g),
|
return Color(Float(aRGBA.r), Float(aRGBA.g),
|
||||||
@@ -123,6 +128,11 @@ inline gfxRect ThebesRect(const Rect &aRect)
|
|||||||
return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline nsIntRect ThebesIntRect(const IntRect &aRect)
|
||||||
|
{
|
||||||
|
return nsIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||||
|
}
|
||||||
|
|
||||||
inline gfxRGBA ThebesRGBA(const Color &aColor)
|
inline gfxRGBA ThebesRGBA(const Color &aColor)
|
||||||
{
|
{
|
||||||
return gfxRGBA(aColor.r, aColor.g, aColor.b, aColor.a);
|
return gfxRGBA(aColor.r, aColor.g, aColor.b, aColor.a);
|
||||||
|
|||||||
Reference in New Issue
Block a user