Closed Bug 574239 Opened 14 years ago Closed 14 years ago

ThebesLayerD3D9 needs to retain layer contents

Categories

(Core :: Graphics, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bas.schouten, Assigned: bas.schouten)

Details

Attachments

(1 file)

ThebesLayerD3D9 needs to retain its layer contents across changes to the visible region when there is a large intersection between the old and the new visible region (like with most scrolling operations).
Attachment #453621 - Flags: review?(jmuizelaar)
Comment on attachment 453621 [details] [diff] [review]
Retain ThebesLayerD3D9 content

>+/**
>+ * Retention threshold - amount of pixels intersection required to enable
>+ * layer content retention.
>+ */
>+#define RETENTION_THRESHOLD 16384

You should add a comment about where this number came from. If it came from nowhere
just say that.

>+  device()->CreateTexture(newBounds.width, newBounds.height, 1,
>                           D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
>                           D3DPOOL_DEFAULT, getter_AddRefs(mTexture), NULL);

I'm concerned that texture allocation during scrolling isn't going to do wonders for our performance.
However, I'm not sure what will be best. Perhaps a linear system buffer backed by texture tiles.

>+  nsIntRegion retainedRegion;
>+  const nsIntRect *r;
>+  for (nsIntRegionRectIterator iter(oldVisibleRegion);
>+       (r = iter.Next()) != nsnull;) {

I prefer this idiom:
http://mxr.mozilla.org/mozilla-central/source/gfx/src/thebes/nsThebesRenderingContext.cpp#296

>+    if (r->width * r->height > RETENTION_THRESHOLD) {
>+      RECT oldRect, newRect;
>+
>+      // Calculate the retained rectangle's position on the old and the new
>+      // surface.
>+      oldRect.left = r->x - oldBounds.x;
>+      oldRect.top = r->y - oldBounds.y;
>+      oldRect.right = oldRect.left + r->width;
>+      oldRect.bottom = oldRect.top + r->height;

an extra line here wouldn't hurt

>+      newRect.left = r->x - newBounds.x;
>+      newRect.top = r->y - newBounds.y;
>+      newRect.right = newRect.left + r->width;
>+      newRect.bottom = newRect.top + r->height;
Attachment #453621 - Flags: review?(jmuizelaar) → review+
Pushed http://hg.mozilla.org/mozilla-central/rev/4b3e2b20b132.

Follow-ups coming for more performance improvements.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: