Bug 929513 Part 7: Convert CreateBasicTextureImage to Moz2D r=nical
authorDavid Zbarsky <dzbarsky@gmail.com>
Sun, 27 Oct 2013 17:53:28 -0400
changeset 152777 0f15e95da259a3e8bbc515e7d8024ed696d67269
parent 152776 381baaf48bd26ba8df7887fd2f8c11aba664c400
child 152778 491ba58e1d90a7f46b74c4b92993b097a551dc6c
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersnical
bugs929513
milestone27.0a1
Bug 929513 Part 7: Convert CreateBasicTextureImage to Moz2D r=nical
gfx/gl/GLTextureImage.cpp
gfx/gl/GLTextureImage.h
gfx/layers/opengl/TextureHostOGL.cpp
gfx/thebes/gfxImageSurface.cpp
gfx/thebes/gfxImageSurface.h
--- a/gfx/gl/GLTextureImage.cpp
+++ b/gfx/gl/GLTextureImage.cpp
@@ -272,22 +272,23 @@ BasicTextureImage::BasicTextureImage(GLu
   , mTexture(aTexture)
   , mTextureState(Created)
   , mGLContext(aContext)
   , mUpdateOffset(0, 0)
 {}
 
 already_AddRefed<TextureImage>
 CreateBasicTextureImage(GLContext* aGL,
-                        const gfx::IntSize& aSize,
+                        const LayerIntSize& aSize,
                         TextureImage::ContentType aContentType,
                         GLenum aWrapMode,
                         TextureImage::Flags aFlags)
 {
-  return CreateBasicTextureImage(aGL, ThebesIntSize(aSize), aContentType, aWrapMode, aFlags);
+  return CreateBasicTextureImage(aGL, ThebesIntSize(aSize.ToUnknownSize()),
+                                 aContentType, aWrapMode, aFlags);
 }
 
 TiledTextureImage::TiledTextureImage(GLContext* aGL,
                                      nsIntSize aSize,
                                      TextureImage::ContentType aContentType,
                                      TextureImage::Flags aFlags,
                                      TextureImage::ImageFormat aImageFormat)
     : TextureImage(aSize, LOCAL_GL_CLAMP_TO_EDGE, aContentType, aFlags)
--- a/gfx/gl/GLTextureImage.h
+++ b/gfx/gl/GLTextureImage.h
@@ -8,16 +8,17 @@
 
 #include "nsAutoPtr.h"
 #include "nsRegion.h"
 #include "nsTArray.h"
 #include "gfxTypes.h"
 #include "GLContextTypes.h"
 #include "GraphicsFilter.h"
 #include "mozilla/gfx/Rect.h"
+#include "Units.h"
 
 class gfxASurface;
 
 namespace mozilla {
 namespace gfx {
 class DataSourceSurface;
 }
 }
@@ -422,17 +423,17 @@ CreateBasicTextureImage(GLContext* aGL,
                         const nsIntSize& aSize,
                         TextureImage::ContentType aContentType,
                         GLenum aWrapMode,
                         TextureImage::Flags aFlags,
                         TextureImage::ImageFormat aImageFormat = gfxImageFormatUnknown);
 
 already_AddRefed<TextureImage>
 CreateBasicTextureImage(GLContext* aGL,
-                        const gfx::IntSize& aSize,
+                        const LayerIntSize& aSize,
                         TextureImage::ContentType aContentType,
                         GLenum aWrapMode,
                         TextureImage::Flags aFlags);
 
 } // namespace gl
 } // namespace mozilla
 
 #endif /* GLTEXTUREIMAGE_H_ */
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -841,34 +841,34 @@ YCbCrDeprecatedTextureHostOGL::UpdateImp
 {
   if (!mGL) {
     return;
   }
   NS_ASSERTION(aImage.type() == SurfaceDescriptor::TYCbCrImage, "SurfaceDescriptor mismatch");
 
   YCbCrImageDataDeserializer deserializer(aImage.get_YCbCrImage().data().get<uint8_t>());
 
-  gfxIntSize gfxSize = ThebesIntSize(deserializer.GetYSize().ToUnknownSize());
-  gfxIntSize gfxCbCrSize = ThebesIntSize(deserializer.GetCbCrSize().ToUnknownSize());
+  LayerIntSize gfxSize = deserializer.GetYSize();
+  LayerIntSize gfxCbCrSize = deserializer.GetCbCrSize();
 
-  if (!mYTexture->mTexImage || mYTexture->mTexImage->GetSize() != gfxSize) {
+  if (!mYTexture->mTexImage || mYTexture->mTexImage->GetSize() != gfxSize.ToUnknownSize()) {
     mYTexture->mTexImage = CreateBasicTextureImage(mGL,
                                                    gfxSize,
                                                    GFX_CONTENT_ALPHA,
                                                    WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
                                                    FlagsToGLFlags(mFlags));
   }
-  if (!mCbTexture->mTexImage || mCbTexture->mTexImage->GetSize() != gfxCbCrSize) {
+  if (!mCbTexture->mTexImage || mCbTexture->mTexImage->GetSize() != gfxCbCrSize.ToUnknownSize()) {
     mCbTexture->mTexImage = CreateBasicTextureImage(mGL,
                                                     gfxCbCrSize,
                                                     GFX_CONTENT_ALPHA,
                                                     WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
                                                     FlagsToGLFlags(mFlags));
   }
-  if (!mCrTexture->mTexImage || mCrTexture->mTexImage->GetSize() != gfxCbCrSize) {
+  if (!mCrTexture->mTexImage || mCrTexture->mTexImage->GetSize() != gfxCbCrSize.ToUnknownSize()) {
     mCrTexture->mTexImage = CreateBasicTextureImage(mGL,
                                                     gfxCbCrSize,
                                                     GFX_CONTENT_ALPHA,
                                                     WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
                                                     FlagsToGLFlags(mFlags));
   }
 
   RefPtr<gfxImageSurface> tempY = new gfxImageSurface(deserializer.GetYData(),
--- a/gfx/thebes/gfxImageSurface.cpp
+++ b/gfx/thebes/gfxImageSurface.cpp
@@ -39,16 +39,22 @@ gfxImageSurface::InitFromSurface(cairo_s
 }
 
 gfxImageSurface::gfxImageSurface(unsigned char *aData, const gfxIntSize& aSize,
                                  long aStride, gfxImageFormat aFormat)
 {
     InitWithData(aData, aSize, aStride, aFormat);
 }
 
+gfxImageSurface::gfxImageSurface(unsigned char *aData, const mozilla::LayerIntSize& aSize,
+                                 long aStride, gfxImageFormat aFormat)
+{
+    InitWithData(aData, gfxIntSize(aSize.width, aSize.height), aStride, aFormat);
+}
+
 void
 gfxImageSurface::MakeInvalid()
 {
     mSize = gfxIntSize(-1, -1);
     mData = nullptr;
     mStride = 0;
 }
 
--- a/gfx/thebes/gfxImageSurface.h
+++ b/gfx/thebes/gfxImageSurface.h
@@ -5,16 +5,17 @@
 
 #ifndef GFX_IMAGESURFACE_H
 #define GFX_IMAGESURFACE_H
 
 #include "mozilla/MemoryReporting.h"
 #include "gfxASurface.h"
 #include "nsAutoPtr.h"
 #include "nsSize.h"
+#include "Units.h"
 
 // ARGB -- raw buffer.. wont be changed.. good for storing data.
 
 class gfxSubimageSurface;
 
 namespace mozilla {
 namespace gfx {
 class SourceSurface;
@@ -34,16 +35,18 @@ public:
      * @param aSize The size of the buffer
      * @param aStride The stride of the buffer
      * @param format Format of the data
      *
      * @see gfxImageFormat
      */
     gfxImageSurface(unsigned char *aData, const gfxIntSize& aSize,
                     long aStride, gfxImageFormat aFormat);
+    gfxImageSurface(unsigned char *aData, const mozilla::LayerIntSize& aSize,
+                    long aStride, gfxImageFormat aFormat);
 
     /**
      * Construct an image surface.
      * @param aSize The size of the buffer
      * @param format Format of the data
      *
      * @see gfxImageFormat
      */