Closed Bug 1211324 Opened 9 years ago Closed 9 years ago

Remove GraphicsFilter

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

It should be possible to remove GraphicsFilter and replace all its uses with gfx::Filter. Though there's some weirdness that needs to be resolved first...
These aren't used meaningfully.
Attachment #8669500 - Flags: review?(matt.woodrow)
The conversions from GraphicsFilter to gfx::Filter and back (in ToFilter() and ThebesFilter()) are screwy:

- FILTER_NEAREST    <--> POINT
- FILTER_GOOD        --> GOOD   --> FILTER_BEST (not FILTER_GOOD!)
- FILTER_{FAST,BEST} --> LINEAR --> FILTER_BEST
- FILTER_FAST        --> LINEAR --> FILTER_BEST

Without knowing anything of the broader context, one way to fix it up might be the following:

- Make FILTER_GOOD <--> GOOD.

- Remove FILTER_FAST and replace it throughout with FILTER_BEST; even though
  that is conceptually weird it's what the current code effectively does.

Then there would be a 1-to-1 correspondence between GraphicsFilter and gfx::Filter and removing the former would be easy.

mattwoodrow: please tell me what I have gotten wrong about this :)
Flags: needinfo?(matt.woodrow)
Attachment #8669500 - Flags: review?(matt.woodrow) → review+
I agree, that sounds like the right plan of action.
Flags: needinfo?(matt.woodrow)
This may sound like an odd change but it's what the current code effectively
already does due to the way ToFilter() and ThebesFilter() are defined.
Attachment #8670039 - Flags: review?(matt.woodrow)
The conversion is as follows:

- GraphicsFilter::FILTER_NEAREST == gfx::Filter::POINT
- GraphicsFilter::FILTER_GOOD    == gfx::Filter::GOOD
- GraphicsFilter::FILTER_BEST    == gfx::Filter::LINEAR

Also typedef GraphicsFilter to gfx::Filter; this will be removed in the next
patch.

These changes mean ToFilter() and ThebesFilter() are no longer needed.
Attachment #8670045 - Flags: review?(matt.woodrow)
(In reply to Nicholas Nethercote [:njn] from comment #6)
> Created attachment 8670045 [details] [diff] [review]
> (part 4) - Replace GraphicsFilter constants with gfx::Filter equivalents
> 

After this patch, in nsLayoutUtils::GetGraphicsFilterForFrame() we end up using Filter::LINEAR for both NS_STYLE_IMAGE_RENDERING_OPTIMIZESPEED and NS_STYLE_IMAGE_RENDERING_OPTIMIZEQUALITY.

Maybe Filter::POINT would be better for the OPTIMIZESPEED case?
Attachment #8670035 - Flags: review?(matt.woodrow) → review+
(In reply to Nicholas Nethercote [:njn] from comment #7)
> (In reply to Nicholas Nethercote [:njn] from comment #6)
> > Created attachment 8670045 [details] [diff] [review]
> > (part 4) - Replace GraphicsFilter constants with gfx::Filter equivalents
> > 
> 
> After this patch, in nsLayoutUtils::GetGraphicsFilterForFrame() we end up
> using Filter::LINEAR for both NS_STYLE_IMAGE_RENDERING_OPTIMIZESPEED and
> NS_STYLE_IMAGE_RENDERING_OPTIMIZEQUALITY.
> 
> Maybe Filter::POINT would be better for the OPTIMIZESPEED case?

That sounds like the right thing to do. It's possible that it'll change rendering and make reftests fail, will need a try run.
Attachment #8670039 - Flags: review?(matt.woodrow) → review+
Attachment #8670045 - Flags: review?(matt.woodrow) → review+
Attachment #8670047 - Flags: review?(matt.woodrow) → review+
Thank you for the fast reviews.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: