Closed Bug 121015 Opened 24 years ago Closed 23 years ago

New server side image scaling code for gtk

Categories

(Core :: XUL, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla0.9.9

People

(Reporter: tor, Assigned: tor)

References

Details

(Keywords: memory-footprint, perf)

Attachments

(1 file, 6 obsolete files)

I've been looking at image scaling on the gtk platform both in regards to the horrible scrolling performance of scaled images (bug 82278) and trying to get rid of the client side copy of images on the gtk platform. This new implementation of image scaling for the gtk platform uses standard Xlib/gdk to perform image scaling on the server side image copy. Additionally this new code checks the size of the underlying drawing surface to minimize the work it needs to do. This helps tremendously with scrolling, where now we only do the work needed for the dirty region. Summary: Old code: * create client side 24bpp temporary size of entire scaled image * hand scale entire image * dither/putimage entire image (unless gdk is doing something smart behind our back) New code: * create server side platform depth temporary size of visible dirty region (if scaling in both directions) * visibleWidth+visibleHeight single pixel wide or high CopyAreas (less if scaling in only one direction) If we get desperate for memory, the math can be tweaked slightly to eliminate the need for a temporary scratchpad if scaling up in the vertical direction. There are, as you might expect, some drawbacks. We're now scaling the dithered, color reduced image. Doesn't change the output for 24-bpp displays, isn't noticeable on 16-bpp (at least, on the images I tested on), but will suck visually on 1- and 8-bpp devices. Are we willing to sacrifice quality for performance on that segment of users? The first person to say "pref it" gets to write the code and convince mpt that it's a good idea and deserves space in a pref panel. :)
Attached patch server side image scaling (obsolete) — Splinter Review
Attachment #65838 - Attachment is obsolete: true
Does this patch also fix issues mentioned in bug 77334 ?
Attachment #68232 - Attachment is obsolete: true
Attached patch DrawToImage() must die... (obsolete) — Splinter Review
Attachment #68719 - Attachment is obsolete: true
If we "sacrify" 1bit and 8bit support then we will sacrify our support for embedded devices as well - which are usually monocrome or 8bit color devices. I doubt we want this (our <=8bit support is already very bad compared to what NS4.x can do (NS4.x can dynamically change the palette, Mozilla's code doesn't do this...)) ... What about splitting the code into a optimised 16bit/24bit path and one optimised <=8bit code path ?
Attachment #68753 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.9
Attached patch merge to tip (obsolete) — Splinter Review
Attachment #69863 - Attachment is obsolete: true
I've been running with this in my tree for a few days now without seeing any problems (and at least one page with a scaled animated GIF is significantly more responsive -- nice).
I've been running with this patch too, no problems so far good work
Okay, I should have kept my mouth shut because now I found a problem. :) With the patch in my tree, resource:///res/samples/gear1.gif yields one or two frames and then completely stops animating (stops using any CPU either). That's with or without scaling. I tried with-patch, without-patch, with-patch, without-patch again and the problem is there consistantly with the patch applied. No problem without patch. Hm.
Attachment #70684 - Attachment is obsolete: true
Comment on attachment 70744 [details] [diff] [review] handle DrawToImage() updates differently looks good to me as well. r=pavlov
Attachment #70744 - Flags: review+
Yayyy, that fixes the problem. Everything is good.
Comment on attachment 70744 [details] [diff] [review] handle DrawToImage() updates differently sr=blizzard
Attachment #70744 - Flags: superreview+
a=asa (on behalf of drivers) for checkin to 0.9.9
Keywords: mozilla0.9.9+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
*** Bug 82278 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: