Modified: trunk/Source/WebCore/ChangeLog (224576 => 224577)
--- trunk/Source/WebCore/ChangeLog 2017-11-08 13:02:13 UTC (rev 224576)
+++ trunk/Source/WebCore/ChangeLog 2017-11-08 13:37:51 UTC (rev 224577)
@@ -1,3 +1,28 @@
+2017-11-08 Zan Dobersek <[email protected]>
+
+ [Cairo] Move transparency layers Vector to PlatformContextCairo
+ https://bugs.webkit.org/show_bug.cgi?id=179420
+
+ Reviewed by Carlos Garcia Campos.
+
+ Move the Vector of transparency layer float values from the
+ GraphicsContextPlatformPrivate class to PlatformContextCairo.
+ It fits better there since it's a platform-specific context
+ state, just like e.g. the ShadowBlur member.
+
+ No new tests -- no change in behavior.
+
+ * platform/graphics/cairo/GraphicsContextCairo.cpp:
+ (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+ (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+ * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
+ * platform/graphics/cairo/PlatformContextCairo.h:
+ (WebCore::PlatformContextCairo::layers):
+ * platform/graphics/win/GraphicsContextCairoWin.cpp:
+ (WebCore::drawBitmapToContext):
+ (WebCore::GraphicsContext::releaseWindowsContext):
+ (WebCore::GraphicsContext::drawWindowsBitmap):
+
2017-11-08 Jeremy Jones <[email protected]>
Disable implicit animations when adding or removing text track representation layers.
Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (224576 => 224577)
--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2017-11-08 13:02:13 UTC (rev 224576)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2017-11-08 13:37:51 UTC (rev 224577)
@@ -878,7 +878,7 @@
cairo_t* cr = platformContext()->cr();
cairo_push_group(cr);
- m_data->layers.append(opacity);
+ platformContext()->layers().append(opacity);
}
void GraphicsContext::endPlatformTransparencyLayer()
@@ -891,8 +891,10 @@
cairo_t* cr = platformContext()->cr();
cairo_pop_group_to_source(cr);
- cairo_paint_with_alpha(cr, m_data->layers.last());
- m_data->layers.removeLast();
+
+ auto& layers = platformContext()->layers();
+ cairo_paint_with_alpha(cr, layers.last());
+ layers.removeLast();
}
bool GraphicsContext::supportsTransparencyLayers()
Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h (224576 => 224577)
--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h 2017-11-08 13:02:13 UTC (rev 224576)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h 2017-11-08 13:37:51 UTC (rev 224577)
@@ -89,7 +89,6 @@
#endif
PlatformContextCairo* platformContext;
- Vector<float> layers;
#if PLATFORM(WIN) || (PLATFORM(GTK) && OS(WINDOWS))
HDC m_hdc;
Modified: trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h (224576 => 224577)
--- trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h 2017-11-08 13:02:13 UTC (rev 224576)
+++ trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h 2017-11-08 13:37:51 UTC (rev 224577)
@@ -51,6 +51,7 @@
void setCr(cairo_t* cr) { m_cr = cr; }
ShadowBlur& shadowBlur() { return m_shadowBlur; }
+ Vector<float>& layers() { return m_layers; }
void save();
void restore();
@@ -81,7 +82,8 @@
// GraphicsContext is responsible for managing the state of the ShadowBlur,
// so it does not need to be on the state stack.
ShadowBlur m_shadowBlur;
-
+ // Transparency layers.
+ Vector<float> m_layers;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp (224576 => 224577)
--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp 2017-11-08 13:02:13 UTC (rev 224576)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp 2017-11-08 13:37:51 UTC (rev 224577)
@@ -97,7 +97,7 @@
bytes[i + 3] = level;
}
-static void drawBitmapToContext(GraphicsContextPlatformPrivate* context, cairo_t* cr, const DIBPixelData& pixelData, const IntSize& translate)
+static void drawBitmapToContext(PlatformContextCairo& platformContext, const DIBPixelData& pixelData, const IntSize& translate)
{
// Need to make a cairo_surface_t out of the bitmap's pixel buffer and then draw
// it into our context.
@@ -109,13 +109,14 @@
// Flip the target surface so that when we set the srcImage as
// the surface it will draw right-side-up.
+ cairo_t* cr = platformContext.cr();
cairo_save(cr);
cairo_translate(cr, static_cast<double>(translate.width()), static_cast<double>(translate.height()));
cairo_scale(cr, 1, -1);
cairo_set_source_surface(cr, surface, 0, 0);
- if (context->layers.size())
- cairo_paint_with_alpha(cr, context->layers.last());
+ if (platformContext.layers().size())
+ cairo_paint_with_alpha(cr, platformContext.layers().last());
else
cairo_paint(cr);
@@ -147,7 +148,7 @@
if (!supportAlphaBlend)
setRGBABitmapAlpha(bytes, pixelData.size().height() * pixelData.bytesPerRow(), 255);
- drawBitmapToContext(m_data, platformContext()->cr(), pixelData, IntSize(dstRect.x(), dstRect.height() + dstRect.y()));
+ drawBitmapToContext(*platformContext(), pixelData, IntSize(dstRect.x(), dstRect.height() + dstRect.y()));
::DeleteDC(hdc);
}
@@ -155,7 +156,7 @@
#if PLATFORM(WIN)
void GraphicsContext::drawWindowsBitmap(WindowsBitmap* bitmap, const IntPoint& point)
{
- drawBitmapToContext(m_data, platformContext()->cr(), bitmap->windowsDIB(), IntSize(point.x(), bitmap->size().height() + point.y()));
+ drawBitmapToContext(*platformContext(), bitmap->windowsDIB(), IntSize(point.x(), bitmap->size().height() + point.y()));
}
void GraphicsContextPlatformPrivate::syncContext(cairo_t* cr)