Merge inbound to m-c a=merge

This commit is contained in:
Wes Kocher 2015-04-21 15:23:57 -07:00
commit 687641fa14
238 changed files with 2725 additions and 1532 deletions

View File

@ -123,23 +123,38 @@ static const GInterfaceInfo atk_if_infos[] = {
(GInterfaceFinalizeFunc) nullptr, nullptr}
};
/**
* This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
*/
struct MaiAtkObject
{
AtkObject parent;
/*
* The AccessibleWrap whose properties and features are exported
* via this object instance.
*/
uintptr_t accWrap;
};
// This is or'd with the pointer in MaiAtkObject::accWrap if the wrap-ee is a
// proxy.
static const uintptr_t IS_PROXY = 1;
static GQuark quark_mai_hyperlink = 0;
AtkHyperlink*
MaiAtkObject::GetAtkHyperlink()
{
NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
MaiHyperlink* maiHyperlink =
(MaiHyperlink*)g_object_get_qdata(G_OBJECT(this), quark_mai_hyperlink);
if (!maiHyperlink) {
maiHyperlink = new MaiHyperlink(reinterpret_cast<Accessible*>(accWrap));
g_object_set_qdata(G_OBJECT(this), quark_mai_hyperlink, maiHyperlink);
}
return maiHyperlink->GetAtkHyperlink();
}
void
MaiAtkObject::Shutdown()
{
accWrap = 0;
MaiHyperlink* maiHyperlink =
(MaiHyperlink*)g_object_get_qdata(G_OBJECT(this), quark_mai_hyperlink);
if (maiHyperlink) {
delete maiHyperlink;
g_object_set_qdata(G_OBJECT(this), quark_mai_hyperlink, nullptr);
}
}
struct MaiAtkObjectClass
{
AtkObjectClass parent_class;
@ -208,8 +223,6 @@ static const char * GetUniqueMaiAtkTypeName(uint16_t interfacesBits);
static gpointer parent_class = nullptr;
static GQuark quark_mai_hyperlink = 0;
GType
mai_atk_object_get_type(void)
{
@ -250,14 +263,15 @@ AccessibleWrap::~AccessibleWrap()
void
AccessibleWrap::ShutdownAtkObject()
{
if (mAtkObject) {
if (IS_MAI_OBJECT(mAtkObject)) {
MAI_ATK_OBJECT(mAtkObject)->accWrap = 0;
}
SetMaiHyperlink(nullptr);
g_object_unref(mAtkObject);
mAtkObject = nullptr;
}
if (!mAtkObject)
return;
NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "wrong type of atk object");
if (IS_MAI_OBJECT(mAtkObject))
MAI_ATK_OBJECT(mAtkObject)->Shutdown();
g_object_unref(mAtkObject);
mAtkObject = nullptr;
}
void
@ -267,42 +281,6 @@ AccessibleWrap::Shutdown()
Accessible::Shutdown();
}
MaiHyperlink*
AccessibleWrap::GetMaiHyperlink(bool aCreate /* = true */)
{
// make sure mAtkObject is created
GetAtkObject();
NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "Invalid AtkObject");
MaiHyperlink* maiHyperlink = nullptr;
if (quark_mai_hyperlink && IS_MAI_OBJECT(mAtkObject)) {
maiHyperlink = (MaiHyperlink*)g_object_get_qdata(G_OBJECT(mAtkObject),
quark_mai_hyperlink);
if (!maiHyperlink && aCreate) {
maiHyperlink = new MaiHyperlink(this);
SetMaiHyperlink(maiHyperlink);
}
}
return maiHyperlink;
}
void
AccessibleWrap::SetMaiHyperlink(MaiHyperlink* aMaiHyperlink)
{
NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "Invalid AtkObject");
if (quark_mai_hyperlink && IS_MAI_OBJECT(mAtkObject)) {
MaiHyperlink* maiHyperlink = GetMaiHyperlink(false);
if (!maiHyperlink && !aMaiHyperlink) {
return; // Never set and we're shutting down
}
delete maiHyperlink;
g_object_set_qdata(G_OBJECT(mAtkObject), quark_mai_hyperlink,
aMaiHyperlink);
}
}
void
AccessibleWrap::GetNativeInterface(void** aOutAccessible)
{
@ -1093,7 +1071,7 @@ void
a11y::ProxyDestroyed(ProxyAccessible* aProxy)
{
auto obj = reinterpret_cast<MaiAtkObject*>(aProxy->GetWrapper() & ~IS_PROXY);
obj->accWrap = 0;
obj->Shutdown();
g_object_unref(obj);
aProxy->SetWrapper(0);
}

View File

@ -63,10 +63,6 @@ public:
bool IsValidObject();
// get/set the MaiHyperlink object for this AccessibleWrap
MaiHyperlink* GetMaiHyperlink(bool aCreate = true);
void SetMaiHyperlink(MaiHyperlink* aMaiHyperlink);
static const char * ReturnString(nsAString &aString) {
static nsCString returnedString;
returnedString = NS_ConvertUTF16toUTF8(aString);

View File

@ -51,4 +51,27 @@ IsAtkVersionAtLeast(int aMajor, int aMinor)
(aMajor == atkMajorVersion && aMinor <= atkMinorVersion);
}
/**
* This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
*/
struct MaiAtkObject
{
AtkObject parent;
/*
* The AccessibleWrap whose properties and features are exported
* via this object instance.
*/
uintptr_t accWrap;
/*
* Get the AtkHyperlink for this atk object.
*/
AtkHyperlink* GetAtkHyperlink();
/*
* Shutdown this AtkObject.
*/
void Shutdown();
};
#endif /* __NS_MAI_H__ */

View File

@ -94,56 +94,28 @@ MaiHyperlink::MaiHyperlink(Accessible* aHyperLink) :
mHyperlink(aHyperLink),
mMaiAtkHyperlink(nullptr)
{
}
MaiHyperlink::~MaiHyperlink()
{
if (mMaiAtkHyperlink) {
MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = nullptr;
g_object_unref(mMaiAtkHyperlink);
}
}
AtkHyperlink*
MaiHyperlink::GetAtkHyperlink(void)
{
NS_ENSURE_TRUE(mHyperlink, nullptr);
if (mMaiAtkHyperlink)
return mMaiAtkHyperlink;
if (!mHyperlink->IsLink())
return nullptr;
return;
mMaiAtkHyperlink =
reinterpret_cast<AtkHyperlink *>
(g_object_new(mai_atk_hyperlink_get_type(), nullptr));
NS_ASSERTION(mMaiAtkHyperlink, "OUT OF MEMORY");
NS_ENSURE_TRUE(mMaiAtkHyperlink, nullptr);
if (!mMaiAtkHyperlink)
return;
/* be sure to initialize it with "this" */
MaiHyperlink::Initialize(mMaiAtkHyperlink, this);
return mMaiAtkHyperlink;
MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = this;
}
/* static */
/* remember to call this static function when a MaiAtkHyperlink
* is created
*/
nsresult
MaiHyperlink::Initialize(AtkHyperlink *aObj, MaiHyperlink *aHyperlink)
MaiHyperlink::~MaiHyperlink()
{
NS_ENSURE_ARG(MAI_IS_ATK_HYPERLINK(aObj));
NS_ENSURE_ARG(aHyperlink);
/* initialize hyperlink */
MAI_ATK_HYPERLINK(aObj)->maiHyperlink = aHyperlink;
return NS_OK;
if (mMaiAtkHyperlink) {
MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = nullptr;
g_object_unref(mMaiAtkHyperlink);
}
}
/* static functions for ATK callbacks */
void

View File

@ -27,15 +27,13 @@ public:
~MaiHyperlink();
public:
AtkHyperlink *GetAtkHyperlink(void);
AtkHyperlink* GetAtkHyperlink() const { return mMaiAtkHyperlink; }
Accessible* GetAccHyperlink()
{ return mHyperlink && mHyperlink->IsLink() ? mHyperlink : nullptr; }
protected:
Accessible* mHyperlink;
AtkHyperlink* mMaiAtkHyperlink;
public:
static nsresult Initialize(AtkHyperlink *aObj, MaiHyperlink *aClass);
};
} // namespace a11y

View File

@ -21,9 +21,7 @@ getHyperlinkCB(AtkHyperlinkImpl* aImpl)
NS_ENSURE_TRUE(accWrap->IsLink(), nullptr);
MaiHyperlink* maiHyperlink = accWrap->GetMaiHyperlink();
NS_ENSURE_TRUE(maiHyperlink, nullptr);
return maiHyperlink->GetAtkHyperlink();
return MAI_ATK_OBJECT(aImpl)->GetAtkHyperlink();
}
}

View File

@ -32,12 +32,9 @@ getLinkCB(AtkHypertext *aText, gint aLinkIndex)
}
AtkObject* hyperLinkAtkObj = AccessibleWrap::GetAtkObject(hyperLink);
AccessibleWrap* accChild = GetAccessibleWrap(hyperLinkAtkObj);
NS_ENSURE_TRUE(accChild, nullptr);
NS_ENSURE_TRUE(IS_MAI_OBJECT(hyperLinkAtkObj), nullptr);
MaiHyperlink* maiHyperlink = accChild->GetMaiHyperlink();
NS_ENSURE_TRUE(maiHyperlink, nullptr);
return maiHyperlink->GetAtkHyperlink();
return MAI_ATK_OBJECT(hyperLinkAtkObj)->GetAtkHyperlink();
}
if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {

View File

@ -300,7 +300,7 @@ nsCoreUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame,
return;
nsPoint point =
aPoint.ToAppUnits(aFrame->PresContext()->AppUnitsPerDevPixel());
ToAppUnits(aPoint, aFrame->PresContext()->AppUnitsPerDevPixel());
nsRect frameRect = aFrame->GetScreenRectInAppUnits();
nsPoint deltaPoint(point.x - frameRect.x, point.y - frameRect.y);

View File

@ -15,13 +15,13 @@
#include "nsString.h"
#include "nsTArray.h"
#include "nsRefPtrHashtable.h"
#include "nsRect.h"
struct nsRoleMapEntry;
struct nsRect;
class nsIFrame;
class nsIAtom;
struct nsIntRect;
class nsIPersistentProperties;
class nsView;

View File

@ -1040,7 +1040,7 @@ HyperTextAccessible::OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType)
nsPresContext* presContext = mDoc->PresContext();
nsPoint coordsInAppUnits =
coords.ToAppUnits(presContext->AppUnitsPerDevPixel());
ToAppUnits(coords, presContext->AppUnitsPerDevPixel());
nsRect frameScreenRect = hyperFrame->GetScreenRectInAppUnits();
if (!frameScreenRect.Contains(coordsInAppUnits.x, coordsInAppUnits.y))
@ -1568,7 +1568,7 @@ HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartOffset,
nsPresContext* presContext = frame->PresContext();
nsPoint coordsInAppUnits =
coords.ToAppUnits(presContext->AppUnitsPerDevPixel());
ToAppUnits(coords, presContext->AppUnitsPerDevPixel());
bool initialScrolled = false;
nsIFrame *parentFrame = frame;

View File

@ -8,9 +8,9 @@ include protocol PContent;
include "mozilla/GfxMessageUtils.h";
using struct nsIntPoint from "nsRect.h";
using struct nsIntRect from "nsRect.h";
using nsIntRect from "nsRect.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
namespace mozilla {
namespace a11y {
@ -135,7 +135,7 @@ child:
prio(high) sync PasteText(uint64_t aID, int32_t aPosition)
returns(bool aValid);
prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(nsIntPoint aRetVal);
prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(IntPoint aRetVal);
prio(high) sync ImageSize(uint64_t aID) returns(IntSize aRetVal);
prio(high) sync StartOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk);

View File

@ -298,11 +298,6 @@ MY_RULES := $(DEPTH)/config/myrules.mk
#
CCC = $(CXX)
# Java macros
JAVA_GEN_DIR = _javagen
JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR)
JAVA_IFACES_PKG_NAME = org/mozilla/interfaces
INCLUDES = \
-I$(srcdir) \
-I. \

View File

@ -14,9 +14,9 @@ interface nsIPrintSettings;
%{ C++
#include "nsTArray.h"
#include "nsRect.h"
class nsIWidget;
struct nsIntRect;
class nsIPresShell;
class nsPresContext;
class nsView;

View File

@ -22,7 +22,7 @@ interface nsIStructuredCloneContainer;
interface nsIBFCacheEntry;
%{C++
struct nsIntRect;
#include "nsRect.h"
class nsDocShellEditorData;
class nsSHEntryShared;
%}

View File

@ -15,6 +15,6 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #bug 948948, NS_ERROR_FAILURE
[test_parent_navigation_by_location.html]
[test_sibling_navigation_by_location.html]
[test_top_navigation_by_location_exotic.html]
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #bug 948948, NS_ERROR_FAILURE from nsWindowWatcher::GetPrompt
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || android_version == '18' #bug 948948, NS_ERROR_FAILURE from nsWindowWatcher::GetPrompt
[test_top_navigation_by_location.html]
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #bug 948948, NS_ERROR_FAILURE from nsWindowWatcher::GetPrompt
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || android_version == '18' #bug 948948, NS_ERROR_FAILURE from nsWindowWatcher::GetPrompt

View File

@ -3922,6 +3922,42 @@ nsIDocument::TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks)
mFrameRequestCallbacks.Clear();
}
bool
nsIDocument::ShouldThrottleFrameRequests()
{
if (!mIsShowing) {
// We're not showing (probably in a background tab or the bf cache).
return true;
}
if (!mPresShell) {
return false; // Can't do anything smarter.
}
nsIFrame* frame = mPresShell->GetRootFrame();
if (!frame) {
return false; // Can't do anything smarter.
}
nsIFrame* displayRootFrame = nsLayoutUtils::GetDisplayRootFrame(frame);
if (!displayRootFrame) {
return false; // Can't do anything smarter.
}
if (!displayRootFrame->DidPaintPresShell(mPresShell)) {
// We didn't get painted during the last paint, so we're not visible.
// Throttle. Note that because we have to paint this document at least
// once to unthrottle it, we will drop one requestAnimationFrame frame
// when a document that previously wasn't visible scrolls into view. This
// is acceptable since it would happen outside the viewport on APZ
// platforms and is unlikely to be human-perceivable on non-APZ platforms.
return true;
}
// We got painted during the last paint, so run at full speed.
return false;
}
PLDHashOperator RequestDiscardEnumerator(imgIRequest* aKey,
uint32_t aData,
void* userArg)

View File

@ -2104,6 +2104,13 @@ public:
*/
void TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks);
/**
* @return true if this document's frame request callbacks should be
* throttled. We throttle requestAnimationFrame for documents which aren't
* visible (e.g. scrolled out of the viewport).
*/
bool ShouldThrottleFrameRequests();
// This returns true when the document tree is being teared down.
bool InUnlinkOrDeletion() { return mInUnlinkOrDeletion; }

View File

@ -308,12 +308,12 @@ public:
nsIntRegion strokePaintNeededRegion;
FilterSupport::ComputeSourceNeededRegions(
ctx->CurrentState().filter, mgfx::ThebesIntRect(mPostFilterBounds),
ctx->CurrentState().filter, mPostFilterBounds,
sourceGraphicNeededRegion, fillPaintNeededRegion, strokePaintNeededRegion);
mSourceGraphicRect = mgfx::ToIntRect(sourceGraphicNeededRegion.GetBounds());
mFillPaintRect = mgfx::ToIntRect(fillPaintNeededRegion.GetBounds());
mStrokePaintRect = mgfx::ToIntRect(strokePaintNeededRegion.GetBounds());
mSourceGraphicRect = sourceGraphicNeededRegion.GetBounds();
mFillPaintRect = fillPaintNeededRegion.GetBounds();
mStrokePaintRect = strokePaintNeededRegion.GetBounds();
mSourceGraphicRect = mSourceGraphicRect.Intersect(aPreFilterBounds);
@ -600,10 +600,10 @@ private:
nsIntRegion strokePaintNeededRegion;
FilterSupport::ComputeSourceNeededRegions(
ctx->CurrentState().filter, mgfx::ThebesIntRect(mgfx::RoundedToInt(aDestBounds)),
ctx->CurrentState().filter, mgfx::RoundedToInt(aDestBounds),
sourceGraphicNeededRegion, fillPaintNeededRegion, strokePaintNeededRegion);
return mgfx::Rect(mgfx::ToIntRect(sourceGraphicNeededRegion.GetBounds()));
return mgfx::Rect(sourceGraphicNeededRegion.GetBounds());
}
mgfx::Rect
@ -639,8 +639,8 @@ private:
nsIntRegion extents =
mgfx::FilterSupport::ComputePostFilterExtents(ctx->CurrentState().filter,
mgfx::ThebesIntRect(intBounds));
return mgfx::Rect(mgfx::ToIntRect(extents.GetBounds()));
intBounds);
return mgfx::Rect(extents.GetBounds());
}
RefPtr<DrawTarget> mTarget;

View File

@ -11,12 +11,11 @@
#include "mozilla/EventForwards.h"
#include "nsCoord.h"
#include "nsIFrame.h"
#include "nsPoint.h"
class nsIScrollableFrame;
class nsITimer;
struct nsIntPoint;
namespace mozilla {
class EventStateManager;

View File

@ -37,9 +37,9 @@ using nscolor from "nsColor.h";
using class mozilla::WidgetCompositionEvent from "ipc/nsGUIEventIPC.h";
using struct mozilla::widget::IMENotification from "nsIWidget.h";
using struct nsIMEUpdatePreference from "nsIWidget.h";
using struct nsIntPoint from "nsPoint.h";
using struct nsIntRect from "nsRect.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
using class mozilla::WidgetKeyboardEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetMouseEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetWheelEvent from "ipc/nsGUIEventIPC.h";
@ -488,11 +488,11 @@ parent:
uint64_t aObserverId);
SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
nsIntPoint aPointerScreenPoint,
IntPoint aPointerScreenPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
uint64_t aObserverId);
SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint,
SynthesizeNativeTouchTap(IntPoint aPointerScreenPoint,
bool aLongTap,
uint64_t aObserverId);
ClearNativeTouchSequence(uint64_t aObserverId);
@ -548,8 +548,8 @@ child:
CacheFileDescriptor(nsString path, FileDescriptor fd);
UpdateDimensions(nsIntRect rect, ScreenIntSize size, ScreenOrientation orientation,
nsIntPoint chromeDisp) compress;
UpdateDimensions(IntRect rect, ScreenIntSize size, ScreenOrientation orientation,
LayoutDeviceIntPoint chromeDisp) compress;
UpdateFrame(FrameMetrics frame);

View File

@ -6,7 +6,7 @@ include protocol PBrowser;
include "mozilla/GfxMessageUtils.h";
using struct nsIntRect from "nsRect.h";
using nsIntRect from "nsRect.h";
namespace mozilla {
namespace plugins {

View File

@ -8,7 +8,7 @@ include protocol PContent;
include "mozilla/GfxMessageUtils.h";
using struct nsIntRect from "nsRect.h";
using nsIntRect from "nsRect.h";
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
namespace mozilla {

View File

@ -1085,7 +1085,7 @@ TabChild::Init()
}
mWidget->Create(
nullptr, 0, // no parents
nsIntRect(nsIntPoint(0, 0), nsIntSize(0, 0)),
gfx::IntRect(gfx::IntPoint(0, 0), gfx::IntSize(0, 0)),
nullptr // HandleWidgetEvent
);
@ -2018,7 +2018,7 @@ TabChild::RecvShow(const ScreenIntSize& aSize,
bool
TabChild::RecvUpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size,
const ScreenOrientation& orientation, const nsIntPoint& chromeDisp)
const ScreenOrientation& orientation, const LayoutDeviceIntPoint& chromeDisp)
{
if (!mRemoteFrame) {
return true;
@ -3179,7 +3179,7 @@ TabChild::CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut)
initData.mUnicode = false;
initData.clipChildren = true;
initData.clipSiblings = true;
nsresult rv = pluginWidget->Create(aParent, nullptr, nsIntRect(nsIntPoint(0, 0),
nsresult rv = pluginWidget->Create(aParent, nullptr, gfx::IntRect(gfx::IntPoint(0, 0),
nsIntSize(0, 0)), &initData);
if (NS_FAILED(rv)) {
NS_WARNING("Creating native plugin widget on the chrome side failed.");

View File

@ -322,7 +322,7 @@ public:
virtual bool RecvUpdateDimensions(const nsIntRect& rect,
const ScreenIntSize& size,
const ScreenOrientation& orientation,
const nsIntPoint& chromeDisp) override;
const LayoutDeviceIntPoint& chromeDisp) override;
virtual bool RecvUpdateFrame(const layers::FrameMetrics& aFrameMetrics) override;
virtual bool RecvRequestFlingSnap(const ViewID& aScrollId,
const CSSPoint& aDestination) override;
@ -487,7 +487,7 @@ public:
bool DeallocPPluginWidgetChild(PPluginWidgetChild* aActor) override;
nsresult CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut);
nsIntPoint GetChromeDisplacement() { return mChromeDisp; };
LayoutDeviceIntPoint GetChromeDisplacement() { return mChromeDisp; };
bool IPCOpen() { return mIPCOpen; }
@ -625,7 +625,7 @@ private:
bool mHasValidInnerSize;
bool mDestroyed;
// Position of tab, relative to parent widget (typically the window)
nsIntPoint mChromeDisp;
LayoutDeviceIntPoint mChromeDisp;
TabId mUniqueId;
float mDPI;
double mDefaultScale;

View File

@ -270,7 +270,6 @@ TabParent::TabParent(nsIContentParent* aManager,
, mDPI(0)
, mDefaultScale(0)
, mUpdatedDimensions(false)
, mChromeOffset(0, 0)
, mManager(aManager)
, mMarkedDestroying(false)
, mIsDestroyed(false)
@ -338,16 +337,27 @@ TabParent::SetOwnerElement(Element* aElement)
// Update to the new content, and register to listen for events from it.
mFrameElement = aElement;
if (mFrameElement && mFrameElement->OwnerDoc()->GetWindow()) {
nsCOMPtr<nsPIDOMWindow> window = mFrameElement->OwnerDoc()->GetWindow();
nsCOMPtr<EventTarget> eventTarget = window->GetTopWindowRoot();
if (eventTarget) {
eventTarget->AddEventListener(NS_LITERAL_STRING("MozUpdateWindowPos"),
this, false, false);
AddWindowListeners();
TryCacheDPIAndScale();
}
void
TabParent::AddWindowListeners()
{
if (mFrameElement && mFrameElement->OwnerDoc()) {
if (nsCOMPtr<nsPIDOMWindow> window = mFrameElement->OwnerDoc()->GetWindow()) {
nsCOMPtr<EventTarget> eventTarget = window->GetTopWindowRoot();
if (eventTarget) {
eventTarget->AddEventListener(NS_LITERAL_STRING("MozUpdateWindowPos"),
this, false, false);
}
}
if (nsIPresShell* shell = mFrameElement->OwnerDoc()->GetShell()) {
mPresShellWithRefreshListener = shell;
shell->AddPostRefreshObserver(this);
}
}
TryCacheDPIAndScale();
}
void
@ -361,6 +371,18 @@ TabParent::RemoveWindowListeners()
this, false);
}
}
if (mPresShellWithRefreshListener) {
mPresShellWithRefreshListener->RemovePostRefreshObserver(this);
mPresShellWithRefreshListener = nullptr;
}
}
void
TabParent::DidRefresh()
{
if (mChromeOffset != -GetChildProcessOffset()) {
UpdatePosition();
}
}
void
@ -395,6 +417,8 @@ TabParent::Destroy()
return;
}
RemoveWindowListeners();
// If this fails, it's most likely due to a content-process crash,
// and auto-cleanup will kick in. Otherwise, the child side will
// destroy itself and send back __delete__().
@ -904,6 +928,19 @@ TabParent::RecvSetDimensions(const uint32_t& aFlags,
return false;
}
nsresult
TabParent::UpdatePosition()
{
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
if (!frameLoader) {
return NS_OK;
}
nsIntRect windowDims;
NS_ENSURE_SUCCESS(frameLoader->GetWindowDimensions(windowDims), NS_ERROR_FAILURE);
UpdateDimensions(windowDims, mDimensions);
return NS_OK;
}
void
TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
{
@ -913,17 +950,18 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
hal::ScreenConfiguration config;
hal::GetCurrentScreenConfiguration(&config);
ScreenOrientation orientation = config.orientation();
nsIntPoint chromeOffset = -LayoutDevicePixel::ToUntyped(GetChildProcessOffset());
LayoutDeviceIntPoint chromeOffset = -GetChildProcessOffset();
nsCOMPtr<nsIWidget> widget = GetWidget();
nsIntRect contentRect = rect;
if (widget) {
contentRect.x += widget->GetClientOffset().x;
contentRect.y += widget->GetClientOffset().y;
}
if (!mUpdatedDimensions || mOrientation != orientation ||
mDimensions != size || !mRect.IsEqualEdges(rect) ||
mDimensions != size || !mRect.IsEqualEdges(contentRect) ||
chromeOffset != mChromeOffset) {
nsCOMPtr<nsIWidget> widget = GetWidget();
nsIntRect contentRect = rect;
if (widget) {
contentRect.x += widget->GetClientOffset().x;
contentRect.y += widget->GetClientOffset().y;
}
mUpdatedDimensions = true;
mRect = contentRect;
@ -2990,14 +3028,7 @@ TabParent::HandleEvent(nsIDOMEvent* aEvent)
if (eventType.EqualsLiteral("MozUpdateWindowPos") && !mIsDestroyed) {
// This event is sent when the widget moved. Therefore we only update
// the position.
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
if (!frameLoader) {
return NS_OK;
}
nsIntRect windowDims;
NS_ENSURE_SUCCESS(frameLoader->GetWindowDimensions(windowDims), NS_ERROR_FAILURE);
UpdateDimensions(windowDims, mDimensions);
return NS_OK;
return UpdatePosition();
}
return NS_OK;
}

View File

@ -23,6 +23,7 @@
#include "nsISecureBrowserUI.h"
#include "nsITabParent.h"
#include "nsIXULBrowserWindow.h"
#include "nsRefreshDriver.h"
#include "nsWeakReference.h"
#include "Units.h"
#include "nsIWidget.h"
@ -74,6 +75,7 @@ class TabParent final : public PBrowserParent
, public nsISecureBrowserUI
, public nsSupportsWeakReference
, public TabContext
, public nsAPostRefreshObserver
{
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
@ -119,6 +121,8 @@ public:
void Destroy();
void RemoveWindowListeners();
void AddWindowListeners();
void DidRefresh() override;
virtual bool RecvMoveFocus(const bool& aForward) override;
virtual bool RecvEvent(const RemoteDOMEvent& aEvent) override;
@ -479,7 +483,7 @@ protected:
float mDPI;
CSSToLayoutDeviceScale mDefaultScale;
bool mUpdatedDimensions;
nsIntPoint mChromeOffset;
LayoutDeviceIntPoint mChromeOffset;
private:
already_AddRefed<nsFrameLoader> GetFrameLoader(bool aUseCachedFrameLoaderAfterDestroy = false) const;
@ -487,6 +491,8 @@ private:
nsRefPtr<nsIContentParent> mManager;
void TryCacheDPIAndScale();
nsresult UpdatePosition();
CSSPoint AdjustTapToChildWidget(const CSSPoint& aPoint);
// Update state prior to routing an APZ-aware event to the child process.
@ -595,6 +601,8 @@ private:
// cursor. This happens whenever the cursor is in the tab's region.
bool mTabSetsCursor;
nsRefPtr<nsIPresShell> mPresShellWithRefreshListener;
private:
// This is used when APZ needs to find the TabParent associated with a layer
// to dispatch events.

View File

@ -12,6 +12,7 @@
#include "mozilla/CheckedInt.h"
#include "nsIThread.h"
#include "nsSize.h"
#include "nsRect.h"
#if !(defined(XP_WIN) || defined(XP_MACOSX) || defined(LINUX)) || \
defined(MOZ_ASAN)
@ -28,8 +29,6 @@ using mozilla::CheckedUint64;
using mozilla::CheckedInt32;
using mozilla::CheckedUint32;
struct nsIntRect;
// This file contains stuff we'd rather put elsewhere, but which is
// dependent on other changes which we don't want to wait for. We plan to
// remove this file in the near future.

View File

@ -174,7 +174,7 @@ bool AndroidMediaReader::DecodeVideoFrame(bool &aKeyframeSkip,
currentImage = bufferCallback.GetImage();
int64_t pos = mDecoder->GetResource()->Tell();
IntRect picture = ToIntRect(mPicture);
IntRect picture = mPicture;
nsRefPtr<VideoData> v;
if (currentImage) {

View File

@ -198,7 +198,7 @@ GonkVideoDecoderManager::CreateVideoData(int64_t aStreamOffset, VideoData **v)
keyFrame = 0;
}
gfx::IntRect picture = ToIntRect(mPicture);
gfx::IntRect picture = mPicture;
if (mFrameInfo.mWidth != mInitialFrame.width ||
mFrameInfo.mHeight != mInitialFrame.height) {

View File

@ -28,7 +28,6 @@ PRLogModuleInfo* GetDemuxerLog();
#define LOG(...)
#endif
using mozilla::gfx::ToIntRect;
using mozilla::layers::Image;
using mozilla::layers::IMFYCbCrImage;
using mozilla::layers::LayerManager;
@ -404,7 +403,7 @@ WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample,
VideoData::SetVideoDataToImage(image,
mVideoInfo,
b,
ToIntRect(mPictureRegion),
mPictureRegion,
false);
nsRefPtr<VideoData> v =
@ -416,7 +415,7 @@ WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample,
image.forget(),
false,
-1,
ToIntRect(mPictureRegion));
mPictureRegion);
v.forget(aOutVideoData);
return S_OK;
@ -453,7 +452,7 @@ WMFVideoMFTManager::CreateD3DVideoFrame(IMFSample* aSample,
image.forget(),
false,
-1,
ToIntRect(mPictureRegion));
mPictureRegion);
NS_ENSURE_TRUE(v, E_FAIL);
v.forget(aOutVideoData);

View File

@ -890,7 +890,7 @@ nsresult OggReader::DecodeTheora(ogg_packet* aPacket, int64_t aTimeThreshold)
b,
isKeyframe,
aPacket->granulepos,
ToIntRect(mPicture));
mPicture);
if (!v) {
// There may be other reasons for this error, but for
// simplicity just assume the worst case: out of memory.

View File

@ -1645,7 +1645,7 @@ MediaCodecReader::UpdateVideoInfo()
}
// Relative picture size
gfx::IntRect relative_picture_rect = gfx::ToIntRect(picture_rect);
gfx::IntRect relative_picture_rect = picture_rect;
if (mVideoTrack.mWidth != mVideoTrack.mFrameSize.width ||
mVideoTrack.mHeight != mVideoTrack.mFrameSize.height) {
// Frame size is different from what the container reports. This is legal,

View File

@ -403,7 +403,7 @@ bool MediaOmxReader::DecodeVideoFrame(bool &aKeyframeSkip,
aKeyframeSkip = false;
IntRect picture = ToIntRect(mPicture);
IntRect picture = mPicture;
if (frame.Y.mWidth != mInitialFrame.width ||
frame.Y.mHeight != mInitialFrame.height) {

View File

@ -218,7 +218,7 @@ bool RawReader::DecodeVideoFrame(bool &aKeyframeSkip,
b,
1, // In raw video every frame is a keyframe
-1,
ToIntRect(mPicture));
mPicture);
if (!v)
return false;

View File

@ -190,7 +190,7 @@ SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip,
b.mPlanes[2].mOffset = b.mPlanes[2].mSkip = 0;
nsIntRect pictureRect = mReader->GetPicture();
IntRect picture = ToIntRect(pictureRect);
IntRect picture = pictureRect;
nsIntSize initFrame = mReader->GetInitialFrame();
if (img->d_w != static_cast<uint32_t>(initFrame.width) ||
img->d_h != static_cast<uint32_t>(initFrame.height)) {

View File

@ -9,8 +9,7 @@
#include "WMF.h"
#include "nsAutoPtr.h"
#include "mozilla/Mutex.h"
struct nsIntRect;
#include "nsRect.h"
namespace mozilla {

View File

@ -747,7 +747,7 @@ WMFReader::CreateBasicVideoFrame(IMFSample* aSample,
b,
false,
-1,
ToIntRect(mPictureRegion));
mPictureRegion);
if (twoDBuffer) {
twoDBuffer->Unlock2D();
} else {
@ -789,7 +789,7 @@ WMFReader::CreateD3DVideoFrame(IMFSample* aSample,
image.forget(),
false,
-1,
ToIntRect(mPictureRegion));
mPictureRegion);
NS_ENSURE_TRUE(v, E_FAIL);
v.forget(aOutVideoData);

View File

@ -24,7 +24,6 @@
#endif
class nsIInputStream;
struct nsIntRect;
class nsPluginDOMContextMenuListener;
class nsPluginFrame;
class nsDisplayListBuilder;

View File

@ -26,7 +26,7 @@ using gfxIntSize from "nsSize.h";
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
using mozilla::plugins::WindowsSharedMemoryHandle from "mozilla/plugins/PluginMessageUtils.h";
using mozilla::layers::SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils.h";
using struct nsIntRect from "nsRect.h";
using nsIntRect from "nsRect.h";
namespace mozilla {
namespace plugins {

View File

@ -3087,7 +3087,7 @@ PluginInstanceChild::PaintRectToSurface(const nsIntRect& aRect,
RefPtr<DrawTarget> dt = CreateDrawTargetForSurface(aSurface);
RefPtr<SourceSurface> surface =
gfxPlatform::GetSourceSurfaceForSurface(dt, renderSurface);
dt->CopySurface(surface, ToIntRect(aRect), ToIntPoint(aRect.TopLeft()));
dt->CopySurface(surface, aRect, aRect.TopLeft());
}
}
@ -3145,7 +3145,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
RefPtr<DrawTarget> dt = CreateDrawTargetForSurface(whiteImage);
RefPtr<SourceSurface> surface =
gfxPlatform::GetSourceSurfaceForSurface(dt, aSurface);
dt->CopySurface(surface, ToIntRect(rect), IntPoint());
dt->CopySurface(surface, rect, IntPoint());
}
// Paint the plugin directly onto the target, with a black
@ -3191,7 +3191,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
gfxPlatform::GetSourceSurfaceForSurface(dt, blackImage);
dt->CopySurface(surface,
IntRect(0, 0, rect.width, rect.height),
ToIntPoint(rect.TopLeft()));
rect.TopLeft());
}
}
@ -3328,9 +3328,7 @@ PluginInstanceChild::ShowPluginFrame()
RefPtr<DrawTarget> dt = CreateDrawTargetForSurface(surface);
RefPtr<SourceSurface> backgroundSurface =
gfxPlatform::GetSourceSurfaceForSurface(dt, mBackground);
dt->CopySurface(backgroundSurface,
ToIntRect(rect),
ToIntPoint(rect.TopLeft()));
dt->CopySurface(backgroundSurface, rect, rect.TopLeft());
}
// ... and hand off to the plugin
// BEWARE: mBackground may die during this call
@ -3463,7 +3461,7 @@ PluginInstanceChild::ReadbackDifferenceRect(const nsIntRect& rect)
nsIntRegionRectIterator iter(result);
const nsIntRect* r;
while ((r = iter.Next()) != nullptr) {
dt->CopySurface(source, ToIntRect(*r), ToIntPoint(r->TopLeft()));
dt->CopySurface(source, *r, r->TopLeft());
}
return true;

View File

@ -15,10 +15,10 @@
#include "nsError.h"
#include "mozilla/EventForwards.h"
#include "nsSize.h"
#include "nsRect.h"
class gfxContext;
class nsCString;
struct nsIntRect;
class nsNPAPIPlugin;
namespace mozilla {

View File

@ -9,8 +9,7 @@
#include "npapi.h"
#include "mozilla/gfx/QuartzSupport.h"
struct nsIntRect;
#include "nsRect.h"
namespace mozilla {
namespace plugins {

View File

@ -6,10 +6,14 @@
#ifndef MOZILLA_GFX_NUMERICTOOLS_H_
#define MOZILLA_GFX_NUMERICTOOLS_H_
namespace mozilla {
// XXX - Move these into mfbt/MathAlgorithms.h?
// Returns the largest multiple of aMultiplied that's <= x.
// Same as int32_t(floor(double(x) / aMultiplier)) * aMultiplier,
// but faster.
static int32_t
inline int32_t
RoundDownToMultiple(int32_t x, int32_t aMultiplier)
{
// We don't use float division + floor because that's hard for the compiler
@ -24,7 +28,7 @@ RoundDownToMultiple(int32_t x, int32_t aMultiplier)
// Returns the smallest multiple of aMultiplied that's >= x.
// Same as int32_t(ceil(double(x) / aMultiplier)) * aMultiplier,
// but faster.
static int32_t
inline int32_t
RoundUpToMultiple(int32_t x, int32_t aMultiplier)
{
int mod = x % aMultiplier;
@ -34,4 +38,6 @@ RoundUpToMultiple(int32_t x, int32_t aMultiplier)
return x - mod;
}
} // namespace mozilla
#endif /* MOZILLA_GFX_NUMERICTOOLS_H_ */

View File

@ -8,6 +8,7 @@
#include "BaseRect.h"
#include "BaseMargin.h"
#include "NumericTools.h"
#include "Point.h"
#include "Tools.h"
@ -105,6 +106,21 @@ struct IntRectTyped :
{
return IntRectTyped<units>::IsEqualEdges(aRect);
}
void InflateToMultiple(const IntSizeTyped<units>& aTileSize)
{
int32_t yMost = this->YMost();
int32_t xMost = this->XMost();
this->x = mozilla::RoundDownToMultiple(this->x, aTileSize.width);
this->y = mozilla::RoundDownToMultiple(this->y, aTileSize.height);
xMost = mozilla::RoundUpToMultiple(xMost, aTileSize.width);
yMost = mozilla::RoundUpToMultiple(yMost, aTileSize.height);
this->width = xMost - this->x;
this->height = yMost - this->y;
}
};
typedef IntRectTyped<UnknownUnits> IntRect;

View File

@ -79,7 +79,7 @@ TextureImage::UpdateFromDataSource(gfx::DataSourceSurface *aSurface,
const gfx::IntPoint* aSrcPoint)
{
nsIntRegion destRegion = aDestRegion ? *aDestRegion
: nsIntRect(0, 0,
: IntRect(0, 0,
aSurface->GetSize().width,
aSurface->GetSize().height);
gfx::IntPoint srcPoint = aSrcPoint ? *aSrcPoint
@ -120,13 +120,13 @@ BasicTextureImage::BeginUpdate(nsIntRegion& aRegion)
if (CanUploadSubTextures(mGLContext)) {
GetUpdateRegion(aRegion);
} else {
aRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aRegion = IntRect(IntPoint(0, 0), mSize);
}
mUpdateRegion = aRegion;
nsIntRect rgnSize = mUpdateRegion.GetBounds();
if (!nsIntRect(nsIntPoint(0, 0), mSize).Contains(rgnSize)) {
IntRect rgnSize = mUpdateRegion.GetBounds();
if (!IntRect(IntPoint(0, 0), mSize).Contains(rgnSize)) {
NS_ERROR("update outside of image");
return nullptr;
}
@ -147,7 +147,7 @@ BasicTextureImage::GetUpdateRegion(nsIntRegion& aForRegion)
// changed, we need to recreate our backing surface and force the
// client to paint everything
if (mTextureState != Valid) {
aForRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aForRegion = IntRect(IntPoint(0, 0), mSize);
}
}
@ -205,10 +205,10 @@ BasicTextureImage::FinishedSurfaceUpload()
bool
BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom /* = gfx::IntPoint(0, 0) */)
{
nsIntRect bounds = aRegion.GetBounds();
IntRect bounds = aRegion.GetBounds();
nsIntRegion region;
if (mTextureState != Valid) {
bounds = nsIntRect(0, 0, mSize.width, mSize.height);
bounds = IntRect(0, 0, mSize.width, mSize.height);
region = nsIntRegion(bounds);
} else {
region = aRegion;
@ -220,7 +220,7 @@ BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
region,
mTexture,
mTextureState == Created,
bounds.TopLeft() + nsIntPoint(aFrom.x, aFrom.y),
bounds.TopLeft() + IntPoint(aFrom.x, aFrom.y),
false);
mTextureState = Valid;
return true;
@ -345,7 +345,7 @@ TiledTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
nsIntRegion region;
if (mTextureState != Valid) {
nsIntRect bounds = nsIntRect(0, 0, mSize.width, mSize.height);
IntRect bounds = IntRect(0, 0, mSize.width, mSize.height);
region = nsIntRegion(bounds);
} else {
region = aRegion;
@ -355,7 +355,7 @@ TiledTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
int oldCurrentImage = mCurrentImage;
BeginBigImageIteration();
do {
nsIntRect tileRect = ThebesIntRect(GetSrcTileRect());
IntRect tileRect = GetSrcTileRect();
int xPos = tileRect.x;
int yPos = tileRect.y;
@ -400,7 +400,7 @@ TiledTextureImage::GetUpdateRegion(nsIntRegion& aForRegion)
// if the texture hasn't been initialized yet, or something important
// changed, we need to recreate our backing surface and force the
// client to paint everything
aForRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aForRegion = IntRect(IntPoint(0, 0), mSize);
return;
}
@ -411,7 +411,7 @@ TiledTextureImage::GetUpdateRegion(nsIntRegion& aForRegion)
for (unsigned i = 0; i < mImages.Length(); i++) {
int xPos = (i % mColumns) * mTileSize;
int yPos = (i / mColumns) * mTileSize;
nsIntRect imageRect = nsIntRect(nsIntPoint(xPos,yPos),
IntRect imageRect = IntRect(IntPoint(xPos,yPos),
mImages[i]->GetSize());
if (aForRegion.Intersects(imageRect)) {
@ -446,16 +446,16 @@ TiledTextureImage::BeginUpdate(nsIntRegion& aRegion)
// if the texture hasn't been initialized yet, or something important
// changed, we need to recreate our backing surface and force the
// client to paint everything
aRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aRegion = IntRect(IntPoint(0, 0), mSize);
}
nsIntRect bounds = aRegion.GetBounds();
IntRect bounds = aRegion.GetBounds();
for (unsigned i = 0; i < mImages.Length(); i++) {
int xPos = (i % mColumns) * mTileSize;
int yPos = (i / mColumns) * mTileSize;
nsIntRegion imageRegion =
nsIntRegion(nsIntRect(nsIntPoint(xPos,yPos),
nsIntRegion(IntRect(IntPoint(xPos,yPos),
mImages[i]->GetSize()));
// a single Image can handle this update request
@ -510,8 +510,7 @@ TiledTextureImage::EndUpdate()
for (unsigned i = 0; i < mImages.Length(); i++) {
int xPos = (i % mColumns) * mTileSize;
int yPos = (i / mColumns) * mTileSize;
nsIntRect imageRect = nsIntRect(nsIntPoint(xPos,yPos),
mImages[i]->GetSize());
IntRect imageRect = IntRect(IntPoint(xPos,yPos), mImages[i]->GetSize());
nsIntRegion subregion;
subregion.And(mUpdateRegion, imageRect);

View File

@ -50,7 +50,7 @@ NextPowerOfTwo(int aNumber)
}
static unsigned int
DataOffset(const nsIntPoint &aPoint, int32_t aStride, SurfaceFormat aFormat)
DataOffset(const IntPoint &aPoint, int32_t aStride, SurfaceFormat aFormat)
{
unsigned int data = aPoint.y * aStride;
data += aPoint.x * BytesPerPixel(aFormat);
@ -502,10 +502,10 @@ UploadImageDataToTexture(GLContext* gl,
}
nsIntRegionRectIterator iter(paintRegion);
const nsIntRect *iterRect;
const IntRect *iterRect;
// Top left point of the region's bounding rectangle.
nsIntPoint topLeft = paintRegion.GetBounds().TopLeft();
IntPoint topLeft = paintRegion.GetBounds().TopLeft();
while ((iterRect = iter.Next())) {
// The inital data pointer is at the top left point of the region's
@ -556,7 +556,7 @@ UploadSurfaceToTexture(GLContext* gl,
const nsIntRegion& aDstRegion,
GLuint& aTexture,
bool aOverwrite,
const nsIntPoint& aSrcPoint,
const gfx::IntPoint& aSrcPoint,
bool aPixelBuffer,
GLenum aTextureUnit,
GLenum aTextureTarget)

View File

@ -74,7 +74,7 @@ UploadSurfaceToTexture(GLContext* gl,
const nsIntRegion& aDstRegion,
GLuint& aTexture,
bool aOverwrite = false,
const nsIntPoint& aSrcPoint = nsIntPoint(0, 0),
const gfx::IntPoint& aSrcPoint = gfx::IntPoint(0, 0),
bool aPixelBuffer = false,
GLenum aTextureUnit = LOCAL_GL_TEXTURE0,
GLenum aTextureTarget = LOCAL_GL_TEXTURE_2D);

View File

@ -102,7 +102,7 @@ TextureImageEGL::GetUpdateRegion(nsIntRegion& aForRegion)
if (mTextureState != Valid) {
// if the texture hasn't been initialized yet, force the
// client to paint everything
aForRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aForRegion = gfx::IntRect(gfx::IntPoint(0, 0), mSize);
}
// We can only draw a rectangle, not subregions due to
@ -122,7 +122,7 @@ TextureImageEGL::BeginUpdate(nsIntRegion& aRegion)
mUpdateRect = aRegion.GetBounds();
//printf_stderr("BeginUpdate with updateRect [%d %d %d %d]\n", mUpdateRect.x, mUpdateRect.y, mUpdateRect.width, mUpdateRect.height);
if (!nsIntRect(nsIntPoint(0, 0), mSize).Contains(mUpdateRect)) {
if (!gfx::IntRect(gfx::IntPoint(0, 0), mSize).Contains(mUpdateRect)) {
NS_ERROR("update outside of image");
return nullptr;
}
@ -198,11 +198,11 @@ TextureImageEGL::EndUpdate()
bool
TextureImageEGL::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom /* = gfx::IntPoint(0,0) */)
{
nsIntRect bounds = aRegion.GetBounds();
gfx::IntRect bounds = aRegion.GetBounds();
nsIntRegion region;
if (mTextureState != Valid) {
bounds = nsIntRect(0, 0, mSize.width, mSize.height);
bounds = gfx::IntRect(0, 0, mSize.width, mSize.height);
region = nsIntRegion(bounds);
} else {
region = aRegion;
@ -214,7 +214,7 @@ TextureImageEGL::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion&
region,
mTexture,
mTextureState == Created,
bounds.TopLeft() + nsIntPoint(aFrom.x, aFrom.y),
bounds.TopLeft() + gfx::IntPoint(aFrom.x, aFrom.y),
false);
mTextureState = Valid;

View File

@ -391,28 +391,6 @@ struct ParamTraits<mozilla::gfx::IntSizeTyped<T> >
}
};
template<>
struct ParamTraits<nsIntRect>
{
typedef nsIntRect paramType;
static void Write(Message* msg, const paramType& param)
{
WriteParam(msg, param.x);
WriteParam(msg, param.y);
WriteParam(msg, param.width);
WriteParam(msg, param.height);
}
static bool Read(const Message* msg, void** iter, paramType* result)
{
return (ReadParam(msg, iter, &result->x) &&
ReadParam(msg, iter, &result->y) &&
ReadParam(msg, iter, &result->width) &&
ReadParam(msg, iter, &result->height));
}
};
template<typename Region, typename Rect, typename Iter>
struct RegionParamTraits
{

View File

@ -21,8 +21,7 @@
#include "nsDebug.h" // for NS_ASSERTION
#include "nsHashKeys.h" // for nsPtrHashKey
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsRect.h" // for IntRect
#include "nsTArray.h" // for nsAutoTArray, nsTArray_Impl
using namespace mozilla::gfx;
@ -33,20 +32,20 @@ namespace layers {
struct LayerPropertiesBase;
UniquePtr<LayerPropertiesBase> CloneLayerTreePropertiesInternal(Layer* aRoot, bool aIsMask = false);
static nsIntRect
TransformRect(const nsIntRect& aRect, const Matrix4x4& aTransform)
static IntRect
TransformRect(const IntRect& aRect, const Matrix4x4& aTransform)
{
if (aRect.IsEmpty()) {
return nsIntRect();
return IntRect();
}
Rect rect(aRect.x, aRect.y, aRect.width, aRect.height);
rect = aTransform.TransformBounds(rect);
rect.RoundOut();
nsIntRect intRect;
IntRect intRect;
if (!gfxUtils::GfxRectToIntRect(ThebesRect(rect), &intRect)) {
return nsIntRect();
return IntRect();
}
return intRect;
@ -56,7 +55,7 @@ static void
AddTransformedRegion(nsIntRegion& aDest, const nsIntRegion& aSource, const Matrix4x4& aTransform)
{
nsIntRegionRectIterator iter(aSource);
const nsIntRect *r;
const IntRect *r;
while ((r = iter.Next())) {
aDest.Or(aDest, TransformRect(*r, aTransform));
}
@ -127,12 +126,12 @@ struct LayerPropertiesBase : public LayerProperties
{
MOZ_COUNT_DTOR(LayerPropertiesBase);
}
virtual nsIntRegion ComputeDifferences(Layer* aRoot,
virtual nsIntRegion ComputeDifferences(Layer* aRoot,
NotifySubDocInvalidationFunc aCallback,
bool* aGeometryChanged);
virtual void MoveBy(const nsIntPoint& aOffset);
virtual void MoveBy(const IntPoint& aOffset);
nsIntRegion ComputeChange(NotifySubDocInvalidationFunc aCallback,
bool& aGeometryChanged)
@ -176,12 +175,12 @@ struct LayerPropertiesBase : public LayerProperties
return result;
}
nsIntRect NewTransformedBounds()
IntRect NewTransformedBounds()
{
return TransformRect(mLayer->GetVisibleRegion().GetBounds(), mLayer->GetLocalTransform());
}
nsIntRect OldTransformedBounds()
IntRect OldTransformedBounds()
{
return TransformRect(mVisibleRegion.GetBounds(), mTransform);
}
@ -189,7 +188,7 @@ struct LayerPropertiesBase : public LayerProperties
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
bool& aGeometryChanged)
{
return nsIntRect();
return IntRect();
}
nsRefPtr<Layer> mLayer;
@ -351,7 +350,7 @@ struct ColorLayerProperties : public LayerPropertiesBase
}
gfxRGBA mColor;
nsIntRect mBounds;
IntRect mBounds;
};
struct ImageLayerProperties : public LayerPropertiesBase
@ -373,7 +372,7 @@ struct ImageLayerProperties : public LayerPropertiesBase
if (!imageLayer->GetVisibleRegion().IsEqual(mVisibleRegion)) {
aGeometryChanged = true;
nsIntRect result = NewTransformedBounds();
IntRect result = NewTransformedBounds();
result = result.Union(OldTransformedBounds());
return result;
}
@ -389,7 +388,7 @@ struct ImageLayerProperties : public LayerPropertiesBase
// Mask layers have an empty visible region, so we have to
// use the image size instead.
IntSize size = container->GetCurrentSize();
nsIntRect rect(0, 0, size.width, size.height);
IntRect rect(0, 0, size.width, size.height);
return TransformRect(rect, mLayer->GetLocalTransform());
} else {
@ -397,7 +396,7 @@ struct ImageLayerProperties : public LayerPropertiesBase
}
}
return nsIntRect();
return IntRect();
}
nsRefPtr<ImageContainer> mContainer;
@ -466,7 +465,7 @@ LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFu
} else {
ClearInvalidations(aRoot);
}
nsIntRect result = TransformRect(aRoot->GetVisibleRegion().GetBounds(),
IntRect result = TransformRect(aRoot->GetVisibleRegion().GetBounds(),
aRoot->GetLocalTransform());
result = result.Union(OldTransformedBounds());
if (aGeometryChanged != nullptr) {
@ -484,7 +483,7 @@ LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFu
}
void
LayerPropertiesBase::MoveBy(const nsIntPoint& aOffset)
LayerPropertiesBase::MoveBy(const IntPoint& aOffset)
{
mTransform.PostTranslate(aOffset.x, aOffset.y, 0);
}

View File

@ -8,9 +8,9 @@
#include "nsRegion.h" // for nsIntRegion
#include "mozilla/UniquePtr.h" // for UniquePtr
#include "mozilla/gfx/Point.h"
class nsPresContext;
struct nsIntPoint;
namespace mozilla {
namespace layers {
@ -59,12 +59,11 @@ struct LayerProperties
* are invalidated.
* @return Painted area changed by the layer tree changes.
*/
virtual nsIntRegion ComputeDifferences(Layer* aRoot,
virtual nsIntRegion ComputeDifferences(Layer* aRoot,
NotifySubDocInvalidationFunc aCallback,
bool* aGeometryChanged = nullptr) = 0;
virtual void MoveBy(const nsIntPoint& aOffset) = 0;
virtual void MoveBy(const gfx::IntPoint& aOffset) = 0;
};
} // namespace layers

View File

@ -17,8 +17,6 @@
#include "nscore.h" // for nsACString, etc
struct gfxRGBA;
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace gfx {
@ -52,10 +50,6 @@ void
AppendToString(std::stringstream& aStream, const nsRect& r,
const char* pfx="", const char* sfx="");
void
AppendToString(std::stringstream& aStream, const nsIntPoint& p,
const char* pfx="", const char* sfx="");
template<class T>
void
AppendToString(std::stringstream& aStream, const mozilla::gfx::PointTyped<T>& p,
@ -72,10 +66,6 @@ AppendToString(std::stringstream& aStream, const mozilla::gfx::IntPointTyped<T>&
aStream << pfx << p << sfx;
}
void
AppendToString(std::stringstream& aStream, const nsIntRect& r,
const char* pfx="", const char* sfx="");
template<class T>
void
AppendToString(std::stringstream& aStream, const mozilla::gfx::RectTyped<T>& r,

View File

@ -9,14 +9,13 @@
#include <stdint.h> // for uint64_t
#include "Layers.h" // for Layer, etc
#include "gfxColor.h" // for gfxRGBA
#include "gfxRect.h" // for gfxRect
#include "mozilla/gfx/Rect.h" // for gfxRect
#include "mozilla/gfx/Point.h" // for gfxRect
#include "mozilla/mozalloc.h" // for operator delete
#include "nsAutoPtr.h" // for nsAutoPtr
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_ASSERTION
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsSize.h" // for nsIntSize
#include "nscore.h" // for nsACString
class gfxContext;
@ -61,14 +60,14 @@ public:
* first BeginUpdate after a SetUnknown will have the complete background.
*/
virtual already_AddRefed<gfxContext>
BeginUpdate(const nsIntRect& aRect, uint64_t aSequenceNumber) = 0;
BeginUpdate(const gfx::IntRect& aRect, uint64_t aSequenceNumber) = 0;
/**
* EndUpdate must be called immediately after BeginUpdate, without returning
* to the event loop.
* @param aContext the context returned by BeginUpdate
* Implicitly Restore()s the state of aContext.
*/
virtual void EndUpdate(gfxContext* aContext, const nsIntRect& aRect) = 0;
virtual void EndUpdate(gfxContext* aContext, const gfx::IntRect& aRect) = 0;
};
/**
@ -122,13 +121,13 @@ public:
* has its top-left at 0,0 and has size aSize.
* Can only be called while the sink is null!
*/
void SetSize(const nsIntSize& aSize)
void SetSize(const gfx::IntSize& aSize)
{
NS_ASSERTION(!mSink, "Should have no sink while changing size!");
mSize = aSize;
}
const nsIntSize& GetSize() { return mSize; }
nsIntRect GetRect() { return nsIntRect(nsIntPoint(0, 0), mSize); }
const gfx::IntSize& GetSize() { return mSize; }
gfx::IntRect GetRect() { return gfx::IntRect(gfx::IntPoint(0, 0), mSize); }
bool IsBackgroundKnown()
{
@ -180,7 +179,7 @@ protected:
uint64_t mSequenceCounter;
nsAutoPtr<ReadbackSink> mSink;
nsIntSize mSize;
gfx::IntSize mSize;
// This can refer to any (earlier) sibling PaintedLayer. That PaintedLayer
// must have mUsedForReadback set on it. If the PaintedLayer is removed

View File

@ -34,12 +34,12 @@ using namespace gfx;
namespace layers {
nsIntRect
IntRect
RotatedBuffer::GetQuadrantRectangle(XSide aXSide, YSide aYSide) const
{
// quadrantTranslation is the amount we translate the top-left
// of the quadrant by to get coordinates relative to the layer
nsIntPoint quadrantTranslation = -mBufferRotation;
IntPoint quadrantTranslation = -mBufferRotation;
quadrantTranslation.x += aXSide == LEFT ? mBufferRect.width : 0;
quadrantTranslation.y += aYSide == TOP ? mBufferRect.height : 0;
return mBufferRect + quadrantTranslation;
@ -89,8 +89,8 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
// render the buffer at mBufferRect + quadrantTranslation to get the
// pixels in the right place, but we're only going to paint within
// mBufferRect
nsIntRect quadrantRect = GetQuadrantRectangle(aXSide, aYSide);
nsIntRect fillRect;
IntRect quadrantRect = GetQuadrantRectangle(aXSide, aYSide);
IntRect fillRect;
if (!fillRect.IntersectRect(mBufferRect, quadrantRect))
return;
@ -241,11 +241,11 @@ RotatedContentBuffer::DrawTo(PaintedLayer* aLayer,
}
DrawTarget*
RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds,
RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const IntRect& aBounds,
ContextSource aSource,
DrawIterator* aIter)
{
nsIntRect bounds = aBounds;
IntRect bounds = aBounds;
if (aIter) {
// If an iterator was provided, then BeginPaint must have been run with
// PAINT_CAN_DRAW_ROTATED, and the draw region might cover multiple quadrants.
@ -254,7 +254,7 @@ RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds
// quadrants we have considered across multiple calls to this function.
aIter->mDrawRegion.SetEmpty();
while (aIter->mCount < 4) {
nsIntRect quadrant = GetQuadrantRectangle((aIter->mCount & 1) ? LEFT : RIGHT,
IntRect quadrant = GetQuadrantRectangle((aIter->mCount & 1) ? LEFT : RIGHT,
(aIter->mCount & 2) ? TOP : BOTTOM);
aIter->mDrawRegion.And(aBounds, quadrant);
aIter->mCount++;
@ -294,7 +294,7 @@ RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds
int32_t yBoundary = mBufferRect.YMost() - mBufferRotation.y;
XSide sideX = bounds.XMost() <= xBoundary ? RIGHT : LEFT;
YSide sideY = bounds.YMost() <= yBoundary ? BOTTOM : TOP;
nsIntRect quadrantRect = GetQuadrantRectangle(sideX, sideY);
IntRect quadrantRect = GetQuadrantRectangle(sideX, sideY);
NS_ASSERTION(quadrantRect.Contains(bounds), "Messed up quadrants");
mLoanedTransform = mLoanedDrawTarget->GetTransform();
@ -390,10 +390,10 @@ WrapRotationAxis(int32_t* aRotationPoint, int32_t aSize)
}
}
static nsIntRect
ComputeBufferRect(const nsIntRect& aRequestedRect)
static IntRect
ComputeBufferRect(const IntRect& aRequestedRect)
{
nsIntRect rect(aRequestedRect);
IntRect rect(aRequestedRect);
// Set a minimum width to guarantee a minimum size of buffers we
// allocate (and work around problems on some platforms with smaller
// dimensions). 64 is the magic number needed to work around the
@ -447,7 +447,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
SurfaceMode mode;
nsIntRegion neededRegion;
nsIntRect destBufferRect;
IntRect destBufferRect;
bool canReuseBuffer = HaveBuffer();
@ -464,7 +464,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
} else if (neededRegion.GetBounds().Size() <= mBufferRect.Size()) {
// The buffer's big enough but doesn't contain everything that's
// going to be visible. We'll move it.
destBufferRect = nsIntRect(neededRegion.GetBounds().TopLeft(), mBufferRect.Size());
destBufferRect = IntRect(neededRegion.GetBounds().TopLeft(), mBufferRect.Size());
} else {
destBufferRect = neededRegion.GetBounds();
}
@ -555,7 +555,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
FinalizeFrame(result.mRegionToDraw);
}
nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
IntRect drawBounds = result.mRegionToDraw.GetBounds();
RefPtr<DrawTarget> destDTBuffer;
RefPtr<DrawTarget> destDTBufferOnWhite;
uint32_t bufferFlags = 0;
@ -566,40 +566,38 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
if (!EnsureBuffer()) {
return result;
}
nsIntRect keepArea;
IntRect keepArea;
if (keepArea.IntersectRect(destBufferRect, mBufferRect)) {
// Set mBufferRotation so that the pixels currently in mDTBuffer
// will still be rendered in the right place when mBufferRect
// changes to destBufferRect.
nsIntPoint newRotation = mBufferRotation +
IntPoint newRotation = mBufferRotation +
(destBufferRect.TopLeft() - mBufferRect.TopLeft());
WrapRotationAxis(&newRotation.x, mBufferRect.width);
WrapRotationAxis(&newRotation.y, mBufferRect.height);
NS_ASSERTION(nsIntRect(nsIntPoint(0,0), mBufferRect.Size()).Contains(newRotation),
NS_ASSERTION(gfx::IntRect(gfx::IntPoint(0,0), mBufferRect.Size()).Contains(newRotation),
"newRotation out of bounds");
int32_t xBoundary = destBufferRect.XMost() - newRotation.x;
int32_t yBoundary = destBufferRect.YMost() - newRotation.y;
bool drawWrapsBuffer = (drawBounds.x < xBoundary && xBoundary < drawBounds.XMost()) ||
(drawBounds.y < yBoundary && yBoundary < drawBounds.YMost());
if ((drawWrapsBuffer && !(aFlags & PAINT_CAN_DRAW_ROTATED)) ||
(newRotation != nsIntPoint(0,0) && !canHaveRotation)) {
(newRotation != IntPoint(0,0) && !canHaveRotation)) {
// The stuff we need to redraw will wrap around an edge of the
// buffer (and the caller doesn't know how to support that), so
// move the pixels we can keep into a position that lets us
// redraw in just one quadrant.
if (mBufferRotation == nsIntPoint(0,0)) {
nsIntRect srcRect(nsIntPoint(0, 0), mBufferRect.Size());
nsIntPoint dest = mBufferRect.TopLeft() - destBufferRect.TopLeft();
if (mBufferRotation == IntPoint(0,0)) {
IntRect srcRect(IntPoint(0, 0), mBufferRect.Size());
IntPoint dest = mBufferRect.TopLeft() - destBufferRect.TopLeft();
MOZ_ASSERT(mDTBuffer);
mDTBuffer->CopyRect(IntRect(srcRect.x, srcRect.y, srcRect.width, srcRect.height),
IntPoint(dest.x, dest.y));
mDTBuffer->CopyRect(srcRect, dest);
if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
if (!EnsureBufferOnWhite()) {
return result;
}
MOZ_ASSERT(mDTBufferOnWhite);
mDTBufferOnWhite->CopyRect(IntRect(srcRect.x, srcRect.y, srcRect.width, srcRect.height),
IntPoint(dest.x, dest.y));
mDTBufferOnWhite->CopyRect(srcRect, dest);
}
result.mDidSelfCopy = true;
mDidSelfCopy = true;
@ -641,7 +639,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
result.mDidSelfCopy = true;
mDidSelfCopy = true;
mBufferRect = destBufferRect;
mBufferRotation = nsIntPoint(0, 0);
mBufferRotation = IntPoint(0, 0);
}
if (!result.mDidSelfCopy) {
@ -664,7 +662,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
// will be redrawn, so we don't need to copy anything, so we don't
// set destBuffer.
mBufferRect = destBufferRect;
mBufferRotation = nsIntPoint(0,0);
mBufferRotation = IntPoint(0,0);
}
} else {
// The buffer's not big enough, so allocate a new one
@ -687,7 +685,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
if (destDTBuffer) {
if (!isClear && (mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || HaveBufferOnWhite())) {
// Copy the bits
nsIntPoint offset = -destBufferRect.TopLeft();
IntPoint offset = -destBufferRect.TopLeft();
Matrix mat = Matrix::Translation(offset.x, offset.y);
destDTBuffer->SetTransform(mat);
if (!EnsureBuffer()) {
@ -711,9 +709,9 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
mDTBuffer = destDTBuffer.forget();
mDTBufferOnWhite = destDTBufferOnWhite.forget();
mBufferRect = destBufferRect;
mBufferRotation = nsIntPoint(0,0);
mBufferRotation = IntPoint(0,0);
}
NS_ASSERTION(canHaveRotation || mBufferRotation == nsIntPoint(0,0),
NS_ASSERTION(canHaveRotation || mBufferRotation == IntPoint(0,0),
"Rotation disabled, but we have nonzero rotation?");
nsIntRegion invalidate;
@ -758,7 +756,7 @@ RotatedContentBuffer::BorrowDrawTargetForPainting(PaintState& aPaintState,
return nullptr;
}
nsIntRegionRectIterator iter(*drawPtr);
const nsIntRect *iterRect;
const IntRect *iterRect;
while ((iterRect = iter.Next())) {
mDTBuffer->FillRect(Rect(iterRect->x, iterRect->y, iterRect->width, iterRect->height),
ColorPattern(Color(0.0, 0.0, 0.0, 1.0)));
@ -768,7 +766,7 @@ RotatedContentBuffer::BorrowDrawTargetForPainting(PaintState& aPaintState,
} else if (aPaintState.mContentType == gfxContentType::COLOR_ALPHA && HaveBuffer()) {
// HaveBuffer() => we have an existing buffer that we must clear
nsIntRegionRectIterator iter(*drawPtr);
const nsIntRect *iterRect;
const IntRect *iterRect;
while ((iterRect = iter.Next())) {
result->ClearRect(Rect(iterRect->x, iterRect->y, iterRect->width, iterRect->height));
}

View File

@ -16,8 +16,6 @@
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsRegion.h" // for nsIntRegion
#include "LayersTypes.h"
@ -50,8 +48,8 @@ class RotatedBuffer {
public:
typedef gfxContentType ContentType;
RotatedBuffer(const nsIntRect& aBufferRect,
const nsIntPoint& aBufferRotation)
RotatedBuffer(const gfx::IntRect& aBufferRect,
const gfx::IntPoint& aBufferRotation)
: mBufferRect(aBufferRect)
, mBufferRotation(aBufferRotation)
, mDidSelfCopy(false)
@ -81,8 +79,8 @@ public:
* RotatedBuffer covers. That is what DrawBufferWithRotation()
* will paint when it's called.
*/
const nsIntRect& BufferRect() const { return mBufferRect; }
const nsIntPoint& BufferRotation() const { return mBufferRotation; }
const gfx::IntRect& BufferRect() const { return mBufferRect; }
const gfx::IntPoint& BufferRotation() const { return mBufferRotation; }
virtual bool HaveBuffer() const = 0;
virtual bool HaveBufferOnWhite() const = 0;
@ -97,7 +95,7 @@ protected:
enum YSide {
TOP, BOTTOM
};
nsIntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide) const;
gfx::IntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide) const;
gfx::Rect GetSourceRectangle(XSide aXSide, YSide aYSide) const;
@ -114,7 +112,7 @@ protected:
const gfx::Matrix* aMaskTransform) const;
/** The area of the PaintedLayer that is covered by the buffer as a whole */
nsIntRect mBufferRect;
gfx::IntRect mBufferRect;
/**
* The x and y rotation of the buffer. Conceptually the buffer
* has its origin translated to mBufferRect.TopLeft() - mBufferRotation,
@ -125,7 +123,7 @@ protected:
* where items falling off the end of the buffer are returned to the
* buffer at the other end, not 2D rotation!
*/
nsIntPoint mBufferRotation;
gfx::IntPoint mBufferRotation;
// When this is true it means that all pixels have moved inside the buffer.
// It's not possible to sync with another buffer without a full copy.
bool mDidSelfCopy;
@ -135,8 +133,8 @@ class SourceRotatedBuffer : public RotatedBuffer
{
public:
SourceRotatedBuffer(gfx::SourceSurface* aSource, gfx::SourceSurface* aSourceOnWhite,
const nsIntRect& aBufferRect,
const nsIntPoint& aBufferRotation)
const gfx::IntRect& aBufferRect,
const gfx::IntPoint& aBufferRotation)
: RotatedBuffer(aBufferRect, aBufferRotation)
, mSource(aSource)
, mSourceOnWhite(aSourceOnWhite)
@ -310,7 +308,7 @@ public:
* will be used.
*/
virtual void
CreateBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags,
CreateBuffer(ContentType aType, const gfx::IntRect& aRect, uint32_t aFlags,
RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) = 0;
/**
@ -375,7 +373,7 @@ protected:
* draw target, if necessary.
*/
gfx::DrawTarget*
BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds,
BorrowDrawTargetForQuadrantUpdate(const gfx::IntRect& aBounds,
ContextSource aSource,
DrawIterator* aIter);

View File

@ -486,7 +486,7 @@ BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion,
// Sometimes the invalid region is larger than we want to draw.
nsIntRegion invalidRegionSafe;
invalidRegionSafe.And(aInvalidRegion, gfx::ThebesIntRect(intRect));
invalidRegionSafe.And(aInvalidRegion, intRect);
nsIntRect invalidRect = invalidRegionSafe.GetBounds();
mInvalidRect = IntRect(invalidRect.x, invalidRect.y, invalidRect.width, invalidRect.height);

View File

@ -14,7 +14,6 @@
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsRegion.h" // for nsIntRegion
#include "ReadbackProcessor.h"
@ -78,7 +77,7 @@ BasicContainerLayer::ComputeEffectiveTransforms(const Matrix4x4& aTransformToSur
}
bool
BasicContainerLayer::ChildrenPartitionVisibleRegion(const nsIntRect& aInRect)
BasicContainerLayer::ChildrenPartitionVisibleRegion(const gfx::IntRect& aInRect)
{
Matrix transform;
if (!GetEffectiveTransform().CanDraw2D(&transform) ||
@ -86,7 +85,7 @@ BasicContainerLayer::ChildrenPartitionVisibleRegion(const nsIntRect& aInRect)
return false;
nsIntPoint offset(int32_t(transform._31), int32_t(transform._32));
nsIntRect rect = aInRect.Intersect(GetEffectiveVisibleRegion().GetBounds() + offset);
gfx::IntRect rect = aInRect.Intersect(GetEffectiveVisibleRegion().GetBounds() + offset);
nsIntRegion covered;
for (Layer* l = mFirstChild; l; l = l->GetNextSibling()) {

View File

@ -12,7 +12,7 @@
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR
#include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE
struct nsIntRect;
#include "mozilla/gfx/Rect.h"
namespace mozilla {
namespace layers {
@ -77,7 +77,7 @@ public:
* This method can be conservative; it's OK to return false under any
* circumstances.
*/
bool ChildrenPartitionVisibleRegion(const nsIntRect& aInRect);
bool ChildrenPartitionVisibleRegion(const gfx::IntRect& aInRect);
void ForceIntermediateSurface() { mUseIntermediateSurface = true; }

View File

@ -18,7 +18,6 @@
#include "mozilla/layers/LayersMessages.h"
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsRect.h" // for nsIntRect
#include "LayersLogging.h"
namespace mozilla {
@ -424,12 +423,12 @@ ClientTiledPaintedLayer::RenderLayer()
// outside of our texture coords. Make the visible region a single rect,
// and pad it out by 1 pixel (restricted to tile boundaries) so that
// we always have valid content or transparent pixels to sample from.
nsIntRect bounds = neededRegion.GetBounds();
nsIntRect wholeTiles = bounds;
wholeTiles.InflateToMultiple(nsIntSize(
IntRect bounds = neededRegion.GetBounds();
IntRect wholeTiles = bounds;
wholeTiles.InflateToMultiple(IntSize(
gfxPlatform::GetPlatform()->GetTileWidth(),
gfxPlatform::GetPlatform()->GetTileHeight()));
nsIntRect padded = bounds;
IntRect padded = bounds;
padded.Inflate(1);
padded.IntersectRect(padded, wholeTiles);
neededRegion = padded;

View File

@ -17,7 +17,6 @@
#include "nsAString.h"
#include "nsRefPtr.h" // for nsRefPtr
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsString.h" // for nsAutoCString
#include "gfxVR.h"

View File

@ -14,7 +14,6 @@
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsRect.h" // for nsIntRect
#include "nscore.h" // for nsACString
struct nsIntPoint;
namespace mozilla {
namespace layers {

View File

@ -14,20 +14,18 @@
#include "mozilla/layers/CompositorTypes.h" // for DiagnosticFlags::COLOR
#include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
namespace mozilla {
namespace layers {
void
ColorLayerComposite::RenderLayer(const nsIntRect& aClipRect)
ColorLayerComposite::RenderLayer(const gfx::IntRect& aClipRect)
{
EffectChain effects(this);
GenEffectChain(effects);
nsIntRect boundRect = GetBounds();
gfx::IntRect boundRect = GetBounds();
LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(GetMaskLayer(),
effects);

View File

@ -11,9 +11,6 @@
#include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace layers {
@ -50,7 +47,7 @@ public:
virtual void Destroy() override { mDestroyed = true; }
virtual void RenderLayer(const nsIntRect& aClipRect) override;
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
virtual void CleanupResources() override {};
virtual void GenEffectChain(EffectChain& aEffect) override;

View File

@ -28,9 +28,6 @@
#include "nscore.h" // for nsACString
#include "Units.h" // for CSSToScreenScale
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace gfx {
class Matrix4x4;
@ -108,7 +105,7 @@ public:
virtual LayerRenderState GetRenderState() = 0;
virtual void SetPictureRect(const nsIntRect& aPictureRect)
virtual void SetPictureRect(const gfx::IntRect& aPictureRect)
{
MOZ_ASSERT(false, "Should have been overridden");
}

View File

@ -29,8 +29,6 @@
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsRegion.h" // for nsIntRegion
#include "nsTArray.h" // for nsAutoTArray
#include "TextRenderer.h" // for TextRenderer
@ -85,8 +83,8 @@ static void DrawLayerInfo(const RenderTargetIntRect& aClipRect,
uint32_t maxWidth = std::min<uint32_t>(visibleRegion.GetBounds().width, 500);
nsIntPoint topLeft = visibleRegion.GetBounds().TopLeft();
aManager->GetTextRenderer()->RenderText(ss.str().c_str(), gfx::IntPoint(topLeft.x, topLeft.y),
IntPoint topLeft = visibleRegion.GetBounds().TopLeft();
aManager->GetTextRenderer()->RenderText(ss.str().c_str(), topLeft,
aLayer->GetEffectiveTransform(), 16,
maxWidth);
}
@ -94,9 +92,7 @@ static void DrawLayerInfo(const RenderTargetIntRect& aClipRect,
template<class ContainerT>
static gfx::IntRect ContainerVisibleRect(ContainerT* aContainer)
{
nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
gfx::IntRect surfaceRect = gfx::IntRect(visibleRect.x, visibleRect.y,
visibleRect.width, visibleRect.height);
gfx::IntRect surfaceRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
return surfaceRect;
}
@ -137,7 +133,7 @@ struct PreparedLayer
template<class ContainerT> void
ContainerRenderVR(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect,
const gfx::IntRect& aClipRect,
gfx::VRHMDInfo* aHMD)
{
RefPtr<CompositingRenderTarget> surface;
@ -146,7 +142,7 @@ ContainerRenderVR(ContainerT* aContainer,
RefPtr<CompositingRenderTarget> previousTarget = compositor->GetCurrentRenderTarget();
nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
gfx::IntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
float opacity = aContainer->GetEffectiveOpacity();
@ -176,7 +172,7 @@ ContainerRenderVR(ContainerT* aContainer,
/**
* Render this container's contents.
*/
nsIntRect surfaceClipRect(0, 0, surfaceRect.width, surfaceRect.height);
gfx::IntRect surfaceClipRect(0, 0, surfaceRect.width, surfaceRect.height);
RenderTargetIntRect rtClipRect(0, 0, surfaceRect.width, surfaceRect.height);
for (uint32_t i = 0; i < children.Length(); i++) {
LayerComposite* layerToRender = static_cast<LayerComposite*>(children.ElementAt(i)->ImplData());
@ -352,7 +348,7 @@ RenderLayers(ContainerT* aContainer,
// intersect areas in different coordinate spaces. So we do this a little more permissively
// and only fill in the background when we know there is checkerboard, which in theory
// should only occur transiently.
nsIntRect layerBounds = layer->GetLayerBounds();
gfx::IntRect layerBounds = layer->GetLayerBounds();
EffectChain effectChain(layer);
effectChain.mPrimaryEffect = new EffectSolidColor(ToColor(color));
aManager->GetCompositor()->DrawQuad(gfx::Rect(layerBounds.x, layerBounds.y, layerBounds.width, layerBounds.height),
@ -365,12 +361,12 @@ RenderLayers(ContainerT* aContainer,
// Composer2D will compose this layer so skip GPU composition
// this time & reset composition flag for next composition phase
layerToRender->SetLayerComposited(false);
nsIntRect clearRect = layerToRender->GetClearRect();
gfx::IntRect clearRect = layerToRender->GetClearRect();
if (!clearRect.IsEmpty()) {
// Clear layer's visible rect on FrameBuffer with transparent pixels
gfx::Rect fbRect(clearRect.x, clearRect.y, clearRect.width, clearRect.height);
compositor->ClearRect(fbRect);
layerToRender->SetClearRect(nsIntRect(0, 0, 0, 0));
layerToRender->SetClearRect(gfx::IntRect(0, 0, 0, 0));
}
} else {
layerToRender->RenderLayer(RenderTargetPixel::ToUntyped(clipRect));
@ -445,7 +441,7 @@ CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer,
LayerManagerComposite* aManager)
{
Compositor* compositor = aManager->GetCompositor();
nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
gfx::IntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
RefPtr<CompositingRenderTarget> previousTarget = compositor->GetCurrentRenderTarget();
gfx::IntRect surfaceRect = gfx::IntRect(visibleRect.x, visibleRect.y,
visibleRect.width, visibleRect.height);
@ -465,7 +461,7 @@ CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer,
template<class ContainerT> void
RenderIntermediate(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect,
const gfx::IntRect& aClipRect,
RefPtr<CompositingRenderTarget> surface)
{
Compositor* compositor = aManager->GetCompositor();
@ -485,7 +481,7 @@ RenderIntermediate(ContainerT* aContainer,
template<class ContainerT> void
ContainerRender(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect)
const gfx::IntRect& aClipRect)
{
MOZ_ASSERT(aContainer->mPrepared);
@ -515,7 +511,7 @@ ContainerRender(ContainerT* aContainer,
float opacity = aContainer->GetEffectiveOpacity();
nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
gfx::IntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
#ifdef MOZ_DUMP_PAINTING
if (gfxUtils::sDumpPainting) {
RefPtr<gfx::DataSourceSurface> surf = surface->Dump(aManager->GetCompositor());
@ -614,7 +610,7 @@ ContainerLayerComposite::GetFirstChildComposite()
}
void
ContainerLayerComposite::RenderLayer(const nsIntRect& aClipRect)
ContainerLayerComposite::RenderLayer(const gfx::IntRect& aClipRect)
{
ContainerRender(this, mCompositeManager, aClipRect);
}
@ -665,7 +661,7 @@ RefLayerComposite::GetFirstChildComposite()
}
void
RefLayerComposite::RenderLayer(const nsIntRect& aClipRect)
RefLayerComposite::RenderLayer(const gfx::IntRect& aClipRect)
{
ContainerRender(this, mCompositeManager, aClipRect);
}

View File

@ -10,9 +10,7 @@
#include "mozilla/Attributes.h" // for override
#include "mozilla/UniquePtr.h" // for UniquePtr
#include "mozilla/layers/LayerManagerComposite.h"
struct nsIntPoint;
struct nsIntRect;
#include "mozilla/gfx/Rect.h"
namespace mozilla {
namespace layers {
@ -39,7 +37,7 @@ class ContainerLayerComposite : public ContainerLayer,
template<class ContainerT>
friend void RenderIntermediate(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect,
const gfx::IntRect& aClipRect,
RefPtr<CompositingRenderTarget> surface);
template<class ContainerT>
friend RefPtr<CompositingRenderTarget>
@ -77,7 +75,7 @@ public:
LayerComposite* GetFirstChildComposite() override;
virtual void RenderLayer(const nsIntRect& aClipRect) override;
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
virtual void Prepare(const RenderTargetIntRect& aClipRect) override;
virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override
@ -126,26 +124,26 @@ class RefLayerComposite : public RefLayer,
template<class ContainerT>
friend void ContainerRender(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect);
const gfx::IntRect& aClipRect);
template<class ContainerT>
friend void RenderLayers(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect);
const gfx::IntRect& aClipRect);
template<class ContainerT>
friend void RenderIntermediate(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect,
const gfx::IntRect& aClipRect,
RefPtr<CompositingRenderTarget> surface);
template<class ContainerT>
friend RefPtr<CompositingRenderTarget>
CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect);
const gfx::IntRect& aClipRect);
template<class ContainerT>
friend RefPtr<CompositingRenderTarget>
CreateTemporaryTarget(ContainerT* aContainer,
LayerManagerComposite* aManager,
const nsIntRect& aClipRect);
const gfx::IntRect& aClipRect);
public:
explicit RefLayerComposite(LayerManagerComposite *aManager);
@ -161,7 +159,7 @@ public:
LayerComposite* GetFirstChildComposite() override;
virtual void RenderLayer(const nsIntRect& aClipRect) override;
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
virtual void Prepare(const RenderTargetIntRect& aClipRect) override;
virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override

View File

@ -327,7 +327,7 @@ ContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData,
// Select only the pixels that are still within the buffer.
nsIntRegion finalRegion;
finalRegion.And(nsIntRect(nsIntPoint(), bufferSize), destRegion);
finalRegion.And(IntRect(IntPoint(), bufferSize), destRegion);
// For each of the overlap areas (right, bottom-right, bottom), select those
// pixels and wrap them around to the opposite edge of the buffer rect.

View File

@ -21,8 +21,6 @@
#include "nsRefPtr.h" // for nsRefPtr
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsString.h" // for nsAutoCString
namespace mozilla {
@ -82,7 +80,7 @@ ImageLayerComposite::GetLayer()
}
void
ImageLayerComposite::RenderLayer(const nsIntRect& aClipRect)
ImageLayerComposite::RenderLayer(const IntRect& aClipRect)
{
if (!mImageHost || !mImageHost->IsAttached()) {
return;

View File

@ -9,6 +9,7 @@
#include "GLTextureImage.h" // for TextureImage
#include "ImageLayers.h" // for ImageLayer
#include "mozilla/Attributes.h" // for override
#include "mozilla/gfx/Rect.h"
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
@ -16,9 +17,6 @@
#include "nscore.h" // for nsACString
#include "CompositableHost.h" // for CompositableHost
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace layers {
@ -54,7 +52,7 @@ public:
}
}
virtual void RenderLayer(const nsIntRect& aClipRect) override;
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
virtual void ComputeEffectiveTransforms(const mozilla::gfx::Matrix4x4& aTransformToSurface) override;

View File

@ -22,9 +22,6 @@
#include "nsRefPtr.h" // for nsRefPtr
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsMathUtils.h" // for NS_lround
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "nsSize.h" // for nsIntSize
#include "nsString.h" // for nsAutoCString
#include "TextRenderer.h"
#include "GeckoProfiler.h"
@ -114,7 +111,7 @@ PaintedLayerComposite::GetRenderState()
}
void
PaintedLayerComposite::RenderLayer(const nsIntRect& aClipRect)
PaintedLayerComposite::RenderLayer(const gfx::IntRect& aClipRect)
{
if (!mBuffer || !mBuffer->IsAttached()) {
return;

View File

@ -7,7 +7,7 @@
#define GFX_PaintedLayerComposite_H
#include "Layers.h" // for Layer (ptr only), etc
#include "gfxRect.h" // for gfxRect
#include "mozilla/gfx/Rect.h"
#include "mozilla/Attributes.h" // for override
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc
@ -16,9 +16,6 @@
#include "nsRegion.h" // for nsIntRegion
#include "nscore.h" // for nsACString
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace layers {
@ -57,7 +54,7 @@ public:
virtual TiledLayerComposer* GetTiledLayerComposer() override;
virtual void RenderLayer(const nsIntRect& aClipRect) override;
virtual void RenderLayer(const gfx::IntRect& aClipRect) override;
virtual void CleanupResources() override;

View File

@ -58,8 +58,6 @@
#define RECYCLE_LOG(...) do { } while (0)
#endif
struct nsIntPoint;
namespace mozilla {
namespace layers {

View File

@ -28,9 +28,9 @@
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
#include "nscore.h" // for nsACString
#include "mozilla/layers/AtomicRefCountedWithFinalize.h"
#include "mozilla/gfx/Rect.h"
class gfxReusableSurfaceWrapper;
struct nsIntRect;
namespace mozilla {
namespace gl {
@ -70,7 +70,7 @@ class BigImageIterator
public:
virtual void BeginBigImageIteration() = 0;
virtual void EndBigImageIteration() {};
virtual nsIntRect GetTileRect() = 0;
virtual gfx::IntRect GetTileRect() = 0;
virtual size_t GetTileCount() = 0;
virtual bool NextTile() = 0;
};

View File

@ -13,9 +13,9 @@
#include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL
#include "nsAString.h"
#include "nsDebug.h" // for NS_WARNING
#include "nsPoint.h" // for nsIntPoint
#include "nsPoint.h" // for IntPoint
#include "nsPrintfCString.h" // for nsPrintfCString
#include "nsRect.h" // for nsIntRect
#include "nsRect.h" // for IntRect
#include "nsSize.h" // for nsIntSize
#include "mozilla/layers/TiledContentClient.h"
@ -171,7 +171,7 @@ TiledLayerBufferComposite::Upload()
TileHost
TiledLayerBufferComposite::ValidateTile(TileHost aTile,
const nsIntPoint& aTileOrigin,
const IntPoint& aTileOrigin,
const nsIntRegion& aDirtyRect)
{
if (aTile.IsPlaceholderTile()) {
@ -465,7 +465,7 @@ TiledContentHost::RenderTile(const TileHost& aTile,
const gfx::Filter& aFilter,
const gfx::Rect& aClipRect,
const nsIntRegion& aScreenRegion,
const nsIntPoint& aTextureOffset,
const IntPoint& aTextureOffset,
const nsIntSize& aTextureBounds)
{
if (aTile.IsPlaceholderTile()) {
@ -477,7 +477,7 @@ TiledContentHost::RenderTile(const TileHost& aTile,
if (aBackgroundColor) {
aEffectChain.mPrimaryEffect = new EffectSolidColor(ToColor(*aBackgroundColor));
nsIntRegionRectIterator it(aScreenRegion);
for (const nsIntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) {
for (const IntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) {
Rect graphicsRect(rect->x, rect->y, rect->width, rect->height);
mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, 1.0, aTransform);
}
@ -507,7 +507,7 @@ TiledContentHost::RenderTile(const TileHost& aTile,
aEffectChain.mPrimaryEffect = effect;
nsIntRegionRectIterator it(aScreenRegion);
for (const nsIntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) {
for (const IntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) {
Rect graphicsRect(rect->x, rect->y, rect->width, rect->height);
Rect textureRect(rect->x - aTextureOffset.x, rect->y - aTextureOffset.y,
rect->width, rect->height);
@ -574,7 +574,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
uint32_t rowCount = 0;
uint32_t tileX = 0;
nsIntRect visibleRect = aVisibleRegion.GetBounds();
IntRect visibleRect = aVisibleRegion.GetBounds();
gfx::IntSize scaledTileSize = aLayerBuffer.GetScaledTileSize();
for (int32_t x = visibleRect.x; x < visibleRect.x + visibleRect.width;) {
rowCount++;
@ -592,17 +592,17 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
}
TileHost tileTexture = aLayerBuffer.
GetTile(nsIntPoint(aLayerBuffer.RoundDownToTileEdge(x, scaledTileSize.width),
aLayerBuffer.RoundDownToTileEdge(y, scaledTileSize.height)));
GetTile(IntPoint(aLayerBuffer.RoundDownToTileEdge(x, scaledTileSize.width),
aLayerBuffer.RoundDownToTileEdge(y, scaledTileSize.height)));
if (tileTexture != aLayerBuffer.GetPlaceholderTile()) {
nsIntRegion tileDrawRegion;
tileDrawRegion.And(nsIntRect(x, y, w, h), aLayerBuffer.GetValidRegion());
tileDrawRegion.And(IntRect(x, y, w, h), aLayerBuffer.GetValidRegion());
tileDrawRegion.And(tileDrawRegion, aVisibleRegion);
tileDrawRegion.Sub(tileDrawRegion, maskRegion);
if (!tileDrawRegion.IsEmpty()) {
tileDrawRegion.ScaleRoundOut(resolution, resolution);
nsIntPoint tileOffset((x - tileStartX) * resolution,
IntPoint tileOffset((x - tileStartX) * resolution,
(y - tileStartY) * resolution);
gfx::IntSize tileSize = aLayerBuffer.GetTileSize();
RenderTile(tileTexture, aBackgroundColor, aEffectChain, aOpacity, aTransform,

View File

@ -32,8 +32,6 @@
#endif
class gfxReusableSurfaceWrapper;
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace gfx {
@ -164,7 +162,7 @@ public:
protected:
TileHost ValidateTile(TileHost aTile,
const nsIntPoint& aTileRect,
const gfx::IntPoint& aTileRect,
const nsIntRegion& dirtyRect);
// do nothing, the desctructor in the texture host takes care of releasing resources
@ -291,7 +289,7 @@ private:
const gfx::Filter& aFilter,
const gfx::Rect& aClipRect,
const nsIntRegion& aScreenRegion,
const nsIntPoint& aTextureOffset,
const gfx::IntPoint& aTextureOffset,
const gfx::IntSize& aTextureBounds);
void EnsureTileStore() {}

View File

@ -1076,7 +1076,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion,
UINT offset = 0;
mContext->IASetVertexBuffers(0, 1, &buffer, &size, &offset);
nsIntRect intRect = nsIntRect(nsIntPoint(0, 0), mSize);
nsIntRect intRect = IntRect(IntPoint(0, 0), mSize);
// Sometimes the invalid region is larger than we want to draw.
nsIntRegion invalidRegionSafe;

View File

@ -132,7 +132,7 @@ SwapChainD3D9::PrepareForRendering()
}
void
SwapChainD3D9::Present(const nsIntRect &aRect)
SwapChainD3D9::Present(const gfx::IntRect &aRect)
{
RECT r;
r.left = aRect.x;

View File

@ -12,8 +12,7 @@
#include "nsTArray.h"
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/RefPtr.h"
struct nsIntRect;
#include "mozilla/gfx/Rect.h"
namespace mozilla {
namespace layers {
@ -102,7 +101,7 @@ public:
* This function will present the selected rectangle of the swap chain to
* its associated window.
*/
void Present(const nsIntRect &aRect);
void Present(const gfx::IntRect &aRect);
void Present();
private:

View File

@ -554,7 +554,7 @@ DataTextureSourceD3D9::GetTileRect(uint32_t aTileIndex) const
nsIntRect
DataTextureSourceD3D9::GetTileRect()
{
return ThebesIntRect(GetTileRect(mCurrentTile));
return GetTileRect(mCurrentTile);
}
CairoTextureClientD3D9::CairoTextureClientD3D9(ISurfaceAllocator* aAllocator,

View File

@ -15,9 +15,7 @@
#include "mozilla/layers/LayersTypes.h" // for LayersBackend
#include "mozilla/layers/TextureClient.h" // for TextureClient
#include "nsRegion.h" // for nsIntRegion
struct nsIntPoint;
struct nsIntRect;
#include "mozilla/gfx/Rect.h"
namespace mozilla {
namespace layers {
@ -79,7 +77,7 @@ public:
* Communicate the picture rect of a YUV image in aLayer to the compositor
*/
virtual void UpdatePictureRect(CompositableClient* aCompositable,
const nsIntRect& aRect) = 0;
const gfx::IntRect& aRect) = 0;
#ifdef MOZ_WIDGET_GONK
virtual void UseOverlaySource(CompositableClient* aCompositabl,

View File

@ -27,6 +27,7 @@
#include "mozilla/DebugOnly.h" // for DebugOnly
#include "mozilla/gfx/2D.h" // for DrawTarget
#include "mozilla/gfx/Point.h" // for IntSize
#include "mozilla/gfx/Rect.h" // for IntSize
#include "mozilla/ipc/Transport.h" // for Transport
#include "mozilla/layers/APZCTreeManager.h" // for APZCTreeManager
#include "mozilla/layers/APZThreadUtils.h" // for APZCTreeManager
@ -48,7 +49,6 @@
#include "nsDebug.h" // for NS_ASSERTION, etc
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsIWidget.h" // for nsIWidget
#include "nsRect.h" // for nsIntRect
#include "nsTArray.h" // for nsTArray
#include "nsThreadUtils.h" // for NS_IsMainThread
#include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop
@ -606,7 +606,7 @@ CompositorParent::RecvResume()
bool
CompositorParent::RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
const nsIntRect& aRect)
const gfx::IntRect& aRect)
{
RefPtr<DrawTarget> target = GetDrawTargetForDescriptor(aInSnapshot, gfx::BackendType::CAIRO);
ForceComposeToTarget(target, &aRect);
@ -977,7 +977,7 @@ CompositorParent::SetShadowProperties(Layer* aLayer)
}
void
CompositorParent::CompositeToTarget(DrawTarget* aTarget, const nsIntRect* aRect)
CompositorParent::CompositeToTarget(DrawTarget* aTarget, const gfx::IntRect* aRect)
{
profiler_tracing("Paint", "Composite", TRACING_INTERVAL_START);
PROFILER_LABEL("CompositorParent", "Composite",
@ -1072,7 +1072,7 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget, const nsIntRect* aRect)
}
void
CompositorParent::ForceComposeToTarget(DrawTarget* aTarget, const nsIntRect* aRect)
CompositorParent::ForceComposeToTarget(DrawTarget* aTarget, const gfx::IntRect* aRect)
{
PROFILER_LABEL("CompositorParent", "ForceComposeToTarget",
js::ProfileEntry::Category::GRAPHICS);
@ -1141,14 +1141,6 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
mRootLayerTreeID, aPaintSequenceNumber);
}
#ifdef DEBUG
if (aTransactionId <= mPendingTransaction) {
// Logging added to help diagnose why we're triggering the assert below.
// See bug 1145295
printf_stderr("CRASH: aTransactionId %" PRIu64 " <= mPendingTransaction %" PRIu64 "\n",
aTransactionId, mPendingTransaction);
}
#endif
MOZ_ASSERT(aTransactionId > mPendingTransaction);
mPendingTransaction = aTransactionId;
@ -1346,7 +1338,7 @@ CompositorParent::AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aB
// mWidget doesn't belong to the compositor thread, so it should be set to
// nullptr before returning from this method, to avoid accessing it elsewhere.
nsIntRect rect;
gfx::IntRect rect;
mWidget->GetClientBounds(rect);
InitializeLayerManager(aBackendHints);
mWidget = nullptr;
@ -1608,7 +1600,7 @@ public:
virtual bool RecvNotifyChildCreated(const uint64_t& child) override;
virtual bool RecvAdoptChild(const uint64_t& child) override { return false; }
virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
const nsIntRect& aRect) override
const gfx::IntRect& aRect) override
{ return true; }
virtual bool RecvFlushRendering() override { return true; }
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) override { return true; }

View File

@ -167,7 +167,7 @@ public:
virtual bool RecvNotifyChildCreated(const uint64_t& child) override;
virtual bool RecvAdoptChild(const uint64_t& child) override;
virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
const nsIntRect& aRect) override;
const gfx::IntRect& aRect) override;
virtual bool RecvFlushRendering() override;
virtual bool RecvGetTileSize(int32_t* aWidth, int32_t* aHeight) override;
@ -364,8 +364,8 @@ protected:
virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers) override;
virtual void ScheduleTask(CancelableTask*, int);
void CompositeCallback(TimeStamp aScheduleTime);
void CompositeToTarget(gfx::DrawTarget* aTarget, const nsIntRect* aRect = nullptr);
void ForceComposeToTarget(gfx::DrawTarget* aTarget, const nsIntRect* aRect = nullptr);
void CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect = nullptr);
void ForceComposeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect = nullptr);
void SetEGLSurfaceSize(int width, int height);

View File

@ -38,8 +38,6 @@
#include "mozilla/StaticPtr.h" // for StaticRefPtr
#include "mozilla/layers/TextureClient.h"
struct nsIntRect;
namespace mozilla {
namespace ipc {
class Shmem;
@ -149,7 +147,7 @@ ImageBridgeChild::UseOverlaySource(CompositableClient* aCompositable,
void
ImageBridgeChild::UpdatePictureRect(CompositableClient* aCompositable,
const nsIntRect& aRect)
const gfx::IntRect& aRect)
{
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->GetIPDLActor());

View File

@ -17,10 +17,9 @@
#include "mozilla/layers/PImageBridgeChild.h"
#include "nsDebug.h" // for NS_RUNTIMEABORT
#include "nsRegion.h" // for nsIntRegion
#include "mozilla/gfx/Rect.h"
class MessageLoop;
struct nsIntPoint;
struct nsIntRect;
namespace base {
class Thread;
@ -241,7 +240,7 @@ public:
* Communicate the picture rect of a YUV image in aLayer to the compositor
*/
virtual void UpdatePictureRect(CompositableClient* aCompositable,
const nsIntRect& aRect) override;
const gfx::IntRect& aRect) override;
virtual void UpdateTextureRegion(CompositableClient* aCompositable,

View File

@ -19,9 +19,9 @@ include "ImageLayers.h";
using mozilla::GraphicsFilterType from "mozilla/GfxMessageUtils.h";
using struct gfxRGBA from "gfxColor.h";
using struct mozilla::gfx::Point3D from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
using nscoord from "nsCoord.h";
using struct nsIntPoint from "nsPoint.h";
using struct nsRect from "nsRect.h";
using struct nsPoint from "nsPoint.h";
using class mozilla::TimeDuration from "mozilla/TimeStamp.h";
@ -47,7 +47,7 @@ namespace mozilla {
namespace layers {
struct TargetConfig {
nsIntRect naturalBounds;
IntRect naturalBounds;
ScreenRotation rotation;
ScreenOrientation orientation;
nsIntRegion clearRegion;
@ -72,8 +72,8 @@ struct OpAttachAsyncCompositable {
};
struct ThebesBufferData {
nsIntRect rect;
nsIntPoint rotation;
IntRect rect;
IntPoint rotation;
};
struct CubicBezierFunction {
@ -195,7 +195,7 @@ struct Animation {
// Change a layer's attributes
struct CommonLayerAttributes {
nsIntRect layerBounds;
IntRect layerBounds;
nsIntRegion visibleRegion;
EventRegions eventRegions;
TransformMatrix transform;
@ -241,8 +241,8 @@ struct ContainerLayerAttributes {
// cross process at some point by passing the HMDConfig
uint64_t hmdInfo;
};
struct ColorLayerAttributes { LayerColor color; nsIntRect bounds; };
struct CanvasLayerAttributes { GraphicsFilterType filter; nsIntRect bounds; };
struct ColorLayerAttributes { LayerColor color; IntRect bounds; };
struct CanvasLayerAttributes { GraphicsFilterType filter; IntRect bounds; };
struct RefLayerAttributes {
int64_t id;
// TODO: Once bug 1132895 is fixed we shouldn't need to propagate the override
@ -269,8 +269,8 @@ struct LayerAttributes {
// See nsIWidget Configurations
struct PluginWindowData {
uintptr_t windowId;
nsIntRect[] clip;
nsIntRect bounds;
IntRect[] clip;
IntRect bounds;
bool visible;
};
@ -348,7 +348,7 @@ struct OpPaintTextureRegion {
struct OpUpdatePictureRect {
PCompositable compositable;
nsIntRect picture;
IntRect picture;
};
/**

View File

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
using struct gfxPoint from "gfxPoint.h";
using struct nsIntRect from "nsRect.h";
using nsIntRegion from "nsRegion.h";
using struct mozilla::layers::MagicGrallocBufferHandle from "gfxipc/ShadowLayerUtils.h";
using struct mozilla::layers::GrallocBufferRef from "gfxipc/ShadowLayerUtils.h";
@ -11,6 +10,7 @@ using struct mozilla::layers::SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h";
using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using gfxImageFormat from "gfxTypes.h";

View File

@ -60,7 +60,7 @@ child:
* application on the widgets. Used on Windows and Linux in managing
* plugin widgets.
*/
async UpdatePluginConfigurations(nsIntPoint aContentOffset,
async UpdatePluginConfigurations(IntPoint aContentOffset,
nsIntRegion aVisibleRegion,
PluginWindowData[] aPlugins);
@ -95,7 +95,7 @@ parent:
//
// NB: this message will result in animations, transforms, effects,
// and so forth being interpolated. That's what we want to happen.
sync MakeSnapshot(SurfaceDescriptor inSnapshot, nsIntRect dirtyRect);
sync MakeSnapshot(SurfaceDescriptor inSnapshot, IntRect dirtyRect);
// Make sure any pending composites are started immediately and
// block until they are completed.

View File

@ -28,14 +28,11 @@
#include "mozilla/layers/TextureClient.h" // for TextureClient
#include "mozilla/mozalloc.h" // for operator new, etc
#include "nsAutoPtr.h" // for nsRefPtr, getter_AddRefs, etc
#include "nsRect.h" // for nsIntRect
#include "nsSize.h" // for nsIntSize
#include "nsTArray.h" // for nsAutoTArray, nsTArray, etc
#include "nsXULAppAPI.h" // for XRE_GetProcessType, etc
#include "mozilla/ReentrantMonitor.h"
struct nsIntPoint;
namespace mozilla {
namespace ipc {
class Shmem;
@ -62,7 +59,7 @@ public:
, mRotationChanged(false)
{}
void Begin(const nsIntRect& aTargetBounds, ScreenRotation aRotation,
void Begin(const gfx::IntRect& aTargetBounds, ScreenRotation aRotation,
dom::ScreenOrientation aOrientation)
{
mOpen = true;
@ -139,7 +136,7 @@ public:
EditVector mCset;
EditVector mPaints;
ShadowableLayerSet mMutants;
nsIntRect mTargetBounds;
gfx::IntRect mTargetBounds;
ScreenRotation mTargetRotation;
dom::ScreenOrientation mTargetOrientation;
bool mSwapRequired;
@ -185,7 +182,7 @@ ShadowLayerForwarder::~ShadowLayerForwarder()
}
void
ShadowLayerForwarder::BeginTransaction(const nsIntRect& aTargetBounds,
ShadowLayerForwarder::BeginTransaction(const gfx::IntRect& aTargetBounds,
ScreenRotation aRotation,
dom::ScreenOrientation aOrientation)
{
@ -354,7 +351,7 @@ ShadowLayerForwarder::UpdateTextureRegion(CompositableClient* aCompositable,
void
ShadowLayerForwarder::UpdatePictureRect(CompositableClient* aCompositable,
const nsIntRect& aRect)
const gfx::IntRect& aRect)
{
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->GetIPDLActor());

View File

@ -12,6 +12,7 @@
#include <stdint.h> // for uint64_t
#include "gfxTypes.h"
#include "mozilla/Attributes.h" // for override
#include "mozilla/gfx/Rect.h"
#include "mozilla/WidgetUtils.h" // for ScreenRotation
#include "mozilla/dom/ScreenOrientation.h" // for ScreenOrientation
#include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc
@ -22,9 +23,6 @@
#include "nsTArrayForwardDeclare.h" // for InfallibleTArray
#include "nsIWidget.h"
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace layers {
@ -170,7 +168,7 @@ public:
* Begin recording a transaction to be forwarded atomically to a
* LayerManagerComposite.
*/
void BeginTransaction(const nsIntRect& aTargetBounds,
void BeginTransaction(const gfx::IntRect& aTargetBounds,
ScreenRotation aRotation,
mozilla::dom::ScreenOrientation aOrientation);
@ -258,7 +256,7 @@ public:
* Communicate the picture rect of an image to the compositor
*/
void UpdatePictureRect(CompositableClient* aCompositable,
const nsIntRect& aRect) override;
const gfx::IntRect& aRect) override;
/**
* See CompositableForwarder::UseTexture

View File

@ -37,8 +37,8 @@ GLBlitTextureImageHelper::~GLBlitTextureImageHelper()
}
void
GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect& aSrcRect,
TextureImage *aDst, const nsIntRect& aDstRect)
GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const gfx::IntRect& aSrcRect,
TextureImage *aDst, const gfx::IntRect& aDstRect)
{
GLContext *gl = mCompositor->gl();
NS_ASSERTION(!aSrc->InUpdate(), "Source texture is in update!");
@ -61,8 +61,8 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect&
aDst->BeginBigImageIteration();
do {
// calculate portion of the tile that is going to be painted to
nsIntRect dstSubRect;
nsIntRect dstTextureRect = ThebesIntRect(aDst->GetTileRect());
gfx::IntRect dstSubRect;
gfx::IntRect dstTextureRect = aDst->GetTileRect();
dstSubRect.IntersectRect(aDstRect, dstTextureRect);
// this tile is not part of the destination rectangle aDstRect
@ -70,7 +70,7 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect&
continue;
// (*) transform the rect of this tile into the rectangle defined by aSrcRect...
nsIntRect dstInSrcRect(dstSubRect);
gfx::IntRect dstInSrcRect(dstSubRect);
dstInSrcRect.MoveBy(-aDstRect.TopLeft());
// ...which might be of different size, hence scale accordingly
dstInSrcRect.ScaleRoundOut(1.0f / blitScaleX, 1.0f / blitScaleY);
@ -83,8 +83,8 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect&
// now iterate over all tiles in the source Image...
do {
// calculate portion of the source tile that is in the source rect
nsIntRect srcSubRect;
nsIntRect srcTextureRect = ThebesIntRect(aSrc->GetTileRect());
gfx::IntRect srcSubRect;
gfx::IntRect srcTextureRect = aSrc->GetTileRect();
srcSubRect.IntersectRect(aSrcRect, srcTextureRect);
// this tile is not part of the source rect
@ -104,7 +104,7 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect&
// and the desired destination rectange
// in destination space.
// We need to transform this back into destination space, inverting the transform from (*)
nsIntRect srcSubInDstRect(srcSubRect);
gfx::IntRect srcSubInDstRect(srcSubRect);
srcSubInDstRect.MoveBy(-aSrcRect.TopLeft());
srcSubInDstRect.ScaleRoundOut(blitScaleX, blitScaleY);
srcSubInDstRect.MoveBy(aDstRect.TopLeft());

View File

@ -10,8 +10,7 @@
#include "mozilla/Attributes.h"
#include "GLContextTypes.h"
#include "GLConsts.h"
struct nsIntRect;
#include "mozilla/gfx/Rect.h"
namespace mozilla {
namespace gl {
@ -62,8 +61,8 @@ public:
* - active texture (will be 0)
* - texture 0 binding
*/
void BlitTextureImage(gl::TextureImage *aSrc, const nsIntRect& aSrcRect,
gl::TextureImage *aDst, const nsIntRect& aDstRect);
void BlitTextureImage(gl::TextureImage *aSrc, const gfx::IntRect& aSrcRect,
gl::TextureImage *aDst, const gfx::IntRect& aDstRect);
};
}

View File

@ -21,7 +21,6 @@
#include <string>
struct gfxRGBA;
struct nsIntRect;
namespace mozilla {
namespace layers {

View File

@ -22,7 +22,6 @@
#include "mozilla/layers/ISurfaceAllocator.h"
#include "mozilla/layers/YCbCrImageDataSerializer.h"
#include "mozilla/layers/GrallocTextureHost.h"
#include "nsPoint.h" // for nsIntPoint
#include "nsRegion.h" // for nsIntRegion
#include "AndroidSurfaceTexture.h"
#include "GfxTexturesReporter.h" // for GfxTexturesReporter
@ -258,7 +257,7 @@ TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
if (aDestRegion &&
!aSrcOffset &&
!aDestRegion->IsEqual(nsIntRect(0, 0, size.width, size.height))) {
!aDestRegion->IsEqual(gfx::IntRect(0, 0, size.width, size.height))) {
// UpdateFromDataSource will ignore our specified aDestRegion since the texture
// hasn't been allocated with glTexImage2D yet. Call Resize() to force the
// allocation (full size, but no upload), and then we'll only upload the pixels
@ -292,9 +291,9 @@ TextureImageTextureSourceOGL::EnsureBuffer(const nsIntSize& aSize,
}
void
TextureImageTextureSourceOGL::CopyTo(const nsIntRect& aSourceRect,
TextureImageTextureSourceOGL::CopyTo(const gfx::IntRect& aSourceRect,
DataTextureSource *aDest,
const nsIntRect& aDestRect)
const gfx::IntRect& aDestRect)
{
MOZ_ASSERT(aDest->AsSourceOGL(), "Incompatible destination type!");
TextureImageTextureSourceOGL *dest =
@ -341,9 +340,9 @@ TextureImageTextureSourceOGL::GetFormat() const
return gfx::SurfaceFormat::UNKNOWN;
}
nsIntRect TextureImageTextureSourceOGL::GetTileRect()
gfx::IntRect TextureImageTextureSourceOGL::GetTileRect()
{
return ThebesIntRect(mTexImage->GetTileRect());
return mTexImage->GetTileRect();
}
void

View File

@ -39,8 +39,6 @@
class gfxReusableSurfaceWrapper;
class nsIntRegion;
struct nsIntPoint;
struct nsIntRect;
namespace mozilla {
namespace gfx {
@ -204,9 +202,9 @@ public:
void EnsureBuffer(const gfx::IntSize& aSize,
gfxContentType aContentType);
void CopyTo(const nsIntRect& aSourceRect,
DataTextureSource* aDest,
const nsIntRect& aDestRect);
void CopyTo(const gfx::IntRect& aSourceRect,
DataTextureSource* aDest,
const gfx::IntRect& aDestRect);
virtual TextureImageTextureSourceOGL* AsTextureImageTextureSource() override { return this; }
@ -250,7 +248,7 @@ public:
mIterating = false;
}
virtual nsIntRect GetTileRect() override;
virtual gfx::IntRect GetTileRect() override;
virtual size_t GetTileCount() override
{

View File

@ -1300,7 +1300,7 @@ ResultChangeRegionForPrimitive(const FilterPrimitiveDescription& aDescription,
}
case PrimitiveType::Tile:
return ThebesIntRect(aDescription.PrimitiveSubregion());
return aDescription.PrimitiveSubregion();
case PrimitiveType::ConvolveMatrix:
{
@ -1384,7 +1384,7 @@ FilterSupport::ComputeResultChangeRegion(const FilterDescription& aFilter,
}
nsIntRegion changeRegion =
ResultChangeRegionForPrimitive(descr, inputChangeRegions);
changeRegion.And(changeRegion, ThebesIntRect(descr.PrimitiveSubregion()));
changeRegion.And(changeRegion, descr.PrimitiveSubregion());
resultChangeRegions.AppendElement(changeRegion);
}
@ -1459,7 +1459,7 @@ FilterSupport::PostFilterExtentsForPrimitive(const FilterPrimitiveDescription& a
region.Or(region, aInputExtents[1]);
}
if (coefficients[3] > 0.0f) {
region = ThebesIntRect(aDescription.PrimitiveSubregion());
region = aDescription.PrimitiveSubregion();
}
return region;
}
@ -1474,7 +1474,7 @@ FilterSupport::PostFilterExtentsForPrimitive(const FilterPrimitiveDescription& a
if (atts.GetColor(eFloodColor).a == 0.0f) {
return nsIntRect();
}
return ThebesIntRect(aDescription.PrimitiveSubregion());
return aDescription.PrimitiveSubregion();
}
case PrimitiveType::ColorMatrix:
@ -1482,7 +1482,7 @@ FilterSupport::PostFilterExtentsForPrimitive(const FilterPrimitiveDescription& a
if (atts.GetUint(eColorMatrixType) == (uint32_t)SVG_FECOLORMATRIX_TYPE_MATRIX) {
const nsTArray<float>& values = atts.GetFloats(eColorMatrixValues);
if (values.Length() == 20 && values[19] > 0.0f) {
return ThebesIntRect(aDescription.PrimitiveSubregion());
return aDescription.PrimitiveSubregion();
}
}
return aInputExtents[0];
@ -1493,7 +1493,7 @@ FilterSupport::PostFilterExtentsForPrimitive(const FilterPrimitiveDescription& a
AttributeMap functionAttributes =
atts.GetAttributeMap(eComponentTransferFunctionA);
if (ResultOfZeroUnderTransferFunction(functionAttributes) > 0.0f) {
return ThebesIntRect(aDescription.PrimitiveSubregion());
return aDescription.PrimitiveSubregion();
}
return aInputExtents[0];
}
@ -1501,7 +1501,7 @@ FilterSupport::PostFilterExtentsForPrimitive(const FilterPrimitiveDescription& a
case PrimitiveType::Turbulence:
case PrimitiveType::Image:
{
return ThebesIntRect(aDescription.PrimitiveSubregion());
return aDescription.PrimitiveSubregion();
}
case PrimitiveType::Morphology:
@ -1530,7 +1530,7 @@ FilterSupport::ComputePostFilterExtents(const FilterDescription& aFilter,
for (int32_t i = 0; i < int32_t(primitives.Length()); ++i) {
const FilterPrimitiveDescription& descr = primitives[i];
nsIntRegion filterSpace = ThebesIntRect(descr.FilterSpaceBounds());
nsIntRegion filterSpace = descr.FilterSpaceBounds();
nsTArray<nsIntRegion> inputExtents;
for (size_t j = 0; j < descr.NumberOfInputs(); j++) {
@ -1542,7 +1542,7 @@ FilterSupport::ComputePostFilterExtents(const FilterDescription& aFilter,
inputExtents.AppendElement(inputExtent);
}
nsIntRegion extent = PostFilterExtentsForPrimitive(descr, inputExtents);
extent.And(extent, ThebesIntRect(descr.PrimitiveSubregion()));
extent.And(extent, descr.PrimitiveSubregion());
postFilterExtents.AppendElement(extent);
}
@ -1664,7 +1664,7 @@ FilterSupport::ComputeSourceNeededRegions(const FilterDescription& aFilter,
for (int32_t i = primitives.Length() - 1; i >= 0; --i) {
const FilterPrimitiveDescription& descr = primitives[i];
nsIntRegion neededRegion = primitiveNeededRegions[i];
neededRegion.And(neededRegion, ThebesIntRect(descr.PrimitiveSubregion()));
neededRegion.And(neededRegion, descr.PrimitiveSubregion());
for (size_t j = 0; j < descr.NumberOfInputs(); j++) {
int32_t inputIndex = descr.InputPrimitiveIndex(j);
@ -1682,7 +1682,7 @@ FilterSupport::ComputeSourceNeededRegions(const FilterDescription& aFilter,
if (primitives.Length() > 0) {
const FilterPrimitiveDescription& firstDescr = primitives[0];
aSourceGraphicNeededRegion.And(aSourceGraphicNeededRegion,
ThebesIntRect(firstDescr.FilterSpaceBounds()));
firstDescr.FilterSpaceBounds());
}
}

View File

@ -10,8 +10,12 @@
#include "mozilla/gfx/BaseSize.h"
#include "mozilla/gfx/BasePoint.h"
#include "nsSize.h"
#include "mozilla/gfx/Point.h"
struct nsIntPoint;
// nsIntPoint represents a point in one of the types of pixels.
// Uses of nsIntPoint should eventually be converted to CSSIntPoint,
// LayoutDeviceIntPoint, etc. (see layout/base/Units.h).
typedef mozilla::gfx::IntPoint nsIntPoint;
// nsPoint represents a point in app units.
@ -35,19 +39,7 @@ struct nsPoint : public mozilla::gfx::BasePoint<nscoord, nsPoint> {
ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
};
// nsIntPoint represents a point in one of the types of pixels.
// Uses of nsIntPoint should eventually be converted to CSSIntPoint,
// LayoutDeviceIntPoint, etc. (see layout/base/Units.h).
struct nsIntPoint : public mozilla::gfx::BasePoint<int32_t, nsIntPoint> {
typedef mozilla::gfx::BasePoint<int32_t, nsIntPoint> Super;
nsIntPoint() : Super() {}
nsIntPoint(const nsIntPoint& aPoint) : Super(aPoint) {}
nsIntPoint(int32_t aX, int32_t aY) : Super(aX, aY) {}
inline nsPoint ToAppUnits(nscoord aAppUnitsPerPixel) const;
};
inline nsPoint ToAppUnits(const nsIntPoint& aPoint, nscoord aAppUnitsPerPixel);
inline nsIntPoint
nsPoint::ScaleToNearestPixels(float aXScale, float aYScale,
@ -78,10 +70,10 @@ nsPoint::ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const
// app units are integer multiples of pixels, so no rounding needed
inline nsPoint
nsIntPoint::ToAppUnits(nscoord aAppUnitsPerPixel) const
ToAppUnits(const nsIntPoint& aPoint, nscoord aAppUnitsPerPixel)
{
return nsPoint(NSIntPixelsToAppUnits(x, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(y, aAppUnitsPerPixel));
return nsPoint(NSIntPixelsToAppUnits(aPoint.x, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(aPoint.y, aAppUnitsPerPixel));
}
#endif /* NSPOINT_H */

View File

@ -15,6 +15,20 @@ static_assert((int(NS_SIDE_TOP) == 0) &&
(int(NS_SIDE_LEFT) == 3),
"The mozilla::css::Side sequence must match the nsMargin nscoord sequence");
nsRect
ToAppUnits(const nsIntRect& aRect, nscoord aAppUnitsPerPixel)
{
return nsRect(NSIntPixelsToAppUnits(aRect.x, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(aRect.y, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(aRect.width, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(aRect.height, aAppUnitsPerPixel));
}
const nsIntRect& GetMaxSizedIntRect() {
static const nsIntRect r(0, 0, INT32_MAX, INT32_MAX);
return r;
}
#ifdef DEBUG
// Diagnostics

View File

@ -13,18 +13,18 @@
#include "nsDebug.h" // for NS_WARNING
#include "gfxCore.h" // for NS_GFX
#include "mozilla/Likely.h" // for MOZ_UNLIKELY
#include "mozilla/gfx/BaseRect.h" // for BaseRect
#include "mozilla/gfx/NumericTools.h" // for RoundUpToMultiple, RoundDownToMultiple
#include "mozilla/gfx/Rect.h"
#include "nsCoord.h" // for nscoord, etc
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsPoint.h" // for nsIntPoint, nsPoint
#include "nsSize.h" // for nsIntSize, nsSize
#include "nscore.h" // for NS_BUILD_REFCNT_LOGGING
struct nsIntRect;
struct nsMargin;
struct nsIntMargin;
typedef mozilla::gfx::IntRect nsIntRect;
struct NS_GFX nsRect :
public mozilla::gfx::BaseRect<nscoord, nsRect, nsPoint, nsSize, nsMargin> {
typedef mozilla::gfx::BaseRect<nscoord, nsRect, nsPoint, nsSize, nsMargin> Super;
@ -179,56 +179,6 @@ struct NS_GFX nsRect :
}
};
struct NS_GFX nsIntRect :
public mozilla::gfx::BaseRect<int32_t, nsIntRect, nsIntPoint, nsIntSize, nsIntMargin> {
typedef mozilla::gfx::BaseRect<int32_t, nsIntRect, nsIntPoint, nsIntSize, nsIntMargin> Super;
// Constructors
nsIntRect() : Super()
{
}
nsIntRect(const nsIntRect& aRect) : Super(aRect)
{
}
nsIntRect(const nsIntPoint& aOrigin, const nsIntSize &aSize) : Super(aOrigin, aSize)
{
}
nsIntRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight) :
Super(aX, aY, aWidth, aHeight)
{
}
MOZ_WARN_UNUSED_RESULT inline nsRect
ToAppUnits(nscoord aAppUnitsPerPixel) const;
// Returns a special nsIntRect that's used in some places to signify
// "all available space".
static const nsIntRect& GetMaxSizedIntRect() {
static const nsIntRect r(0, 0, INT32_MAX, INT32_MAX);
return r;
}
void InflateToMultiple(const nsIntSize& aTileSize)
{
int32_t xMost = XMost();
int32_t yMost = YMost();
x = RoundDownToMultiple(x, aTileSize.width);
y = RoundDownToMultiple(y, aTileSize.height);
xMost = RoundUpToMultiple(xMost, aTileSize.width);
yMost = RoundUpToMultiple(yMost, aTileSize.height);
width = xMost - x;
height = yMost - y;
}
// This is here only to keep IPDL-generated code happy. DO NOT USE.
bool operator==(const nsIntRect& aRect) const
{
return IsEqualEdges(aRect);
}
};
/*
* App Unit/Pixel conversions
*/
@ -335,15 +285,11 @@ nsRect::ToInsidePixels(nscoord aAppUnitsPerPixel) const
return ScaleToInsidePixels(1.0f, 1.0f, aAppUnitsPerPixel);
}
const nsIntRect& GetMaxSizedIntRect();
// app units are integer multiples of pixels, so no rounding needed
inline nsRect
nsIntRect::ToAppUnits(nscoord aAppUnitsPerPixel) const
{
return nsRect(NSIntPixelsToAppUnits(x, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(y, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(width, aAppUnitsPerPixel),
NSIntPixelsToAppUnits(height, aAppUnitsPerPixel));
}
nsRect
ToAppUnits(const nsIntRect& aRect, nscoord aAppUnitsPerPixel);
#ifdef DEBUG
// Diagnostics

View File

@ -699,7 +699,7 @@ public:
RectIterator rgnIter(*this);
const Rect* currentRect;
while ((currentRect = rgnIter.Next())) {
nsRect appRect = currentRect->ToAppUnits(aAppUnitsPerPixel);
nsRect appRect = ::ToAppUnits(*currentRect, aAppUnitsPerPixel);
result.Or(result, appRect);
}
return result;

View File

@ -38,11 +38,6 @@ inline Rect ToRect(const nsIntRect &aRect)
return Rect(aRect.x, aRect.y, aRect.width, aRect.height);
}
inline IntRect ToIntRect(const nsIntRect &aRect)
{
return IntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
inline Color ToColor(const gfxRGBA &aRGBA)
{
return Color(Float(aRGBA.r), Float(aRGBA.g),
@ -71,9 +66,9 @@ inline Point ToPoint(const gfxPoint &aPoint)
return Point(Float(aPoint.x), Float(aPoint.y));
}
inline IntPoint ToIntPoint(const nsIntPoint &aPoint)
inline IntMargin ToIntMargin(const nsIntMargin& aMargin)
{
return IntPoint(aPoint.x, aPoint.y);
return IntMargin(aMargin.top, aMargin.right, aMargin.bottom, aMargin.left);
}
inline Size ToSize(const gfxSize &aSize)
@ -157,11 +152,6 @@ inline gfxRect ThebesRect(const Rect &aRect)
return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
inline nsIntRect ThebesIntRect(const IntRect &aRect)
{
return nsIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
inline gfxRGBA ThebesRGBA(const Color &aColor)
{
return gfxRGBA(aColor.r, aColor.g, aColor.b, aColor.a);

Some files were not shown because too many files have changed in this diff Show More