Now entering Valhalla.
This commit is contained in:
parent
a1d2c2b9fd
commit
5267489f0b
|
@ -40,6 +40,9 @@ CFILES += \
|
||||||
windows/utilwin.c \
|
windows/utilwin.c \
|
||||||
windows/window.c
|
windows/window.c
|
||||||
|
|
||||||
|
CXXFILES += \
|
||||||
|
windows/drawtext.cpp
|
||||||
|
|
||||||
HFILES += \
|
HFILES += \
|
||||||
windows/area.h \
|
windows/area.h \
|
||||||
windows/compilerver.h \
|
windows/compilerver.h \
|
||||||
|
|
|
@ -24,21 +24,6 @@ void uninitDraw(void)
|
||||||
ID2D1Factory_Release(d2dfactory);
|
ID2D1Factory_Release(d2dfactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
static IDWriteFactory *dwfactory = NULL;
|
|
||||||
|
|
||||||
HRESULT initDrawText(void)
|
|
||||||
{
|
|
||||||
// TOOD use DWRITE_FACTORY_TYPE_ISOLATED instead?
|
|
||||||
return DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED,
|
|
||||||
&IID_IDWriteFactory,
|
|
||||||
(IUnknown **) (&dwfactory));
|
|
||||||
}
|
|
||||||
|
|
||||||
void uninitDrawText(void)
|
|
||||||
{
|
|
||||||
IDWriteFactory_Release(dwfactory);
|
|
||||||
}
|
|
||||||
|
|
||||||
ID2D1HwndRenderTarget *makeHWNDRenderTarget(HWND hwnd)
|
ID2D1HwndRenderTarget *makeHWNDRenderTarget(HWND hwnd)
|
||||||
{
|
{
|
||||||
D2D1_RENDER_TARGET_PROPERTIES props;
|
D2D1_RENDER_TARGET_PROPERTIES props;
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
// 22 december 2015
|
||||||
|
// Before we begin, you may be wondering why this file is C++.
|
||||||
|
// Simple: <dwrite.h> is C++ only! Thanks Microsoft!
|
||||||
|
// And unlike UI Automation which accidentally just forgets the 'struct' and 'enum' tags in places, <dwrite.h> is a full C++ header file, with class definitions and the use of __uuidof. Oh well :/
|
||||||
|
#include "uipriv_windows.h"
|
||||||
|
|
||||||
|
static IDWriteFactory *dwfactory = NULL;
|
||||||
|
|
||||||
|
HRESULT initDrawText(void)
|
||||||
|
{
|
||||||
|
// TOOD use DWRITE_FACTORY_TYPE_ISOLATED instead?
|
||||||
|
return DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED,
|
||||||
|
__uuidof (IDWriteFactory),
|
||||||
|
(IUnknown **) (&dwfactory));
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninitDrawText(void)
|
||||||
|
{
|
||||||
|
dwfactory->Release();
|
||||||
|
}
|
|
@ -6,6 +6,10 @@
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
#include "compilerver.h"
|
#include "compilerver.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
// ui internal window messages
|
// ui internal window messages
|
||||||
enum {
|
enum {
|
||||||
// redirected WM_COMMAND and WM_NOTIFY
|
// redirected WM_COMMAND and WM_NOTIFY
|
||||||
|
@ -127,8 +131,14 @@ extern int registerAreaFilter(void);
|
||||||
// draw.c
|
// draw.c
|
||||||
extern HRESULT initDraw(void);
|
extern HRESULT initDraw(void);
|
||||||
extern void uninitDraw(void);
|
extern void uninitDraw(void);
|
||||||
extern HRESULT initDrawText(void);
|
|
||||||
extern void uninitDrawText(void);
|
|
||||||
extern ID2D1HwndRenderTarget *makeHWNDRenderTarget(HWND hwnd);
|
extern ID2D1HwndRenderTarget *makeHWNDRenderTarget(HWND hwnd);
|
||||||
extern uiDrawContext *newContext(ID2D1RenderTarget *);
|
extern uiDrawContext *newContext(ID2D1RenderTarget *);
|
||||||
extern void freeContext(uiDrawContext *);
|
extern void freeContext(uiDrawContext *);
|
||||||
|
|
||||||
|
// drawtext.cpp
|
||||||
|
extern HRESULT initDrawText(void);
|
||||||
|
extern void uninitDrawText(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -3,9 +3,12 @@
|
||||||
#define _UNICODE
|
#define _UNICODE
|
||||||
#define STRICT
|
#define STRICT
|
||||||
#define STRICT_TYPED_ITEMIDS
|
#define STRICT_TYPED_ITEMIDS
|
||||||
|
#ifndef __cplusplus
|
||||||
#define CINTERFACE
|
#define CINTERFACE
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
|
#endif
|
||||||
// see https://github.com/golang/go/issues/9916#issuecomment-74812211
|
// see https://github.com/golang/go/issues/9916#issuecomment-74812211
|
||||||
|
// TODO get rid of this
|
||||||
#define INITGUID
|
#define INITGUID
|
||||||
#define _USE_MATH_DEFINES
|
#define _USE_MATH_DEFINES
|
||||||
// for the manifest
|
// for the manifest
|
||||||
|
@ -16,10 +19,6 @@
|
||||||
#define _WIN32_WINDOWS 0x0600 /* according to Microsoft's pdh.h */
|
#define _WIN32_WINDOWS 0x0600 /* according to Microsoft's pdh.h */
|
||||||
#define _WIN32_IE 0x0700 /* according to Microsoft's sdkddkver.h */
|
#define _WIN32_IE 0x0700 /* according to Microsoft's sdkddkver.h */
|
||||||
#define NTDDI_VERSION 0x06000000 /* according to Microsoft's sdkddkver.h */
|
#define NTDDI_VERSION 0x06000000 /* according to Microsoft's sdkddkver.h */
|
||||||
// TODO cl.exe spews garbage warnings for system headers; figure out which flags cause it
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(push, 0)
|
|
||||||
#endif
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
// Microsoft's resource compiler will segfault if we feed it headers it was not designed to handle
|
// Microsoft's resource compiler will segfault if we feed it headers it was not designed to handle
|
||||||
#ifndef RC_INVOKED
|
#ifndef RC_INVOKED
|
||||||
|
@ -38,7 +37,8 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <d2d1.h>
|
#include <d2d1.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
// see drawtext.cpp for details
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include <dwrite.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue