WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
23728
[QT] clearRect fill's a given rect with white
https://bugs.webkit.org/show_bug.cgi?id=23728
Summary
[QT] clearRect fill's a given rect with white
Dirk Schulze
Reported
2009-02-04 04:38:19 PST
clearRect doesn't erase a given rect, it just fills it with white. clearRect uses p->eraseRect to clear a given rect. eraseRect is the same as p->fillRect(rect, p->background()). We never set the background, because we're using transparent background mode, the default. And the documentation saith that setBackground() has no effect in transparent background mode. But adding: m_context.get()->platformContext()->setBackground(QColor(Qt::transparent)); to ImageBuffer::ImageBuffer(const IntSize& size, bool grayScale, bool& success) solves the problem. (I would add set the background somewhere in the ImageBuffer. We may need to erase the context somewehere else than in context->clearRect().)
Attachments
transparent background for context
(1.25 KB, patch)
2009-02-04 05:16 PST
,
Dirk Schulze
no flags
Details
Formatted Diff
Diff
clearRect test
(436 bytes, text/html)
2009-02-05 08:50 PST
,
Dirk Schulze
no flags
Details
Fix for clearRect
(1.46 KB, patch)
2009-02-06 09:20 PST
,
Dirk Schulze
hausmann
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Dirk Schulze
Comment 1
2009-02-04 05:16:42 PST
Created
attachment 27312
[details]
transparent background for context see above
Simon Hausmann
Comment 2
2009-02-04 07:42:04 PST
Dirk, thanks for tracking this down! I think an alternate and perhaps cleaner solution would be to set the composition mode to QPainter::CompositionMode_Clear. What do you think?
Dirk Schulze
Comment 3
2009-02-04 11:13:47 PST
I tried QPainter::CompositionMode_Clear first, but it doesn't fix the problem. I'm not sure why setBackground() works. It shouldn't
http://doc.trolltech.com/4.4/qpainter.html#setBackground
. And setting background mode manually to Qt::TransparentMode doens't work either.
Simon Hausmann
Comment 4
2009-02-05 07:21:56 PST
(In reply to
comment #3
)
> I tried QPainter::CompositionMode_Clear first, but it doesn't fix the problem. > I'm not sure why setBackground() works. It shouldn't >
http://doc.trolltech.com/4.4/qpainter.html#setBackground
. And setting > background mode manually to Qt::TransparentMode doens't work either. >
That's odd. What's the easiest way to test/verify this? I can try to take a look at this with our QPainter guys.
Dirk Schulze
Comment 5
2009-02-05 08:50:22 PST
Created
attachment 27350
[details]
clearRect test This shows the problem in Canvas. Hope that's what you wanted.
Simon Hausmann
Comment 6
2009-02-06 08:17:48 PST
I had a chat with our QPainter guys and discussed your testcase. We can use CompositionMode_Clear, but then we have to call drawRect(rect); instead of eraseRect(). The fastest way however is to simply call fillRect(Qt::transparent). Both worked for me (_Clear with drawRect() and fillRect(Qt::transparent). Can you make a patch with fillRect(Qt::transparent)? I'll review it then :) Thanks again, Dirk!
Dirk Schulze
Comment 7
2009-02-06 09:20:38 PST
Created
attachment 27400
[details]
Fix for clearRect Fix for clearRect with another composite operator.
Dirk Schulze
Comment 8
2009-02-06 09:39:06 PST
landed in
r40721
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug