diff options
author | Steve Block <steveblock@google.com> | 2010-04-27 16:31:00 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-05-11 14:42:12 +0100 |
commit | dcc8cf2e65d1aa555cce12431a16547e66b469ee (patch) | |
tree | 92a8d65cd5383bca9749f5327fb5e440563926e6 /WebCore/platform/graphics/qt/GraphicsContextQt.cpp | |
parent | ccac38a6b48843126402088a309597e682f40fe6 (diff) | |
download | external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2 |
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebCore/platform/graphics/qt/GraphicsContextQt.cpp')
-rw-r--r-- | WebCore/platform/graphics/qt/GraphicsContextQt.cpp | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 8bcda2e..edac268 100644 --- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -312,14 +312,16 @@ void GraphicsContext::drawRect(const IntRect& rect) const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines); - IntSize shadowSize; - int shadowBlur; - Color shadowColor; - if (getShadow(shadowSize, shadowBlur, shadowColor)) { - IntRect shadowRect = rect; - shadowRect.move(shadowSize.width(), shadowSize.height()); - shadowRect.inflate(static_cast<int>(p->pen().widthF())); - p->fillRect(shadowRect, QColor(shadowColor)); + if (m_common->state.shadowColor.isValid()) { + IntSize shadowSize; + int shadowBlur; + Color shadowColor; + if (getShadow(shadowSize, shadowBlur, shadowColor)) { + IntRect shadowRect = rect; + shadowRect.move(shadowSize.width(), shadowSize.height()); + shadowRect.inflate(static_cast<int>(p->pen().widthF())); + p->fillRect(shadowRect, QColor(shadowColor)); + } } p->drawRect(rect); @@ -410,7 +412,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) patternOffset = patWidth / 2; } else { if (remainder) - patternOffset = (patWidth - remainder)/2; + patternOffset = (patWidth - remainder) / 2; } } @@ -614,10 +616,20 @@ void GraphicsContext::fillRect(const FloatRect& rect) QPainter* p = m_data->p(); if (m_common->state.fillPattern || m_common->state.fillGradient || fillColor().alpha()) { - drawBorderlessRectShadow(this, p, rect); + if (m_common->state.shadowColor.isValid()) + drawBorderlessRectShadow(this, p, rect); if (m_common->state.fillPattern) { AffineTransform affine; - p->fillRect(rect, QBrush(m_common->state.fillPattern->createPlatformPattern(affine))); + FloatRect rectM(rect); + QBrush brush(m_common->state.fillPattern->createPlatformPattern(affine)); + QPixmap* image = m_common->state.fillPattern->tileImage()->nativeImageForCurrentFrame(); + + if (!m_common->state.fillPattern->repeatX() && image) + rectM.setWidth(image->width()); + if (!m_common->state.fillPattern->repeatY() && image) + rectM.setHeight(image->height()); + p->fillRect(rectM, brush); + } else if (m_common->state.fillGradient) { QBrush brush(*m_common->state.fillGradient->platformGradient()); brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform()); @@ -636,7 +648,8 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& c, ColorSpace m_data->solidColor.setColor(c); QPainter* p = m_data->p(); - drawBorderlessRectShadow(this, p, rect); + if (m_common->state.shadowColor.isValid()) + drawBorderlessRectShadow(this, p, rect); p->fillRect(rect, m_data->solidColor); } @@ -1006,11 +1019,11 @@ void GraphicsContext::rotate(float radians) if (paintingDisabled()) return; - m_data->p()->rotate(180/M_PI*radians); + m_data->p()->rotate(180 / M_PI*radians); if (!m_data->currentPath.isEmpty()) { QTransform matrix; - m_data->currentPath = m_data->currentPath * matrix.rotate(-180/M_PI*radians); + m_data->currentPath = m_data->currentPath * matrix.rotate(-180 / M_PI*radians); m_common->state.pathTransform.rotate(radians); } } |