Bug 1035330 - Optimize rects in the gfxContext methods for getting extents to fix tsvgr_opacity regressions. r=Bas
authorJonathan Watt <jwatt@jwatt.org>
Thu, 10 Jul 2014 08:44:17 +0100
changeset 193262 ba55afbced84f67f912e1cae551299dda8d01d6d
parent 193261 8abc07984f2f83dfec9d3c441ed7410e48aea431
child 193263 0519b4b09abb7f5c316e22d5f9669d0ca324fabe
push id27112
push usercbook@mozilla.com
push dateThu, 10 Jul 2014 12:47:23 +0000
treeherdermozilla-central@6e9f72bdd32e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs1035330
milestone33.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 1035330 - Optimize rects in the gfxContext methods for getting extents to fix tsvgr_opacity regressions. r=Bas
gfx/thebes/gfxContext.cpp
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -1764,42 +1764,53 @@ gfxContext::PointInStroke(const gfxPoint
 gfxRect
 gfxContext::GetUserPathExtent()
 {
   if (mCairo) {
     double xmin, ymin, xmax, ymax;
     cairo_path_extents(mCairo, &xmin, &ymin, &xmax, &ymax);
     return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);
   } else {
+    if (mPathIsRect) {
+      return ThebesRect(mTransform.TransformBounds(mRect));
+    }
     EnsurePath();
     return ThebesRect(mPath->GetBounds());
   }
 }
 
 gfxRect
 gfxContext::GetUserFillExtent()
 {
   if (mCairo) {
     double xmin, ymin, xmax, ymax;
     cairo_fill_extents(mCairo, &xmin, &ymin, &xmax, &ymax);
     return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);
   } else {
+    if (mPathIsRect) {
+      return ThebesRect(mTransform.TransformBounds(mRect));
+    }
     EnsurePath();
     return ThebesRect(mPath->GetBounds());
   }
 }
 
 gfxRect
 gfxContext::GetUserStrokeExtent()
 {
   if (mCairo) {
     double xmin, ymin, xmax, ymax;
     cairo_stroke_extents(mCairo, &xmin, &ymin, &xmax, &ymax);
     return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);
   } else {
+    if (mPathIsRect) {
+      Rect rect = mRect;
+      rect.Inflate(CurrentState().strokeOptions.mLineWidth / 2);
+      return ThebesRect(mTransform.TransformBounds(rect));
+    }
     EnsurePath();
     return ThebesRect(mPath->GetStrokedBounds(CurrentState().strokeOptions, mTransform));
   }
 }
 
 bool
 gfxContext::HasError()
 {