Changeset 147750 in webkit
- Timestamp:
- Apr 5, 2013 8:52:08 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147749 r147750 1 2013-03-28 Allan Sandfeld Jensen <allan.jensen@digia.com> 2 3 [Qt] Create ShadowBlur on demand. 4 https://bugs.webkit.org/show_bug.cgi?id=113506 5 6 Reviewed by Noam Rosenthal. 7 8 This patch creates ShadowBlur objects on demand instead of keeping a single one alive for 9 each GraphicsContext. This matches what other platforms does and fixes the problem with 10 an active shadowblur being affected by changing shadow settings on the GraphicsContext. 11 12 The method mustUseShadowBlur is moved from ShadowBlur to GraphcisContext, so that it can 13 be used to determine if a ShadowBlur object should even be generated. 14 15 * platform/graphics/GraphicsContext.cpp: 16 (WebCore::GraphicsContext::hasBlurredShadow): 17 (WebCore::GraphicsContext::mustUseShadowBlur): 18 * platform/graphics/GraphicsContext.h: 19 (GraphicsContext): 20 * platform/graphics/ShadowBlur.cpp: 21 (WebCore::ShadowBlur::ShadowBlur): 22 * platform/graphics/ShadowBlur.h: 23 * platform/graphics/cairo/FontCairo.cpp: 24 (WebCore::drawGlyphsShadow): 25 * platform/graphics/cg/GraphicsContextCG.cpp: 26 (WebCore::GraphicsContext::fillRect): 27 (WebCore::GraphicsContext::fillRoundedRect): 28 (WebCore::GraphicsContext::fillRectWithRoundedHole): 29 * platform/graphics/qt/FontQt.cpp: 30 (WebCore::drawQtGlyphRun): 31 * platform/graphics/qt/GraphicsContextQt.cpp: 32 (GraphicsContextPlatformPrivate): 33 (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): 34 (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate): 35 (WebCore::GraphicsContext::restorePlatformState): 36 (WebCore::GraphicsContext::fillPath): 37 (WebCore::GraphicsContext::strokePath): 38 (WebCore::GraphicsContext::fillRect): 39 (WebCore::GraphicsContext::fillRoundedRect): 40 (WebCore::GraphicsContext::fillRectWithRoundedHole): 41 (WebCore::GraphicsContext::setPlatformShadow): 42 (WebCore::GraphicsContext::clearPlatformShadow): 43 * platform/graphics/qt/ImageQt.cpp: 44 (WebCore::BitmapImage::draw): 45 * platform/graphics/qt/StillImageQt.cpp: 46 (WebCore::StillImage::draw): 47 1 48 2013-04-05 Ryosuke Niwa <rniwa@webkit.org> 2 49 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r145366 r147750 185 185 } 186 186 187 bool GraphicsContext::hasBlurredShadow() const 188 { 189 return m_state.shadowColor.isValid() && m_state.shadowColor.alpha() && m_state.shadowBlur; 190 } 191 192 #if PLATFORM(QT) || USE(CAIRO) 193 bool GraphicsContext::mustUseShadowBlur() const 194 { 195 // We can't avoid ShadowBlur if the shadow has blur. 196 if (hasBlurredShadow()) 197 return true; 198 // We can avoid ShadowBlur and optimize, since we're not drawing on a 199 // canvas and box shadows are affected by the transformation matrix. 200 if (!m_state.shadowsIgnoreTransforms) 201 return false; 202 // We can avoid ShadowBlur, since there are no transformations to apply to the canvas. 203 if (getCTM().isIdentity()) 204 return false; 205 // Otherwise, no chance avoiding ShadowBlur. 206 return true; 207 } 208 #endif 209 187 210 float GraphicsContext::strokeThickness() const 188 211 { -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r147622 r147750 54 54 #elif PLATFORM(QT) 55 55 #include <QPainter> 56 namespace WebCore {57 class ShadowBlur;58 }59 56 typedef QPainter PlatformGraphicsContext; 60 57 #elif PLATFORM(WX) … … 395 392 void clearShadow(); 396 393 394 bool hasBlurredShadow() const; 395 #if PLATFORM(QT) || USE(CAIRO) 396 bool mustUseShadowBlur() const; 397 #endif 398 397 399 void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Color&); 398 400 void drawFocusRing(const Path&, int width, int offset, const Color&); … … 516 518 void pushTransparencyLayerInternal(const QRect&, qreal, QPixmap&); 517 519 void takeOwnershipOfPlatformContext(); 518 #endif519 520 #if PLATFORM(QT)521 ShadowBlur* shadowBlur();522 520 #endif 523 521 -
trunk/Source/WebCore/platform/graphics/ShadowBlur.cpp
r145810 r147750 4 4 * Copyright (C) 2010 Igalia S.L. All rights reserved. 5 5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 6 * Copyright (C) 2013 Digia Plc. and/or its subsidiary(-ies). 6 7 * 7 8 * Redistribution and use in source and binary forms, with or without … … 169 170 static const int templateSideLength = 1; 170 171 172 #if USE(CG) 173 static float radiusToLegacyRadius(float radius) 174 { 175 return radius > 8 ? 8 + 4 * sqrt((radius - 8) / 2) : radius; 176 } 177 #endif 178 171 179 ShadowBlur::ShadowBlur(const FloatSize& radius, const FloatSize& offset, const Color& color, ColorSpace colorSpace) 172 180 : m_color(color) … … 177 185 , m_shadowsIgnoreTransforms(false) 178 186 { 187 updateShadowBlurValues(); 188 } 189 190 ShadowBlur::ShadowBlur(const GraphicsContextState& state) 191 : m_color(state.shadowColor) 192 , m_colorSpace(state.shadowColorSpace) 193 , m_blurRadius(state.shadowBlur, state.shadowBlur) 194 , m_offset(state.shadowOffset) 195 , m_layerImage(0) 196 , m_shadowsIgnoreTransforms(state.shadowsIgnoreTransforms) 197 { 198 #if USE(CG) 199 if (state.shadowsUseLegacyRadius) { 200 float shadowBlur = radiusToLegacyRadius(state.shadowBlur); 201 m_blurRadius = FloatSize(shadowBlur, shadowBlur); 202 } 203 #endif 179 204 updateShadowBlurValues(); 180 205 } … … 898 923 } 899 924 900 #if PLATFORM(QT) || USE(CAIRO)901 bool ShadowBlur::mustUseShadowBlur(GraphicsContext* context) const902 {903 // We can't avoid ShadowBlur, since the shadow has blur.904 if (type() == BlurShadow)905 return true;906 // We can avoid ShadowBlur and optimize, since we're not drawing on a907 // canvas and box shadows are affected by the transformation matrix.908 if (!shadowsIgnoreTransforms())909 return false;910 // We can avoid ShadowBlur, since there are no transformations to apply to the canvas.911 if (context->getCTM().isIdentity())912 return false;913 // Otherwise, no chance avoiding ShadowBlur.914 return true;915 }916 #endif917 918 925 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/ShadowBlur.h
r95901 r147750 40 40 class AffineTransform; 41 41 class GraphicsContext; 42 struct GraphicsContextState; 42 43 class ImageBuffer; 43 44 … … 52 53 53 54 ShadowBlur(const FloatSize& radius, const FloatSize& offset, const Color&, ColorSpace); 55 ShadowBlur(const GraphicsContextState&); 54 56 ShadowBlur(); 55 57 … … 70 72 71 73 ShadowType type() const { return m_type; } 72 73 #if PLATFORM(QT) || USE(CAIRO)74 bool mustUseShadowBlur(GraphicsContext*) const;75 #endif76 74 77 75 private: -
trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp
r129657 r147750 70 70 return; 71 71 72 if (! shadow.mustUseShadowBlur(graphicsContext)) {72 if (!graphicsContext->mustUseShadowBlur()) { 73 73 // Optimize non-blurry shadows, by just drawing text without the ShadowBlur. 74 74 cairo_t* context = graphicsContext->platformContext()->cr(); -
trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r147710 r147750 763 763 } 764 764 765 static float radiusToLegacyRadius(float radius)766 {767 return radius > 8 ? 8 + 4 * sqrt((radius - 8) / 2) : radius;768 }769 770 static bool hasBlurredShadow(const GraphicsContextState& state)771 {772 return state.shadowColor.isValid() && state.shadowColor.alpha() && state.shadowBlur;773 }774 775 765 void GraphicsContext::fillRect(const FloatRect& rect) 776 766 { … … 809 799 applyFillPattern(); 810 800 811 bool drawOwnShadow = !isAcceleratedContext() && hasBlurredShadow( m_state) && !m_state.shadowsIgnoreTransforms; // Don't use ShadowBlur for canvas yet.801 bool drawOwnShadow = !isAcceleratedContext() && hasBlurredShadow() && !m_state.shadowsIgnoreTransforms; // Don't use ShadowBlur for canvas yet. 812 802 if (drawOwnShadow) { 813 float shadowBlur = m_state.shadowsUseLegacyRadius ? radiusToLegacyRadius(m_state.shadowBlur) : m_state.shadowBlur;814 803 // Turn off CG shadows. 815 804 CGContextSaveGState(context); 816 805 CGContextSetShadowWithColor(platformContext(), CGSizeZero, 0, 0); 817 806 818 ShadowBlur contextShadow( FloatSize(shadowBlur, shadowBlur), m_state.shadowOffset, m_state.shadowColor, m_state.shadowColorSpace);807 ShadowBlur contextShadow(m_state); 819 808 contextShadow.drawRectShadow(this, rect, RoundedRect::Radii()); 820 809 } … … 838 827 setCGFillColor(context, color, colorSpace); 839 828 840 bool drawOwnShadow = !isAcceleratedContext() && hasBlurredShadow( m_state) && !m_state.shadowsIgnoreTransforms; // Don't use ShadowBlur for canvas yet.829 bool drawOwnShadow = !isAcceleratedContext() && hasBlurredShadow() && !m_state.shadowsIgnoreTransforms; // Don't use ShadowBlur for canvas yet. 841 830 if (drawOwnShadow) { 842 float shadowBlur = m_state.shadowsUseLegacyRadius ? radiusToLegacyRadius(m_state.shadowBlur) : m_state.shadowBlur;843 831 // Turn off CG shadows. 844 832 CGContextSaveGState(context); 845 833 CGContextSetShadowWithColor(platformContext(), CGSizeZero, 0, 0); 846 834 847 ShadowBlur contextShadow( FloatSize(shadowBlur, shadowBlur), m_state.shadowOffset, m_state.shadowColor, m_state.shadowColorSpace);835 ShadowBlur contextShadow(m_state); 848 836 contextShadow.drawRectShadow(this, rect, RoundedRect::Radii()); 849 837 } … … 870 858 setCGFillColor(context, color, colorSpace); 871 859 872 bool drawOwnShadow = !isAcceleratedContext() && hasBlurredShadow( m_state) && !m_state.shadowsIgnoreTransforms; // Don't use ShadowBlur for canvas yet.860 bool drawOwnShadow = !isAcceleratedContext() && hasBlurredShadow() && !m_state.shadowsIgnoreTransforms; // Don't use ShadowBlur for canvas yet. 873 861 if (drawOwnShadow) { 874 float shadowBlur = m_state.shadowsUseLegacyRadius ? radiusToLegacyRadius(m_state.shadowBlur) : m_state.shadowBlur;875 876 862 // Turn off CG shadows. 877 863 CGContextSaveGState(context); 878 864 CGContextSetShadowWithColor(platformContext(), CGSizeZero, 0, 0); 879 865 880 ShadowBlur contextShadow( FloatSize(shadowBlur, shadowBlur), m_state.shadowOffset, m_state.shadowColor, m_state.shadowColorSpace);866 ShadowBlur contextShadow(m_state); 881 867 contextShadow.drawRectShadow(this, rect, RoundedRect::Radii(topLeft, topRight, bottomLeft, bottomRight)); 882 868 } … … 923 909 924 910 // fillRectWithRoundedHole() assumes that the edges of rect are clipped out, so we only care about shadows cast around inside the hole. 925 bool drawOwnShadow = !isAcceleratedContext() && hasBlurredShadow( m_state) && !m_state.shadowsIgnoreTransforms;911 bool drawOwnShadow = !isAcceleratedContext() && hasBlurredShadow() && !m_state.shadowsIgnoreTransforms; 926 912 if (drawOwnShadow) { 927 float shadowBlur = m_state.shadowsUseLegacyRadius ? radiusToLegacyRadius(m_state.shadowBlur) : m_state.shadowBlur;928 929 913 // Turn off CG shadows. 930 914 CGContextSaveGState(context); 931 915 CGContextSetShadowWithColor(platformContext(), CGSizeZero, 0, 0); 932 916 933 ShadowBlur contextShadow( FloatSize(shadowBlur, shadowBlur), m_state.shadowOffset, m_state.shadowColor, m_state.shadowColorSpace);917 ShadowBlur contextShadow(m_state); 934 918 contextShadow.drawInsetShadow(this, rect, roundedHoleRect.rect(), roundedHoleRect.radii()); 935 919 } -
trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp
r146761 r147750 126 126 textStrokePath = pathForGlyphs(qtGlyphRun, point); 127 127 128 ShadowBlur* shadow = context->shadowBlur(); 129 if (context->hasShadow() && shadow->type() != ShadowBlur::NoShadow) { 130 switch (shadow->type()) { 131 case ShadowBlur::SolidShadow: { 128 if (context->hasShadow()) { 129 const GraphicsContextState& state = context->state(); 130 if (context->mustUseShadowBlur()) { 131 ShadowBlur shadow(state); 132 const int width = qtGlyphRun.boundingRect().width(); 133 const QRawFont& font = qtGlyphRun.rawFont(); 134 const int height = font.ascent() + font.descent(); 135 const QRectF boundingRect(point.x(), point.y() - font.ascent() + baseLineOffset, width, height); 136 GraphicsContext* shadowContext = shadow.beginShadowLayer(context, boundingRect); 137 if (shadowContext) { 138 QPainter* shadowPainter = shadowContext->platformContext(); 139 shadowPainter->setPen(state.shadowColor); 140 if (shadowContext->textDrawingMode() & TextModeFill) 141 shadowPainter->drawGlyphRun(point, qtGlyphRun); 142 else if (shadowContext->textDrawingMode() & TextModeStroke) 143 shadowPainter->strokePath(textStrokePath, shadowPainter->pen()); 144 shadow.endShadowLayer(context); 145 } 146 } else { 132 147 QPen previousPen = painter->pen(); 133 painter->setPen( context->state().shadowColor);134 const QPointF shadowOffset( context->state().shadowOffset.width(), context->state().shadowOffset.height());148 painter->setPen(state.shadowColor); 149 const QPointF shadowOffset(state.shadowOffset.width(), state.shadowOffset.height()); 135 150 painter->translate(shadowOffset); 136 151 if (context->textDrawingMode() & TextModeFill) … … 140 155 painter->translate(-shadowOffset); 141 156 painter->setPen(previousPen); 142 break;143 }144 case ShadowBlur::BlurShadow: {145 const int width = qtGlyphRun.boundingRect().width();146 const QRawFont& font = qtGlyphRun.rawFont();147 const int height = font.ascent() + font.descent();148 const QRectF boundingRect(point.x(), point.y() - font.ascent() + baseLineOffset, width, height);149 GraphicsContext* shadowContext = shadow->beginShadowLayer(context, boundingRect);150 if (shadowContext) {151 QPainter* shadowPainter = shadowContext->platformContext();152 shadowPainter->setPen(shadowContext->state().shadowColor);153 if (shadowContext->textDrawingMode() & TextModeFill)154 shadowPainter->drawGlyphRun(point, qtGlyphRun);155 else if (shadowContext->textDrawingMode() & TextModeStroke)156 shadowPainter->strokePath(textStrokePath, shadowPainter->pen());157 shadow->endShadowLayer(context);158 }159 break;160 }161 case ShadowBlur::NoShadow:162 default:163 ASSERT_NOT_REACHED();164 break;165 157 } 166 158 } -
trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
r146878 r147750 11 11 * Copyright (C) 2010, 2011 Sencha, Inc. 12 12 * Copyright (C) 2011 Andreas Kling <kling@webkit.org> 13 * Copyright (C) 2013 Digia Plc. and/or its subsidiary(-ies). 13 14 * 14 15 * All rights reserved. … … 251 252 bool initialSmoothPixmapTransformHint; 252 253 253 ShadowBlur* shadow;254 255 254 QRectF clipBoundingRect() const 256 255 { … … 271 270 , imageInterpolationQuality(InterpolationDefault) 272 271 , initialSmoothPixmapTransformHint(false) 273 , shadow(new ShadowBlur())274 272 , painter(p) 275 273 , platformContextIsOwned(false) … … 290 288 GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate() 291 289 { 292 delete shadow;293 294 290 if (!platformContextIsOwned) 295 291 return; … … 356 352 357 353 m_data->p()->restore(); 358 359 m_data->shadow->setShadowValues(FloatSize(m_state.shadowBlur, m_state.shadowBlur), m_state.shadowOffset, m_state.shadowColor, m_state.shadowColorSpace, m_state.shadowsIgnoreTransforms);360 354 } 361 355 … … 629 623 630 624 if (hasShadow()) { 631 ShadowBlur* shadow = shadowBlur(); 632 if (shadow->mustUseShadowBlur(this) || m_state.fillPattern || m_state.fillGradient) 625 if (mustUseShadowBlur() || m_state.fillPattern || m_state.fillGradient) 633 626 { 634 GraphicsContext* shadowContext = shadow->beginShadowLayer(this, platformPath.controlPointRect()); 627 ShadowBlur shadow(m_state); 628 GraphicsContext* shadowContext = shadow.beginShadowLayer(this, platformPath.controlPointRect()); 635 629 if (shadowContext) { 636 630 QPainter* shadowPainter = shadowContext->platformContext(); … … 644 638 shadowPainter->fillPath(platformPath, p->brush()); 645 639 } 646 shadow ->endShadowLayer(this);640 shadow.endShadowLayer(this); 647 641 } 648 642 } else { … … 688 682 689 683 if (hasShadow()) { 690 ShadowBlur* shadow = shadowBlur(); 691 if (shadow->mustUseShadowBlur(this) || m_state.strokePattern || m_state.strokeGradient) 684 if (mustUseShadowBlur() || m_state.strokePattern || m_state.strokeGradient) 692 685 { 686 ShadowBlur shadow(m_state); 693 687 FloatRect boundingRect = platformPath.controlPointRect(); 694 688 boundingRect.inflate(pen.miterLimit() + pen.widthF()); 695 GraphicsContext* shadowContext = shadow ->beginShadowLayer(this, boundingRect);689 GraphicsContext* shadowContext = shadow.beginShadowLayer(this, boundingRect); 696 690 if (shadowContext) { 697 691 QPainter* shadowPainter = shadowContext->platformContext(); … … 702 696 } else 703 697 fillPathStroke(shadowPainter, pathStroker, platformPath, pen.brush()); 704 shadow ->endShadowLayer(this);698 shadow.endShadowLayer(this); 705 699 } 706 700 } else { … … 780 774 QPainter* p = m_data->p(); 781 775 QRectF normalizedRect = rect.normalized(); 782 ShadowBlur* shadow = shadowBlur();783 776 784 777 if (m_state.fillPattern) { 785 GraphicsContext* shadowContext = hasShadow() ? shadow->beginShadowLayer(this, normalizedRect) : 0; 786 if (shadowContext) { 787 QPainter* shadowPainter = shadowContext->platformContext(); 788 drawRepeatPattern(shadowPainter, m_state.fillPattern, normalizedRect); 789 shadow->endShadowLayer(this); 778 if (hasShadow()) { 779 ShadowBlur shadow(m_state); 780 GraphicsContext* shadowContext = shadow.beginShadowLayer(this, normalizedRect); 781 if (shadowContext) { 782 QPainter* shadowPainter = shadowContext->platformContext(); 783 drawRepeatPattern(shadowPainter, m_state.fillPattern, normalizedRect); 784 shadow.endShadowLayer(this); 785 } 790 786 } 791 787 drawRepeatPattern(p, m_state.fillPattern, normalizedRect); … … 793 789 QBrush brush(*m_state.fillGradient->platformGradient()); 794 790 brush.setTransform(m_state.fillGradient->gradientSpaceTransform()); 795 GraphicsContext* shadowContext = hasShadow() ? shadow->beginShadowLayer(this, normalizedRect) : 0; 796 if (shadowContext) { 797 QPainter* shadowPainter = shadowContext->platformContext(); 798 shadowPainter->fillRect(normalizedRect, brush); 799 shadow->endShadowLayer(this); 791 if (hasShadow()) { 792 ShadowBlur shadow(m_state); 793 GraphicsContext* shadowContext = shadow.beginShadowLayer(this, normalizedRect); 794 if (shadowContext) { 795 QPainter* shadowPainter = shadowContext->platformContext(); 796 shadowPainter->fillRect(normalizedRect, brush); 797 shadow.endShadowLayer(this); 798 } 800 799 } 801 800 p->fillRect(normalizedRect, brush); 802 801 } else { 803 802 if (hasShadow()) { 804 if (shadow->mustUseShadowBlur(this)) { 803 if (mustUseShadowBlur()) { 804 ShadowBlur shadow(m_state); 805 805 // drawRectShadowWithTiling does not work with rotations, and the fallback of 806 806 // drawing though clipToImageBuffer() produces scaling artifacts for us. 807 807 if (!getCTM().preservesAxisAlignment()) { 808 GraphicsContext* shadowContext = shadow ->beginShadowLayer(this, normalizedRect);808 GraphicsContext* shadowContext = shadow.beginShadowLayer(this, normalizedRect); 809 809 if (shadowContext) { 810 810 QPainter* shadowPainter = shadowContext->platformContext(); 811 811 shadowPainter->fillRect(normalizedRect, p->brush()); 812 shadow ->endShadowLayer(this);812 shadow.endShadowLayer(this); 813 813 } 814 814 } else 815 shadow ->drawRectShadow(this, rect, RoundedRect::Radii());815 shadow.drawRectShadow(this, rect, RoundedRect::Radii()); 816 816 } else { 817 817 // Solid rectangle fill with no blur shadow or transformations applied can be done … … 836 836 QPainter* p = m_data->p(); 837 837 if (hasShadow()) { 838 ShadowBlur* shadow = shadowBlur();839 if (shadow->mustUseShadowBlur(this)) {840 shadow ->drawRectShadow(this, platformRect, RoundedRect::Radii());838 if (mustUseShadowBlur()) { 839 ShadowBlur shadow(m_state); 840 shadow.drawRectShadow(this, platformRect, RoundedRect::Radii()); 841 841 } else { 842 842 QColor shadowColor = m_state.shadowColor; … … 857 857 QPainter* p = m_data->p(); 858 858 if (hasShadow()) { 859 ShadowBlur* shadow = shadowBlur();860 if (shadow->mustUseShadowBlur(this)) {861 shadow ->drawRectShadow(this, rect, RoundedRect::Radii(topLeft, topRight, bottomLeft, bottomRight));859 if (mustUseShadowBlur()) { 860 ShadowBlur shadow(m_state); 861 shadow.drawRectShadow(this, rect, RoundedRect::Radii(topLeft, topRight, bottomLeft, bottomRight)); 862 862 } else { 863 863 const QPointF shadowOffset(m_state.shadowOffset.width(), m_state.shadowOffset.height()); … … 887 887 QPainter* p = m_data->p(); 888 888 if (hasShadow()) { 889 ShadowBlur* shadow = shadowBlur();890 if (shadow->mustUseShadowBlur(this))891 shadow ->drawInsetShadow(this, rect, roundedHoleRect.rect(), roundedHoleRect.radii());892 else {889 if (mustUseShadowBlur()) { 890 ShadowBlur shadow(m_state); 891 shadow.drawInsetShadow(this, rect, roundedHoleRect.rect(), roundedHoleRect.radii()); 892 } else { 893 893 const QPointF shadowOffset(m_state.shadowOffset.width(), m_state.shadowOffset.height()); 894 894 p->translate(shadowOffset); … … 904 904 { 905 905 return m_data->layerCount; 906 }907 908 ShadowBlur* GraphicsContext::shadowBlur()909 {910 return m_data->shadow;911 906 } 912 907 … … 1171 1166 // Qt doesn't support shadows natively, they are drawn manually in the draw* 1172 1167 // functions 1173 1174 1168 if (m_state.shadowsIgnoreTransforms) { 1175 1169 // Meaning that this graphics context is associated with a CanvasRenderingContext … … 1177 1171 m_state.shadowOffset = FloatSize(size.width(), -size.height()); 1178 1172 } 1179 1180 m_data->shadow->setShadowValues(FloatSize(m_state.shadowBlur, m_state.shadowBlur), m_state.shadowOffset, color, colorSpace, m_state.shadowsIgnoreTransforms);1181 1173 } 1182 1174 1183 1175 void GraphicsContext::clearPlatformShadow() 1184 1176 { 1185 m_data->shadow->clear();1186 1177 } 1187 1178 -
trunk/Source/WebCore/platform/graphics/qt/ImageQt.cpp
r143046 r147750 260 260 261 261 if (ctxt->hasShadow()) { 262 ShadowBlur * shadow = ctxt->shadowBlur();263 GraphicsContext* shadowContext = shadow ->beginShadowLayer(ctxt, normalizedDst);262 ShadowBlur shadow(ctxt->state()); 263 GraphicsContext* shadowContext = shadow.beginShadowLayer(ctxt, normalizedDst); 264 264 if (shadowContext) { 265 265 QPainter* shadowPainter = shadowContext->platformContext(); 266 266 shadowPainter->drawPixmap(normalizedDst, *image, normalizedSrc); 267 shadow ->endShadowLayer(ctxt);267 shadow.endShadowLayer(ctxt); 268 268 } 269 269 } -
trunk/Source/WebCore/platform/graphics/qt/StillImageQt.cpp
r147622 r147750 81 81 82 82 if (ctxt->hasShadow()) { 83 ShadowBlur * shadow = ctxt->shadowBlur();84 GraphicsContext* shadowContext = shadow ->beginShadowLayer(ctxt, normalizedDst);83 ShadowBlur shadow(ctxt->state()); 84 GraphicsContext* shadowContext = shadow.beginShadowLayer(ctxt, normalizedDst); 85 85 if (shadowContext) { 86 86 QPainter* shadowPainter = shadowContext->platformContext(); 87 87 shadowPainter->drawPixmap(normalizedDst, *m_pixmap, normalizedSrc); 88 shadow ->endShadowLayer(ctxt);88 shadow.endShadowLayer(ctxt); 89 89 } 90 90 }
Note: See TracChangeset
for help on using the changeset viewer.