Bug 1092555 - Replace some occurences of gfxIntSize by gfx::IntSize in CanvasRenderingContext2D. r=nical"
authorDel Valle <ahinki@yahoo.fr>
Tue, 04 Nov 2014 14:00:36 +0100
changeset 213920 1dd40ce6fc5a3774ecf69536b9b240135ffd6f2f
parent 213919 6066f395207ab227495e47504ef67d5ec97a39d2
child 213921 e3a2c467103bc84efca6a5331d910416705f2461
push id27768
push userkwierso@gmail.com
push dateWed, 05 Nov 2014 02:19:03 +0000
treeherdermozilla-central@a1823d3c7365 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1092555
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1092555 - Replace some occurences of gfxIntSize by gfx::IntSize in CanvasRenderingContext2D. r=nical"
dom/canvas/CanvasImageCache.cpp
dom/canvas/CanvasImageCache.h
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/CanvasRenderingContext2D.h
--- a/dom/canvas/CanvasImageCache.cpp
+++ b/dom/canvas/CanvasImageCache.cpp
@@ -8,16 +8,17 @@
 #include "nsExpirationTracker.h"
 #include "imgIRequest.h"
 #include "mozilla/dom/Element.h"
 #include "nsTHashtable.h"
 #include "mozilla/dom/HTMLCanvasElement.h"
 #include "nsContentUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/gfx/2D.h"
+#include "gfx2DGlue.h"
 
 namespace mozilla {
 
 using namespace dom;
 using namespace gfx;
 
 struct ImageCacheKey {
   ImageCacheKey(Element* aImage, HTMLCanvasElement* aCanvas)
@@ -276,33 +277,33 @@ CanvasImageCache::NotifyDrawImage(Elemen
   // Expire the image cache early if its larger than we want it to be.
   while (gImageCache->mTotal > size_t(sCanvasImageCacheLimit))
     gImageCache->AgeOneGeneration();
 }
 
 SourceSurface*
 CanvasImageCache::Lookup(Element* aImage,
                          HTMLCanvasElement* aCanvas,
-                         gfxIntSize* aSize)
+                         gfx::IntSize* aSize)
 {
   if (!gImageCache)
     return nullptr;
 
   ImageCacheEntry* entry = gImageCache->mCache.GetEntry(ImageCacheKey(aImage, aCanvas));
   if (!entry || !entry->mData->mILC)
     return nullptr;
 
   nsCOMPtr<imgIRequest> request;
   entry->mData->mILC->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST, getter_AddRefs(request));
   if (request != entry->mData->mRequest)
     return nullptr;
 
   gImageCache->MarkUsed(entry->mData);
 
-  *aSize = entry->mData->mSize;
+  *aSize = gfx::ToIntSize(entry->mData->mSize);
   return entry->mData->mSourceSurface;
 }
 
 SourceSurface*
 CanvasImageCache::SimpleLookup(Element* aImage)
 {
   if (!gImageCache)
     return nullptr;
--- a/dom/canvas/CanvasImageCache.h
+++ b/dom/canvas/CanvasImageCache.h
@@ -38,17 +38,17 @@ public:
   /**
    * Check whether aImage has recently been drawn into aCanvas. If we return
    * a non-null surface, then the image was recently drawn into the canvas
    * (with the same image request) and the returned surface contains the image
    * data, and the image size will be returned in aSize.
    */
   static SourceSurface* Lookup(dom::Element* aImage,
                                dom::HTMLCanvasElement* aCanvas,
-                               gfxIntSize* aSize);
+                               gfx::IntSize* aSize);
 
   /**
    * This is the same as Lookup, except it works on any image recently drawn
    * into any canvas. Security checks need to be done again if using the
    * results from this.
    */
   static SourceSurface* SimpleLookup(dom::Element* aImage);
 };
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -3952,17 +3952,17 @@ CanvasRenderingContext2D::DrawImage(cons
                                     double sh, double dx, double dy,
                                     double dw, double dh,
                                     uint8_t optional_argc,
                                     ErrorResult& error)
 {
   MOZ_ASSERT(optional_argc == 0 || optional_argc == 2 || optional_argc == 6);
 
   RefPtr<SourceSurface> srcSurf;
-  gfxIntSize imgSize;
+  gfx::IntSize imgSize;
 
   Element* element;
 
   EnsureTarget();
   if (image.IsHTMLCanvasElement()) {
     HTMLCanvasElement* canvas = &image.GetAsHTMLCanvasElement();
     element = canvas;
     nsIntSize size = canvas->GetSize();
@@ -4003,17 +4003,17 @@ CanvasRenderingContext2D::DrawImage(cons
     if (!res.mSourceSurface && !res.mDrawInfo.mImgContainer) {
       // Spec says to silently do nothing if the element is still loading.
       if (!res.mIsStillLoading) {
         error.Throw(NS_ERROR_NOT_AVAILABLE);
       }
       return;
     }
 
-    imgSize = res.mSize;
+    imgSize = gfx::ToIntSize(res.mSize);
 
     // Scale sw/sh based on aspect ratio
     if (image.IsHTMLVideoElement()) {
       HTMLVideoElement* video = &image.GetAsHTMLVideoElement();
       int32_t displayWidth = video->VideoWidth();
       int32_t displayHeight = video->VideoHeight();
       sw *= (double)imgSize.width / (double)displayWidth;
       sh *= (double)imgSize.height / (double)displayHeight;
@@ -4023,17 +4023,17 @@ CanvasRenderingContext2D::DrawImage(cons
       CanvasUtils::DoDrawImageSecurityCheck(mCanvasElement,
                                             res.mPrincipal, res.mIsWriteOnly,
                                             res.mCORSUsed);
     }
 
     if (res.mSourceSurface) {
       if (res.mImageRequest) {
         CanvasImageCache::NotifyDrawImage(element, mCanvasElement, res.mImageRequest,
-                                          res.mSourceSurface, imgSize);
+                                          res.mSourceSurface, ThebesIntSize(imgSize));
       }
 
       srcSurf = res.mSourceSurface;
     } else {
       drawInfo = res.mDrawInfo;
     }
   }
 
@@ -4108,17 +4108,17 @@ CanvasRenderingContext2D::DrawImage(cons
 }
 
 void
 CanvasRenderingContext2D::DrawDirectlyToCanvas(
                           const nsLayoutUtils::DirectDrawInfo& image,
                           mgfx::Rect* bounds,
                           mgfx::Rect dest,
                           mgfx::Rect src,
-                          gfxIntSize imgSize)
+                          gfx::IntSize imgSize)
 {
   MOZ_ASSERT(src.width > 0 && src.height > 0,
              "Need positive source width and height");
 
   gfxMatrix contextMatrix;
   AdjustedTarget tempTarget(this, bounds->IsEmpty() ? nullptr: bounds);
 
   // Get any existing transforms on the context, including transformations used
--- a/dom/canvas/CanvasRenderingContext2D.h
+++ b/dom/canvas/CanvasRenderingContext2D.h
@@ -721,17 +721,17 @@ protected:
                  double sx, double sy, double sw, double sh,
                  double dx, double dy, double dw, double dh,
                  uint8_t optional_argc, mozilla::ErrorResult& error);
 
   void DrawDirectlyToCanvas(const nsLayoutUtils::DirectDrawInfo& image,
                             mozilla::gfx::Rect* bounds,
                             mozilla::gfx::Rect dest,
                             mozilla::gfx::Rect src,
-                            gfxIntSize imgSize);
+                            gfx::IntSize imgSize);
 
   nsString& GetFont()
   {
     /* will initilize the value if not set, else does nothing */
     GetCurrentFontStyle();
 
     return CurrentState().font;
   }