Closed Bug 1130802 Opened 10 years ago Closed 10 years ago

Make downscale-during-decode prefer decoded surfaces when substituting surfaces

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38
Tracking Status
firefox38 --- fixed

People

(Reporter: seth, Assigned: seth)

References

Details

Attachments

(1 file, 1 obsolete file)

Testing downscale-during-decode on the Flame, where I was using pinch-to-zoom instead of click-to-zoom, made me realize that downscale-during-decode should always prefer to substitute a fully-decoded version of a surface if it has to substitute surfaces. Otherwise, you can end up in a situation where the surface is you're substituting is *also* undecoded or mostly undecoded, and you'll end up looking at a black screen for a second until the decoder catches up. That's not the experience we want; we want to be putting *something* on the screen whenever possible. In this bug I'll make TryToImproveMatch always prefer completely decoded surfaces when one is available.
Here's the patch.
Attachment #8560946 - Flags: review?(dholbert)
Tweaked the logic.
Attachment #8560948 - Flags: review?(dholbert)
Attachment #8560946 - Attachment is obsolete: true
Attachment #8560946 - Flags: review?(dholbert)
Comment on attachment 8560948 [details] [diff] [review] Always prefer decoded surfaces when substituting surfaces for downscale-during-decode >+ // Always prefer completely decoded surfaces. >+ bool bestMatchIsDecoded = context->mBestMatch->IsDecoded(); >+ if (bestMatchIsDecoded && !aSurface->IsDecoded()) { >+ return PL_DHASH_NEXT; >+ } >+ if (!bestMatchIsDecoded && aSurface->IsDecoded()) { >+ context->mBestMatch = aSurface; >+ return PL_DHASH_NEXT; >+ } This might be better structured with a "bestMatchIsDecoded != aSurface->IsDecoded()" check, to reduce calls to IsDecoded(), return statements, and (non-comment) lines of code. Something like: if (bestMatchIsDecoded != aSurface->IsDecoded()) { if (!bestMatchIsDecoded) { // aSurface is decoded & best match so far is not. Prefer aSurface. context->mBestMatch = aSurface; } // else, best match is decoded & aSurface isn't. Skip aSurface. return PL_DHASH_NEXT; } r=me with that if you agree. (Probably r=me if you disagree too, but I'd be curious why)
Attachment #8560948 - Flags: review?(dholbert) → review+
Thanks for the review! (In reply to Daniel Holbert [:dholbert] from comment #3) > This might be better structured with a "bestMatchIsDecoded != > aSurface->IsDecoded()" check, to reduce calls to IsDecoded(), return > statements, and (non-comment) lines of code. I can see why you think so - I considered that possibility too! I must've tried four or five different ways to structure this logic. However, while the approach in comment 3 does have the advantage that we can merge the |return PL_DHASH_NEXT;| statements from the different branches, I ultimately decided that the version in the patch was more readable. It seemed to me to be the clearest expression of what the rules actually were. I recognize that that's somewhat subjective. =)
Fair enough. :) Thanks, r=me
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Depends on: 1144899
No longer depends on: 1145560
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: