WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch v4
riaa_d2d_v4.patch (text/plain), 22.57 KB, created by
Brent Fulgham
on 2016-10-27 14:33:35 PDT
(
hide
)
Description:
Patch v4
Filename:
MIME Type:
Creator:
Brent Fulgham
Created:
2016-10-27 14:33:35 PDT
Size:
22.57 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 208005) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,46 @@ >+2016-10-25 Brent Fulgham <bfulgham@apple.com> >+ >+ [Win][Direct2D] Create a RIAA Helper Class for the Render Target >+ https://bugs.webkit.org/show_bug.cgi?id=164005 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Tested by existing SVG, image, and Canvas layout tests. >+ >+ * platform/graphics/GraphicsContext.h: >+ * platform/graphics/win/GradientDirect2D.cpp: >+ (WebCore::Gradient::fill): Use new convenience helper class. >+ * platform/graphics/win/GraphicsContextDirect2D.cpp: >+ (WebCore::GraphicsContext::didBeginDraw): >+ (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): >+ (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate): Add an >+ assertion that we are in a valid state when cleaning up the graphics context. >+ (WebCore::GraphicsContextPlatformPrivate::clip): Clipping can only happen in a Draw operation. >+ Open a new BeginDraw if asked to Clip. The Begin must stay active when this method returns, >+ as the Clip layer is only valid during a Draw operation. >+ (WebCore::GraphicsContextPlatformPrivate::beginDraw): Added. >+ (WebCore::GraphicsContextPlatformPrivate::endDraw): Added. >+ (WebCore::GraphicsContext::beginDrawIfNeeded): Added. >+ (WebCore::GraphicsContext::endDraw): Added. >+ (WebCore::GraphicsContext::drawWithoutShadow): Revise to use new RenderTargetHelper class. >+ (WebCore::GraphicsContext::drawWithShadow): Ditto. >+ (WebCore::GraphicsContext::platformFillRoundedRect): Ditto. >+ (WebCore::GraphicsContext::fillRectWithRoundedHole): Ditto. >+ (WebCore::GraphicsContext::setDidBeginDraw): Deleted. >+ * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: >+ (WebCore::GraphicsContextPlatformPrivate::didBeginDraw): Revise to use count instead of >+ a separate boolean. >+ * platform/graphics/win/ImageBufferDataDirect2D.cpp: >+ (WebCore::ImageBufferData::getData): Revise to use new RenderTargetHelper class. >+ * platform/graphics/win/NativeImageDirect2D.cpp: >+ (WebCore::drawNativeImage): Ditto. >+ * platform/graphics/win/RenderTargetHelper.h: Added. >+ (WebCore::RenderTargetHelper::RenderTargetHelper): >+ (WebCore::RenderTargetHelper::~RenderTargetHelper): >+ (WebCore::RenderTargetHelper::endDraw): >+ * svg/graphics/SVGImage.cpp: >+ (WebCore::SVGImage::nativeImage): Revise to use new RenderTargetHelper class. >+ > 2016-10-25 Brent Fulgham <bfulgham@apple.com> > > [Win] Unreviewed build fix. >Index: Source/WebCore/platform/graphics/GraphicsContext.h >=================================================================== >--- Source/WebCore/platform/graphics/GraphicsContext.h (revision 208005) >+++ Source/WebCore/platform/graphics/GraphicsContext.h (working copy) >@@ -552,9 +552,10 @@ public: > WEBCORE_EXPORT static ID2D1Factory* systemFactory(); > WEBCORE_EXPORT static ID2D1RenderTarget* defaultRenderTarget(); > >- WEBCORE_EXPORT void setDidBeginDraw(bool); >+ WEBCORE_EXPORT bool beginDrawIfNeeded(); > WEBCORE_EXPORT bool didBeginDraw() const; > D2D1_COLOR_F colorWithGlobalAlpha(const Color&) const; >+ WEBCORE_EXPORT void endDraw(); > > ID2D1Brush* solidStrokeBrush() const; > ID2D1Brush* solidFillBrush() const; >Index: Source/WebCore/platform/graphics/win/GradientDirect2D.cpp >=================================================================== >--- Source/WebCore/platform/graphics/win/GradientDirect2D.cpp (revision 208005) >+++ Source/WebCore/platform/graphics/win/GradientDirect2D.cpp (working copy) >@@ -28,6 +28,7 @@ > > #include "FloatPoint.h" > #include "GraphicsContext.h" >+#include "RenderTargetScopedDrawing.h" > #include <d2d1.h> > #include <wtf/RetainPtr.h> > >@@ -120,20 +121,13 @@ void Gradient::fill(GraphicsContext* con > if (!m_cachedHash || !m_gradient) > generateGradient(d2dContext); > >- if (!context->didBeginDraw()) >- d2dContext->BeginDraw(); >+ RenderTargetScopedDrawing helper(*context); > > d2dContext->SetTags(GRADIENT_DRAWING, __LINE__); > > const D2D1_RECT_F d2dRect = rect; > d2dContext->FillRectangle(&d2dRect, m_gradient); > >- if (!context->didBeginDraw()) { >- D2D1_TAG first, second; >- HRESULT hr = d2dContext->EndDraw(&first, &second); >- RELEASE_ASSERT(SUCCEEDED(hr)); >- } >- > if (needScaling) > context->restore(); > } >Index: Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp >=================================================================== >--- Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp (revision 208005) >+++ Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp (working copy) >@@ -34,6 +34,7 @@ > #include "ImageBuffer.h" > #include "Logging.h" > #include "NotImplemented.h" >+#include "RenderTargetScopedDrawing.h" > #include "URL.h" > #include <d2d1.h> > #include <d2d1effects.h> >@@ -98,15 +99,9 @@ ID2D1RenderTarget* GraphicsContext::defa > return defaultRenderTarget; > } > >-void GraphicsContext::setDidBeginDraw(bool didBeginDraw) >-{ >- RELEASE_ASSERT(m_data); >- m_data->m_didBeginDraw = didBeginDraw; >-} >- > bool GraphicsContext::didBeginDraw() const > { >- return m_data->m_didBeginDraw; >+ return m_data->didBeginDraw(); > } > > void GraphicsContext::platformInit(HDC hdc, bool hasAlpha) >@@ -279,6 +274,19 @@ void GraphicsContext::drawLineForDocumen > { > } > >+GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(ID2D1RenderTarget* renderTarget) >+ : m_renderTarget(renderTarget) >+{ >+} >+ >+GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate() >+{ >+ if (!m_renderTarget) >+ return; >+ >+ ASSERT(!m_beginDrawCount.unsafeGet()); >+} >+ > COMPtr<ID2D1SolidColorBrush> GraphicsContextPlatformPrivate::brushWithColor(const D2D1_COLOR_F& color) > { > RGBA32 colorKey = makeRGBA32FromFloats(color.r, color.g, color.b, color.a); >@@ -311,6 +319,11 @@ ID2D1SolidColorBrush* GraphicsContext::b > > void GraphicsContextPlatformPrivate::clip(const FloatRect& rect) > { >+ // In D2D, we can only clip in the context of a 'BeginDraw', and the clip can >+ // only live as long as the draw is happening. >+ if (!didBeginDraw()) >+ beginDraw(); >+ > if (m_renderStates.isEmpty()) > save(); > >@@ -325,6 +338,11 @@ void GraphicsContextPlatformPrivate::cli > > void GraphicsContextPlatformPrivate::clip(ID2D1Geometry* path) > { >+ // In D2D, we can only clip in the context of a 'BeginDraw', and the clip can >+ // only live as long as the draw is happening. >+ if (!didBeginDraw()) >+ beginDraw(); >+ > ASSERT(m_renderStates.size()); > if (!m_renderStates.size()) > return; >@@ -360,6 +378,17 @@ void GraphicsContextPlatformPrivate::flu > RELEASE_ASSERT(SUCCEEDED(hr)); > } > >+void GraphicsContextPlatformPrivate::beginDraw() >+{ >+ ASSERT(m_renderTarget.get()); >+ if (didBeginDraw()) >+ return; >+ >+ m_renderTarget->BeginDraw(); >+ >+ ++m_beginDrawCount; >+} >+ > void GraphicsContextPlatformPrivate::endDraw() > { > ASSERT(m_renderTarget.get()); >@@ -368,6 +397,8 @@ void GraphicsContextPlatformPrivate::end > > if (!SUCCEEDED(hr)) > WTFLogAlways("Failed in GraphicsContextPlatformPrivate::endDraw: hr=%ld, first=%ld, second=%ld", hr, first, second); >+ >+ --m_beginDrawCount; > } > > void GraphicsContextPlatformPrivate::restore() >@@ -464,6 +495,20 @@ ID2D1Brush* GraphicsContext::patternFill > return m_data->m_patternFillBrush.get(); > } > >+bool GraphicsContext::beginDrawIfNeeded() >+{ >+ if (m_data->didBeginDraw()) >+ return false; >+ >+ m_data->beginDraw(); >+ return true; >+} >+ >+void GraphicsContext::endDraw() >+{ >+ m_data->endDraw(); >+} >+ > void GraphicsContext::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator op, BlendMode blendMode) > { > if (paintingDisabled() || !patternTransform.isInvertible()) >@@ -848,19 +893,14 @@ void GraphicsContext::drawPath(const Pat > > void GraphicsContext::drawWithoutShadow(const FloatRect& /*boundingRect*/, const std::function<void(ID2D1RenderTarget*)>& drawCommands) > { >- auto context = platformContext(); >- >- if (!didBeginDraw()) >- context->BeginDraw(); >- >- drawCommands(context); >- >- if (!didBeginDraw()) >- m_data->endDraw(); >+ RenderTargetScopedDrawing helper(*this); >+ drawCommands(platformContext()); > } > > void GraphicsContext::drawWithShadow(const FloatRect& boundingRect, const std::function<void(ID2D1RenderTarget*)>& drawCommands) > { >+ RenderTargetScopedDrawing helper(*this); >+ > auto context = platformContext(); > > // Render the current geometry to a bitmap context >@@ -913,10 +953,7 @@ void GraphicsContext::drawWithShadow(con > auto flip = D2D1::Matrix3x2F::Scale(D2D1::SizeF(1.0f, -1.0f)); > deviceContext->SetTransform(ctm * flip * translate); > >- deviceContext->BeginDraw(); > deviceContext->DrawImage(compositor.get(), D2D1_INTERPOLATION_MODE_LINEAR); >- hr = deviceContext->EndDraw(); >- ASSERT(SUCCEEDED(hr)); > } > > void GraphicsContext::fillPath(const Path& path) >@@ -1107,9 +1144,8 @@ void GraphicsContext::platformFillRounde > notImplemented(); > } > >- if (!didBeginDraw()) >- context->BeginDraw(); >- >+ RenderTargetScopedDrawing helper(*this); >+ > context->SetTags(1, __LINE__); > > const FloatRect& r = rect.rect(); >@@ -1129,9 +1165,6 @@ void GraphicsContext::platformFillRounde > fillPath(path); > } > >- if (!didBeginDraw()) >- m_data->endDraw(); >- > if (drawOwnShadow) > stateSaver.restore(); > } >@@ -1148,8 +1181,7 @@ void GraphicsContext::fillRectWithRounde > > auto context = platformContext(); > >- if (!didBeginDraw()) >- context->BeginDraw(); >+ RenderTargetScopedDrawing helper(*this); > > context->SetTags(1, __LINE__); > >@@ -1179,9 +1211,6 @@ void GraphicsContext::fillRectWithRounde > > fillPath(path); > >- if (!didBeginDraw()) >- m_data->endDraw(); >- > if (drawOwnShadow) > stateSaver.restore(); > >Index: Source/WebCore/platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h >=================================================================== >--- Source/WebCore/platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h (revision 208005) >+++ Source/WebCore/platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h (working copy) >@@ -32,6 +32,7 @@ > #include <d2d1effects.h> > #include <d2d1helper.h> > #include <windows.h> >+#include <wtf/CheckedArithmetic.h> > #include <wtf/TinyLRUCache.h> > > namespace WebCore { >@@ -39,16 +40,15 @@ namespace WebCore { > class GraphicsContextPlatformPrivate { > WTF_MAKE_FAST_ALLOCATED; > public: >- GraphicsContextPlatformPrivate(ID2D1RenderTarget* renderTarget) >- : m_renderTarget(renderTarget) >- { >- } >+ GraphicsContextPlatformPrivate(ID2D1RenderTarget*); >+ ~GraphicsContextPlatformPrivate(); > > enum Direct2DLayerType { AxisAlignedClip, LayerClip }; > > void clip(const FloatRect&); > void clip(const Path&); > void clip(ID2D1Geometry*); >+ void beginDraw(); > void endDraw(); > void flush(); > void save(); >@@ -75,11 +75,13 @@ public: > > COMPtr<ID2D1SolidColorBrush> brushWithColor(const D2D1_COLOR_F&); > >+ bool didBeginDraw() const { return m_beginDrawCount.unsafeGet(); } >+ > HDC m_hdc { nullptr }; > D2D1_BLEND_MODE m_blendMode { D2D1_BLEND_MODE_MULTIPLY }; > D2D1_COMPOSITE_MODE m_compositeMode { D2D1_COMPOSITE_MODE_SOURCE_OVER }; >+ Checked<unsigned> m_beginDrawCount { 0 }; > bool m_shouldIncludeChildWindows { false }; >- bool m_didBeginDraw { false }; > bool m_strokeSyleIsDirty { false }; > > COMPtr<ID2D1SolidColorBrush> m_solidStrokeBrush; >Index: Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp >=================================================================== >--- Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp (revision 208005) >+++ Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp (working copy) >@@ -33,6 +33,7 @@ > #include "HWndDC.h" > #include "IntRect.h" > #include "NotImplemented.h" >+#include "RenderTargetScopedDrawing.h" > #include <d2d1.h> > #include <runtime/JSCInlines.h> > #include <runtime/TypedArrayInlines.h> >@@ -70,7 +71,7 @@ RefPtr<Uint8ClampedArray> ImageBufferDat > if (FAILED(hr)) > return nullptr; > >- platformContext->BeginDraw(); >+ RenderTargetScopedDrawing helper(*context); > > HDC hdc = nullptr; > hr = gdiRenderTarget->GetDC(D2D1_DC_INITIALIZE_MODE_COPY, &hdc); >@@ -81,6 +82,8 @@ RefPtr<Uint8ClampedArray> ImageBufferDat > > hr = platformContext->EndDraw(); > >+ helper.endDraw(); >+ > if (!ok) > return nullptr; > >Index: Source/WebCore/platform/graphics/win/NativeImageDirect2D.cpp >=================================================================== >--- Source/WebCore/platform/graphics/win/NativeImageDirect2D.cpp (revision 208005) >+++ Source/WebCore/platform/graphics/win/NativeImageDirect2D.cpp (working copy) >@@ -32,6 +32,7 @@ > #include "GraphicsContext.h" > #include "IntSize.h" > #include "NotImplemented.h" >+#include "RenderTargetScopedDrawing.h" > #include <d2d1.h> > > namespace WebCore { >@@ -85,14 +86,13 @@ void drawNativeImage(const NativeImagePt > > float opacity = 1.0f; > >- if (!context.didBeginDraw()) >- platformContext->BeginDraw(); >+ bool temporaryDraw = context.beginDrawIfNeeded(); > > platformContext->DrawBitmap(image.get(), destRect, opacity, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, adjustedSrcRect); > > HRESULT hr = S_OK; >- if (!context.didBeginDraw()) >- hr = platformContext->EndDraw(); >+ if (temporaryDraw) >+ context.endDraw(); > else > hr = platformContext->Flush(); > >Index: Source/WebCore/platform/graphics/win/RenderTargetScopedDrawing.h >=================================================================== >--- Source/WebCore/platform/graphics/win/RenderTargetScopedDrawing.h (nonexistent) >+++ Source/WebCore/platform/graphics/win/RenderTargetScopedDrawing.h (working copy) >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2016 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 RenderTargetScopedDrawing { >+ WTF_MAKE_NONCOPYABLE(RenderTargetScopedDrawing); >+public: >+ RenderTargetScopedDrawing(GraphicsContext& context) >+ : m_context(context) >+ { >+ m_drawIsScoped = context.beginDrawIfNeeded(); >+ } >+ >+ ~RenderTargetScopedDrawing() >+ { >+ endDraw(); >+ } >+ >+ void endDraw() >+ { >+ if (!m_drawIsScoped) >+ return; >+ >+ m_context.endDraw(); >+ m_drawIsScoped = false; >+ } >+ >+private: >+ GraphicsContext& m_context; >+ bool m_drawIsScoped; >+}; >+ >+} // namespace WebCore >Index: Source/WebCore/svg/graphics/SVGImage.cpp >=================================================================== >--- Source/WebCore/svg/graphics/SVGImage.cpp (revision 208005) >+++ Source/WebCore/svg/graphics/SVGImage.cpp (working copy) >@@ -1,6 +1,6 @@ > /* > * Copyright (C) 2006 Eric Seidel <eric@webkit.org> >- * Copyright (C) 2008, 2009, 2015 Apple Inc. All rights reserved. >+ * Copyright (C) 2008-2009, 2015-2016 Apple Inc. All rights reserved. > * Copyright (C) Research In Motion Limited 2011. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without >@@ -56,6 +56,7 @@ > > #if USE(DIRECT2D) > #include "COMPtr.h" >+#include "RenderTargetScopedDrawing.h" > #include <d2d1.h> > #endif > >@@ -224,14 +225,12 @@ NativeImagePtr SVGImage::nativeImage(con > HRESULT hr = platformContext->CreateCompatibleRenderTarget(IntSize(rect().size()), &nativeImageTarget); > ASSERT(SUCCEEDED(hr)); > >- nativeImageTarget->BeginDraw(); > GraphicsContext localContext(nativeImageTarget.get()); >- localContext.setDidBeginDraw(true); > >+ { >+ RenderTargetScopedDrawing helper(localContext); > draw(localContext, rect(), rect(), CompositeSourceOver, BlendModeNormal, ImageOrientationDescription()); >- >- hr = nativeImageTarget->Flush(); >- ASSERT(SUCCEEDED(hr)); >+ } > > COMPtr<ID2D1Bitmap> nativeImage; > hr = nativeImageTarget->GetBitmap(&nativeImage); >Index: Source/WebKit/win/ChangeLog >=================================================================== >--- Source/WebKit/win/ChangeLog (revision 208005) >+++ Source/WebKit/win/ChangeLog (working copy) >@@ -1,3 +1,14 @@ >+2016-10-25 Brent Fulgham <bfulgham@apple.com> >+ >+ [Win][Direct2D] Create a RIAA Helper Class for the Render Target >+ https://bugs.webkit.org/show_bug.cgi?id=164005 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebView.cpp: >+ (WebView::sizeChanged): Construct RenderTarget with higher-resolution display timer. >+ (WebView::paintWithDirect2D): Revise to use new RenderTargetHelper class. >+ > 2016-10-26 Brian Burg <bburg@apple.com> > > Web Inspector: remove unused bool return value from FrontendChannel::sendMessageToFrontend >Index: Source/WebKit/win/WebView.cpp >=================================================================== >--- Source/WebKit/win/WebView.cpp (revision 208005) >+++ Source/WebKit/win/WebView.cpp (working copy) >@@ -142,6 +142,7 @@ > #include <WebCore/PopupMenuWin.h> > #include <WebCore/ProgressTracker.h> > #include <WebCore/RenderLayer.h> >+#include <WebCore/RenderTargetScopedDrawing.h> > #include <WebCore/RenderTheme.h> > #include <WebCore/RenderTreeAsText.h> > #include <WebCore/RenderView.h> >@@ -164,6 +165,7 @@ > #include <WebCore/WindowMessageBroadcaster.h> > #include <WebCore/WindowsTouch.h> > #include <bindings/ScriptValue.h> >+#include <comdef.h> > #include <d2d1.h> > #include <wtf/MainThread.h> > #include <wtf/RAMSize.h> >@@ -1063,7 +1065,7 @@ void WebView::sizeChanged(const IntSize& > // Create a Direct2D render target. > auto renderTargetProperties = D2D1::RenderTargetProperties(); > renderTargetProperties.usage = D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE; >- auto hwndRenderTargetProperties = D2D1::HwndRenderTargetProperties(m_viewWindow, newSize); >+ auto hwndRenderTargetProperties = D2D1::HwndRenderTargetProperties(m_viewWindow, newSize, D2D1_PRESENT_OPTIONS_IMMEDIATELY); > HRESULT hr = GraphicsContext::systemFactory()->CreateHwndRenderTarget(&renderTargetProperties, &hwndRenderTargetProperties, &m_renderTarget); > ASSERT(SUCCEEDED(hr)); > #endif >@@ -1236,13 +1238,15 @@ void WebView::paintWithDirect2D() > > auto pixelSize = D2D1::SizeU(clientRect.width(), clientRect.height()); > >- auto hwndRenderTargetProperties = D2D1::HwndRenderTargetProperties(m_viewWindow, pixelSize); >+ auto hwndRenderTargetProperties = D2D1::HwndRenderTargetProperties(m_viewWindow, pixelSize, D2D1_PRESENT_OPTIONS_IMMEDIATELY); > HRESULT hr = GraphicsContext::systemFactory()->CreateHwndRenderTarget(&renderTargetProperties, &hwndRenderTargetProperties, &m_renderTarget); > if (!SUCCEEDED(hr)) > return; > } > >- m_renderTarget->BeginDraw(); >+ GraphicsContext gc(m_renderTarget.get()); >+ >+ WebCore::RenderTargetScopedDrawing helper(gc); > > m_renderTarget->SetTags(WEBKIT_DRAWING, __LINE__); > m_renderTarget->Clear(); >@@ -1251,7 +1255,7 @@ void WebView::paintWithDirect2D() > float scaleFactor = 1.0f; > float inverseScaleFactor = 1.0f / scaleFactor; > >- RECT clientRect; >+ RECT clientRect = { }; > GetClientRect(m_viewWindow, &clientRect); > > IntRect dirtyRectPixels(0, 0, clientRect.right, clientRect.bottom); >@@ -1259,9 +1263,6 @@ void WebView::paintWithDirect2D() > logicalDirtyRectFloat.scale(inverseScaleFactor); > IntRect logicalDirtyRect(enclosingIntRect(logicalDirtyRectFloat)); > >- GraphicsContext gc(m_renderTarget.get()); >- gc.setDidBeginDraw(true); >- > if (frameView && frameView->frame().contentRenderer()) { > gc.save(); > gc.scale(FloatSize(scaleFactor, scaleFactor)); >@@ -1272,9 +1273,7 @@ void WebView::paintWithDirect2D() > gc.fillRect(logicalDirtyRect, Color::white, CompositeDifference); > } > >- HRESULT hr = m_renderTarget->EndDraw(); >- // FIXME: Recognize and recover from error state: >- UNUSED_PARAM(hr); >+ helper.endDraw(); > > ::ValidateRect(m_viewWindow, &clientRect); > #else >@@ -3151,6 +3150,7 @@ HRESULT WebView::initWithFrame(RECT fram > m_page->setDeviceScaleFactor(deviceScaleFactor()); > > setSmartInsertDeleteEnabled(TRUE); >+ > return hr; > } > >Index: Source/cmake/OptionsAppleWin.cmake >=================================================================== >--- Source/cmake/OptionsAppleWin.cmake (revision 208005) >+++ Source/cmake/OptionsAppleWin.cmake (working copy) >@@ -6,7 +6,7 @@ set(USE_CFURLCONNECTION 1) > set(USE_ICU_UNICODE 1) > > # Uncomment the following line to try the Direct2D backend. >-# set(USE_DIRECT2D 1) >+set(USE_DIRECT2D 1) > > if (${USE_DIRECT2D}) > add_definitions(-DUSE_DIRECT2D=1) >Index: Tools/TestWebKitAPI/PlatformWin.cmake >=================================================================== >--- Tools/TestWebKitAPI/PlatformWin.cmake (revision 208005) >+++ Tools/TestWebKitAPI/PlatformWin.cmake (working copy) >@@ -28,6 +28,8 @@ add_definitions(-DWEBCORE_EXPORT=) > set(test_webcore_LIBRARIES > Crypt32 > D2d1 >+ Dwrite >+ dxguid > Iphlpapi > Psapi > Shlwapi >@@ -35,6 +37,7 @@ set(test_webcore_LIBRARIES > WebCore${DEBUG_SUFFIX} > WebCoreDerivedSources${DEBUG_SUFFIX} > WebKit${DEBUG_SUFFIX} >+ WindowsCodecs > gtest > ) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 164005
:
292876
|
292877
|
292878
|
293058
|
293072