Bug 1090398 - Small refactoring that adds ParentLayerPixel::ToUntyped. r=botond

This commit is contained in:
Kartikaya Gupta 2014-11-14 07:40:14 -05:00
parent ce01ad7c02
commit 28d8e0fc7e
3 changed files with 20 additions and 17 deletions

View File

@ -20,7 +20,6 @@ template <typename T> struct ParamTraits;
} // namespace IPC
namespace mozilla {
namespace layers {
/**

View File

@ -216,11 +216,8 @@ ComputeTouchSensitiveRegion(GeckoContentController* aController,
// Not sure what rounding option is the most correct here, but if we ever
// figure it out we can change this. For now I'm rounding in to minimize
// the chances of getting a complex region.
ParentLayerIntRect roundedVisible = RoundedIn(visible);
nsIntRegion unobscured;
unobscured.Sub(nsIntRect(roundedVisible.x, roundedVisible.y,
roundedVisible.width, roundedVisible.height),
aObscured);
unobscured.Sub(ParentLayerIntRect::ToUntyped(RoundedIn(visible)), aObscured);
return unobscured;
}

View File

@ -27,18 +27,7 @@ struct LayoutDevicePixel;
struct LayerPixel;
struct RenderTargetPixel;
struct ScreenPixel;
// The layer coordinates of the parent frame.
// This can be arrived at in three ways:
// - Start with the CSS coordinates of the parent frame, multiply by the
// device scale and the cumulative resolution of the parent frame.
// - Start with the CSS coordinates of current frame, multiply by the device
// scale, the cumulative resolution of the current frame, and the scales
// from the CSS and async transforms of the current frame.
// - Start with global screen coordinates and unapply all CSS and async
// transforms from the root down to and including the parent.
// It's helpful to look at https://wiki.mozilla.org/Platform/GFX/APZ#Coordinate_systems
// to get a picture of how the various coordinate systems relate to each other.
struct ParentLayerPixel {};
struct ParentLayerPixel;
template<> struct IsPixel<CSSPixel> : TrueType {};
template<> struct IsPixel<LayoutDevicePixel> : TrueType {};
@ -339,6 +328,24 @@ struct ScreenPixel {
}
};
/* The layer coordinates of the parent frame.
* This can be arrived at in three ways:
* - Start with the CSS coordinates of the parent frame, multiply by the
* device scale and the cumulative resolution of the parent frame.
* - Start with the CSS coordinates of current frame, multiply by the device
* scale, the cumulative resolution of the current frame, and the scales
* from the CSS and async transforms of the current frame.
* - Start with global screen coordinates and unapply all CSS and async
* transforms from the root down to and including the parent.
* It's helpful to look at https://wiki.mozilla.org/Platform/GFX/APZ#Coordinate_systems
* to get a picture of how the various coordinate systems relate to each other.
*/
struct ParentLayerPixel {
static nsIntRect ToUntyped(const ParentLayerIntRect& aRect) {
return nsIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
};
// Operators to apply ScaleFactors directly to Coords, Points, Rects, Sizes and Margins
template<class src, class dst>