Diff
Modified: trunk/LayoutTests/ChangeLog (180510 => 180511)
--- trunk/LayoutTests/ChangeLog 2015-02-23 19:27:36 UTC (rev 180510)
+++ trunk/LayoutTests/ChangeLog 2015-02-23 20:31:04 UTC (rev 180511)
@@ -1,3 +1,16 @@
+2015-02-23 Said Abou-Hallawa <[email protected]>
+
+ Drawing an SVG image into a canvas using drawImage() ignores globalAlpha.
+ https://bugs.webkit.org/show_bug.cgi?id=141729.
+
+ Reviewed by Simon Fraser.
+
+ Add a new test which draws an SVG image on a canvas after setting its
+ globalAlpha to a value less than 1.
+
+ * svg/canvas/canvas-global-alpha-svg-expected.html: Added.
+ * svg/canvas/canvas-global-alpha-svg.html: Added.
+
2015-02-23 Gyuyoung Kim <[email protected]>
Unreviewed EFL gardening. Mark tests of css3 overflow, border to ImageOnlyFailure.
Added: trunk/LayoutTests/svg/canvas/canvas-global-alpha-svg-expected.html (0 => 180511)
--- trunk/LayoutTests/svg/canvas/canvas-global-alpha-svg-expected.html (rev 0)
+++ trunk/LayoutTests/svg/canvas/canvas-global-alpha-svg-expected.html 2015-02-23 20:31:04 UTC (rev 180511)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ div {
+ border-width: 25px;
+ border-style: solid;
+ border-color: green;
+ }
+ .main {
+ width: 100px;
+ height: 100px;
+ }
+ .sub {
+ width: 50px;
+ height: 50px;
+ }
+ .sub-sub {
+ width: 0px;
+ height: 0px;
+ }
+ .low-opacity {
+ opacity: 0.2;
+ }
+ </style>
+</head>
+<body>
+ <div class="main">
+ <div class="sub low-opacity">
+ <div class="sub-sub low-opacity"></div>
+ </div>
+ </div>
+</body>
+</html>
Added: trunk/LayoutTests/svg/canvas/canvas-global-alpha-svg.html (0 => 180511)
--- trunk/LayoutTests/svg/canvas/canvas-global-alpha-svg.html (rev 0)
+++ trunk/LayoutTests/svg/canvas/canvas-global-alpha-svg.html 2015-02-23 20:31:04 UTC (rev 180511)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <canvas id="canvas"></canvas>
+ <script>
+ var canvas = document.getElementById("canvas");
+ canvas.width = 150;
+ canvas.height = 150;
+
+ var context = canvas.getContext("2d");
+ context.strokeStyle = "green";
+ context.lineWidth = 50;
+ context.strokeRect(0,0,150,150);
+
+ var svgImage = new Image();
+ svgImage._onload_ = function() {
+ context.globalAlpha = 0.2;
+ context.drawImage(svgImage, 25, 25);
+ };
+
+ svgImage.src = "" \
+ <svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'> \
+ <rect width='100%' height='100%' style='fill:none;stroke:green;stroke-width:50%;'/> \
+ <rect x='25%' y='25%' width='50%' height='50%' fill='green' fill-opacity='0.2'/> \
+ </svg>";
+ </script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (180510 => 180511)
--- trunk/Source/WebCore/ChangeLog 2015-02-23 19:27:36 UTC (rev 180510)
+++ trunk/Source/WebCore/ChangeLog 2015-02-23 20:31:04 UTC (rev 180511)
@@ -1,3 +1,42 @@
+2015-02-23 Said Abou-Hallawa <[email protected]>
+
+ Drawing an SVG image into a canvas using drawImage() ignores globalAlpha.
+ https://bugs.webkit.org/show_bug.cgi?id=141729.
+
+ Reviewed by Simon Fraser.
+
+ When drawing an SVG image and the drawing context is set to be transparent,
+ make sure this transparency is applied to the compositing layer.
+
+ Test: svg/canvas/canvas-global-alpha-svg.html
+
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContext::setAlpha): Make setAlpha() calls the platform
+ function and sets 'm_state.alpha' to the input value.
+
+ (WebCore::GraphicsContext::alpha): Add a new function 'alpha()' which
+ returns the value of the global alpha.
+
+ * platform/graphics/GraphicsContext.h:
+ (WebCore::GraphicsContextState::GraphicsContextState): Add a new member
+ 'alpha' to the context state since the getter function CGContextGetAlpha
+ is defined only in a private header file. Also move single line functions
+ from the source file to the header file.
+
+ * platform/graphics/cairo/GraphicsContextCairo.cpp:
+ (WebCore::GraphicsContext::setPlatformAlpha):
+ (WebCore::GraphicsContext::setAlpha): Deleted.
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::setPlatformAlpha):
+ (WebCore::GraphicsContext::setAlpha): Deleted.
+ Rename setAlpha() to setPlatformAlpha() in the platform files. Add setAlpha()
+ to the core file. setAlpha() will set the value of 'm_state.alpha' and call
+ setPlatformAlpha().
+
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::draw): If the drawing context is transparent, apply its
+ global alpha value to the compositing layer.
+
2015-02-23 Eric Carlson <[email protected]>
Occasional crash in MediaPlayer::setPrivateBrowsingMode
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (180510 => 180511)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2015-02-23 19:27:36 UTC (rev 180510)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2015-02-23 20:31:04 UTC (rev 180511)
@@ -208,12 +208,6 @@
clearPlatformShadow();
}
-bool GraphicsContext::hasShadow() const
-{
- return m_state.shadowColor.isValid() && m_state.shadowColor.alpha()
- && (m_state.shadowBlur || m_state.shadowOffset.width() || m_state.shadowOffset.height());
-}
-
bool GraphicsContext::getShadow(FloatSize& offset, float& blur, Color& color, ColorSpace& colorSpace) const
{
offset = m_state.shadowOffset;
@@ -224,11 +218,6 @@
return hasShadow();
}
-bool GraphicsContext::hasBlurredShadow() const
-{
- return m_state.shadowColor.isValid() && m_state.shadowColor.alpha() && m_state.shadowBlur;
-}
-
#if USE(CAIRO)
bool GraphicsContext::mustUseShadowBlur() const
{
@@ -247,36 +236,6 @@
}
#endif
-float GraphicsContext::strokeThickness() const
-{
- return m_state.strokeThickness;
-}
-
-StrokeStyle GraphicsContext::strokeStyle() const
-{
- return m_state.strokeStyle;
-}
-
-Color GraphicsContext::strokeColor() const
-{
- return m_state.strokeColor;
-}
-
-ColorSpace GraphicsContext::strokeColorSpace() const
-{
- return m_state.strokeColorSpace;
-}
-
-WindRule GraphicsContext::fillRule() const
-{
- return m_state.fillRule;
-}
-
-void GraphicsContext::setFillRule(WindRule fillRule)
-{
- m_state.fillRule = fillRule;
-}
-
void GraphicsContext::setFillColor(const Color& color, ColorSpace colorSpace)
{
m_state.fillColor = color;
@@ -286,53 +245,18 @@
setPlatformFillColor(color, colorSpace);
}
-Color GraphicsContext::fillColor() const
+void GraphicsContext::setShouldAntialias(bool shouldAntialias)
{
- return m_state.fillColor;
+ m_state.shouldAntialias = shouldAntialias;
+ setPlatformShouldAntialias(shouldAntialias);
}
-ColorSpace GraphicsContext::fillColorSpace() const
+void GraphicsContext::setShouldSmoothFonts(bool shouldSmoothFonts)
{
- return m_state.fillColorSpace;
+ m_state.shouldSmoothFonts = shouldSmoothFonts;
+ setPlatformShouldSmoothFonts(shouldSmoothFonts);
}
-void GraphicsContext::setShouldAntialias(bool b)
-{
- m_state.shouldAntialias = b;
- setPlatformShouldAntialias(b);
-}
-
-bool GraphicsContext::shouldAntialias() const
-{
- return m_state.shouldAntialias;
-}
-
-void GraphicsContext::setShouldSmoothFonts(bool b)
-{
- m_state.shouldSmoothFonts = b;
- setPlatformShouldSmoothFonts(b);
-}
-
-bool GraphicsContext::shouldSmoothFonts() const
-{
- return m_state.shouldSmoothFonts;
-}
-
-void GraphicsContext::setShouldSubpixelQuantizeFonts(bool b)
-{
- m_state.shouldSubpixelQuantizeFonts = b;
-}
-
-bool GraphicsContext::shouldSubpixelQuantizeFonts() const
-{
- return m_state.shouldSubpixelQuantizeFonts;
-}
-
-const GraphicsContextState& GraphicsContext::state() const
-{
- return m_state;
-}
-
void GraphicsContext::setStrokePattern(Ref<Pattern>&& pattern)
{
m_state.strokeGradient.clear();
@@ -357,36 +281,6 @@
m_state.fillPattern.clear();
}
-Gradient* GraphicsContext::fillGradient() const
-{
- return m_state.fillGradient.get();
-}
-
-Gradient* GraphicsContext::strokeGradient() const
-{
- return m_state.strokeGradient.get();
-}
-
-Pattern* GraphicsContext::fillPattern() const
-{
- return m_state.fillPattern.get();
-}
-
-Pattern* GraphicsContext::strokePattern() const
-{
- return m_state.strokePattern.get();
-}
-
-void GraphicsContext::setShadowsIgnoreTransforms(bool ignoreTransforms)
-{
- m_state.shadowsIgnoreTransforms = ignoreTransforms;
-}
-
-bool GraphicsContext::shadowsIgnoreTransforms() const
-{
- return m_state.shadowsIgnoreTransforms;
-}
-
void GraphicsContext::beginTransparencyLayer(float opacity)
{
beginPlatformTransparencyLayer(opacity);
@@ -400,32 +294,12 @@
--m_transparencyCount;
}
-bool GraphicsContext::isInTransparencyLayer() const
-{
- return (m_transparencyCount > 0) && supportsTransparencyLayers();
-}
-
-bool GraphicsContext::updatingControlTints() const
-{
- return m_updatingControlTints;
-}
-
void GraphicsContext::setUpdatingControlTints(bool b)
{
setPaintingDisabled(b);
m_updatingControlTints = b;
}
-void GraphicsContext::setPaintingDisabled(bool f)
-{
- m_state.paintingDisabled = f;
-}
-
-bool GraphicsContext::paintingDisabled() const
-{
- return m_state.paintingDisabled;
-}
-
float GraphicsContext::drawText(const FontCascade& font, const TextRun& run, const FloatPoint& point, int from, int to)
{
if (paintingDisabled())
@@ -610,11 +484,6 @@
}
#endif
-TextDrawingModeFlags GraphicsContext::textDrawingMode() const
-{
- return m_state.textDrawingMode;
-}
-
void GraphicsContext::setTextDrawingMode(TextDrawingModeFlags mode)
{
m_state.textDrawingMode = mode;
@@ -679,6 +548,12 @@
}
#endif
+void GraphicsContext::setAlpha(float alpha)
+{
+ m_state.alpha = alpha;
+ setPlatformAlpha(alpha);
+}
+
void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation, BlendMode blendMode)
{
m_state.compositeOperator = compositeOperation;
@@ -686,26 +561,6 @@
setPlatformCompositeOperation(compositeOperation, blendMode);
}
-CompositeOperator GraphicsContext::compositeOperation() const
-{
- return m_state.compositeOperator;
-}
-
-BlendMode GraphicsContext::blendModeOperation() const
-{
- return m_state.blendMode;
-}
-
-void GraphicsContext::setDrawLuminanceMask(bool drawLuminanceMask)
-{
- m_state.drawLuminanceMask = drawLuminanceMask;
-}
-
-bool GraphicsContext::drawLuminanceMask() const
-{
- return m_state.drawLuminanceMask;
-}
-
#if !USE(CG)
// Implement this if you want to go ahead and push the drawing mode into your native context
// immediately.
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (180510 => 180511)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2015-02-23 19:27:36 UTC (rev 180510)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2015-02-23 20:31:04 UTC (rev 180511)
@@ -113,19 +113,7 @@
struct GraphicsContextState {
GraphicsContextState()
- : strokeThickness(0)
- , shadowBlur(0)
- , textDrawingMode(TextModeFill)
- , strokeColor(Color::black)
- , fillColor(Color::black)
- , strokeStyle(SolidStroke)
- , fillRule(RULE_NONZERO)
- , strokeColorSpace(ColorSpaceDeviceRGB)
- , fillColorSpace(ColorSpaceDeviceRGB)
- , shadowColorSpace(ColorSpaceDeviceRGB)
- , compositeOperator(CompositeSourceOver)
- , blendMode(BlendModeNormal)
- , shouldAntialias(true)
+ : shouldAntialias(true)
, shouldSmoothFonts(true)
, shouldSubpixelQuantizeFonts(true)
, paintingDisabled(false)
@@ -147,24 +135,25 @@
FloatSize shadowOffset;
- float strokeThickness;
- float shadowBlur;
+ float strokeThickness { 0 };
+ float shadowBlur { 0 };
- TextDrawingModeFlags textDrawingMode;
+ TextDrawingModeFlags textDrawingMode { TextModeFill };
- Color strokeColor;
- Color fillColor;
+ Color strokeColor { Color::black };
+ Color fillColor { Color::black };
Color shadowColor;
- StrokeStyle strokeStyle;
- WindRule fillRule;
+ StrokeStyle strokeStyle { SolidStroke };
+ WindRule fillRule { RULE_NONZERO };
- ColorSpace strokeColorSpace;
- ColorSpace fillColorSpace;
- ColorSpace shadowColorSpace;
+ ColorSpace strokeColorSpace { ColorSpaceDeviceRGB };
+ ColorSpace fillColorSpace { ColorSpaceDeviceRGB };
+ ColorSpace shadowColorSpace { ColorSpaceDeviceRGB };
- CompositeOperator compositeOperator;
- BlendMode blendMode;
+ float alpha { 1 };
+ CompositeOperator compositeOperator { CompositeSourceOver };
+ BlendMode blendMode { BlendModeNormal };
bool shouldAntialias : 1;
bool shouldSmoothFonts : 1;
@@ -216,47 +205,50 @@
WEBCORE_EXPORT PlatformGraphicsContext* platformContext() const;
- float strokeThickness() const;
void setStrokeThickness(float);
- StrokeStyle strokeStyle() const;
+ float strokeThickness() const { return m_state.strokeThickness; }
+
void setStrokeStyle(StrokeStyle);
- Color strokeColor() const;
- ColorSpace strokeColorSpace() const;
+ StrokeStyle strokeStyle() const { return m_state.strokeStyle; }
+
WEBCORE_EXPORT void setStrokeColor(const Color&, ColorSpace);
+ Color strokeColor() const { return m_state.strokeColor; }
+ ColorSpace strokeColorSpace() const { return m_state.strokeColorSpace; }
void setStrokePattern(Ref<Pattern>&&);
- Pattern* strokePattern() const;
+ Pattern* strokePattern() const { return m_state.strokePattern.get(); }
void setStrokeGradient(Ref<Gradient>&&);
- Gradient* strokeGradient() const;
+ Gradient* strokeGradient() const { return m_state.strokeGradient.get(); }
- WindRule fillRule() const;
- void setFillRule(WindRule);
- Color fillColor() const;
- ColorSpace fillColorSpace() const;
+ void setFillRule(WindRule fillRule) { m_state.fillRule = fillRule; }
+ WindRule fillRule() const { return m_state.fillRule; }
+
WEBCORE_EXPORT void setFillColor(const Color&, ColorSpace);
+ Color fillColor() const { return m_state.fillColor; }
+ ColorSpace fillColorSpace() const { return m_state.fillColorSpace; }
void setFillPattern(Ref<Pattern>&&);
- Pattern* fillPattern() const;
+ Pattern* fillPattern() const { return m_state.fillPattern.get(); }
WEBCORE_EXPORT void setFillGradient(Ref<Gradient>&&);
- Gradient* fillGradient() const;
+ Gradient* fillGradient() const { return m_state.fillGradient.get(); }
- void setShadowsIgnoreTransforms(bool);
- bool shadowsIgnoreTransforms() const;
+ void setShadowsIgnoreTransforms(bool shadowsIgnoreTransforms) { m_state.shadowsIgnoreTransforms = shadowsIgnoreTransforms; }
+ bool shadowsIgnoreTransforms() const { return m_state.shadowsIgnoreTransforms; }
WEBCORE_EXPORT void setShouldAntialias(bool);
- bool shouldAntialias() const;
+ bool shouldAntialias() const { return m_state.shouldAntialias; }
WEBCORE_EXPORT void setShouldSmoothFonts(bool);
- bool shouldSmoothFonts() const;
+ bool shouldSmoothFonts() const { return m_state.shouldSmoothFonts; }
// Normally CG enables subpixel-quantization because it improves the performance of aligning glyphs.
// In some cases we have to disable to to ensure a high-quality output of the glyphs.
- void setShouldSubpixelQuantizeFonts(bool);
- bool shouldSubpixelQuantizeFonts() const;
+ void setShouldSubpixelQuantizeFonts(bool shouldSubpixelQuantizeFonts) { m_state.shouldSubpixelQuantizeFonts = shouldSubpixelQuantizeFonts; }
+ bool shouldSubpixelQuantizeFonts() const { return m_state.shouldSubpixelQuantizeFonts; }
- const GraphicsContextState& state() const;
+ const GraphicsContextState& state() const { return m_state; }
#if USE(CG)
void applyStrokePattern();
@@ -338,9 +330,9 @@
IntRect clipBounds() const;
- TextDrawingModeFlags textDrawingMode() const;
void setTextDrawingMode(TextDrawingModeFlags);
-
+ TextDrawingModeFlags textDrawingMode() const { return m_state.textDrawingMode; }
+
float drawText(const FontCascade&, const TextRun&, const FloatPoint&, int from = 0, int to = -1);
void drawGlyphs(const FontCascade&, const Font&, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&);
void drawEmphasisMarks(const FontCascade&, const TextRun& , const AtomicString& mark, const FloatPoint&, int from = 0, int to = -1);
@@ -367,26 +359,28 @@
static void updateDocumentMarkerResources();
void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarkerLineStyle);
- WEBCORE_EXPORT bool paintingDisabled() const;
- void setPaintingDisabled(bool);
+ void setPaintingDisabled(bool paintingDisabled) { m_state.paintingDisabled = paintingDisabled; }
+ WEBCORE_EXPORT bool paintingDisabled() const { return m_state.paintingDisabled; }
- WEBCORE_EXPORT bool updatingControlTints() const;
void setUpdatingControlTints(bool);
+ WEBCORE_EXPORT bool updatingControlTints() const { return m_updatingControlTints; }
WEBCORE_EXPORT void beginTransparencyLayer(float opacity);
WEBCORE_EXPORT void endTransparencyLayer();
- bool isInTransparencyLayer() const;
+ bool isInTransparencyLayer() const { return (m_transparencyCount > 0) && supportsTransparencyLayers(); }
- bool hasShadow() const;
WEBCORE_EXPORT void setShadow(const FloatSize&, float blur, const Color&, ColorSpace);
// Legacy shadow blur radius is used for canvas, and -webkit-box-shadow.
// It has different treatment of radii > 8px.
void setLegacyShadow(const FloatSize&, float blur, const Color&, ColorSpace);
- bool getShadow(FloatSize&, float&, Color&, ColorSpace&) const;
WEBCORE_EXPORT void clearShadow();
+ bool getShadow(FloatSize&, float&, Color&, ColorSpace&) const;
- bool hasBlurredShadow() const;
+ bool hasVisibleShadow() const { return m_state.shadowColor.isValid() && m_state.shadowColor.alpha(); }
+ bool hasShadow() const { return hasVisibleShadow() && (m_state.shadowBlur || m_state.shadowOffset.width() || m_state.shadowOffset.height()); }
+ bool hasBlurredShadow() const { return hasVisibleShadow() && m_state.shadowBlur; }
+
#if USE(CAIRO)
bool mustUseShadowBlur() const;
#endif
@@ -403,13 +397,14 @@
void setMiterLimit(float);
void setAlpha(float);
+ float alpha() const { return m_state.alpha; }
WEBCORE_EXPORT void setCompositeOperation(CompositeOperator, BlendMode = BlendModeNormal);
- CompositeOperator compositeOperation() const;
- BlendMode blendModeOperation() const;
+ CompositeOperator compositeOperation() const { return m_state.compositeOperator; }
+ BlendMode blendModeOperation() const { return m_state.blendMode; }
- void setDrawLuminanceMask(bool);
- bool drawLuminanceMask() const;
+ void setDrawLuminanceMask(bool drawLuminanceMask) { m_state.drawLuminanceMask = drawLuminanceMask; }
+ bool drawLuminanceMask() const { return m_state.drawLuminanceMask; }
WEBCORE_EXPORT void clip(const Path&, WindRule = RULE_EVENODD);
@@ -540,6 +535,7 @@
void setPlatformShadow(const FloatSize&, float blur, const Color&, ColorSpace);
void clearPlatformShadow();
+ void setPlatformAlpha(float);
void setPlatformCompositeOperation(CompositeOperator, BlendMode = BlendModeNormal);
void beginPlatformTransparencyLayer(float opacity);
Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (180510 => 180511)
--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2015-02-23 19:27:36 UTC (rev 180510)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2015-02-23 20:31:04 UTC (rev 180511)
@@ -928,7 +928,7 @@
cairo_set_miter_limit(platformContext()->cr(), miter);
}
-void GraphicsContext::setAlpha(float alpha)
+void GraphicsContext::setPlatformAlpha(float alpha)
{
platformContext()->setGlobalAlpha(alpha);
}
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (180510 => 180511)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2015-02-23 19:27:36 UTC (rev 180510)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2015-02-23 20:31:04 UTC (rev 180511)
@@ -996,13 +996,6 @@
CGContextSetMiterLimit(platformContext(), limit);
}
-void GraphicsContext::setAlpha(float alpha)
-{
- if (paintingDisabled())
- return;
- CGContextSetAlpha(platformContext(), alpha);
-}
-
void GraphicsContext::clearRect(const FloatRect& r)
{
if (paintingDisabled())
@@ -1481,6 +1474,13 @@
CGContextSetShouldSmoothFonts(platformContext(), enable);
}
+void GraphicsContext::setPlatformAlpha(float alpha)
+{
+ if (paintingDisabled())
+ return;
+ CGContextSetAlpha(platformContext(), alpha);
+}
+
void GraphicsContext::setPlatformCompositeOperation(CompositeOperator mode, BlendMode blendMode)
{
if (paintingDisabled())
Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (180510 => 180511)
--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2015-02-23 19:27:36 UTC (rev 180510)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp 2015-02-23 20:31:04 UTC (rev 180511)
@@ -229,9 +229,11 @@
GraphicsContextStateSaver stateSaver(*context);
context->setCompositeOperation(compositeOp, blendMode);
context->clip(enclosingIntRect(dstRect));
- bool compositingRequiresTransparencyLayer = compositeOp != CompositeSourceOver || blendMode != BlendModeNormal;
+
+ float alpha = context->alpha();
+ bool compositingRequiresTransparencyLayer = compositeOp != CompositeSourceOver || blendMode != BlendModeNormal || alpha < 1;
if (compositingRequiresTransparencyLayer) {
- context->beginTransparencyLayer(1);
+ context->beginTransparencyLayer(alpha);
context->setCompositeOperation(CompositeSourceOver, BlendModeNormal);
}