зеркало из https://github.com/mozilla/gecko-dev.git
Bug 880676 - Move the RoundToInt functions to be standalone in the gfx headers. r=BenWa
This commit is contained in:
Родитель
2743f68fed
Коммит
ddc341ee0a
|
@ -61,6 +61,12 @@ struct PointTyped :
|
|||
};
|
||||
typedef PointTyped<UnknownUnits> Point;
|
||||
|
||||
template<class units>
|
||||
IntPointTyped<units> RoundedToInt(const PointTyped<units>& aPoint) {
|
||||
return IntPointTyped<units>(NS_lround(aPoint.x),
|
||||
NS_lround(aPoint.y));
|
||||
}
|
||||
|
||||
template<class units>
|
||||
struct IntSizeTyped :
|
||||
public BaseSize< int32_t, IntSizeTyped<units> >,
|
||||
|
|
|
@ -100,6 +100,15 @@ struct RectTyped :
|
|||
};
|
||||
typedef RectTyped<UnknownUnits> Rect;
|
||||
|
||||
template<class units>
|
||||
IntRectTyped<units> RoundedToInt(const RectTyped<units>& aRect)
|
||||
{
|
||||
return IntRectTyped<units>(NS_lround(aRect.x),
|
||||
NS_lround(aRect.y),
|
||||
NS_lround(aRect.width),
|
||||
NS_lround(aRect.height));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -658,7 +658,7 @@ nsEventStatus AsyncPanZoomController::OnLongPress(const TapGestureInput& aEvent)
|
|||
WidgetSpaceToCompensatedViewportSpace(
|
||||
gfx::Point(aEvent.mPoint.x, aEvent.mPoint.y),
|
||||
resolution));
|
||||
mGeckoContentController->HandleLongTap(CSSIntPoint::RoundToInt(point));
|
||||
mGeckoContentController->HandleLongTap(gfx::RoundedToInt(point));
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
return nsEventStatus_eIgnore;
|
||||
|
@ -677,7 +677,7 @@ nsEventStatus AsyncPanZoomController::OnSingleTapConfirmed(const TapGestureInput
|
|||
WidgetSpaceToCompensatedViewportSpace(
|
||||
gfx::Point(aEvent.mPoint.x, aEvent.mPoint.y),
|
||||
resolution));
|
||||
mGeckoContentController->HandleSingleTap(CSSIntPoint::RoundToInt(point));
|
||||
mGeckoContentController->HandleSingleTap(gfx::RoundedToInt(point));
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
return nsEventStatus_eIgnore;
|
||||
|
@ -693,7 +693,7 @@ nsEventStatus AsyncPanZoomController::OnDoubleTap(const TapGestureInput& aEvent)
|
|||
WidgetSpaceToCompensatedViewportSpace(
|
||||
gfx::Point(aEvent.mPoint.x, aEvent.mPoint.y),
|
||||
resolution));
|
||||
mGeckoContentController->HandleDoubleTap(CSSIntPoint::RoundToInt(point));
|
||||
mGeckoContentController->HandleDoubleTap(gfx::RoundedToInt(point));
|
||||
}
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
|
|
|
@ -43,13 +43,6 @@ typedef gfx::IntRectTyped<ScreenPixel> ScreenIntRect;
|
|||
*/
|
||||
struct CSSPixel {
|
||||
|
||||
// Operations within CSS units
|
||||
|
||||
static CSSIntPoint RoundToInt(const CSSPoint& aPoint) {
|
||||
return CSSIntPoint(NS_lround(aPoint.x),
|
||||
NS_lround(aPoint.y));
|
||||
}
|
||||
|
||||
// Conversions from app units
|
||||
|
||||
static CSSPoint FromAppUnits(const nsPoint& aPoint) {
|
||||
|
@ -106,15 +99,6 @@ struct CSSPixel {
|
|||
*/
|
||||
struct LayerPixel {
|
||||
|
||||
// Operations within layer units
|
||||
|
||||
static LayerIntRect RoundToInt(const LayerRect& aRect) {
|
||||
return LayerIntRect(NS_lround(aRect.x),
|
||||
NS_lround(aRect.y),
|
||||
NS_lround(aRect.width),
|
||||
NS_lround(aRect.height));
|
||||
}
|
||||
|
||||
// Conversions from CSS units
|
||||
|
||||
static LayerPoint FromCSSPoint(const CSSPoint& aPoint, float aResolutionX, float aResolutionY) {
|
||||
|
@ -135,7 +119,7 @@ struct LayerPixel {
|
|||
}
|
||||
|
||||
static LayerIntRect FromCSSRectRounded(const CSSRect& aRect, float aResolutionX, float aResolutionY) {
|
||||
return RoundToInt(FromCSSRect(aRect, aResolutionX, aResolutionY));
|
||||
return gfx::RoundedToInt(FromCSSRect(aRect, aResolutionX, aResolutionY));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -939,7 +939,7 @@ AndroidGeckoLayerClient::SyncFrameMetrics(const ScreenPoint& aScrollOffset, floa
|
|||
// convert the displayport rect from scroll-relative CSS pixels to document-relative device pixels
|
||||
LayerRect dpUnrounded = LayerRect::FromCSSRect(aDisplayPort, aDisplayResolution, aDisplayResolution);
|
||||
dpUnrounded += LayerPoint::FromUnknownPoint(aScrollOffset.ToUnknownPoint());
|
||||
LayerIntRect dp = LayerRect::RoundToInt(dpUnrounded);
|
||||
LayerIntRect dp = gfx::RoundedToInt(dpUnrounded);
|
||||
|
||||
jobject viewTransformJObj = env->CallObjectMethod(wrapped_obj, jSyncFrameMetricsMethod,
|
||||
aScrollOffset.x, aScrollOffset.y, aZoom,
|
||||
|
|
Загрузка…
Ссылка в новой задаче