author | Lee Salzman <lsalzman@mozilla.com> |
Fri, 01 May 2015 08:57:24 -0400 | |
changeset 243631 | e9ce69afe62406c61bb43df314ab0f26caca321f |
parent 243630 | 0c35d4c15798c1c64abb288b1c41e49aa504e789 |
child 243632 | d495587bc0d2df281746ccb3fb0f9ce9b56d64fd |
push id | 28744 |
push user | kwierso@gmail.com |
push date | Wed, 13 May 2015 18:12:16 +0000 |
treeherder | mozilla-central@324c3423deaf [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jrmuizel |
bugs | 1159273 |
milestone | 41.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
|
--- a/gfx/thebes/gfxFontTest.h +++ b/gfx/thebes/gfxFontTest.h @@ -4,17 +4,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef GFX_FONT_TEST_H #define GFX_FONT_TEST_H #include "nsString.h" #include "nsTArray.h" -#include "cairo/cairo.h" +#include "cairo.h" struct gfxFontTestItem { gfxFontTestItem(const nsCString& fontName, cairo_glyph_t *cglyphs, int nglyphs) : platformFont(fontName) { glyphs = new cairo_glyph_t[nglyphs]; memcpy (glyphs, cglyphs, sizeof(cairo_glyph_t) * nglyphs);
--- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -97,32 +97,27 @@ using namespace mozilla::widget; #include <wchar.h> #include "imgIContainer.h" #include "nsGfxCIID.h" #include "nsImageToPixbuf.h" #include "nsIInterfaceRequestorUtils.h" #include "nsAutoPtr.h" #include "ClientLayerManager.h" -extern "C" { -#define PIXMAN_DONT_DEFINE_STDINT -#include "pixman.h" -} #include "gfxPlatformGtk.h" #include "gfxContext.h" #include "gfxImageSurface.h" #include "gfxUtils.h" #include "Layers.h" #include "GLContextProvider.h" #include "mozilla/gfx/2D.h" #include "mozilla/layers/CompositorParent.h" #ifdef MOZ_X11 #include "gfxXlibSurface.h" -#include "cairo-xlib.h" #endif #include "nsShmImage.h" #include "nsIDOMWheelEvent.h" #include "NativeKeyBindings.h" #include "nsWindow.h" @@ -290,35 +285,16 @@ typedef struct _GdkDisplay GdkDisplay; static GdkCursor *gCursorCache[eCursorCount]; static GtkWidget *gInvisibleContainer = nullptr; // Sometimes this actually also includes the state of the modifier keys, but // only the button state bits are used. static guint gButtonState; -// nsAutoRef<pixman_region32> uses nsSimpleRef<> to know how to automatically -// destroy regions. -template <> -class nsSimpleRef<pixman_region32> : public pixman_region32 { -protected: - typedef pixman_region32 RawRef; - - nsSimpleRef() { data = nullptr; } - explicit nsSimpleRef(const RawRef &aRawRef) : pixman_region32(aRawRef) { } - - static void Release(pixman_region32& region) { - pixman_region32_fini(®ion); - } - // Whether this needs to be released: - bool HaveResource() const { return data != nullptr; } - - pixman_region32& get() { return *this; } -}; - static inline int32_t GetBitmapStride(int32_t width) { #if defined(MOZ_X11) || (MOZ_WIDGET_GTK == 2) return (width+7)/8; #else return cairo_format_stride_for_width(CAIRO_FORMAT_A1, width); #endif @@ -4164,94 +4140,40 @@ nsWindow::ConfigureChildren(const nsTArr } else if (w->mBounds.TopLeft() != configuration.mBounds.TopLeft()) { w->Move(configuration.mBounds.x, configuration.mBounds.y); } w->SetWindowClipRegion(configuration.mClipRegion, false); } return NS_OK; } -static pixman_box32 -ToPixmanBox(const nsIntRect& aRect) -{ - pixman_box32_t result; - result.x1 = aRect.x; - result.y1 = aRect.y; - result.x2 = aRect.XMost(); - result.y2 = aRect.YMost(); - return result; -} - -static nsIntRect -ToIntRect(const pixman_box32& aBox) -{ - nsIntRect result; - result.x = aBox.x1; - result.y = aBox.y1; - result.width = aBox.x2 - aBox.x1; - result.height = aBox.y2 - aBox.y1; - return result; -} - -static void -InitRegion(pixman_region32* aRegion, - const nsTArray<nsIntRect>& aRects) -{ - nsAutoTArray<pixman_box32,10> rects; - rects.SetCapacity(aRects.Length()); - for (uint32_t i = 0; i < aRects.Length (); ++i) { - if (!aRects[i].IsEmpty()) { - rects.AppendElement(ToPixmanBox(aRects[i])); - } - } - - pixman_region32_init_rects(aRegion, - rects.Elements(), rects.Length()); -} - -static void -GetIntRects(pixman_region32& aRegion, nsTArray<nsIntRect>* aRects) -{ - int nRects; - pixman_box32* boxes = pixman_region32_rectangles(&aRegion, &nRects); - aRects->SetCapacity(aRects->Length() + nRects); - for (int i = 0; i < nRects; ++i) { - aRects->AppendElement(ToIntRect(boxes[i])); - } -} - nsresult nsWindow::SetWindowClipRegion(const nsTArray<nsIntRect>& aRects, bool aIntersectWithExisting) { const nsTArray<nsIntRect>* newRects = &aRects; nsAutoTArray<nsIntRect,1> intersectRects; if (aIntersectWithExisting) { nsAutoTArray<nsIntRect,1> existingRects; GetWindowClipRegion(&existingRects); - nsAutoRef<pixman_region32> existingRegion; - InitRegion(&existingRegion, existingRects); - nsAutoRef<pixman_region32> newRegion; - InitRegion(&newRegion, aRects); - nsAutoRef<pixman_region32> intersectRegion; - pixman_region32_init(&intersectRegion); - pixman_region32_intersect(&intersectRegion, - &newRegion, &existingRegion); + nsIntRegion existingRegion = RegionFromArray(existingRects); + nsIntRegion newRegion = RegionFromArray(aRects); + nsIntRegion intersectRegion; + intersectRegion.And(newRegion, existingRegion); // If mClipRects is null we haven't set a clip rect yet, so we // need to set the clip even if it is equal. - if (mClipRects && - pixman_region32_equal(&intersectRegion, &existingRegion)) { + if (mClipRects && intersectRegion.IsEqual(existingRegion)) { return NS_OK; } - if (!pixman_region32_equal(&intersectRegion, &newRegion)) { - GetIntRects(intersectRegion, &intersectRects); + if (!intersectRegion.IsEqual(newRegion)) { + ArrayFromRegion(intersectRegion, intersectRects); newRects = &intersectRects; } } if (IsWindowClipRegionEqual(*newRects)) return NS_OK; StoreWindowClipRegion(*newRects);
--- a/widget/windows/nsWindowGfx.cpp +++ b/widget/windows/nsWindowGfx.cpp @@ -42,21 +42,16 @@ using mozilla::plugins::PluginInstancePa #include "nsIXULRuntime.h" #include "mozilla/layers/CompositorParent.h" #include "ClientLayerManager.h" #include "nsUXThemeData.h" #include "nsUXThemeConstants.h" -extern "C" { -#define PIXMAN_DONT_DEFINE_STDINT -#include "pixman.h" -} - using namespace mozilla; using namespace mozilla::gfx; using namespace mozilla::layers; using namespace mozilla::widget; using namespace mozilla::plugins; /************************************************************** **************************************************************
--- a/widget/windows/nsWindowGfx.h +++ b/widget/windows/nsWindowGfx.h @@ -8,21 +8,16 @@ /* * nsWindowGfx - Painting and aceleration. */ #include "nsWindow.h" #include <imgIContainer.h> -// This isn't ideal, we should figure out how to export -// the #defines here; need this to figure out if we have -// the DirectDraw surface or not. -#include "cairo-features.h" - class nsWindowGfx { public: enum IconSizeType { kSmallIcon, kRegularIcon }; static gfxIntSize GetIconMetrics(IconSizeType aSizeType); static nsresult CreateIcon(imgIContainer *aContainer, bool aIsCursor, uint32_t aHotspotX, uint32_t aHotspotY, gfxIntSize aScaledSize, HICON *aIcon);