https://bugs.webkit.org/show_bug.cgi?id=179286
Reviewed by Sam Weinig.
Start moving towards a model when GraphicsContext has a pointer to an implementation
("pimpl") by adding GraphicsContextImpl, and converting display list recording to
be an implementation of a GraphicsContextImpl.
No behavior change.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::DisplayListDrawingContext::DisplayListDrawingContext):
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::GraphicsContext):
(WebCore::GraphicsContext::save):
(WebCore::GraphicsContext::restore):
(WebCore::GraphicsContext::setStrokeThickness):
(WebCore::GraphicsContext::setStrokeStyle):
(WebCore::GraphicsContext::setStrokeColor):
(WebCore::GraphicsContext::setShadow):
(WebCore::GraphicsContext::setLegacyShadow):
(WebCore::GraphicsContext::clearShadow):
(WebCore::GraphicsContext::setFillColor):
(WebCore::GraphicsContext::setShadowsIgnoreTransforms):
(WebCore::GraphicsContext::setShouldAntialias):
(WebCore::GraphicsContext::setShouldSmoothFonts):
(WebCore::GraphicsContext::setShouldSubpixelQuantizeFonts):
(WebCore::GraphicsContext::setImageInterpolationQuality):
(WebCore::GraphicsContext::setStrokePattern):
(WebCore::GraphicsContext::setFillPattern):
(WebCore::GraphicsContext::setStrokeGradient):
(WebCore::GraphicsContext::setFillRule):
(WebCore::GraphicsContext::setFillGradient):
(WebCore::GraphicsContext::beginTransparencyLayer):
(WebCore::GraphicsContext::endTransparencyLayer):
(WebCore::GraphicsContext::drawGlyphs):
(WebCore::GraphicsContext::drawImage):
(WebCore::GraphicsContext::drawTiledImage):
(WebCore::GraphicsContext::setTextDrawingMode):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::fillRoundedRect):
(WebCore::GraphicsContext::setAlpha):
(WebCore::GraphicsContext::setCompositeOperation):
(WebCore::GraphicsContext::setDrawLuminanceMask):
(WebCore::GraphicsContext::applyDeviceScaleFactor):
(WebCore::GraphicsContext::fillEllipse):
(WebCore::GraphicsContext::strokeEllipse):
* platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::hasPlatformContext const):
(WebCore::GraphicsContext::paintingDisabled const):
(WebCore::GraphicsContext::setDisplayListRecorder): Deleted.
(WebCore::GraphicsContext::isRecording const): Deleted.
* platform/graphics/GraphicsContextImpl.cpp: Added.
(WebCore::GraphicsContextImpl::GraphicsContextImpl):
(WebCore::GraphicsContextImpl::~GraphicsContextImpl):
* platform/graphics/GraphicsContextImpl.h: Added.
(WebCore::GraphicsContextImpl::graphicsContext const):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::getCTM const):
(WebCore::GraphicsContext::savePlatformState):
(WebCore::GraphicsContext::restorePlatformState):
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::drawNativeImage):
(WebCore::GraphicsContext::drawLine):
(WebCore::GraphicsContext::drawEllipse):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::clipPath):
(WebCore::GraphicsContext::clipBounds const):
(WebCore::GraphicsContext::drawLinesForText):
(WebCore::GraphicsContext::roundToDevicePixels):
(WebCore::GraphicsContext::translate):
(WebCore::GraphicsContext::setPlatformStrokeThickness):
(WebCore::GraphicsContext::setPlatformStrokeStyle):
(WebCore::GraphicsContext::concatCTM):
(WebCore::GraphicsContext::setCTM):
(WebCore::GraphicsContext::beginPlatformTransparencyLayer):
(WebCore::GraphicsContext::endPlatformTransparencyLayer):
(WebCore::GraphicsContext::clearRect):
(WebCore::GraphicsContext::strokeRect):
(WebCore::GraphicsContext::setLineCap):
(WebCore::GraphicsContext::setLineDash):
(WebCore::GraphicsContext::setLineJoin):
(WebCore::GraphicsContext::setMiterLimit):
(WebCore::GraphicsContext::clipOut):
(WebCore::GraphicsContext::rotate):
(WebCore::GraphicsContext::scale):
(WebCore::GraphicsContext::platformFillRoundedRect):
(WebCore::GraphicsContext::fillRectWithRoundedHole):
(WebCore::GraphicsContext::drawPattern):
(WebCore::GraphicsContext::setPlatformShouldAntialias):
(WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
(WebCore::GraphicsContext::isAcceleratedContext const):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::savePlatformState):
(WebCore::GraphicsContext::restorePlatformState):
(WebCore::GraphicsContext::drawNativeImage):
(WebCore::GraphicsContext::drawPattern):
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::drawLine):
(WebCore::GraphicsContext::drawEllipse):
(WebCore::GraphicsContext::applyStrokePattern):
(WebCore::GraphicsContext::applyFillPattern):
(WebCore::GraphicsContext::drawPath):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::platformFillRoundedRect):
(WebCore::GraphicsContext::fillRectWithRoundedHole):
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::clipOut):
(WebCore::GraphicsContext::clipPath):
(WebCore::GraphicsContext::clipBounds const):
(WebCore::GraphicsContext::beginPlatformTransparencyLayer):
(WebCore::GraphicsContext::endPlatformTransparencyLayer):
(WebCore::GraphicsContext::setPlatformShadow):
(WebCore::GraphicsContext::setMiterLimit):
(WebCore::GraphicsContext::clearRect):
(WebCore::GraphicsContext::strokeRect):
(WebCore::GraphicsContext::setLineCap):
(WebCore::GraphicsContext::setLineDash):
(WebCore::GraphicsContext::setLineJoin):
(WebCore::GraphicsContext::scale):
(WebCore::GraphicsContext::rotate):
(WebCore::GraphicsContext::translate):
(WebCore::GraphicsContext::concatCTM):
(WebCore::GraphicsContext::setCTM):
(WebCore::GraphicsContext::getCTM const):
(WebCore::GraphicsContext::roundToDevicePixels):
(WebCore::GraphicsContext::drawLinesForText):
(WebCore::GraphicsContext::setURLForRect):
(WebCore::GraphicsContext::setIsCALayerContext):
(WebCore::GraphicsContext::isCALayerContext const):
(WebCore::GraphicsContext::setIsAcceleratedContext):
(WebCore::GraphicsContext::isAcceleratedContext const):
(WebCore::GraphicsContext::setPlatformTextDrawingMode):
(WebCore::GraphicsContext::setPlatformStrokeColor):
(WebCore::GraphicsContext::setPlatformStrokeThickness):
(WebCore::GraphicsContext::setPlatformFillColor):
(WebCore::GraphicsContext::setPlatformShouldAntialias):
(WebCore::GraphicsContext::setPlatformShouldSmoothFonts):
(WebCore::GraphicsContext::setPlatformAlpha):
(WebCore::GraphicsContext::setPlatformCompositeOperation):
(WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
(WebCore::GraphicsContext::platformFillEllipse):
(WebCore::GraphicsContext::platformStrokeEllipse):
(WebCore::GraphicsContext::setDestinationForRect):
(WebCore::GraphicsContext::addDestinationAtPoint):
* platform/graphics/cocoa/GraphicsContextCocoa.mm:
(WebCore::GraphicsContext::drawFocusRing):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::Recorder):
(WebCore::DisplayList::Recorder::updateItemExtent const):
(WebCore::DisplayList::Recorder::extentFromLocalBounds const):
* platform/graphics/displaylists/DisplayListRecorder.h:
(WebCore::DisplayList::Recorder::itemCount const):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::paint):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224463
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-11-04 Simon Fraser <simon.fraser@apple.com>
+
+ Add a GraphicsContextImpl and use it for DispayList::Recorder
+ https://bugs.webkit.org/show_bug.cgi?id=179286
+
+ Reviewed by Sam Weinig.
+
+ Start moving towards a model when GraphicsContext has a pointer to an implementation
+ ("pimpl") by adding GraphicsContextImpl, and converting display list recording to
+ be an implementation of a GraphicsContextImpl.
+
+ No behavior change.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::DisplayListDrawingContext::DisplayListDrawingContext):
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContext::GraphicsContext):
+ (WebCore::GraphicsContext::save):
+ (WebCore::GraphicsContext::restore):
+ (WebCore::GraphicsContext::setStrokeThickness):
+ (WebCore::GraphicsContext::setStrokeStyle):
+ (WebCore::GraphicsContext::setStrokeColor):
+ (WebCore::GraphicsContext::setShadow):
+ (WebCore::GraphicsContext::setLegacyShadow):
+ (WebCore::GraphicsContext::clearShadow):
+ (WebCore::GraphicsContext::setFillColor):
+ (WebCore::GraphicsContext::setShadowsIgnoreTransforms):
+ (WebCore::GraphicsContext::setShouldAntialias):
+ (WebCore::GraphicsContext::setShouldSmoothFonts):
+ (WebCore::GraphicsContext::setShouldSubpixelQuantizeFonts):
+ (WebCore::GraphicsContext::setImageInterpolationQuality):
+ (WebCore::GraphicsContext::setStrokePattern):
+ (WebCore::GraphicsContext::setFillPattern):
+ (WebCore::GraphicsContext::setStrokeGradient):
+ (WebCore::GraphicsContext::setFillRule):
+ (WebCore::GraphicsContext::setFillGradient):
+ (WebCore::GraphicsContext::beginTransparencyLayer):
+ (WebCore::GraphicsContext::endTransparencyLayer):
+ (WebCore::GraphicsContext::drawGlyphs):
+ (WebCore::GraphicsContext::drawImage):
+ (WebCore::GraphicsContext::drawTiledImage):
+ (WebCore::GraphicsContext::setTextDrawingMode):
+ (WebCore::GraphicsContext::fillRect):
+ (WebCore::GraphicsContext::fillRoundedRect):
+ (WebCore::GraphicsContext::setAlpha):
+ (WebCore::GraphicsContext::setCompositeOperation):
+ (WebCore::GraphicsContext::setDrawLuminanceMask):
+ (WebCore::GraphicsContext::applyDeviceScaleFactor):
+ (WebCore::GraphicsContext::fillEllipse):
+ (WebCore::GraphicsContext::strokeEllipse):
+ * platform/graphics/GraphicsContext.h:
+ (WebCore::GraphicsContext::hasPlatformContext const):
+ (WebCore::GraphicsContext::paintingDisabled const):
+ (WebCore::GraphicsContext::setDisplayListRecorder): Deleted.
+ (WebCore::GraphicsContext::isRecording const): Deleted.
+ * platform/graphics/GraphicsContextImpl.cpp: Added.
+ (WebCore::GraphicsContextImpl::GraphicsContextImpl):
+ (WebCore::GraphicsContextImpl::~GraphicsContextImpl):
+ * platform/graphics/GraphicsContextImpl.h: Added.
+ (WebCore::GraphicsContextImpl::graphicsContext const):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::recursiveCommitChanges):
+ * platform/graphics/cairo/GraphicsContextCairo.cpp:
+ (WebCore::GraphicsContext::getCTM const):
+ (WebCore::GraphicsContext::savePlatformState):
+ (WebCore::GraphicsContext::restorePlatformState):
+ (WebCore::GraphicsContext::drawRect):
+ (WebCore::GraphicsContext::drawNativeImage):
+ (WebCore::GraphicsContext::drawLine):
+ (WebCore::GraphicsContext::drawEllipse):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ (WebCore::GraphicsContext::fillRect):
+ (WebCore::GraphicsContext::clip):
+ (WebCore::GraphicsContext::clipPath):
+ (WebCore::GraphicsContext::clipBounds const):
+ (WebCore::GraphicsContext::drawLinesForText):
+ (WebCore::GraphicsContext::roundToDevicePixels):
+ (WebCore::GraphicsContext::translate):
+ (WebCore::GraphicsContext::setPlatformStrokeThickness):
+ (WebCore::GraphicsContext::setPlatformStrokeStyle):
+ (WebCore::GraphicsContext::concatCTM):
+ (WebCore::GraphicsContext::setCTM):
+ (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+ (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+ (WebCore::GraphicsContext::clearRect):
+ (WebCore::GraphicsContext::strokeRect):
+ (WebCore::GraphicsContext::setLineCap):
+ (WebCore::GraphicsContext::setLineDash):
+ (WebCore::GraphicsContext::setLineJoin):
+ (WebCore::GraphicsContext::setMiterLimit):
+ (WebCore::GraphicsContext::clipOut):
+ (WebCore::GraphicsContext::rotate):
+ (WebCore::GraphicsContext::scale):
+ (WebCore::GraphicsContext::platformFillRoundedRect):
+ (WebCore::GraphicsContext::fillRectWithRoundedHole):
+ (WebCore::GraphicsContext::drawPattern):
+ (WebCore::GraphicsContext::setPlatformShouldAntialias):
+ (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
+ (WebCore::GraphicsContext::isAcceleratedContext const):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::savePlatformState):
+ (WebCore::GraphicsContext::restorePlatformState):
+ (WebCore::GraphicsContext::drawNativeImage):
+ (WebCore::GraphicsContext::drawPattern):
+ (WebCore::GraphicsContext::drawRect):
+ (WebCore::GraphicsContext::drawLine):
+ (WebCore::GraphicsContext::drawEllipse):
+ (WebCore::GraphicsContext::applyStrokePattern):
+ (WebCore::GraphicsContext::applyFillPattern):
+ (WebCore::GraphicsContext::drawPath):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ (WebCore::GraphicsContext::fillRect):
+ (WebCore::GraphicsContext::platformFillRoundedRect):
+ (WebCore::GraphicsContext::fillRectWithRoundedHole):
+ (WebCore::GraphicsContext::clip):
+ (WebCore::GraphicsContext::clipOut):
+ (WebCore::GraphicsContext::clipPath):
+ (WebCore::GraphicsContext::clipBounds const):
+ (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+ (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+ (WebCore::GraphicsContext::setPlatformShadow):
+ (WebCore::GraphicsContext::setMiterLimit):
+ (WebCore::GraphicsContext::clearRect):
+ (WebCore::GraphicsContext::strokeRect):
+ (WebCore::GraphicsContext::setLineCap):
+ (WebCore::GraphicsContext::setLineDash):
+ (WebCore::GraphicsContext::setLineJoin):
+ (WebCore::GraphicsContext::scale):
+ (WebCore::GraphicsContext::rotate):
+ (WebCore::GraphicsContext::translate):
+ (WebCore::GraphicsContext::concatCTM):
+ (WebCore::GraphicsContext::setCTM):
+ (WebCore::GraphicsContext::getCTM const):
+ (WebCore::GraphicsContext::roundToDevicePixels):
+ (WebCore::GraphicsContext::drawLinesForText):
+ (WebCore::GraphicsContext::setURLForRect):
+ (WebCore::GraphicsContext::setIsCALayerContext):
+ (WebCore::GraphicsContext::isCALayerContext const):
+ (WebCore::GraphicsContext::setIsAcceleratedContext):
+ (WebCore::GraphicsContext::isAcceleratedContext const):
+ (WebCore::GraphicsContext::setPlatformTextDrawingMode):
+ (WebCore::GraphicsContext::setPlatformStrokeColor):
+ (WebCore::GraphicsContext::setPlatformStrokeThickness):
+ (WebCore::GraphicsContext::setPlatformFillColor):
+ (WebCore::GraphicsContext::setPlatformShouldAntialias):
+ (WebCore::GraphicsContext::setPlatformShouldSmoothFonts):
+ (WebCore::GraphicsContext::setPlatformAlpha):
+ (WebCore::GraphicsContext::setPlatformCompositeOperation):
+ (WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
+ (WebCore::GraphicsContext::platformFillEllipse):
+ (WebCore::GraphicsContext::platformStrokeEllipse):
+ (WebCore::GraphicsContext::setDestinationForRect):
+ (WebCore::GraphicsContext::addDestinationAtPoint):
+ * platform/graphics/cocoa/GraphicsContextCocoa.mm:
+ (WebCore::GraphicsContext::drawFocusRing):
+ * platform/graphics/displaylists/DisplayListRecorder.cpp:
+ (WebCore::DisplayList::Recorder::Recorder):
+ (WebCore::DisplayList::Recorder::updateItemExtent const):
+ (WebCore::DisplayList::Recorder::extentFromLocalBounds const):
+ * platform/graphics/displaylists/DisplayListRecorder.h:
+ (WebCore::DisplayList::Recorder::itemCount const):
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::paint):
+
2017-11-04 Zalan Bujtas <zalan@apple.com>
[LayoutState cleanup] Move all LayoutState* classes to LayoutState.h/cpp
platform/graphics/Gradient.cpp
platform/graphics/GradientImage.cpp
platform/graphics/GraphicsContext.cpp
+platform/graphics/GraphicsContextImpl.cpp
platform/graphics/GraphicsLayer.cpp
platform/graphics/GraphicsLayerTransform.cpp
platform/graphics/GraphicsLayerUpdater.cpp
0C45342610CDBBFA00869157 /* JSWebGLUniformLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLUniformLocation.h; sourceTree = "<group>"; };
0E7058ED1BC5BC190045A507 /* SearchPopupMenuCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SearchPopupMenuCocoa.mm; sourceTree = "<group>"; };
0E7058F31BC5CCD70045A507 /* SearchPopupMenuCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SearchPopupMenuCocoa.h; sourceTree = "<group>"; };
+ 0F00123F1FAD87D600531D76 /* GraphicsContextImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GraphicsContextImpl.h; sourceTree = "<group>"; };
+ 0F0012401FAD881000531D76 /* GraphicsContextImpl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContextImpl.cpp; sourceTree = "<group>"; };
0F03C0731884695E00A5F8CA /* SystemMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemMemory.h; sourceTree = "<group>"; };
0F099D0617B968A100FF84B9 /* WebCoreTypedArrayController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreTypedArrayController.cpp; sourceTree = "<group>"; };
0F099D0717B968A100FF84B9 /* WebCoreTypedArrayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreTypedArrayController.h; sourceTree = "<group>"; };
6E21C6BF1126338500A7BE02 /* GraphicsContext3D.cpp */,
49C7B9FB1042D3650009D447 /* GraphicsContext3D.h */,
7C330A011DF8FAC600D3395C /* GraphicsContext3DAttributes.h */,
+ 0F0012401FAD881000531D76 /* GraphicsContextImpl.cpp */,
+ 0F00123F1FAD87D600531D76 /* GraphicsContextImpl.h */,
0F580B090F12A2690051D689 /* GraphicsLayer.cpp */,
0F580B0A0F12A2690051D689 /* GraphicsLayer.h */,
0F580B0B0F12A2690051D689 /* GraphicsLayerClient.h */,
WTF_MAKE_FAST_ALLOCATED;
public:
GraphicsContext context;
- DisplayList::Recorder recorder;
DisplayList::DisplayList displayList;
DisplayListDrawingContext(const FloatRect& clip)
- : recorder(context, displayList, clip, AffineTransform())
+ : context([&](GraphicsContext& context) {
+ return std::make_unique<DisplayList::Recorder>(context, displayList, clip, AffineTransform());
+ })
{
}
};
#include "BidiResolver.h"
#include "BitmapImage.h"
-#include "DisplayListRecorder.h"
#include "FloatRoundedRect.h"
#include "Gradient.h"
+#include "GraphicsContextImpl.h"
#include "ImageBuffer.h"
#include "IntRect.h"
#include "RoundedRect.h"
platformInit(platformGraphicsContext);
}
+GraphicsContext::GraphicsContext(const GraphicsContextImplFactory& factoryFunction)
+ : m_impl(factoryFunction(*this))
+{
+}
+
GraphicsContext::~GraphicsContext()
{
ASSERT(m_stack.isEmpty());
m_stack.append(m_state);
- if (isRecording()) {
- m_displayListRecorder->save();
+ if (m_impl) {
+ m_impl->save();
return;
}
if (m_stack.isEmpty())
m_stack.clear();
- if (isRecording()) {
- m_displayListRecorder->restore();
+ if (m_impl) {
+ m_impl->restore();
return;
}
void GraphicsContext::setStrokeThickness(float thickness)
{
m_state.strokeThickness = thickness;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::StrokeThicknessChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::StrokeThicknessChange);
return;
}
void GraphicsContext::setStrokeStyle(StrokeStyle style)
{
m_state.strokeStyle = style;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::StrokeStyleChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::StrokeStyleChange);
return;
}
setPlatformStrokeStyle(style);
m_state.strokeColor = color;
m_state.strokeGradient = nullptr;
m_state.strokePattern = nullptr;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::StrokeColorChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::StrokeColorChange);
return;
}
setPlatformStrokeColor(color);
#if USE(CG)
m_state.shadowsUseLegacyRadius = false;
#endif
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ShadowChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::ShadowChange);
return;
}
setPlatformShadow(offset, blur, color);
#if USE(CG)
m_state.shadowsUseLegacyRadius = true;
#endif
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ShadowChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::ShadowChange);
return;
}
setPlatformShadow(offset, blur, color);
m_state.shadowsUseLegacyRadius = false;
#endif
- if (isRecording()) {
- m_displayListRecorder->clearShadow();
+ if (m_impl) {
+ m_impl->clearShadow();
return;
}
clearPlatformShadow();
m_state.fillGradient = nullptr;
m_state.fillPattern = nullptr;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::FillColorChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::FillColorChange);
return;
}
void GraphicsContext::setShadowsIgnoreTransforms(bool shadowsIgnoreTransforms)
{
m_state.shadowsIgnoreTransforms = shadowsIgnoreTransforms;
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ShadowsIgnoreTransformsChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::ShadowsIgnoreTransformsChange);
}
void GraphicsContext::setShouldAntialias(bool shouldAntialias)
{
m_state.shouldAntialias = shouldAntialias;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ShouldAntialiasChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::ShouldAntialiasChange);
return;
}
{
m_state.shouldSmoothFonts = shouldSmoothFonts;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ShouldSmoothFontsChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::ShouldSmoothFontsChange);
return;
}
void GraphicsContext::setShouldSubpixelQuantizeFonts(bool shouldSubpixelQuantizeFonts)
{
m_state.shouldSubpixelQuantizeFonts = shouldSubpixelQuantizeFonts;
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ShouldSubpixelQuantizeFontsChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::ShouldSubpixelQuantizeFontsChange);
}
void GraphicsContext::setImageInterpolationQuality(InterpolationQuality imageInterpolationQuality)
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ImageInterpolationQualityChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::ImageInterpolationQualityChange);
return;
}
{
m_state.strokeGradient = nullptr;
m_state.strokePattern = WTFMove(pattern);
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::StrokePatternChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::StrokePatternChange);
}
void GraphicsContext::setFillPattern(Ref<Pattern>&& pattern)
{
m_state.fillGradient = nullptr;
m_state.fillPattern = WTFMove(pattern);
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::FillPatternChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::FillPatternChange);
}
void GraphicsContext::setStrokeGradient(Ref<Gradient>&& gradient)
{
m_state.strokeGradient = WTFMove(gradient);
m_state.strokePattern = nullptr;
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::StrokeGradientChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::StrokeGradientChange);
}
void GraphicsContext::setFillRule(WindRule fillRule)
{
m_state.fillRule = fillRule;
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::FillRuleChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::FillRuleChange);
}
void GraphicsContext::setFillGradient(Ref<Gradient>&& gradient)
{
m_state.fillGradient = WTFMove(gradient);
m_state.fillPattern = nullptr;
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::FillGradientChange); // FIXME: also fill pattern?
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::FillGradientChange); // FIXME: also fill pattern?
}
void GraphicsContext::beginTransparencyLayer(float opacity)
{
- if (isRecording()) {
- m_displayListRecorder->beginTransparencyLayer(opacity);
+ if (m_impl) {
+ m_impl->beginTransparencyLayer(opacity);
return;
}
beginPlatformTransparencyLayer(opacity);
void GraphicsContext::endTransparencyLayer()
{
- if (isRecording()) {
- m_displayListRecorder->endTransparencyLayer();
+ if (m_impl) {
+ m_impl->endTransparencyLayer();
return;
}
endPlatformTransparencyLayer();
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawGlyphs(font, buffer, from, numGlyphs, point, fontCascade.fontDescription().fontSmoothing());
+ if (m_impl) {
+ m_impl->drawGlyphs(font, buffer, from, numGlyphs, point, fontCascade.fontDescription().fontSmoothing());
return;
}
if (paintingDisabled())
return ImageDrawResult::DidNothing;
- if (isRecording()) {
- m_displayListRecorder->drawImage(image, destination, source, imagePaintingOptions);
+ if (m_impl) {
+ m_impl->drawImage(image, destination, source, imagePaintingOptions);
return ImageDrawResult::DidRecord;
}
if (paintingDisabled())
return ImageDrawResult::DidNothing;
- if (isRecording()) {
- m_displayListRecorder->drawTiledImage(image, destination, source, tileSize, spacing, imagePaintingOptions);
+ if (m_impl) {
+ m_impl->drawTiledImage(image, destination, source, tileSize, spacing, imagePaintingOptions);
return ImageDrawResult::DidRecord;
}
if (paintingDisabled())
return ImageDrawResult::DidNothing;
- if (isRecording()) {
- m_displayListRecorder->drawTiledImage(image, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions);
+ if (m_impl) {
+ m_impl->drawTiledImage(image, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions);
return ImageDrawResult::DidRecord;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::TextDrawingModeChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::TextDrawingModeChange);
return;
}
setPlatformTextDrawingMode(mode);
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect, gradient);
+ if (m_impl) {
+ m_impl->fillRect(rect, gradient);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect, color, op, blendMode);
+ if (m_impl) {
+ m_impl->fillRect(rect, color, op, blendMode);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRoundedRect(rect, color, blendMode);
+ if (m_impl) {
+ m_impl->fillRoundedRect(rect, color, blendMode);
return;
}
void GraphicsContext::setAlpha(float alpha)
{
m_state.alpha = alpha;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::AlphaChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::AlphaChange);
return;
}
setPlatformAlpha(alpha);
{
m_state.compositeOperator = compositeOperation;
m_state.blendMode = blendMode;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::CompositeOperationChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::CompositeOperationChange);
return;
}
setPlatformCompositeOperation(compositeOperation, blendMode);
void GraphicsContext::setDrawLuminanceMask(bool drawLuminanceMask)
{
m_state.drawLuminanceMask = drawLuminanceMask;
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::DrawLuminanceMaskChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::DrawLuminanceMaskChange);
}
#if !USE(CG) && !USE(DIRECT2D)
{
scale(deviceScaleFactor);
- if (isRecording()) {
- m_displayListRecorder->applyDeviceScaleFactor(deviceScaleFactor);
+ if (m_impl) {
+ m_impl->applyDeviceScaleFactor(deviceScaleFactor);
return;
}
void GraphicsContext::fillEllipse(const FloatRect& ellipse)
{
- if (isRecording()) {
- m_displayListRecorder->fillEllipse(ellipse);
+ if (m_impl) {
+ m_impl->fillEllipse(ellipse);
return;
}
void GraphicsContext::strokeEllipse(const FloatRect& ellipse)
{
- if (isRecording()) {
- m_displayListRecorder->strokeEllipse(ellipse);
+ if (m_impl) {
+ m_impl->strokeEllipse(ellipse);
return;
}
class AffineTransform;
class FloatRoundedRect;
class Gradient;
+class GraphicsContextImpl;
class GraphicsContextPlatformPrivate;
class ImageBuffer;
class IntRect;
WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED;
public:
WEBCORE_EXPORT GraphicsContext(PlatformGraphicsContext*);
+
+ using GraphicsContextImplFactory = WTF::Function<std::unique_ptr<GraphicsContextImpl>(GraphicsContext&)>;
+ WEBCORE_EXPORT GraphicsContext(const GraphicsContextImplFactory&);
+
GraphicsContext() = default;
WEBCORE_EXPORT ~GraphicsContext();
};
GraphicsContext(NonPaintingReasons);
+ bool hasPlatformContext() const { return m_data; }
WEBCORE_EXPORT PlatformGraphicsContext* platformContext() const;
- bool paintingDisabled() const { return !m_data && !isRecording(); }
+ bool paintingDisabled() const { return !m_data && !m_impl; }
bool updatingControlTints() const { return m_nonPaintingReasons == NonPaintingReasons::UpdatingControlTints; }
- void setDisplayListRecorder(DisplayList::Recorder* recorder) { m_displayListRecorder = recorder; }
- bool isRecording() const { return m_displayListRecorder; }
-
void setStrokeThickness(float);
float strokeThickness() const { return m_state.strokeThickness; }
Vector<FloatPoint> centerLineAndCutOffCorners(bool isVerticalLine, float cornerWidth, FloatPoint point1, FloatPoint point2) const;
GraphicsContextPlatformPrivate* m_data { nullptr };
- DisplayList::Recorder* m_displayListRecorder { nullptr };
+ std::unique_ptr<GraphicsContextImpl> m_impl;
GraphicsContextState m_state;
Vector<GraphicsContextState, 1> m_stack;
--- /dev/null
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GraphicsContextImpl.h"
+
+namespace WebCore {
+
+GraphicsContextImpl::GraphicsContextImpl(GraphicsContext& context, const FloatRect&, const AffineTransform&)
+ : m_graphicsContext(context)
+{
+}
+
+GraphicsContextImpl::~GraphicsContextImpl()
+{
+}
+
+} // namespace WebCore
--- /dev/null
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "GraphicsContext.h"
+
+namespace WebCore {
+
+class GraphicsContextImpl {
+ WTF_MAKE_NONCOPYABLE(GraphicsContextImpl);
+public:
+ GraphicsContextImpl(GraphicsContext&, const FloatRect& initialClip, const AffineTransform&);
+ virtual ~GraphicsContextImpl();
+
+ GraphicsContext& graphicsContext() const { return m_graphicsContext; }
+
+ virtual void updateState(const GraphicsContextState&, GraphicsContextState::StateChangeFlags) = 0;
+ virtual void clearShadow() = 0;
+
+ virtual void setLineCap(LineCap) = 0;
+ virtual void setLineDash(const DashArray&, float dashOffset) = 0;
+ virtual void setLineJoin(LineJoin) = 0;
+ virtual void setMiterLimit(float) = 0;
+
+ virtual void fillRect(const FloatRect&) = 0;
+ virtual void fillRect(const FloatRect&, const Color&) = 0;
+ virtual void fillRect(const FloatRect&, Gradient&) = 0;
+ virtual void fillRect(const FloatRect&, const Color&, CompositeOperator, BlendMode) = 0;
+ virtual void fillRoundedRect(const FloatRoundedRect&, const Color&, BlendMode) = 0;
+ virtual void fillRectWithRoundedHole(const FloatRect&, const FloatRoundedRect& roundedHoleRect, const Color&) = 0;
+ virtual void fillPath(const Path&) = 0;
+ virtual void fillEllipse(const FloatRect&) = 0;
+ virtual void strokeRect(const FloatRect&, float lineWidth) = 0;
+ virtual void strokePath(const Path&) = 0;
+ virtual void strokeEllipse(const FloatRect&) = 0;
+ virtual void clearRect(const FloatRect&) = 0;
+
+#if USE(CG)
+ virtual void applyStrokePattern() = 0;
+ virtual void applyFillPattern() = 0;
+#endif
+
+ virtual void drawGlyphs(const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint& anchorPoint, FontSmoothingMode) = 0;
+
+ virtual void drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&) = 0;
+ virtual void drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions&) = 0;
+ virtual void drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions&) = 0;
+#if USE(CG) || USE(CAIRO)
+ virtual void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, ImageOrientation) = 0;
+#endif
+ virtual void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal) = 0;
+
+ virtual void drawRect(const FloatRect&, float borderThickness) = 0;
+ virtual void drawLine(const FloatPoint&, const FloatPoint&) = 0;
+ virtual void drawLinesForText(const FloatPoint&, const DashArray& widths, bool printing, bool doubleLines, float strokeThickness) = 0;
+ virtual void drawLineForDocumentMarker(const FloatPoint&, float width, GraphicsContext::DocumentMarkerLineStyle) = 0;
+ virtual void drawEllipse(const FloatRect&) = 0;
+ virtual void drawPath(const Path&) = 0;
+
+ virtual void drawFocusRing(const Path&, float width, float offset, const Color&) = 0;
+ virtual void drawFocusRing(const Vector<FloatRect>&, float width, float offset, const Color&) = 0;
+
+ virtual void save() = 0;
+ virtual void restore() = 0;
+
+ virtual void translate(float x, float y) = 0;
+ virtual void rotate(float angleInRadians) = 0;
+ virtual void scale(const FloatSize&) = 0;
+ virtual void concatCTM(const AffineTransform&) = 0;
+
+ virtual void beginTransparencyLayer(float opacity) = 0;
+ virtual void endTransparencyLayer() = 0;
+
+ virtual void clip(const FloatRect&) = 0;
+ virtual void clipOut(const FloatRect&) = 0;
+ virtual void clipOut(const Path&) = 0;
+ virtual void clipPath(const Path&, WindRule) = 0;
+
+ virtual void applyDeviceScaleFactor(float) = 0;
+
+private:
+ friend class GraphicsContext;
+ GraphicsContext& m_graphicsContext;
+};
+
+} // namespace WebCore
FloatRect initialClip(boundsOrigin(), size());
- GraphicsContext context;
- // The Recorder is large, so heap-allocate.
- std::unique_ptr<DisplayList::Recorder> recorder = std::make_unique<DisplayList::Recorder>(context, *m_displayList, initialClip, AffineTransform());
+ GraphicsContext context([&](GraphicsContext& context) {
+ return std::make_unique<DisplayList::Recorder>(context, *m_displayList, initialClip, AffineTransform());
+ });
paintGraphicsLayerContents(context, FloatRect(FloatPoint(), size()));
}
}
if (paintingDisabled())
return AffineTransform();
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::getCTM() is not yet compatible with recording contexts.");
return AffineTransform();
}
void GraphicsContext::savePlatformState()
{
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
platformContext()->save();
m_data->save();
}
void GraphicsContext::restorePlatformState()
{
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
platformContext()->restore();
m_data->restore();
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawRect(rect, borderThickness);
+ if (m_impl) {
+ m_impl->drawRect(rect, borderThickness);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawNativeImage(image, imageSize, destRect, srcRect, op, blendMode, orientation);
+ if (m_impl) {
+ m_impl->drawNativeImage(image, imageSize, destRect, srcRect, op, blendMode, orientation);
return;
}
if (strokeStyle() == NoStroke)
return;
- if (isRecording()) {
- m_displayListRecorder->drawLine(point1, point2);
+ if (m_impl) {
+ m_impl->drawLine(point1, point2);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawEllipse(rect);
+ if (m_impl) {
+ m_impl->drawEllipse(rect);
return;
}
if (paintingDisabled() || path.isEmpty())
return;
- if (isRecording()) {
- m_displayListRecorder->fillPath(path);
+ if (m_impl) {
+ m_impl->fillPath(path);
return;
}
if (paintingDisabled() || path.isEmpty())
return;
- if (isRecording()) {
- m_displayListRecorder->strokePath(path);
+ if (m_impl) {
+ m_impl->strokePath(path);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect);
+ if (m_impl) {
+ m_impl->fillRect(rect);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect, color);
+ if (m_impl) {
+ m_impl->fillRect(rect, color);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clip(rect);
+ if (m_impl) {
+ m_impl->clip(rect);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipPath(path, clipRule);
+ if (m_impl) {
+ m_impl->clipPath(path, clipRule);
return;
}
if (paintingDisabled())
return IntRect();
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("Getting the clip bounds not yet supported with display lists");
return IntRect(-2048, -2048, 4096, 4096); // FIXME: display lists.
}
if (widths.size() <= 0)
return;
- if (isRecording()) {
- m_displayListRecorder->drawLinesForText(point, widths, printing, doubleUnderlines, strokeThickness());
+ if (m_impl) {
+ m_impl->drawLinesForText(point, widths, printing, doubleUnderlines, strokeThickness());
return;
}
if (paintingDisabled())
return frect;
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::roundToDevicePixels() is not yet compatible with recording contexts.");
return frect;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->translate(x, y);
+ if (m_impl) {
+ m_impl->translate(x, y);
return;
}
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
cairo_set_line_width(platformContext()->cr(), strokeThickness);
}
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
switch (strokeStyle) {
case NoStroke:
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->concatCTM(transform);
+ if (m_impl) {
+ m_impl->concatCTM(transform);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::setCTM() is not compatible with recording contexts.");
return;
}
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
cairo_t* cr = platformContext()->cr();
cairo_push_group(cr);
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
cairo_t* cr = platformContext()->cr();
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clearRect(rect);
+ if (m_impl) {
+ m_impl->clearRect(rect);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->strokeRect(rect, width);
+ if (m_impl) {
+ m_impl->strokeRect(rect, width);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineCap(lineCap);
+ if (m_impl) {
+ m_impl->setLineCap(lineCap);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineDash(dashes, dashOffset);
+ if (m_impl) {
+ m_impl->setLineDash(dashes, dashOffset);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineJoin(lineJoin);
+ if (m_impl) {
+ m_impl->setLineJoin(lineJoin);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
+ if (m_impl) {
// Maybe this should be part of the state.
- m_displayListRecorder->setMiterLimit(miter);
+ m_impl->setMiterLimit(miter);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipOut(path);
+ if (m_impl) {
+ m_impl->clipOut(path);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->rotate(radians);
+ if (m_impl) {
+ m_impl->rotate(radians);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->scale(size);
+ if (m_impl) {
+ m_impl->scale(size);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipOut(r);
+ if (m_impl) {
+ m_impl->clipOut(r);
return;
}
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
if (hasShadow())
platformContext()->shadowBlur().drawRectShadow(*this, rect);
if (paintingDisabled() || !color.isValid())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRectWithRoundedHole(rect, roundedHoleRect, color);
+ if (m_impl) {
+ m_impl->fillRectWithRoundedHole(rect, roundedHoleRect, color);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode);
+ if (m_impl) {
+ m_impl->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode);
return;
}
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// When true, use the default Cairo backend antialias mode (usually this
// enables standard 'grayscale' antialiasing); false to explicitly disable
void GraphicsContext::setPlatformImageInterpolationQuality(InterpolationQuality quality)
{
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
platformContext()->setImageInterpolationQuality(quality);
}
bool GraphicsContext::isAcceleratedContext() const
{
- if (isRecording())
+ if (!hasPlatformContext())
return false;
return cairo_surface_get_type(cairo_get_target(platformContext()->cr())) == CAIRO_SURFACE_TYPE_GL;
void GraphicsContext::savePlatformState()
{
ASSERT(!paintingDisabled());
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// Note: Do not use this function within this class implementation, since we want to avoid the extra
// save of the secondary context (in GraphicsContextPlatformPrivateCG.h).
void GraphicsContext::restorePlatformState()
{
ASSERT(!paintingDisabled());
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// Note: Do not use this function within this class implementation, since we want to avoid the extra
// restore of the secondary context (in GraphicsContextPlatformPrivateCG.h).
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawNativeImage(image, imageSize, destRect, srcRect, op, blendMode, orientation);
+ if (m_impl) {
+ m_impl->drawNativeImage(image, imageSize, destRect, srcRect, op, blendMode, orientation);
return;
}
if (paintingDisabled() || !patternTransform.isInvertible())
return;
- if (isRecording()) {
- m_displayListRecorder->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode);
+ if (m_impl) {
+ m_impl->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawRect(rect, borderThickness);
+ if (m_impl) {
+ m_impl->drawRect(rect, borderThickness);
return;
}
if (strokeStyle() == NoStroke)
return;
- if (isRecording()) {
- m_displayListRecorder->drawLine(point1, point2);
+ if (m_impl) {
+ m_impl->drawLine(point1, point2);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawEllipse(rect);
+ if (m_impl) {
+ m_impl->drawEllipse(rect);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->applyStrokePattern();
+ if (m_impl) {
+ m_impl->applyStrokePattern();
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->applyFillPattern();
+ if (m_impl) {
+ m_impl->applyFillPattern();
return;
}
if (paintingDisabled() || path.isEmpty())
return;
- if (isRecording()) {
- m_displayListRecorder->drawPath(path);
+ if (m_impl) {
+ m_impl->drawPath(path);
return;
}
if (paintingDisabled() || path.isEmpty())
return;
- if (isRecording()) {
- m_displayListRecorder->fillPath(path);
+ if (m_impl) {
+ m_impl->fillPath(path);
return;
}
if (paintingDisabled() || path.isEmpty())
return;
- if (isRecording()) {
- m_displayListRecorder->strokePath(path);
+ if (m_impl) {
+ m_impl->strokePath(path);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect);
+ if (m_impl) {
+ m_impl->fillRect(rect);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect, color);
+ if (m_impl) {
+ m_impl->fillRect(rect, color);
return;
}
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextRef context = platformContext();
Color oldFillColor = fillColor();
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRectWithRoundedHole(rect, roundedHoleRect, color);
+ if (m_impl) {
+ m_impl->fillRectWithRoundedHole(rect, roundedHoleRect, color);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clip(rect);
+ if (m_impl) {
+ m_impl->clip(rect);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipOut(rect);
+ if (m_impl) {
+ m_impl->clipOut(rect);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipOut(path);
+ if (m_impl) {
+ m_impl->clipOut(path);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipPath(path, clipRule);
+ if (m_impl) {
+ m_impl->clipPath(path, clipRule);
return;
}
if (paintingDisabled())
return IntRect();
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("Getting the clip bounds not yet supported with display lists");
return IntRect(-2048, -2048, 4096, 4096); // FIXME: display lists.
}
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
save();
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextRef context = platformContext();
CGContextEndTransparencyLayer(context);
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// FIXME: we could avoid the shadow setup cost when we know we'll render the shadow ourselves.
if (paintingDisabled())
return;
- if (isRecording()) {
+ if (m_impl) {
// Maybe this should be part of the state.
- m_displayListRecorder->setMiterLimit(limit);
+ m_impl->setMiterLimit(limit);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clearRect(r);
+ if (m_impl) {
+ m_impl->clearRect(r);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->strokeRect(rect, lineWidth);
+ if (m_impl) {
+ m_impl->strokeRect(rect, lineWidth);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineCap(cap);
+ if (m_impl) {
+ m_impl->setLineCap(cap);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineDash(dashes, dashOffset);
+ if (m_impl) {
+ m_impl->setLineDash(dashes, dashOffset);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineJoin(join);
+ if (m_impl) {
+ m_impl->setLineJoin(join);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->scale(size);
+ if (m_impl) {
+ m_impl->scale(size);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->rotate(angle);
+ if (m_impl) {
+ m_impl->rotate(angle);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->translate(x, y);
+ if (m_impl) {
+ m_impl->translate(x, y);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->concatCTM(transform);
+ if (m_impl) {
+ m_impl->concatCTM(transform);
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::setCTM() is not compatible with recording contexts.");
return;
}
if (paintingDisabled())
return AffineTransform();
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::getCTM() is not yet compatible with recording contexts.");
return AffineTransform();
}
if (paintingDisabled())
return rect;
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::roundToDevicePixels() is not yet compatible with recording contexts.");
return rect;
}
if (!widths.size())
return;
- if (isRecording()) {
- m_displayListRecorder->drawLinesForText(point, widths, printing, doubleLines, strokeThickness());
+ if (m_impl) {
+ m_impl->drawLinesForText(point, widths, printing, doubleLines, strokeThickness());
return;
}
if (paintingDisabled())
return;
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::setURLForRect() is not yet compatible with recording contexts.");
return; // FIXME for display lists.
}
return;
// FIXME
- if (isRecording())
+ if (m_impl)
return;
if (isLayerContext)
return false;
// FIXME
- if (isRecording())
+ if (m_impl)
return false;
return m_data->m_contextFlags & IsLayerCGContext;
return;
// FIXME
- if (isRecording())
+ if (m_impl)
return;
if (isAccelerated)
return false;
// FIXME
- if (isRecording())
+ if (m_impl)
return false;
return m_data->m_contextFlags & IsAcceleratedCGContext;
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextRef context = platformContext();
switch (mode) {
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
setCGStrokeColor(platformContext(), color);
}
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextSetLineWidth(platformContext(), std::max(thickness, 0.f));
}
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
setCGFillColor(platformContext(), color);
}
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextSetShouldAntialias(platformContext(), enable);
}
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextSetShouldSmoothFonts(platformContext(), enable);
}
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextSetAlpha(platformContext(), alpha);
}
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGBlendMode target = kCGBlendModeNormal;
if (blendMode != BlendModeNormal) {
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// CoreGraphics expects the base CTM of a HiDPI context to have the scale factor applied to it.
// Failing to change the base level CTM will cause certain CG features, such as focus rings,
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// CGContextFillEllipseInRect only supports solid colors.
if (m_state.fillGradient || m_state.fillPattern) {
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// CGContextStrokeEllipseInRect only supports solid colors.
if (m_state.strokeGradient || m_state.strokePattern) {
if (paintingDisabled())
return;
+ ASSERT(hasPlatformContext());
+
CGContextRef context = platformContext();
FloatRect rect = destRect;
if (paintingDisabled())
return;
+ ASSERT(hasPlatformContext());
+
CGContextRef context = platformContext();
CGPoint transformedPoint = CGPointApplyAffineTransform(position, CGContextGetCTM(context));
if (paintingDisabled() || path.isNull())
return;
- if (isRecording()) {
- m_displayListRecorder->drawFocusRing(path, width, offset, color);
+ if (m_impl) {
+ m_impl->drawFocusRing(path, width, offset, color);
return;
}
if (paintingDisabled() || path.isNull())
return;
- if (isRecording()) // FIXME: implement animated focus ring drawing.
+ if (m_impl) // FIXME: implement animated focus ring drawing.
return;
needsRedraw = drawFocusRingToContextAtTime(platformContext(), path.platformPath(), timeOffset);
if (paintingDisabled())
return;
- if (isRecording()) // FIXME: implement animated focus ring drawing.
+ if (m_impl) // FIXME: implement animated focus ring drawing.
return;
RetainPtr<CGMutablePathRef> focusRingPath = adoptCF(CGPathCreateMutable());
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawFocusRing(rects, width, offset, color);
+ if (m_impl) {
+ m_impl->drawFocusRing(rects, width, offset, color);
return;
}
namespace DisplayList {
Recorder::Recorder(GraphicsContext& context, DisplayList& displayList, const FloatRect& initialClip, const AffineTransform& baseCTM)
- : m_graphicsContext(context)
+ : GraphicsContextImpl(context, initialClip, baseCTM)
, m_displayList(displayList)
{
LOG_WITH_STREAM(DisplayLists, stream << "\nRecording with clip " << initialClip);
- m_graphicsContext.setDisplayListRecorder(this);
m_stateStack.append(ContextState(baseCTM, initialClip));
}
void Recorder::updateItemExtent(DrawingItem& item) const
{
- if (std::optional<FloatRect> rect = item.localBounds(m_graphicsContext))
+ if (std::optional<FloatRect> rect = item.localBounds(graphicsContext()))
item.setExtent(extentFromLocalBounds(rect.value()));
}
FloatSize shadowOffset;
float shadowRadius;
Color shadowColor;
- if (m_graphicsContext.getShadow(shadowOffset, shadowRadius, shadowColor)) {
+ if (graphicsContext().getShadow(shadowOffset, shadowRadius, shadowColor)) {
FloatRect shadowExtent= bounds;
shadowExtent.move(shadowOffset);
shadowExtent.inflate(shadowPaintingExtent(shadowRadius));
#pragma once
#include "DisplayList.h"
-#include "GraphicsContext.h" // For InterpolationQuality.
+#include "GraphicsContextImpl.h"
#include "Image.h" // For Image::TileRule.
#include "TextFlags.h"
#include <wtf/Noncopyable.h>
class DrawingItem;
-class Recorder {
+class Recorder : public GraphicsContextImpl {
WTF_MAKE_NONCOPYABLE(Recorder);
public:
Recorder(GraphicsContext&, DisplayList&, const FloatRect& initialClip, const AffineTransform&);
- ~Recorder();
-
- void updateState(const GraphicsContextState&, GraphicsContextState::StateChangeFlags);
- void clearShadow();
-
- void setLineCap(LineCap);
- void setLineDash(const DashArray&, float dashOffset);
- void setLineJoin(LineJoin);
- void setMiterLimit(float);
-
- void fillRect(const FloatRect&);
- void fillRect(const FloatRect&, const Color&);
- void fillRect(const FloatRect&, Gradient&);
- void fillRect(const FloatRect&, const Color&, CompositeOperator, BlendMode);
- void fillRoundedRect(const FloatRoundedRect&, const Color&, BlendMode);
- void fillRectWithRoundedHole(const FloatRect&, const FloatRoundedRect& roundedHoleRect, const Color&);
- void fillPath(const Path&);
- void fillEllipse(const FloatRect&);
- void strokeRect(const FloatRect&, float lineWidth);
- void strokePath(const Path&);
- void strokeEllipse(const FloatRect&);
- void clearRect(const FloatRect&);
+ virtual ~Recorder();
+
+ size_t itemCount() const { return m_displayList.itemCount(); }
+
+private:
+ void updateState(const GraphicsContextState&, GraphicsContextState::StateChangeFlags) override;
+ void clearShadow() override;
+
+ void setLineCap(LineCap) override;
+ void setLineDash(const DashArray&, float dashOffset) override;
+ void setLineJoin(LineJoin) override;
+ void setMiterLimit(float) override;
+
+ void fillRect(const FloatRect&) override;
+ void fillRect(const FloatRect&, const Color&) override;
+ void fillRect(const FloatRect&, Gradient&) override;
+ void fillRect(const FloatRect&, const Color&, CompositeOperator, BlendMode) override;
+ void fillRoundedRect(const FloatRoundedRect&, const Color&, BlendMode) override;
+ void fillRectWithRoundedHole(const FloatRect&, const FloatRoundedRect& roundedHoleRect, const Color&) override;
+ void fillPath(const Path&) override;
+ void fillEllipse(const FloatRect&) override;
+ void strokeRect(const FloatRect&, float lineWidth) override;
+ void strokePath(const Path&) override;
+ void strokeEllipse(const FloatRect&) override;
+ void clearRect(const FloatRect&) override;
#if USE(CG)
- void applyStrokePattern();
- void applyFillPattern();
+ void applyStrokePattern() override;
+ void applyFillPattern() override;
#endif
- void drawGlyphs(const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint& anchorPoint, FontSmoothingMode);
+ void drawGlyphs(const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint& anchorPoint, FontSmoothingMode) override;
- void drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&);
- void drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions&);
- void drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions&);
+ void drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&) override;
+ void drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions&) override;
+ void drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions&) override;
#if USE(CG) || USE(CAIRO)
- void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, ImageOrientation);
+ void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, ImageOrientation) override;
#endif
- void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal);
+ void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal) override;
- void drawRect(const FloatRect&, float borderThickness);
- void drawLine(const FloatPoint&, const FloatPoint&);
- void drawLinesForText(const FloatPoint&, const DashArray& widths, bool printing, bool doubleLines, float strokeThickness);
- void drawLineForDocumentMarker(const FloatPoint&, float width, GraphicsContext::DocumentMarkerLineStyle);
- void drawEllipse(const FloatRect&);
- void drawPath(const Path&);
+ void drawRect(const FloatRect&, float borderThickness) override;
+ void drawLine(const FloatPoint&, const FloatPoint&) override;
+ void drawLinesForText(const FloatPoint&, const DashArray& widths, bool printing, bool doubleLines, float strokeThickness) override;
+ void drawLineForDocumentMarker(const FloatPoint&, float width, GraphicsContext::DocumentMarkerLineStyle) override;
+ void drawEllipse(const FloatRect&) override;
+ void drawPath(const Path&) override;
- void drawFocusRing(const Path&, float width, float offset, const Color&);
- void drawFocusRing(const Vector<FloatRect>&, float width, float offset, const Color&);
+ void drawFocusRing(const Path&, float width, float offset, const Color&) override;
+ void drawFocusRing(const Vector<FloatRect>&, float width, float offset, const Color&) override;
- void save();
- void restore();
+ void save() override;
+ void restore() override;
- void translate(float x, float y);
- void rotate(float angleInRadians);
- void scale(const FloatSize&);
- void concatCTM(const AffineTransform&);
+ void translate(float x, float y) override;
+ void rotate(float angleInRadians) override;
+ void scale(const FloatSize&) override;
+ void concatCTM(const AffineTransform&) override;
- void beginTransparencyLayer(float opacity);
- void endTransparencyLayer();
+ void beginTransparencyLayer(float opacity) override;
+ void endTransparencyLayer() override;
- void clip(const FloatRect&);
- void clipOut(const FloatRect&);
- void clipOut(const Path&);
- void clipPath(const Path&, WindRule);
+ void clip(const FloatRect&) override;
+ void clipOut(const FloatRect&) override;
+ void clipOut(const Path&) override;
+ void clipPath(const Path&, WindRule) override;
- void applyDeviceScaleFactor(float);
+ void applyDeviceScaleFactor(float) override;
- size_t itemCount() const { return m_displayList.itemCount(); }
-
-private:
Item& appendItem(Ref<Item>&&);
void willAppendItem(const Item&);
const ContextState& currentState() const;
ContextState& currentState();
- GraphicsContext& m_graphicsContext;
DisplayList& m_displayList;
Vector<ContextState, 32> m_stateStack;
#if USE(CG)
#include "AffineTransform.h"
+#include "GraphicsContextImpl.h"
#include "GraphicsContextPlatformPrivateCG.h"
#include "Path.h"
if (paintInfo.context().paintingDisabled())
return false;
- if (UNLIKELY(paintInfo.context().isRecording()))
+ if (UNLIKELY(!paintInfo.context().hasPlatformContext()))
return false;
ControlPart part = box.style().appearance();