[Win][Direct2D] Correct bookkeeping for begin/end draw pairs
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Oct 2016 20:47:16 +0000 (20:47 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Oct 2016 20:47:16 +0000 (20:47 +0000)
commit0b4c66cf4eee4d8cbee6a01b4d77d3222b472f98
tree60b4428c9ef679524df5212ac343e1cbc58502a5
parent39fa533fbbc1591ad614858b037dcb83ac8c87a6
[Win][Direct2D] Correct bookkeeping for begin/end draw pairs
https://bugs.webkit.org/show_bug.cgi?id=163898

Reviewed by Darin Adler.

Simon pointed out that GraphicsContext objects are generally only created at
the time we intend to do drawing, so calling 'BeginDraw' as part of object
construction, and 'EndDraw' at time of destruction should be sufficient.

As usual, he was correct.

This patch gets rid of unneeded code and greatly simplifies the Direct2D
drawing path.

Tested by existing layout tests.

* platform/graphics/GraphicsContext.h:
* platform/graphics/win/GradientDirect2D.cpp:
(WebCore::Gradient::fill):Remove unneeded use
of 'RenderTargetScopedDrawing.h'.
* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContext::releaseWindowsContext): Remove unneeded use
of RenderTargetScopedDrawing class.
(WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): Enter
the 'BeginDraw' state at object creation.
(WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate): End
draw state at object destruction.
(WebCore::GraphicsContextPlatformPrivate::clip): Remove unneeded call to 'beginDraw'.
(WebCore::GraphicsContextPlatformPrivate::beginDraw): Renamed from 'beginDrawIfNeeded'.
(WebCore::GraphicsContextPlatformPrivate::endDraw): Get rid of draw state flags.
(WebCore::GraphicsContext::beginDraw): Renamed from 'beginDrawIfNeeded'.
(WebCore::GraphicsContext::flush): Added.
(WebCore::GraphicsContext::drawWithoutShadow): Remove unneeded use of
RenderTargetScopedDrawing class.
(WebCore::GraphicsContext::drawWithShadow): Ditto.
(WebCore::GraphicsContext::platformFillRoundedRect): Ditto.
(WebCore::GraphicsContext::fillRectWithRoundedHole): Ditto.
(WebCore::GraphicsContext::didBeginDraw): Deleted.
(WebCore::GraphicsContextPlatformPrivate::beginDrawIfNeeded): Deleted.
(WebCore::GraphicsContext::beginDrawIfNeeded): Deleted.
* platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
(WebCore::GraphicsContextPlatformPrivate::didBeginDraw): Deleted.
* platform/graphics/win/ImageBufferDataDirect2D.cpp:
(WebCore::ImageBufferData::getData): Remove unneeded use of RenderTargetScopedDrawing class.
(WebCore::ImageBufferData::putData):
* platform/graphics/win/ImageBufferDirect2D.cpp:
(WebCore::ImageBuffer::flushContext): Call new GraphicsContext 'flush' command.
(WebCore::ImageBuffer::draw): Remove unneeded use of RenderTargetScopedDrawing class.
* platform/graphics/win/NativeImageDirect2D.cpp: Ditto.
* platform/graphics/win/RenderTargetScopedDrawing.h: Removed.
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::nativeImage): Remove unneeded use of RenderTargetScopedDrawing class.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208131 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/win/GradientDirect2D.cpp
Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp
Source/WebCore/platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h
Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp
Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp
Source/WebCore/platform/graphics/win/NativeImageDirect2D.cpp
Source/WebCore/platform/graphics/win/RenderTargetScopedDrawing.h [deleted file]
Source/WebCore/svg/graphics/SVGImage.cpp