mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1257288 - Move IntersectMaybeRects() to gfx/2d/Rect.h. r=kats
MozReview-Commit-ID: C99GwsLN7Zg --HG-- extra : rebase_source : e12db0995ec0f1ffc30e0f01b8c85081236b405c
This commit is contained in:
parent
5fcf95430d
commit
0b5440e37a
@ -11,6 +11,7 @@
|
||||
#include "NumericTools.h"
|
||||
#include "Point.h"
|
||||
#include "Tools.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
@ -244,6 +245,21 @@ RectTyped<units> IntRectToRect(const IntRectTyped<units>& aRect)
|
||||
return RectTyped<units>(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
|
||||
// Convenience function for intersecting two IntRects wrapped in Maybes.
|
||||
template <typename Units>
|
||||
Maybe<IntRectTyped<Units>>
|
||||
IntersectMaybeRects(const Maybe<IntRectTyped<Units>>& a,
|
||||
const Maybe<IntRectTyped<Units>>& b)
|
||||
{
|
||||
if (!a) {
|
||||
return b;
|
||||
} else if (!b) {
|
||||
return a;
|
||||
} else {
|
||||
return Some(a->Intersect(*b));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -782,20 +782,6 @@ MoveScrollbarForLayerMargin(Layer* aRoot, FrameMetrics::ViewID aRootScrollId,
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename Units>
|
||||
Maybe<IntRectTyped<Units>>
|
||||
IntersectMaybeRects(const Maybe<IntRectTyped<Units>>& a,
|
||||
const Maybe<IntRectTyped<Units>>& b)
|
||||
{
|
||||
if (!a) {
|
||||
return b;
|
||||
} else if (!b) {
|
||||
return a;
|
||||
} else {
|
||||
return Some(a->Intersect(*b));
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
|
||||
bool* aOutFoundRoot,
|
||||
|
@ -197,19 +197,6 @@ LayerManagerComposite::BeginTransactionWithDrawTarget(DrawTarget* aTarget, const
|
||||
mTargetBounds = aRect;
|
||||
}
|
||||
|
||||
template<typename RectType>
|
||||
Maybe<RectType>
|
||||
IntersectMaybeRects(const Maybe<RectType>& aRect1, const Maybe<RectType>& aRect2)
|
||||
{
|
||||
if (aRect1) {
|
||||
if (aRect2) {
|
||||
return Some(aRect1->Intersect(*aRect2));
|
||||
}
|
||||
return aRect1;
|
||||
}
|
||||
return aRect2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get accumulated transform of from the context creating layer to the
|
||||
* given layer.
|
||||
|
Loading…
Reference in New Issue
Block a user