Closed Bug 589978 Opened 11 years ago Closed 11 years ago

[D3D9] 2D canvas layers always have premultiplied alpha

Categories

(Core :: Graphics, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mattwoodrow, Assigned: mattwoodrow)

References

Details

Attachments

(1 file, 2 obsolete files)

No description provided.
Attached patch Fix (obsolete) — Splinter Review
Fixes reftest image-element/canvas-outside-document.html
Attachment #468524 - Flags: review?(bas.schouten)
Blocks: 586459
Hmm.  Could we get away with not using premultiplied in some cases?  I thought we just did that because that's what cairo image surfaces do?
2D content coming from canvas is a cairo surface. Don't know enough about this to say whether we could change the canvas backend to skip this.
This is correct; we should rename the flag to something like mDataIsPremultiplied.  The canvas 2d data is always premult, only WebGL content can be either.
Comment on attachment 468524 [details] [diff] [review]
Fix

Let's do this, but let's do the rename Vlad suggested too.
Attachment #468524 - Flags: review?(bas.schouten) → review+
Attached patch Renamed var (obsolete) — Splinter Review
Attachment #468524 - Attachment is obsolete: true
Attachment #468584 - Flags: review+
Comment on attachment 468584 [details] [diff] [review]
Renamed var

>diff --git a/gfx/layers/d3d9/ThebesLayerD3D9.cpp b/gfx/layers/d3d9/ThebesLayerD3D9.cpp
>--- a/gfx/layers/d3d9/ThebesLayerD3D9.cpp
>+++ b/gfx/layers/d3d9/ThebesLayerD3D9.cpp
>@@ -360,6 +360,17 @@ ThebesLayerD3D9::DrawRegion(const nsIntR
>   LayerManagerD3D9::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo();
>   cbInfo.Callback(this, context, aRegion, nsIntRegion(), cbInfo.CallbackData);
> 
>+      nsRefPtr<gfxImageSurface> isurf =
>+      new gfxImageSurface(gfxIntSize(bounds.width, bounds.height),
>+                            gfxASurface::ImageFormatARGB32);
>+
>+      nsRefPtr<gfxContext> cx = new gfxContext(isurf);
>+
>+      cx->SetOperator(gfxContext::OPERATOR_SOURCE);
>+      cx->SetSource(destinationSurface);
>+      cx->Paint();
>+      void *bits = isurf->Data();
>+
>   if (UseOpaqueSurface(this)) {
>     surf->ReleaseDC(dc);
>   } else {

Looks like something spilled into the patch.
Argh.
Attachment #468584 - Attachment is obsolete: true
Attachment #468589 - Flags: review+
Attachment #468589 - Flags: review+
Attachment #468589 - Flags: review+
Assignee: nobody → matt.woodrow+bugzilla
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.