Bug 477708 - backout previous numRects, getRect attempt r=vlad
authorTaras Glek <tglek@mozilla.com>
Wed, 18 Mar 2009 09:53:14 -0700
changeset 26311 89d1fb16456b85631e8ab907a6d7583ec0ee7896
parent 26310 8fc57e8196a5b40f614490a806486ba38490bea1
child 26312 9d34172f942f8bb2732458e822e622d85cc208b6
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvlad
bugs477708
milestone1.9.2a1pre
Bug 477708 - backout previous numRects, getRect attempt r=vlad
gfx/idl/nsIScriptableRegion.idl
gfx/src/nsScriptableRegion.cpp
gfx/src/nsScriptableRegion.h
--- a/gfx/idl/nsIScriptableRegion.idl
+++ b/gfx/idl/nsIScriptableRegion.idl
@@ -41,17 +41,17 @@
 
 %{C++
 class nsIRegion;
 %}
 
 [ptr] native nsIRegion(nsIRegion);
 
 
-[scriptable, uuid(dbd0e356-09f5-40b1-99a7-5629c1a45f06)]
+[scriptable, uuid(82d8f400-5bde-11d3-b033-b27a62766bbc)]
 interface nsIScriptableRegion : nsISupports
 {
   void init ( ) ;
 
   /**
   * copy operator equivalent that takes another region
   *
   * @param      region to copy
@@ -191,34 +191,16 @@ interface nsIScriptableRegion : nsISuppo
   * does the region intersect the rectangle?
   *
   * @param      rect to check for containment
   * @return     true if the region intersects the rect
   *
   **/
 
   boolean containsRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ;
-
-  /**
-  * returns a rectangle within the region
-  *
-  * @param      aIndex index of the rect to retrieve
-  * @param      aX out parameter for xoffset of bounding rect for region
-  * @param      aY out parameter for yoffset of bounding rect for region
-  * @param      aWidth out parameter for width of bounding rect for region
-  * @param      aHeight out parameter for height of bounding rect for region
-  * @return     void
-  *
-  **/
-  void getRect ( in unsigned long aIndex, out long aX, out long aY, out long aWidth, out long aHeight ) ;
-
-  /**
-   * The number of rectangles that can be retrieved via getRect
-   */
-  readonly attribute unsigned long numRects;
   
   [noscript] readonly attribute nsIRegion region;
   
 };
 
 
 %{ C++
 
--- a/gfx/src/nsScriptableRegion.cpp
+++ b/gfx/src/nsScriptableRegion.cpp
@@ -33,30 +33,28 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsScriptableRegion.h"
+#include "nsIRegion.h"
 #include "nsCOMPtr.h"
 
-nsScriptableRegion::nsScriptableRegion(nsIRegion* region) : mRegion(nsnull), mRectSet(nsnull)
+nsScriptableRegion::nsScriptableRegion(nsIRegion* region) : mRegion(nsnull)
 {
 	mRegion = region;
 	NS_IF_ADDREF(mRegion);
 }
 
 nsScriptableRegion::~nsScriptableRegion()
 {
-  if (mRegion) {
-    mRegion->FreeRects(mRectSet);
-    NS_RELEASE(mRegion);
-  }
+	NS_IF_RELEASE(mRegion);
 }
 
 NS_IMPL_ISUPPORTS1(nsScriptableRegion, nsIScriptableRegion)
 
 NS_IMETHODIMP nsScriptableRegion::Init()
 {
 	return mRegion->Init();
 }
@@ -146,25 +144,8 @@ NS_IMETHODIMP nsScriptableRegion::Contai
 
 
 NS_IMETHODIMP nsScriptableRegion::GetRegion(nsIRegion** outRgn)
 {
   *outRgn = mRegion;
   NS_IF_ADDREF(*outRgn);
   return NS_OK;
 }
-
-NS_IMETHODIMP nsScriptableRegion::GetRect(PRUint32 aIndex, PRInt32 *aX, PRInt32 *aY, PRInt32 *aWidth, PRInt32 *aHeight) {
-  // nsIRegion reuses the GetRects parameter between calls
-  nsresult rv = mRegion->GetRects(&mRectSet);
-  NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_TRUE(aIndex < mRectSet->mNumRects, NS_ERROR_INVALID_ARG);
-  nsRegionRect &rect = mRectSet->mRects[aIndex];
-  *aX = rect.x;
-  *aY = rect.y;
-  *aWidth = rect.width;
-  *aHeight = rect.height;
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsScriptableRegion::GetNumRects(PRUint32 *aLength) {
-  return mRegion->GetNumRects(aLength);
-}
--- a/gfx/src/nsScriptableRegion.h
+++ b/gfx/src/nsScriptableRegion.h
@@ -34,28 +34,26 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsIScriptableRegion.h"
 #include "gfxCore.h"
-#include "nsIRegion.h"
 
 class nsIRegion;
 
 /**
  * An adapter class for the unscriptable nsIRegion interface.
  */
 class NS_GFX nsScriptableRegion : public nsIScriptableRegion {
 public:
 	nsScriptableRegion(nsIRegion* region);
 	virtual ~nsScriptableRegion();
 	
 	NS_DECL_ISUPPORTS
 
 	NS_DECL_NSISCRIPTABLEREGION
 
 private:
-  nsIRegion* mRegion;
-  nsRegionRectSet *mRectSet;
+	nsIRegion* mRegion;
 };