[webkit-changes] cvs commit: WebCore/kwq KWQPainter.mm
Darin
darin at opensource.apple.com
Sun Sep 4 21:01:25 PDT 2005
darin 05/09/04 21:01:25
Modified: . ChangeLog
khtml/rendering render_canvasimage.cpp
kwq KWQPainter.mm
Log:
Reviewed by John Sullivan.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4274
REGRESSION: canvas draws when window loses focus (flipped and in wrong position!)
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4755
"CGContext*: invalid context" messages dumped to the console (may indicate a performance hit)
* khtml/rendering/render_canvasimage.cpp: (RenderCanvasImage::paint):
Don't try to paint if painting is disabled.
* kwq/KWQPainter.mm:
(QPainter::addClip): Do nothing if painting is disabled.
(QPainter::addRoundedRectClip): Ditto.
(QPainter::currentContext): Assert that painting is not disabled.
(QPainter::beginTransparencyLayer): Do nothing if painting is disabled.
(QPainter::endTransparencyLayer): Ditto.
(QPainter::setShadow): Ditto.
(QPainter::clearShadow): Ditto.
(QPainter::initFocusRing): Ditto.
(QPainter::addFocusRingRect): Ditto.
(QPainter::drawFocusRing): Ditto.
Revision Changes Path
1.91 +24 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- ChangeLog 5 Sep 2005 03:43:02 -0000 1.90
+++ ChangeLog 5 Sep 2005 04:01:22 -0000 1.91
@@ -2,6 +2,30 @@
Reviewed by John Sullivan.
+ - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4274
+ REGRESSION: canvas draws when window loses focus (flipped and in wrong position!)
+ - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4755
+ "CGContext*: invalid context" messages dumped to the console (may indicate a performance hit)
+
+ * khtml/rendering/render_canvasimage.cpp: (RenderCanvasImage::paint):
+ Don't try to paint if painting is disabled.
+
+ * kwq/KWQPainter.mm:
+ (QPainter::addClip): Do nothing if painting is disabled.
+ (QPainter::addRoundedRectClip): Ditto.
+ (QPainter::currentContext): Assert that painting is not disabled.
+ (QPainter::beginTransparencyLayer): Do nothing if painting is disabled.
+ (QPainter::endTransparencyLayer): Ditto.
+ (QPainter::setShadow): Ditto.
+ (QPainter::clearShadow): Ditto.
+ (QPainter::initFocusRing): Ditto.
+ (QPainter::addFocusRingRect): Ditto.
+ (QPainter::drawFocusRing): Ditto.
+
+2005-09-04 Darin Adler <darin at apple.com>
+
+ Reviewed by John Sullivan.
+
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4393
REGRESSION: Unconfirmed text ignored in input type=text
1.20 +5 -3 WebCore/khtml/rendering/render_canvasimage.cpp
Index: render_canvasimage.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_canvasimage.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- render_canvasimage.cpp 16 Aug 2005 19:03:18 -0000 1.19
+++ render_canvasimage.cpp 5 Sep 2005 04:01:24 -0000 1.20
@@ -146,6 +146,8 @@
paintBoxDecorations(i, x, y);
QPainter* p = i.p;
+ if (p->paintingDisabled())
+ return;
if (i.phase == PaintActionOutline && style()->outlineWidth() && style()->visibility() == VISIBLE)
paintOutline(p, x, y, width(), height(), style());
@@ -185,11 +187,11 @@
int oldOperation = 0;
if (i && !i->compositeOperator().isNull()){
oldOperation = QPainter::getCompositeOperation(p->currentContext());
- QPainter::setCompositeOperation (p->currentContext(),i->compositeOperator());
+ QPainter::setCompositeOperation(p->currentContext(), i->compositeOperator());
}
- CGContextDrawImage (p->currentContext(), CGRectMake (x, y, cWidth, cHeight), drawnImage());
+ CGContextDrawImage(p->currentContext(), CGRectMake(x, y, cWidth, cHeight), drawnImage());
if (i && !i->compositeOperator().isNull()) {
- QPainter::setCompositeOperation (p->currentContext(),oldOperation);
+ QPainter::setCompositeOperation (p->currentContext(), oldOperation);
}
}
1.136 +24 -2 WebCore/kwq/KWQPainter.mm
Index: KWQPainter.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQPainter.mm,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -r1.135 -r1.136
--- KWQPainter.mm 1 Sep 2005 03:30:17 -0000 1.135
+++ KWQPainter.mm 5 Sep 2005 04:01:24 -0000 1.136
@@ -765,12 +765,18 @@
void QPainter::addClip(const QRect &rect)
{
+ if (data->state.paintingDisabled)
+ return;
+
[NSBezierPath clipRect:rect];
}
void QPainter::addRoundedRectClip(const QRect& rect, const QSize& topLeft, const QSize& topRight,
const QSize& bottomLeft, const QSize& bottomRight)
{
+ if (data->state.paintingDisabled)
+ return;
+
// Need sufficient width and height to contain these curves. Sanity check our top/bottom
// values and our width/height values to make sure the curves can all fit.
int requiredWidth = kMax(topLeft.width() + topRight.width(), bottomLeft.width() + bottomRight.width());
@@ -840,11 +846,14 @@
CGContextRef QPainter::currentContext()
{
- return (CGContextRef)([[NSGraphicsContext currentContext] graphicsPort]);
+ ASSERT(!data->state.paintingDisabled);
+ return (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
}
void QPainter::beginTransparencyLayer(float opacity)
{
+ if (data->state.paintingDisabled)
+ return;
[NSGraphicsContext saveGraphicsState];
CGContextRef context = (CGContextRef)([[NSGraphicsContext currentContext] graphicsPort]);
CGContextSetAlpha(context, opacity);
@@ -853,6 +862,8 @@
void QPainter::endTransparencyLayer()
{
+ if (data->state.paintingDisabled)
+ return;
CGContextRef context = (CGContextRef)([[NSGraphicsContext currentContext] graphicsPort]);
CGContextEndTransparencyLayer(context);
[NSGraphicsContext restoreGraphicsState];
@@ -860,6 +871,8 @@
void QPainter::setShadow(int x, int y, int blur, const QColor& color)
{
+ if (data->state.paintingDisabled)
+ return;
// Check for an invalid color, as this means that the color was not set for the shadow
// and we should therefore just use the default shadow color.
CGContextRef context = (CGContextRef)([[NSGraphicsContext currentContext] graphicsPort]);
@@ -877,12 +890,16 @@
void QPainter::clearShadow()
{
+ if (data->state.paintingDisabled)
+ return;
CGContextRef context = (CGContextRef)([[NSGraphicsContext currentContext] graphicsPort]);
CGContextSetShadowWithColor(context, CGSizeZero, 0, NULL);
}
void QPainter::initFocusRing(int width, int offset)
{
+ if (data->state.paintingDisabled)
+ return;
clearFocusRing();
data->focusRingWidth = width;
data->hasFocusRingColor = false;
@@ -893,6 +910,8 @@
void QPainter::initFocusRing(int width, int offset, const QColor &color)
{
+ if (data->state.paintingDisabled)
+ return;
initFocusRing(width, offset);
data->hasFocusRingColor = true;
data->focusRingColor = color;
@@ -900,6 +919,8 @@
void QPainter::addFocusRingRect(int x, int y, int width, int height)
{
+ if (data->state.paintingDisabled)
+ return;
ASSERT(data->focusRingPath);
NSRect rect = NSMakeRect(x, y, width, height);
int offset = (data->focusRingWidth-1)/2 + data->focusRingOffset;
@@ -909,10 +930,11 @@
void QPainter::drawFocusRing()
{
- ASSERT(data->focusRingPath);
if (data->state.paintingDisabled)
return;
+ ASSERT(data->focusRingPath);
+
if ([data->focusRingPath elementCount] == 0) {
ERROR("Request to draw focus ring with no control points");
return;
More information about the webkit-changes
mailing list