Bug 1370682 - Allow passing in LayoutDeviceSize to wr::ToBorderRadius for convenience. r=jrmuizel,mstange

There's no real reason to restrict this to LayerSize, since we use
use Layer and LayoutDevice coordinate spaces interchangeably for
webrender. With the templating of the function the compiler doesn't know
what type to use for {0, 0} so I added a new function to deal with that.

MozReview-Commit-ID: KyabB6P6LiA

--HG--
extra : rebase_source : d5fff8f21a17c433d3c8c580fdd3153140d61545
This commit is contained in:
Kartikaya Gupta 2017-08-09 19:19:03 -04:00
parent a824d7cc43
commit 9d778bce61
2 changed files with 11 additions and 4 deletions

View File

@ -354,8 +354,15 @@ static inline wr::BorderRadius ToUniformBorderRadius(const mozilla::LayerSize& a
return br;
}
static inline wr::BorderRadius ToBorderRadius(const mozilla::LayerSize& topLeft, const mozilla::LayerSize& topRight,
const mozilla::LayerSize& bottomLeft, const mozilla::LayerSize& bottomRight)
static inline wr::BorderRadius EmptyBorderRadius()
{
wr::BorderRadius br;
memset(&br, 0, sizeof(br));
}
template<class T>
static inline wr::BorderRadius ToBorderRadius(const gfx::SizeTyped<T>& topLeft, const gfx::SizeTyped<T>& topRight,
const gfx::SizeTyped<T>& bottomLeft, const gfx::SizeTyped<T>& bottomRight)
{
wr::BorderRadius br;
br.top_left = ToLayoutSize(topLeft);

View File

@ -7449,7 +7449,7 @@ BCBlockDirSeg::CreateWebRenderCommands(BCPaintBorderIterator& aIter,
}
wrSide[eSideLeft] = wr::ToBorderSide(ToDeviceColor(param->mBorderColor), param->mBorderStyle);
wr::BorderRadius borderRadii = wr::ToBorderRadius( {0, 0}, {0, 0}, {0, 0}, {0, 0} );
wr::BorderRadius borderRadii = wr::EmptyBorderRadius();
// All border style is set to none except left side. So setting the widths of
// each side to width of rect is fine.
@ -7707,7 +7707,7 @@ BCInlineDirSeg::CreateWebRenderCommands(BCPaintBorderIterator& aIter,
}
wrSide[eSideTop] = wr::ToBorderSide(ToDeviceColor(param->mBorderColor), param->mBorderStyle);
wr::BorderRadius borderRadii = wr::ToBorderRadius( {0, 0}, {0, 0}, {0, 0}, {0, 0} );
wr::BorderRadius borderRadii = wr::EmptyBorderRadius();
// All border style is set to none except top side. So setting the widths of
// each side to height of rect is fine.