Bug 15721 - [CAIRO] Image transformations are broken
: [CAIRO] Image transformations are broken
Status: RESOLVED FIXED
Product: WebKit
Classification: Unclassified
Component: New Bugs
: 523.x (Safari 3)
: All All
: P2 Normal
Assigned To: Nobody
http://www.netzgesta.de/reflex/
: Cairo
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-27 01:34 PDT by Alp Toker
Modified: 2008-08-18 06:38 PDT (History)
1 user (show)

See Also:


Attachments
CompositeOperator (1.36 KB, patch)
2008-06-16 14:23 PDT, Dirk Schulze
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alp Toker 2007-10-27 01:34:40 PDT
The transformed images at http://www.netzgesta.de/reflex/ do not render properly.

The culprit is probably incorrect pattern usage in the ImageCairo tiled drawing functions.
Comment 1 Kalle Vahlman 2008-06-10 09:36:06 PDT
This seems fixed by now, probably should close this one...
Comment 2 Dirk Schulze 2008-06-15 13:07:22 PDT
(In reply to comment #1)
> This seems fixed by now, probably should close this one...

What about the backgrounds? They are all black.
Some reflections are rendered wrong (Reflections are missing if a image is transformed and the reflection is translated).
Comment 3 Dirk Schulze 2008-06-16 07:53:06 PDT
The black background is a problem of the CompositeOperator.
If you hardcode the CompositeOperator, the background is transparent:

-    if (op == CompositeSourceOver && !frameHasAlphaAtIndex(m_currentFrame))
-         context->setCompositeOperation(CompositeCopy);
-     else
-        context->setCompositeOperation(op);
+    cairo_set_operator(cr, CAIRO_OPERATOR_OVER);

For every single step the background is transparent.
Only the last operation takes a wrong CompositeOperator. Thats why the background is black. 
Comment 4 Dirk Schulze 2008-06-16 14:23:43 PDT
Created attachment 21745 [details]
CompositeOperator

Is the if-clause in ImageCairo.cpp still necessary?

    if (op == CompositeSourceOver && !frameHasAlphaAtIndex(m_currentFrame))
         context->setCompositeOperation(CompositeCopy);
     else
        context->setCompositeOperation(op);

Other implementations don't change the CompositeOperator. And in this case it causes the black background. Why is it there?
Comment 5 Dirk Schulze 2008-06-21 12:29:17 PDT
(In reply to comment #2)
> Some reflections are rendered wrong (Reflections are missing if a image is
> transformed and the reflection is translated).

It could be a problem of path and clip in GraphicsContext.
Comment 6 Dirk Schulze 2008-06-21 13:41:45 PDT
Do http://developer.mozilla.org/samples/canvas-tutorial/5_4_canvas_scale.html and the wrong reflection of images with borders base on the same problem? 

Both are drawn with canvas and on both, parts of the drawing, is filled with the stroke-color of a line/border.
Comment 7 Dirk Schulze 2008-06-28 08:13:44 PDT
The main problem is solved. The problem with the borders is a problem with canvas. strokeStyle and fillStyle are saved to the same source pattern. 

I would mark this bug as a duplication of https://bugs.webkit.org/show_bug.cgi?id=19789 now.
Comment 8 Dirk Schulze 2008-08-18 06:38:20 PDT
Wrong border problem is fixed with https://bugs.webkit.org/show_bug.cgi?id=20405