aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2013-05-08 11:47:27 +1000
committernyamatongwe <unknown>2013-05-08 11:47:27 +1000
commitbec5dd1f96911abfe65aded29212bd50a3d89c24 (patch)
treeb29244fd7d346d7cc357fe779954daf617f8bba3
parent91d928e41eb04dfb81656310f503a54eaf90293b (diff)
downloadscintilla-mirror-bec5dd1f96911abfe65aded29212bd50a3d89c24.tar.gz
Partial fix for compiling Direct2D code with MinGW-w64.
Also needs changes to GUID code and the pixel format in InitPixMap but the correct code for those issues is less certain.
-rw-r--r--win32/PlatWin.cxx21
-rw-r--r--win32/ScintillaWin.cxx38
2 files changed, 41 insertions, 18 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 580ceb560..0eb377ed4 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -1490,15 +1490,15 @@ void SurfaceD2D::FillRectangle(PRectangle rc, Surface &surfacePattern) {
void SurfaceD2D::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) {
if (pRenderTarget) {
- D2D1_ROUNDED_RECT roundedRectFill = D2D1::RoundedRect(
+ D2D1_ROUNDED_RECT roundedRectFill = {
D2D1::RectF(rc.left+1.0, rc.top+1.0, rc.right-1.0, rc.bottom-1.0),
- 8, 8);
+ 8, 8};
D2DPenColour(back);
pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush);
- D2D1_ROUNDED_RECT roundedRect = D2D1::RoundedRect(
+ D2D1_ROUNDED_RECT roundedRect = {
D2D1::RectF(rc.left + 0.5, rc.top+0.5, rc.right - 0.5, rc.bottom-0.5),
- 8, 8);
+ 8, 8};
D2DPenColour(fore);
pRenderTarget->DrawRoundedRectangle(roundedRect, pBrush);
}
@@ -1517,15 +1517,16 @@ void SurfaceD2D::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil
D2DPenColour(outline, alphaOutline);
pRenderTarget->DrawRectangle(rectOutline, pBrush);
} else {
- D2D1_ROUNDED_RECT roundedRectFill = D2D1::RoundedRect(
+ const float cornerSizeF = static_cast<float>(cornerSize);
+ D2D1_ROUNDED_RECT roundedRectFill = {
D2D1::RectF(RoundFloat(rc.left) + 1.0, rc.top + 1.0, RoundFloat(rc.right) - 1.0, rc.bottom - 1.0),
- cornerSize, cornerSize);
+ cornerSizeF, cornerSizeF};
D2DPenColour(fill, alphaFill);
pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush);
- D2D1_ROUNDED_RECT roundedRect = D2D1::RoundedRect(
+ D2D1_ROUNDED_RECT roundedRect = {
D2D1::RectF(RoundFloat(rc.left) + 0.5, rc.top + 0.5, RoundFloat(rc.right) - 0.5, rc.bottom - 0.5),
- cornerSize, cornerSize);
+ cornerSizeF, cornerSizeF};
D2DPenColour(outline, alphaOutline);
pRenderTarget->DrawRoundedRectangle(roundedRect, pBrush);
}
@@ -1571,9 +1572,9 @@ void SurfaceD2D::DrawRGBAImage(PRectangle rc, int width, int height, const unsig
void SurfaceD2D::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) {
if (pRenderTarget) {
FLOAT radius = rc.Width() / 2.0f - 1.0f;
- D2D1_ELLIPSE ellipse = D2D1::Ellipse(
+ D2D1_ELLIPSE ellipse = {
D2D1::Point2F((rc.left + rc.right) / 2.0f, (rc.top + rc.bottom) / 2.0f),
- radius,radius);
+ radius,radius};
PenColour(back);
pRenderTarget->FillEllipse(ellipse, pBrush);
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 7d8efe3b0..94d676a4f 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -425,10 +425,21 @@ void ScintillaWin::EnsureRenderTarget() {
// Create a Direct2D render target.
#if 1
- pD2DFactory->CreateHwndRenderTarget(
- D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT, D2D1::PixelFormat(), 96.0, 96.0),
- D2D1::HwndRenderTargetProperties(hw, size),
- &pRenderTarget);
+ D2D1_HWND_RENDER_TARGET_PROPERTIES dhrtp;
+ dhrtp.hwnd = hw;
+ dhrtp.pixelSize = size;
+ dhrtp.presentOptions = D2D1_PRESENT_OPTIONS_NONE;
+
+ D2D1_RENDER_TARGET_PROPERTIES drtp;
+ drtp.type = D2D1_RENDER_TARGET_TYPE_DEFAULT;
+ drtp.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
+ drtp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_UNKNOWN;
+ drtp.dpiX = 96.0;
+ drtp.dpiY = 96.0;
+ drtp.usage = D2D1_RENDER_TARGET_USAGE_NONE;
+ drtp.minLevel = D2D1_FEATURE_LEVEL_DEFAULT;
+
+ pD2DFactory->CreateHwndRenderTarget(drtp, dhrtp, &pRenderTarget);
#else
pD2DFactory->CreateHwndRenderTarget(
D2D1::RenderTargetProperties(
@@ -2800,10 +2811,21 @@ sptr_t PASCAL ScintillaWin::CTWndProc(
surfaceWindow->Init(ps.hdc, hWnd);
} else {
#if defined(USE_D2D)
- pD2DFactory->CreateHwndRenderTarget(
- D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT, D2D1::PixelFormat(), 96.0, 96.0),
- D2D1::HwndRenderTargetProperties(hWnd, D2D1::SizeU(rc.right - rc.left, rc.bottom - rc.top)),
- &pCTRenderTarget);
+ D2D1_HWND_RENDER_TARGET_PROPERTIES dhrtp;
+ dhrtp.hwnd = hWnd;
+ dhrtp.pixelSize = D2D1::SizeU(rc.right - rc.left, rc.bottom - rc.top);
+ dhrtp.presentOptions = D2D1_PRESENT_OPTIONS_NONE;
+
+ D2D1_RENDER_TARGET_PROPERTIES drtp;
+ drtp.type = D2D1_RENDER_TARGET_TYPE_DEFAULT;
+ drtp.pixelFormat.format = DXGI_FORMAT_UNKNOWN;
+ drtp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_UNKNOWN;
+ drtp.dpiX = 96.0;
+ drtp.dpiY = 96.0;
+ drtp.usage = D2D1_RENDER_TARGET_USAGE_NONE;
+ drtp.minLevel = D2D1_FEATURE_LEVEL_DEFAULT;
+
+ pD2DFactory->CreateHwndRenderTarget(drtp, dhrtp, &pCTRenderTarget);
surfaceWindow->Init(pCTRenderTarget, hWnd);
pCTRenderTarget->BeginDraw();
#endif