Skip to content
Permalink
Browse files
Remove Direct2D code (part 2)
https://bugs.webkit.org/show_bug.cgi?id=235097

Reviewed by Yusuke Suzuki.

.:

* Source/cmake/OptionsAppleWin.cmake:

Source/WebCore:

* platform/graphics/Color.h:
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::createGDIFont):
(WebCore::FontCache::createFontPlatformData):
* platform/graphics/win/FontPlatformDataWin.cpp:
* platform/image-decoders/ScalableImageDecoder.cpp:
(WebCore::ScalableImageDecoder::setTargetContext): Deleted.
* platform/image-decoders/ScalableImageDecoder.h:

Source/WebCore/PAL:

* pal/PlatformAppleWin.cmake:

Source/WebKit:

* UIProcess/BackingStore.h:
(): Deleted.
* UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
(WebKit::DrawingAreaProxyCoordinatedGraphics::sizeDidChange):
(WebKit::DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange):
* UIProcess/win/PageClientImpl.cpp:
* UIProcess/win/WebView.cpp:
(WebKit::WebView::paint):



Canonical link: https://commits.webkit.org/245946@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287913 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
fujii committed Jan 12, 2022
1 parent f26254e commit 3cd336d16f1a31549785b0bd6b97a8ddade7a81f
@@ -1,3 +1,12 @@
2022-01-11 Fujii Hironori <Hironori.Fujii@sony.com>

Remove Direct2D code (part 2)
https://bugs.webkit.org/show_bug.cgi?id=235097

Reviewed by Yusuke Suzuki.

* Source/cmake/OptionsAppleWin.cmake:

2022-01-10 Alex Christensen <achristensen@webkit.org>

Start using C++20
@@ -1,3 +1,19 @@
2022-01-11 Fujii Hironori <Hironori.Fujii@sony.com>

Remove Direct2D code (part 2)
https://bugs.webkit.org/show_bug.cgi?id=235097

Reviewed by Yusuke Suzuki.

* platform/graphics/Color.h:
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::createGDIFont):
(WebCore::FontCache::createFontPlatformData):
* platform/graphics/win/FontPlatformDataWin.cpp:
* platform/image-decoders/ScalableImageDecoder.cpp:
(WebCore::ScalableImageDecoder::setTargetContext): Deleted.
* platform/image-decoders/ScalableImageDecoder.h:

2022-01-11 Said Abou-Hallawa <said@apple.com>

[GPU Process] Make SVG resources create remote ImageBuffers for their drawing
@@ -1,3 +1,12 @@
2022-01-11 Fujii Hironori <Hironori.Fujii@sony.com>

Remove Direct2D code (part 2)
https://bugs.webkit.org/show_bug.cgi?id=235097

Reviewed by Yusuke Suzuki.

* pal/PlatformAppleWin.cmake:

2022-01-10 Wenson Hsieh <wenson_hsieh@apple.com>

Add support for a -shouldWrap property when injecting Live Text
@@ -14,17 +14,14 @@ list(APPEND PAL_PUBLIC_HEADERS
spi/win/CoreTextSPIWin.h
)

if (${USE_DIRECT2D})
else ()
list(APPEND PAL_PUBLIC_HEADERS
spi/cg/CoreGraphicsSPI.h
spi/cg/ImageIOSPI.h
)

list(APPEND PAL_PRIVATE_INCLUDE_DIRECTORIES
"${PAL_DIR}/pal/spi/cg"
)
endif ()
list(APPEND PAL_PUBLIC_HEADERS
spi/cg/CoreGraphicsSPI.h
spi/cg/ImageIOSPI.h
)

list(APPEND PAL_PRIVATE_INCLUDE_DIRECTORIES
"${PAL_DIR}/pal/spi/cg"
)

list(APPEND PAL_SOURCES
avfoundation/MediaTimeAVFoundation.cpp
@@ -42,15 +42,6 @@
typedef struct CGColor* CGColorRef;
#endif

#if PLATFORM(WIN)
struct _D3DCOLORVALUE;
typedef _D3DCOLORVALUE D3DCOLORVALUE;
typedef D3DCOLORVALUE D2D_COLOR_F;
typedef D2D_COLOR_F D2D1_COLOR_F;
struct D2D_VECTOR_4F;
typedef D2D_VECTOR_4F D2D1_VECTOR_4F;
#endif

#if PLATFORM(GTK)
typedef struct _GdkRGBA GdkRGBA;
#endif
@@ -148,12 +139,6 @@ class Color {
WEBCORE_EXPORT static Color createAndPreserveColorSpace(CGColorRef, OptionSet<Flags> = { });
#endif

#if PLATFORM(WIN)
WEBCORE_EXPORT Color(D2D1_COLOR_F);
WEBCORE_EXPORT operator D2D1_COLOR_F() const;
WEBCORE_EXPORT operator D2D1_VECTOR_4F() const;
#endif

static constexpr auto transparentBlack = SRGBA<uint8_t> { };
static constexpr auto black = SRGBA<uint8_t> { 0, 0, 0 };
static constexpr auto white = SRGBA<uint8_t> { 255, 255, 255 };
@@ -46,10 +46,6 @@
#include <pal/spi/cg/CoreGraphicsSPI.h>
#endif

#if USE(DIRECT2D)
#include <dwrite_3.h>
#endif

using std::min;

namespace WebCore
@@ -539,7 +535,7 @@ static GDIObject<HFONT> createGDIFont(const AtomString& family, LONG desiredWeig
matchData.m_chosen.lfUnderline = false;
matchData.m_chosen.lfStrikeOut = false;
matchData.m_chosen.lfCharSet = DEFAULT_CHARSET;
#if USE(CG) || USE(CAIRO) || USE(DIRECT2D)
#if USE(CG) || USE(CAIRO)
matchData.m_chosen.lfOutPrecision = OUT_TT_ONLY_PRECIS;
#else
matchData.m_chosen.lfOutPrecision = OUT_TT_PRECIS;
@@ -679,8 +675,6 @@ std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDe

#if USE(CG)
bool fontCreationFailed = !result->cgFont();
#elif USE(DIRECT2D)
bool fontCreationFailed = !result->dwFont();
#elif USE(CAIRO)
bool fontCreationFailed = !result->scaledFont();
#endif
@@ -33,10 +33,6 @@
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>

#if USE(DIRECT2D)
#include <dwrite_3.h>
#endif

using std::min;

namespace WebCore {
@@ -251,11 +251,4 @@ PlatformImagePtr ScalableImageDecoder::createFrameImageAtIndex(size_t index, Sub
return buffer->backingStore()->image();
}

#if USE(DIRECT2D)
void ScalableImageDecoder::setTargetContext(ID2D1RenderTarget*)
{
notImplemented();
}
#endif

}
@@ -204,10 +204,6 @@ class ScalableImageDecoder : public ImageDecoder {
private:
virtual void tryDecodeSize(bool) = 0;

#if USE(DIRECT2D)
void setTargetContext(ID2D1RenderTarget*) override;
#endif

IntSize m_size;
EncodedDataStatus m_encodedDataStatus { EncodedDataStatus::TypeAvailable };
bool m_decodingSizeFromSetData { false };
@@ -1,3 +1,19 @@
2022-01-11 Fujii Hironori <Hironori.Fujii@sony.com>

Remove Direct2D code (part 2)
https://bugs.webkit.org/show_bug.cgi?id=235097

Reviewed by Yusuke Suzuki.

* UIProcess/BackingStore.h:
(): Deleted.
* UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
(WebKit::DrawingAreaProxyCoordinatedGraphics::sizeDidChange):
(WebKit::DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange):
* UIProcess/win/PageClientImpl.cpp:
* UIProcess/win/WebView.cpp:
(WebKit::WebView::paint):

2022-01-11 Said Abou-Hallawa <said@apple.com>

[GPU Process] Make SVG resources create remote ImageBuffers for their drawing
@@ -30,15 +30,6 @@

#if USE(CAIRO)
#include <WebCore/BackingStoreBackendCairo.h>
#elif USE(DIRECT2D)
#include <WebCore/BackingStoreBackendDirect2D.h>
#endif

#if USE(DIRECT2D)
interface ID2D1RenderTarget;
interface ID3D11Device1;
interface ID3D11DeviceContext1;
interface ID3D11Texture2D;
#endif

namespace WebKit {
@@ -60,12 +51,6 @@ class BackingStore {

#if USE(CAIRO)
typedef cairo_t* PlatformGraphicsContext;
#elif USE(DIRECT2D)
struct DXConnections {
ID3D11DeviceContext1* immediateContext { nullptr };
ID3D11Texture2D* backBuffer { nullptr };
};
typedef DXConnections PlatformGraphicsContext;
#endif

void paint(PlatformGraphicsContext, const WebCore::IntRect&);
@@ -77,17 +62,13 @@ class BackingStore {

#if USE(CAIRO)
std::unique_ptr<WebCore::BackingStoreBackendCairo> createBackend();
#elif USE(DIRECT2D)
std::unique_ptr<WebCore::BackingStoreBackendDirect2D> createBackend();
#endif

WebCore::IntSize m_size;
float m_deviceScaleFactor;
WebPageProxy& m_webPageProxy;
#if USE(CAIRO)
std::unique_ptr<WebCore::BackingStoreBackendCairo> m_backend;
#elif USE(DIRECT2D)
std::unique_ptr<WebCore::BackingStoreBackendDirect2D> m_backend;
#endif
};

@@ -46,11 +46,6 @@
#include <wtf/glib/RunLoopSourcePriority.h>
#endif

#if USE(DIRECT2D)
#include <d2d1.h>
#include <d3d11_1.h>
#endif

namespace WebKit {
using namespace WebCore;

@@ -119,17 +114,11 @@ void DrawingAreaProxyCoordinatedGraphics::paint(BackingStore::PlatformGraphicsCo

void DrawingAreaProxyCoordinatedGraphics::sizeDidChange()
{
#if USE(DIRECT2D)
m_backingStore = nullptr;
#endif
backingStoreStateDidChange(RespondImmediately);
}

void DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange()
{
#if USE(DIRECT2D)
m_backingStore = nullptr;
#endif
backingStoreStateDidChange(RespondImmediately);
}

@@ -35,7 +35,6 @@
#include "WebView.h"
#include <WebCore/DOMPasteAccess.h>
#include <WebCore/NotImplemented.h>
#include <d3d11_1.h>

namespace WebKit {
using namespace WebCore;
@@ -491,15 +491,6 @@ void WebView::paint(HDC hdc, const IntRect& dirtyRect)

cairo_destroy(context);
cairo_surface_destroy(surface);
#else
COMPtr<ID3D11Texture2D> backBuffer;
HRESULT hr = m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(&backBuffer));
if (SUCCEEDED(hr)) {
BackingStore::DXConnections context { m_immediateContext.get(), backBuffer.get() };
drawingArea->paint(context, dirtyRect, unpaintedRegion);
}

m_swapChain->Present(0, 0);
#endif

auto unpaintedRects = unpaintedRegion.rects();
@@ -41,59 +41,52 @@ find_package(ZLIB REQUIRED)
# Libraries where find_package does not work
set(COREFOUNDATION_LIBRARY CoreFoundation${DEBUG_SUFFIX})

# Uncomment the following line to try the Direct2D backend.
# set(USE_DIRECT2D 1)

if (${USE_DIRECT2D})
SET_AND_EXPOSE_TO_BUILD(USE_DIRECT2D ON)
else ()
SET_AND_EXPOSE_TO_BUILD(USE_CA ON)
SET_AND_EXPOSE_TO_BUILD(USE_CG ON)
SET_AND_EXPOSE_TO_BUILD(USE_CORE_TEXT ON)

set(CMAKE_REQUIRED_INCLUDES ${WEBKIT_LIBRARIES_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES
"${WEBKIT_LIBRARIES_LINK_DIR}/CoreFoundation${DEBUG_SUFFIX}.lib"
"${WEBKIT_LIBRARIES_LINK_DIR}/AVFoundationCF${DEBUG_SUFFIX}.lib"
"${WEBKIT_LIBRARIES_LINK_DIR}/QuartzCore${DEBUG_SUFFIX}.lib"
"${WEBKIT_LIBRARIES_LINK_DIR}/libdispatch${DEBUG_SUFFIX}.lib"
)

WEBKIT_CHECK_HAVE_INCLUDE(HAVE_AVCF AVFoundationCF/AVCFBase.h)

if (HAVE_AVCF)
SET_AND_EXPOSE_TO_BUILD(USE_AVFOUNDATION ON)
endif ()

WEBKIT_CHECK_HAVE_SYMBOL(HAVE_AVCF_LEGIBLE_OUTPUT AVCFPlayerItemLegibleOutputSetCallbacks "TargetConditionals.h;dispatch/dispatch.h;AVFoundationCF/AVFoundationCF.h;AVFoundationCF/AVCFPlayerItemLegibleOutput.h")
WEBKIT_CHECK_HAVE_SYMBOL(HAVE_AVFOUNDATION_LOADER_DELEGATE AVCFAssetResourceLoaderSetCallbacks "TargetConditionals.h;dispatch/dispatch.h;AVFoundationCF/AVFoundationCF.h")
WEBKIT_CHECK_HAVE_SYMBOL(HAVE_AVCFURL_PLAYABLE_MIMETYPE AVCFURLAssetIsPlayableExtendedMIMEType "TargetConditionals.h;dispatch/dispatch.h;AVFoundationCF/AVFoundationCF.h")

# CMake cannot identify an enum through a symbol check so a source file is required
WEBKIT_CHECK_SOURCE_COMPILES(HAVE_AVCFPLAYERITEM_CALLBACK_VERSION_2 "
#include <AVFoundationCF/AVFoundationCF.h>
#include <AVFoundationCF/AVCFPlayerItemLegibleOutput.h>
#include <CoreFoundation/CoreFoundation.h>
#include <dispatch/dispatch.h>
int main() {
CFArrayRef types = CFArrayCreate(kCFAllocatorDefault, nullptr, 0, nullptr);
AVCFPlayerItemLegibleOutputRef legibleOutput = AVCFPlayerItemLegibleOutputCreateWithMediaSubtypesForNativeRepresentation(kCFAllocatorDefault, types);
AVCFPlayerItemLegibleOutputCallbacks callbackInfo;
callbackInfo.version = kAVCFPlayerItemLegibleOutput_CallbacksVersion_2;
dispatch_queue_t dispatchQueue = dispatch_queue_create(\"test\", DISPATCH_QUEUE_SERIAL);
AVCFPlayerItemLegibleOutputSetCallbacks(legibleOutput, &callbackInfo, dispatchQueue);
}")

if (HAVE_AVCF_LEGIBLE_OUTPUT)
SET_AND_EXPOSE_TO_BUILD(HAVE_AVFOUNDATION_MEDIA_SELECTION_GROUP ON)
SET_AND_EXPOSE_TO_BUILD(HAVE_AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT ON)
SET_AND_EXPOSE_TO_BUILD(HAVE_MEDIA_ACCESSIBILITY_FRAMEWORK ON)
endif ()
SET_AND_EXPOSE_TO_BUILD(USE_CA ON)
SET_AND_EXPOSE_TO_BUILD(USE_CG ON)
SET_AND_EXPOSE_TO_BUILD(USE_CORE_TEXT ON)

set(CMAKE_REQUIRED_INCLUDES ${WEBKIT_LIBRARIES_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES
"${WEBKIT_LIBRARIES_LINK_DIR}/CoreFoundation${DEBUG_SUFFIX}.lib"
"${WEBKIT_LIBRARIES_LINK_DIR}/AVFoundationCF${DEBUG_SUFFIX}.lib"
"${WEBKIT_LIBRARIES_LINK_DIR}/QuartzCore${DEBUG_SUFFIX}.lib"
"${WEBKIT_LIBRARIES_LINK_DIR}/libdispatch${DEBUG_SUFFIX}.lib"
)

WEBKIT_CHECK_HAVE_INCLUDE(HAVE_AVCF AVFoundationCF/AVCFBase.h)

if (HAVE_AVCF)
SET_AND_EXPOSE_TO_BUILD(USE_AVFOUNDATION ON)
endif ()

WEBKIT_CHECK_HAVE_SYMBOL(HAVE_CACFLAYER_SETCONTENTSSCALE CACFLayerSetContentsScale QuartzCore/CoreAnimationCF.h)
WEBKIT_CHECK_HAVE_SYMBOL(HAVE_AVCF_LEGIBLE_OUTPUT AVCFPlayerItemLegibleOutputSetCallbacks "TargetConditionals.h;dispatch/dispatch.h;AVFoundationCF/AVFoundationCF.h;AVFoundationCF/AVCFPlayerItemLegibleOutput.h")
WEBKIT_CHECK_HAVE_SYMBOL(HAVE_AVFOUNDATION_LOADER_DELEGATE AVCFAssetResourceLoaderSetCallbacks "TargetConditionals.h;dispatch/dispatch.h;AVFoundationCF/AVFoundationCF.h")
WEBKIT_CHECK_HAVE_SYMBOL(HAVE_AVCFURL_PLAYABLE_MIMETYPE AVCFURLAssetIsPlayableExtendedMIMEType "TargetConditionals.h;dispatch/dispatch.h;AVFoundationCF/AVFoundationCF.h")

# CMake cannot identify an enum through a symbol check so a source file is required
WEBKIT_CHECK_SOURCE_COMPILES(HAVE_AVCFPLAYERITEM_CALLBACK_VERSION_2 "
#include <AVFoundationCF/AVFoundationCF.h>
#include <AVFoundationCF/AVCFPlayerItemLegibleOutput.h>
#include <CoreFoundation/CoreFoundation.h>
#include <dispatch/dispatch.h>
int main() {
CFArrayRef types = CFArrayCreate(kCFAllocatorDefault, nullptr, 0, nullptr);
AVCFPlayerItemLegibleOutputRef legibleOutput = AVCFPlayerItemLegibleOutputCreateWithMediaSubtypesForNativeRepresentation(kCFAllocatorDefault, types);
AVCFPlayerItemLegibleOutputCallbacks callbackInfo;
callbackInfo.version = kAVCFPlayerItemLegibleOutput_CallbacksVersion_2;
dispatch_queue_t dispatchQueue = dispatch_queue_create(\"test\", DISPATCH_QUEUE_SERIAL);
AVCFPlayerItemLegibleOutputSetCallbacks(legibleOutput, &callbackInfo, dispatchQueue);
}")

if (HAVE_AVCF_LEGIBLE_OUTPUT)
SET_AND_EXPOSE_TO_BUILD(HAVE_AVFOUNDATION_MEDIA_SELECTION_GROUP ON)
SET_AND_EXPOSE_TO_BUILD(HAVE_AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT ON)
SET_AND_EXPOSE_TO_BUILD(HAVE_MEDIA_ACCESSIBILITY_FRAMEWORK ON)
endif ()

WEBKIT_CHECK_HAVE_SYMBOL(HAVE_CACFLAYER_SETCONTENTSSCALE CACFLayerSetContentsScale QuartzCore/CoreAnimationCF.h)

# Warnings as errors (ignore narrowing conversions)
add_compile_options(/WX /Wv:18)

0 comments on commit 3cd336d

Please sign in to comment.