Bug 1596513: Part 2: Allow for floating point dx/dy on feDropShadow attributes r=nical

WebRender expects drop shadow dx/dy to be in user space, which is a floating point value.
Before this, a dx/dy such as (0.2, 0.2) was truncated to (0, 0) resulting in no offset of the shadow.

Differential Revision: https://phabricator.services.mozilla.com/D63442

--HG--
extra : moz-landing-system : lando
This commit is contained in:
cbrewster 2020-02-28 17:10:17 +00:00
Родитель eed2534a96
Коммит ac38c6d0ab
4 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -80,10 +80,10 @@ FilterPrimitiveDescription SVGFEDropShadowElement::GetPrimitiveDescription(
return FilterPrimitiveDescription();
}
IntPoint offset(int32_t(aInstance->GetPrimitiveNumber(
SVGContentUtils::X, &mNumberAttributes[DX])),
int32_t(aInstance->GetPrimitiveNumber(
SVGContentUtils::Y, &mNumberAttributes[DY])));
Point offset(
aInstance->GetPrimitiveNumber(SVGContentUtils::X, &mNumberAttributes[DX]),
aInstance->GetPrimitiveNumber(SVGContentUtils::Y,
&mNumberAttributes[DY]));
DropShadowAttributes atts;
atts.mStdDeviation = Size(stdX, stdY);

Просмотреть файл

@ -989,8 +989,8 @@ static already_AddRefed<FilterNode> FilterNodeFromPrimitiveDescription(
RefPtr<FilterNode> alpha = FilterWrappers::ToAlpha(mDT, mSources[0]);
RefPtr<FilterNode> blur =
FilterWrappers::GaussianBlur(mDT, alpha, aDropShadow.mStdDeviation);
RefPtr<FilterNode> offsetBlur =
FilterWrappers::Offset(mDT, blur, aDropShadow.mOffset);
RefPtr<FilterNode> offsetBlur = FilterWrappers::Offset(
mDT, blur, IntPoint::Truncate(aDropShadow.mOffset));
RefPtr<FilterNode> flood = mDT->CreateFilter(FilterType::FLOOD);
if (!flood) {
return nullptr;
@ -1453,7 +1453,7 @@ static nsIntRegion ResultChangeRegionForPrimitive(
}
nsIntRegion operator()(const DropShadowAttributes& aDropShadow) {
IntPoint offset = aDropShadow.mOffset;
IntPoint offset = IntPoint::Truncate(aDropShadow.mOffset);
nsIntRegion offsetRegion =
mInputChangeRegions[0].MovedBy(offset.x, offset.y);
Size stdDeviation = aDropShadow.mStdDeviation;
@ -1833,7 +1833,7 @@ static nsIntRegion SourceNeededRegionForPrimitive(
}
nsIntRegion operator()(const DropShadowAttributes& aDropShadow) {
IntPoint offset = aDropShadow.mOffset;
IntPoint offset = IntPoint::Truncate(aDropShadow.mOffset);
nsIntRegion offsetRegion =
mResultNeededRegion.MovedBy(-nsIntPoint(offset.x, offset.y));
Size stdDeviation = aDropShadow.mStdDeviation;

Просмотреть файл

@ -212,7 +212,7 @@ struct GaussianBlurAttributes {
struct DropShadowAttributes {
Size mStdDeviation;
IntPoint mOffset;
Point mOffset;
Color mColor;
bool operator==(const DropShadowAttributes& aOther) const {

Просмотреть файл

@ -257,7 +257,7 @@ bool nsFilterInstance::BuildWebRenderFilters(nsIFrame* aFilteredFrame,
gsRGBToLinearRGBMap[uint8_t(color.b * 255)], color.a);
}
wr::Shadow wrShadow;
wrShadow.offset = {(float)shadow.mOffset.x, (float)shadow.mOffset.y};
wrShadow.offset = {shadow.mOffset.x, shadow.mOffset.y};
wrShadow.color = wr::ToColorF(ToDeviceColor(color));
wrShadow.blur_radius = stdDev.width;
wr::FilterOp filterOp = wr::FilterOp::DropShadow(wrShadow);