Bug 1852806 - Remove macros for older Windows SDK from gfx/. r=gfx-reviewers,lsalzman

Depends on D188022

Differential Revision: https://phabricator.services.mozilla.com/D188023
This commit is contained in:
Masatoshi Kimura 2023-09-15 03:19:26 +00:00
parent db45d70072
commit 0f09dfdb3e
13 changed files with 6 additions and 229 deletions

View file

@ -17,18 +17,6 @@
#include "dwrite_3.h" #include "dwrite_3.h"
// Currently, we build with WINVER=0x601 (Win7), which means newer
// declarations in dwrite_3.h will not be visible. Also, we don't
// yet have the Fall Creators Update SDK available on build machines,
// so even with updated WINVER, some of the interfaces we need would
// not be present.
// To work around this, until the build environment is updated,
// we #include an extra header that contains copies of the relevant
// classes/interfaces we need.
#if !defined(__MINGW32__) && WINVER < 0x0A00
# include "dw-extra.h"
#endif
#include "PathSkia.h" #include "PathSkia.h"
#include "skia/include/core/SkPaint.h" #include "skia/include/core/SkPaint.h"
#include "skia/include/core/SkPath.h" #include "skia/include/core/SkPath.h"

View file

@ -1,136 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* New DirectWrite interfaces based on Win10 Fall Creators Update versions
* of dwrite_3.h and dcommon.h (from SDK 10.0.17061.0). This particular
* subset of declarations is intended to be just sufficient to compile the
* Gecko DirectWrite font code; it omits many other new interfaces, etc.
*/
#ifndef DWRITE_EXTRA_H
#define DWRITE_EXTRA_H
#pragma once
interface IDWriteFontResource;
interface IDWriteFontFaceReference1;
enum DWRITE_GLYPH_IMAGE_FORMATS {
DWRITE_GLYPH_IMAGE_FORMATS_NONE = 0x00000000,
DWRITE_GLYPH_IMAGE_FORMATS_TRUETYPE = 0x00000001,
DWRITE_GLYPH_IMAGE_FORMATS_CFF = 0x00000002,
DWRITE_GLYPH_IMAGE_FORMATS_COLR = 0x00000004,
DWRITE_GLYPH_IMAGE_FORMATS_SVG = 0x00000008,
DWRITE_GLYPH_IMAGE_FORMATS_PNG = 0x00000010,
DWRITE_GLYPH_IMAGE_FORMATS_JPEG = 0x00000020,
DWRITE_GLYPH_IMAGE_FORMATS_TIFF = 0x00000040,
DWRITE_GLYPH_IMAGE_FORMATS_PREMULTIPLIED_B8G8R8A8 = 0x00000080,
};
#ifdef DEFINE_ENUM_FLAG_OPERATORS
DEFINE_ENUM_FLAG_OPERATORS(DWRITE_GLYPH_IMAGE_FORMATS);
#endif
#define DWRITE_MAKE_FONT_AXIS_TAG(a, b, c, d) \
(static_cast<DWRITE_FONT_AXIS_TAG>(DWRITE_MAKE_OPENTYPE_TAG(a, b, c, d)))
enum DWRITE_FONT_AXIS_TAG : UINT32 {
DWRITE_FONT_AXIS_TAG_WEIGHT = DWRITE_MAKE_FONT_AXIS_TAG('w', 'g', 'h', 't'),
DWRITE_FONT_AXIS_TAG_WIDTH = DWRITE_MAKE_FONT_AXIS_TAG('w', 'd', 't', 'h'),
DWRITE_FONT_AXIS_TAG_SLANT = DWRITE_MAKE_FONT_AXIS_TAG('s', 'l', 'n', 't'),
DWRITE_FONT_AXIS_TAG_OPTICAL_SIZE =
DWRITE_MAKE_FONT_AXIS_TAG('o', 'p', 's', 'z'),
DWRITE_FONT_AXIS_TAG_ITALIC = DWRITE_MAKE_FONT_AXIS_TAG('i', 't', 'a', 'l'),
};
enum DWRITE_FONT_AXIS_ATTRIBUTES {
DWRITE_FONT_AXIS_ATTRIBUTES_NONE = 0x0000,
DWRITE_FONT_AXIS_ATTRIBUTES_VARIABLE = 0x0001,
DWRITE_FONT_AXIS_ATTRIBUTES_HIDDEN = 0x0002,
};
struct DWRITE_FONT_AXIS_VALUE {
DWRITE_FONT_AXIS_TAG axisTag;
FLOAT value;
};
struct DWRITE_FONT_AXIS_RANGE {
DWRITE_FONT_AXIS_TAG axisTag;
FLOAT minValue;
FLOAT maxValue;
};
struct DWRITE_GLYPH_IMAGE_DATA {
const void* imageData;
UINT32 imageDataSize;
UINT32 uniqueDataId;
UINT32 pixelsPerEm;
D2D1_SIZE_U pixelSize;
D2D1_POINT_2L horizontalLeftOrigin;
D2D1_POINT_2L horizontalRightOrigin;
D2D1_POINT_2L verticalTopOrigin;
D2D1_POINT_2L verticalBottomOrigin;
};
interface DWRITE_DECLARE_INTERFACE("27F2A904-4EB8-441D-9678-0563F53E3E2F")
IDWriteFontFace4 : public IDWriteFontFace3 {
STDMETHOD_(DWRITE_GLYPH_IMAGE_FORMATS, GetGlyphImageFormats)() PURE;
STDMETHOD(GetGlyphImageFormats)
(UINT16 glyphId, UINT32 pixelsPerEmFirst, UINT32 pixelsPerEmLast,
_Out_ DWRITE_GLYPH_IMAGE_FORMATS* glyphImageFormats) PURE;
STDMETHOD(GetGlyphImageData)
(_In_ UINT16 glyphId, UINT32 pixelsPerEm,
DWRITE_GLYPH_IMAGE_FORMATS glyphImageFormat,
_Out_ DWRITE_GLYPH_IMAGE_DATA* glyphData,
_Outptr_result_maybenull_ void** glyphDataContext) PURE;
STDMETHOD_(void, ReleaseGlyphImageData)(void* glyphDataContext) PURE;
};
interface DWRITE_DECLARE_INTERFACE("98EFF3A5-B667-479A-B145-E2FA5B9FDC29")
IDWriteFontFace5 : public IDWriteFontFace4 {
STDMETHOD_(UINT32, GetFontAxisValueCount)() PURE;
STDMETHOD(GetFontAxisValues)
(_Out_writes_(fontAxisValueCount) DWRITE_FONT_AXIS_VALUE* fontAxisValues,
UINT32 fontAxisValueCount) PURE;
STDMETHOD_(BOOL, HasVariations)() PURE;
STDMETHOD(GetFontResource)
(_COM_Outptr_ IDWriteFontResource** fontResource) PURE;
STDMETHOD_(BOOL, Equals)(IDWriteFontFace* fontFace) PURE;
};
interface DWRITE_DECLARE_INTERFACE("1F803A76-6871-48E8-987F-B975551C50F2")
IDWriteFontResource : public IUnknown {
STDMETHOD(GetFontFile)(_COM_Outptr_ IDWriteFontFile** fontFile) PURE;
STDMETHOD_(UINT32, GetFontFaceIndex)() PURE;
STDMETHOD_(UINT32, GetFontAxisCount)() PURE;
STDMETHOD(GetDefaultFontAxisValues)
(_Out_writes_(fontAxisValueCount) DWRITE_FONT_AXIS_VALUE* fontAxisValues,
UINT32 fontAxisValueCount) PURE;
STDMETHOD(GetFontAxisRanges)
(_Out_writes_(fontAxisRangeCount) DWRITE_FONT_AXIS_RANGE* fontAxisRanges,
UINT32 fontAxisRangeCount) PURE;
STDMETHOD_(DWRITE_FONT_AXIS_ATTRIBUTES, GetFontAxisAttributes)
(UINT32 axisIndex) PURE;
STDMETHOD(GetAxisNames)
(UINT32 axisIndex, _COM_Outptr_ IDWriteLocalizedStrings** names) PURE;
STDMETHOD_(UINT32, GetAxisValueNameCount)(UINT32 axisIndex) PURE;
STDMETHOD(GetAxisValueNames)
(UINT32 axisIndex, UINT32 axisValueIndex,
_Out_ DWRITE_FONT_AXIS_RANGE* fontAxisRange,
_COM_Outptr_ IDWriteLocalizedStrings** names) PURE;
STDMETHOD_(BOOL, HasVariations)() PURE;
STDMETHOD(CreateFontFace)
(DWRITE_FONT_SIMULATIONS fontSimulations,
_In_reads_(fontAxisValueCount) DWRITE_FONT_AXIS_VALUE const* fontAxisValues,
UINT32 fontAxisValueCount, _COM_Outptr_ IDWriteFontFace5** fontFace) PURE;
STDMETHOD(CreateFontFaceReference)
(DWRITE_FONT_SIMULATIONS fontSimulations,
_In_reads_(fontAxisValueCount) DWRITE_FONT_AXIS_VALUE const* fontAxisValues,
UINT32 fontAxisValueCount,
_COM_Outptr_ IDWriteFontFaceReference1** fontFaceReference) PURE;
};
#endif /* DWRITE_EXTRA_H */

View file

@ -74,7 +74,6 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("cocoa", "uikit"):
] ]
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
EXPORTS.mozilla.gfx += [ EXPORTS.mozilla.gfx += [
"dw-extra.h",
"DWriteSettings.h", "DWriteSettings.h",
"UnscaledFontDWrite.h", "UnscaledFontDWrite.h",
"UnscaledFontGDI.h", "UnscaledFontGDI.h",

View file

@ -34,9 +34,6 @@
#include "DeviceAttachmentsD3D11.h" #include "DeviceAttachmentsD3D11.h"
#include "BlendShaderConstants.h" #include "BlendShaderConstants.h"
#include <versionhelpers.h> // For IsWindows8OrGreater
#include <winsdkver.h>
namespace mozilla { namespace mozilla {
using namespace gfx; using namespace gfx;
@ -164,15 +161,13 @@ bool CompositorD3D11::Initialize(nsCString* const out_failureReason) {
hr = dxgiFactory->QueryInterface( hr = dxgiFactory->QueryInterface(
(IDXGIFactory2**)getter_AddRefs(dxgiFactory2)); (IDXGIFactory2**)getter_AddRefs(dxgiFactory2));
#if (_WIN32_WINDOWS_MAXVER >= 0x0A00)
if (gfxVars::UseDoubleBufferingWithCompositor() && SUCCEEDED(hr) && if (gfxVars::UseDoubleBufferingWithCompositor() && SUCCEEDED(hr) &&
dxgiFactory2) { dxgiFactory2) {
// DXGI_SCALING_NONE is not available on Windows 7 with Platform Update. // DXGI_SCALING_NONE is not available on Windows 7 with Platform Update.
// This looks awful for things like the awesome bar and browser window // This looks awful for things like the awesome bar and browser window
// resizing so we don't use a flip buffer chain here. When using // resizing so we don't use a flip buffer chain here. When using
// EFFECT_SEQUENTIAL it looks like windows doesn't stretch the surface // EFFECT_SEQUENTIAL it looks like windows doesn't stretch the surface
// when resizing. We chose not to run this before Windows 10 because it // when resizing.
// appears sometimes this breaks our ability to test ASAP compositing.
RefPtr<IDXGISwapChain1> swapChain; RefPtr<IDXGISwapChain1> swapChain;
DXGI_SWAP_CHAIN_DESC1 swapDesc; DXGI_SWAP_CHAIN_DESC1 swapDesc;
@ -211,9 +206,7 @@ bool CompositorD3D11::Initialize(nsCString* const out_failureReason) {
// In some configurations double buffering may have failed with an // In some configurations double buffering may have failed with an
// ACCESS_DENIED error. // ACCESS_DENIED error.
if (!mSwapChain) if (!mSwapChain) {
#endif
{
if (mWidget->AsWindows()->GetCompositorHwnd()) { if (mWidget->AsWindows()->GetCompositorHwnd()) {
// Destroy compositor window. // Destroy compositor window.
mWidget->AsWindows()->DestroyCompositorWindow(); mWidget->AsWindows()->DestroyCompositorWindow();

View file

@ -22,10 +22,6 @@
#include <dwrite_2.h> #include <dwrite_2.h>
#include <dwrite_3.h> #include <dwrite_3.h>
#if !defined(__MINGW32__) && WINVER < 0x0A00
#include "mozilla/gfx/dw-extra.h"
#endif
class SkFontDescriptor; class SkFontDescriptor;
struct SkScalerContextRec; struct SkScalerContextRec;

View file

@ -1,40 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_gfx_AllOfDcomp_h
#define mozilla_gfx_AllOfDcomp_h
// Getting everything that we need in dcomp.h defined means messing with some
// defines.
#if (_WIN32_WINNT < _WIN32_WINNT_WIN10)
# define XSTR(x) STR(x)
# define STR(x) #x
// clang-format off
# pragma message "IDCompositionFilterEffect in dcomp.h requires _WIN32_WINNT >= _WIN32_WINNT_WIN10."
// Pedantically, it actually requires _WIN32_WINNT_WINTHRESHOLD, but that's the
// same as _WIN32_WINNT_WIN10.
# pragma message "Forcing NTDDI_VERSION " XSTR(NTDDI_VERSION) " -> " XSTR(NTDDI_WIN10)
# undef NTDDI_VERSION
# define NTDDI_VERSION NTDDI_WIN10
# pragma message "Forcing _WIN32_WINNT " XSTR(_WIN32_WINNT) " -> " XSTR(_WIN32_WINNT_WIN10)
# undef _WIN32_WINNT
# define _WIN32_WINNT _WIN32_WINNT_WIN10
// clang-format on
# undef STR
# undef XSTR
#endif
// -
#include <dcomp.h>
#endif // mozilla_gfx_AllOfDcomp_h

View file

@ -26,8 +26,8 @@
// - // -
#include "mozilla/gfx/AllOfDcomp.h"
#include <d3d11.h> #include <d3d11.h>
#include <dcomp.h>
#include <ddraw.h> #include <ddraw.h>
#include <dxgi.h> #include <dxgi.h>

View file

@ -12,18 +12,6 @@
#include "gfxDWriteCommon.h" #include "gfxDWriteCommon.h"
#include "dwrite_3.h" #include "dwrite_3.h"
// Currently, we build with WINVER=0x601 (Win7), which means newer
// declarations in dwrite_3.h will not be visible. Also, we don't
// yet have the Fall Creators Update SDK available on build machines,
// so even with updated WINVER, some of the interfaces we need would
// not be present.
// To work around this, until the build environment is updated,
// we #include an extra header that contains copies of the relevant
// classes/interfaces we need.
#if !defined(__MINGW32__) && WINVER < 0x0A00
# include "mozilla/gfx/dw-extra.h"
#endif
#include "gfxFont.h" #include "gfxFont.h"
#include "gfxUserFontSet.h" #include "gfxUserFontSet.h"
#include "cairo-win32.h" #include "cairo-win32.h"

View file

@ -67,7 +67,6 @@ EXPORTS += [
] ]
EXPORTS.mozilla.gfx += [ EXPORTS.mozilla.gfx += [
"AllOfDcomp.h",
"D3D11Checks.h", "D3D11Checks.h",
"DeviceManagerDx.h", "DeviceManagerDx.h",
"DisplayConfigWindows.h", "DisplayConfigWindows.h",
@ -241,8 +240,6 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
"D3D11Checks.cpp", "D3D11Checks.cpp",
]
SOURCES += [
"DeviceManagerDx.cpp", "DeviceManagerDx.cpp",
] ]

View file

@ -8,8 +8,8 @@
// - // -
#include "mozilla/gfx/AllOfDcomp.h"
#include <d3d11.h> #include <d3d11.h>
#include <dcomp.h>
#include <d3d11_1.h> #include <d3d11_1.h>
#include <dxgi1_2.h> #include <dxgi1_2.h>

View file

@ -26,9 +26,6 @@
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
#include "FxROutputHandler.h" #include "FxROutputHandler.h"
#undef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_WIN8
#include <d3d11.h> #include <d3d11.h>
#include <dcomp.h> #include <dcomp.h>
#include <dxgi1_2.h> #include <dxgi1_2.h>

View file

@ -5,11 +5,6 @@
#include "RenderDcompSurfaceTextureHost.h" #include "RenderDcompSurfaceTextureHost.h"
#undef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_WINBLUE
#undef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_WINBLUE
#include <dcomp.h> #include <dcomp.h>
#define LOG(msg, ...) \ #define LOG(msg, ...) \

View file

@ -81,12 +81,12 @@ if CONFIG["MOZ_ENABLE_D3D10_LAYER"]:
"RenderDcompSurfaceTextureHost.h", "RenderDcompSurfaceTextureHost.h",
] ]
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
"DCLayerTree.cpp",
"RenderCompositorANGLE.cpp",
"RenderCompositorD3D11SWGL.cpp", "RenderCompositorD3D11SWGL.cpp",
"RenderD3D11TextureHost.cpp", "RenderD3D11TextureHost.cpp",
] ]
SOURCES += [ SOURCES += [
"DCLayerTree.cpp",
"RenderCompositorANGLE.cpp",
"RenderDcompSurfaceTextureHost.cpp", "RenderDcompSurfaceTextureHost.cpp",
] ]