Bug 67404 - [cairo] GraphicsContextCairo::FillRect with a solid colour does not respect operator
Summary: [cairo] GraphicsContextCairo::FillRect with a solid colour does not respect o...
Status: RESOLVED DUPLICATE of bug 84848
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-01 07:54 PDT by Rob Bradford
Modified: 2012-04-25 08:37 PDT (History)
2 users (show)

See Also:


Attachments
Proposed patch (3.38 KB, patch)
2011-09-01 08:20 PDT, Rob Bradford
no flags Details | Formatted Diff | Diff
Fix gramatical errors in the ChangeLog entry on the original patch (3.37 KB, patch)
2011-09-01 08:28 PDT, Rob Bradford
eric: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Bradford 2011-09-01 07:54:10 PDT
In the GraphicsContext function:

void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorSpace styleColorSpace, CompositeOperator op)

(which is not overridden in the GraphicsContextCairo)

It sets the operator and then proceeds to call the fillRect(const FloatRect& rect, const Color& color, ColorSpace styleColorSpace) (i.e. the version without the operator)

The problem is that the fillRectWithColor in GraphicsContextCairo.cpp always uses the OVER operator.

Without respecting the operator I think we would see incorrect results from code that triggers

"
        if (baseColor.alpha()) {
            if (bgColor.alpha())
                baseColor = baseColor.blend(bgColor);

            context->fillRect(backgroundRect, baseColor, style()->colorSpace(), CompositeCopy);
        } else if (bgColor.alpha()) {
            CompositeOperator operation = shouldClearBackground ? CompositeCopy : context->compositeOperation();
            context->fillRect(backgroundRect, bgColor, style()->colorSpace(), operation);
        } else if (shouldClearBackground)
            context->clearRect(backgroundRect);

" from RenderBoxModelObject::paintFillLayerExtended
Comment 1 Rob Bradford 2011-09-01 08:20:39 PDT
Created attachment 105968 [details]
Proposed patch
Comment 2 Rob Bradford 2011-09-01 08:28:20 PDT
Created attachment 105969 [details]
Fix gramatical errors in the ChangeLog entry on the original patch
Comment 3 Martin Robinson 2011-09-01 10:01:11 PDT
Do you have a test case where this fails? In what cases would this lead to degraded performance?
Comment 4 Rob Bradford 2011-09-01 10:40:57 PDT
(In reply to comment #3)
> Do you have a test case where this fails? In what cases would this lead to degraded performance?

I observed this bug by observation of the code. I will try and figure out a test case that triggers a visual issue because of this bug.

In terms of performance painting with OVER is more costly than SOURCE since SOURCE can be optimised to a blit by Cairo in many situations (since it doesn't depend on the value that is currently in the destination.)
Comment 5 Martin Robinson 2011-09-09 14:40:29 PDT
(In reply to comment #4)

> In terms of performance painting with OVER is more costly than SOURCE since SOURCE can be optimised to a blit by Cairo in many situations (since it doesn't depend on the value that is currently in the destination.)

Thanks. This is very likely a bug!
Comment 6 Eric Seidel (no email) 2011-12-19 13:53:00 PST
Comment on attachment 105969 [details]
Fix gramatical errors in the ChangeLog entry on the original patch

View in context: https://bugs.webkit.org/attachment.cgi?id=105969&action=review

How do we test this?

> Source/WebCore/ChangeLog:5
> +

Please don't remove the REviewed by line, otherwise the tools can't fill it in fo ryou.
Comment 7 Martin Robinson 2012-04-25 08:32:37 PDT
*** Bug 84848 has been marked as a duplicate of this bug. ***
Comment 8 Martin Robinson 2012-04-25 08:37:48 PDT

*** This bug has been marked as a duplicate of bug 84848 ***