Closed Bug 1488555 Opened Last year Closed Last year

Support ImageRendering on video (NativeTexture external images)

Categories

(Core :: Graphics: WebRender, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox63 --- disabled
firefox64 --- fixed

People

(Reporter: h.winnemoeller, Assigned: h.winnemoeller)

References

Details

Attachments

(2 files, 2 obsolete files)

STR:
0. (only macOS) Set gfx.canvas.azure.accelerated to true. 
1. Be on a new profile and set gfx.webrender.all to true.
2. Create a video element.
3. Set the video's style to image-rendering: -moz-crisp-edges
4. Zoom the Page.

Expected Results:
Video is scaled using a nearest neighbour/pixelated filter algorithm. Content is pixelated.

Actual Results:
Video scaled using a linear filter algorithm. Content is blurry.

---

Bug 1452979 added the support for the ImageRendering CSS property on canvas (NativeTexture external images).

For video that uses NativeTexture external images, further changes are needed to support the CSS property. The CreateAsyncImageWebRenderCommands at https://searchfox.org/mozilla-central/rev/c3fef66a5b211ea8038c1c132706d02db408093a/gfx/layers/wr/WebRenderCommandBuilder.cpp#1509 needs the actual ImageRendering object.

I have attached an example (see "test video moz-crisp.zip") that toggles an video on mouseclick between auto and -moz-crisp-edges filtering and reproduces missing filtering on current WR.

I will attach a patch that applies the needed changes.
Depends on: 1452979
Blocks: 1488585
Mentor: h.winnemoeller
Mentor: h.winnemoeller
Assignee: nobody → h.winnemoeller
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment on attachment 9006392 [details] [diff] [review]
3-Bug_1488555___Use_ImageRendering_property_to_provide_proper_filtering_support_for_AsyncImage__r_nical.diff

Review of attachment 9006392 [details] [diff] [review]:
-----------------------------------------------------------------

Sorry for the pickiness on white spaces. Looks good otherwise.

::: gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ +1546,5 @@
>      return false;
>    }
>  
>    auto r = wr::ToRoundedLayoutRect(aRect);
> +  

nit: trailing space.

::: layout/painting/nsCSSRenderingBorders.cpp
@@ +3726,5 @@
>        if (!container) {
>          return;
>        }
>  
> +	  mozilla::wr::ImageRendering rendering = wr::ToImageRendering(

nit: indentation is off (there's a tab)

::: layout/painting/nsImageRenderer.cpp
@@ +628,5 @@
>          NS_WARNING("Failed to get image container");
>          return ImgDrawResult::NOT_READY;
>        }
>  
> +	  mozilla::wr::ImageRendering rendering = wr::ToImageRendering(

nit: indentation is off (there's a tab)
Attachment #9006392 - Flags: review?(nical.bugzilla) → review+
Keywords: checkin-needed
Henrik, there were conflicts applying your patch. Please fix and attach the new version.
Flags: needinfo?(h.winnemoeller)
Ok, I will rebase again.
Flags: needinfo?(h.winnemoeller)
Keywords: checkin-needed
Keywords: checkin-needed
Pushed by apavel@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/723580244cfb
Use ImageRendering property to provide proper filtering support for AsyncImage. r=nical
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/723580244cfb
Status: ASSIGNED → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in before you can comment on or make changes to this bug.