Bug 808305 - Pass a gfx::Rect instead of a gfxRect in InvalidateCanvasContent; r=Bas
authorMs2ger <ms2ger@gmail.com>
Sun, 04 Nov 2012 09:05:25 +0100
changeset 112277 5c6b71348e20c46089baa600a1b508d0326bdacd
parent 112276 cac8275e885b7fddee60e0545f4d34cbc52aefda
child 112278 ab099c9e1a096183c64324116428b3c472509b13
push id17494
push usereakhgari@mozilla.com
push dateSun, 04 Nov 2012 16:11:17 +0000
treeherdermozilla-inbound@a370aa5720c4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs808305
milestone19.0a1
first release with
nightly linux32
5c6b71348e20 / 19.0a1 / 20121104030714 / files
nightly linux64
5c6b71348e20 / 19.0a1 / 20121104030714 / files
nightly mac
5c6b71348e20 / 19.0a1 / 20121104030714 / files
nightly win32
5c6b71348e20 / 19.0a1 / 20121104030714 / files
nightly win64
5c6b71348e20 / 19.0a1 / 20121104030714 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 808305 - Pass a gfx::Rect instead of a gfxRect in InvalidateCanvasContent; r=Bas
content/canvas/src/CanvasRenderingContext2D.cpp
content/html/content/public/nsHTMLCanvasElement.h
content/html/content/src/nsHTMLCanvasElement.cpp
--- a/content/canvas/src/CanvasRenderingContext2D.cpp
+++ b/content/canvas/src/CanvasRenderingContext2D.cpp
@@ -787,20 +787,17 @@ CanvasRenderingContext2D::Redraw(const m
 
   if (!mThebesSurface)
     mThebesSurface =
       gfxPlatform::GetPlatform()->GetThebesSurfaceForDrawTarget(mTarget);
   mThebesSurface->MarkDirty();
 
   nsSVGEffects::InvalidateDirectRenderingObservers(mCanvasElement);
 
-  gfxRect tmpR = ThebesRect(r);
-  mCanvasElement->InvalidateCanvasContent(&tmpR);
-
-  return;
+  mCanvasElement->InvalidateCanvasContent(&r);
 }
 
 void
 CanvasRenderingContext2D::RedrawUser(const gfxRect& r)
 {
   if (mIsEntireFrameInvalid) {
     ++mInvalidateCount;
     return;
--- a/content/html/content/public/nsHTMLCanvasElement.h
+++ b/content/html/content/public/nsHTMLCanvasElement.h
@@ -18,20 +18,26 @@
 
 class nsICanvasRenderingContextInternal;
 class nsIDOMFile;
 class nsHTMLCanvasPrintState;
 class nsITimerCallback;
 class nsIPropertyBag;
 
 namespace mozilla {
+
 namespace layers {
 class CanvasLayer;
 class LayerManager;
 }
+
+namespace gfx {
+struct Rect;
+}
+
 }
 
 class nsHTMLCanvasElement : public nsGenericHTMLElement,
                             public nsICanvasElementExternal,
                             public nsIDOMHTMLCanvasElement
 {
   typedef mozilla::layers::CanvasLayer CanvasLayer;
   typedef mozilla::layers::LayerManager LayerManager;
@@ -80,17 +86,17 @@ public:
    * Force the canvas to be write-only.
    */
   void SetWriteOnly();
 
   /**
    * Notify that some canvas content has changed and the window may
    * need to be updated. aDamageRect is in canvas coordinates.
    */
-  void InvalidateCanvasContent(const gfxRect* aDamageRect);
+  void InvalidateCanvasContent(const mozilla::gfx::Rect* aDamageRect);
   /*
    * Notify that we need to repaint the entire canvas, including updating of
    * the layer tree.
    */
   void InvalidateCanvas();
 
   /*
    * Get the number of contexts in this canvas, and request a context at
--- a/content/html/content/src/nsHTMLCanvasElement.cpp
+++ b/content/html/content/src/nsHTMLCanvasElement.cpp
@@ -3,31 +3,32 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsHTMLCanvasElement.h"
 #include "nsAttrValueInlines.h"
 
 #include "mozilla/Base64.h"
 #include "mozilla/CheckedInt.h"
+#include "mozilla/gfx/Rect.h"
+#include "mozilla/Preferences.h"
+#include "mozilla/Telemetry.h"
 #include "nsNetUtil.h"
 #include "nsDOMFile.h"
 
 #include "nsICanvasRenderingContextInternal.h"
 #include "nsIDOMCanvasRenderingContext2D.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIXPConnect.h"
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "nsContentUtils.h"
 #include "nsJSUtils.h"
 #include "nsMathUtils.h"
 #include "nsStreamUtils.h"
-#include "mozilla/Preferences.h"
-#include "mozilla/Telemetry.h"
 
 #include "nsFrameManager.h"
 #include "nsDisplayList.h"
 #include "BasicLayers.h"
 #include "imgIEncoder.h"
 #include "nsITimer.h"
 #include "nsAsyncDOMEvent.h"
 
@@ -884,35 +885,35 @@ nsHTMLCanvasElement::IsWriteOnly()
 
 void
 nsHTMLCanvasElement::SetWriteOnly()
 {
   mWriteOnly = true;
 }
 
 void
-nsHTMLCanvasElement::InvalidateCanvasContent(const gfxRect* damageRect)
+nsHTMLCanvasElement::InvalidateCanvasContent(const gfx::Rect* damageRect)
 {
   // We don't need to flush anything here; if there's no frame or if
   // we plan to reframe we don't need to invalidate it anyway.
   nsIFrame *frame = GetPrimaryFrame();
   if (!frame)
     return;
 
   frame->MarkLayersActive(nsChangeHint(0));
 
   Layer* layer = nullptr;
   if (damageRect) {
     nsIntSize size = GetWidthHeight();
     if (size.width != 0 && size.height != 0) {
 
-      gfxRect realRect(*damageRect);
+      gfx::Rect realRect(*damageRect);
       realRect.RoundOut();
 
-      // then make it a nsRect
+      // then make it a nsIntRect
       nsIntRect invalRect(realRect.X(), realRect.Y(),
                           realRect.Width(), realRect.Height());
 
       layer = frame->InvalidateLayer(nsDisplayItem::TYPE_CANVAS, &invalRect);
     }
   } else {
     layer = frame->InvalidateLayer(nsDisplayItem::TYPE_CANVAS);
   }