Bug 1258481 - Use RegionBuilder for nsRegion IPC. r=jrmuizel

MozReview-Commit-ID: 6Ma8sVkfeuj

--HG--
extra : rebase_source : fb9ed83b170ca33657314cb3a18a532b6222dfdd
This commit is contained in:
Benoit Girard 2016-03-23 11:36:53 -04:00
parent 5ff652a2ac
commit 97d955db86
2 changed files with 21 additions and 16 deletions

View File

@ -7,25 +7,25 @@
#ifndef __GFXMESSAGEUTILS_H__
#define __GFXMESSAGEUTILS_H__
#include "FilterSupport.h"
#include "FrameMetrics.h"
#include "ImageTypes.h"
#include "RegionBuilder.h"
#include "base/process_util.h"
#include "chrome/common/ipc_message_utils.h"
#include "ipc/IPCMessageUtils.h"
#include <stdint.h>
#include "mozilla/gfx/Matrix.h"
#include "gfxPoint.h"
#include "gfxRect.h"
#include "gfxTypes.h"
#include "ipc/IPCMessageUtils.h"
#include "mozilla/gfx/Matrix.h"
#include "mozilla/layers/AsyncDragMetrics.h"
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/GeckoContentController.h"
#include "mozilla/layers/LayersTypes.h"
#include "nsRect.h"
#include "nsRegion.h"
#include "gfxTypes.h"
#include "mozilla/layers/AsyncDragMetrics.h"
#include "mozilla/layers/LayersTypes.h"
#include "mozilla/layers/CompositorTypes.h"
#include "ImageTypes.h"
#include "FrameMetrics.h"
#include "FilterSupport.h"
#include "mozilla/layers/GeckoContentController.h"
#include <stdint.h>
#ifdef _MSC_VER
#pragma warning( disable : 4800 )
@ -367,6 +367,7 @@ struct RegionParamTraits
static void Write(Message* msg, const paramType& param)
{
for (auto iter = param.RectIter(); !iter.Done(); iter.Next()) {
const Rect& r = iter.Get();
MOZ_RELEASE_ASSERT(!r.IsEmpty());
@ -379,12 +380,16 @@ struct RegionParamTraits
static bool Read(const Message* msg, void** iter, paramType* result)
{
RegionBuilder<Region> builder;
Rect rect;
while (ReadParam(msg, iter, &rect)) {
if (rect.IsEmpty())
if (rect.IsEmpty()) {
*result = builder.ToRegion();
return true;
result->Or(*result, rect);
}
builder.Or(rect);
}
return false;
}
};

View File

@ -831,7 +831,7 @@ public:
// Forward constructors.
IntRegionTyped() {}
MOZ_IMPLICIT IntRegionTyped(const IntRectTyped<units>& aRect) : Super(aRect) {}
IntRegionTyped(const IntRegionTyped& aRegion) : Super(aRegion) {}
explicit IntRegionTyped(const IntRegionTyped& aRegion) : Super(aRegion) {}
IntRegionTyped(const nsTArray<pixman_box32_t>& aRects) : Super(aRects) {}
IntRegionTyped(IntRegionTyped&& aRegion) : Super(mozilla::Move(aRegion)) {}