Minor formatting and style fixes to the previous commit

Fix indentation and spacing.

Also declare some variables when initializing them and make them const
if they don't change later.
This commit is contained in:
Vadim Zeitlin
2018-01-25 18:36:14 +01:00
committed by New Pagodi
parent df1456e4e2
commit 8d75368a30
3 changed files with 66 additions and 72 deletions

View File

@@ -4500,7 +4500,8 @@ wxGraphicsRenderer* wxGraphicsRenderer::GetDirect2DRenderer()
return gs_D2DRenderer; return gs_D2DRenderer;
} }
wxD2DRenderer::wxD2DRenderer():m_direct2dFactory(wxD2D1Factory()) wxD2DRenderer::wxD2DRenderer()
: m_direct2dFactory(wxD2D1Factory())
{ {
if ( m_direct2dFactory.get() == NULL ) if ( m_direct2dFactory.get() == NULL )
{ {

View File

@@ -91,17 +91,15 @@ class wxFontWithAscent : public wxFont
public: public:
explicit wxFontWithAscent(const wxFont &font) explicit wxFontWithAscent(const wxFont &font)
: wxFont(font), : wxFont(font),
m_ascent(0),m_surfaceFontData(NULL) m_ascent(0),
m_surfaceFontData(NULL)
{ {
} }
~wxFontWithAscent() virtual ~wxFontWithAscent()
{
if ( m_surfaceFontData )
{ {
delete m_surfaceFontData; delete m_surfaceFontData;
} }
}
static wxFontWithAscent* FromFID(FontID fid) static wxFontWithAscent* FromFID(FontID fid)
{ {
@@ -847,8 +845,10 @@ bool SurfaceFontDataD2D::Initialised() const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// SurfaceDataD2D // SurfaceDataD2D
SurfaceDataD2D::SurfaceDataD2D(ScintillaWX* editor):m_editor(editor), SurfaceDataD2D::SurfaceDataD2D(ScintillaWX* editor)
m_pD2DFactory(::wxD2D1Factory()), m_pDWriteFactory(::wxDWriteFactory()) : m_editor(editor),
m_pD2DFactory(::wxD2D1Factory()),
m_pDWriteFactory(::wxDWriteFactory())
{ {
if ( Initialised() ) if ( Initialised() )
{ {
@@ -1044,7 +1044,8 @@ private:
FontID m_curFontID; FontID m_curFontID;
}; };
SurfaceD2D::SurfaceD2D():m_pDWriteFactory(::wxDWriteFactory()) SurfaceD2D::SurfaceD2D()
: m_pDWriteFactory(::wxDWriteFactory())
{ {
m_unicodeMode = false; m_unicodeMode = false;
m_x = 0; m_x = 0;
@@ -1080,32 +1081,24 @@ void SurfaceD2D::Init(SurfaceID sid, WindowID wid)
{ {
Release(); Release();
wxDC* dc = static_cast<wxDC*>(sid);
wxStyledTextCtrl* stc(NULL);
ScintillaWX* sciwx(NULL);
wxWindow* win = wxDynamicCast(wid,wxWindow); wxWindow* win = wxDynamicCast(wid,wxWindow);
wxSize sz = dc->GetSize();
RECT rc;
HRESULT hr;
if ( win && win->GetName() == "wxSTCCallTip" ) if ( win && win->GetName() == "wxSTCCallTip" )
{ win = win->GetParent();
stc = wxDynamicCast(win->GetParent(),wxStyledTextCtrl);
}
else
{
stc = wxDynamicCast(wid,wxStyledTextCtrl);
}
wxStyledTextCtrl* const stc = wxDynamicCast(wid, wxStyledTextCtrl);
if ( stc ) if ( stc )
{ {
wxDC* const dc = static_cast<wxDC*>(sid);
const wxSize sz = dc->GetSize();
SetScale(dc); SetScale(dc);
ScintillaWX* const
sciwx = reinterpret_cast<ScintillaWX*>(stc->GetDirectPointer()); sciwx = reinterpret_cast<ScintillaWX*>(stc->GetDirectPointer());
m_surfaceData = static_cast<SurfaceDataD2D*>(sciwx->GetSurfaceData()); m_surfaceData = static_cast<SurfaceDataD2D*>(sciwx->GetSurfaceData());
hr = m_surfaceData->CreateGraphicsResources(); HRESULT hr = m_surfaceData->CreateGraphicsResources();
if ( SUCCEEDED(hr) ) if ( SUCCEEDED(hr) )
{ {
RECT rc;
::SetRect(&rc,0,0,sz.GetWidth(),sz.GetHeight()); ::SetRect(&rc,0,0,sz.GetWidth(),sz.GetHeight());
hr = m_surfaceData->GetRenderTarget() hr = m_surfaceData->GetRenderTarget()
->BindDC(reinterpret_cast<HDC>(dc->GetHandle()),&rc); ->BindDC(reinterpret_cast<HDC>(dc->GetHandle()),&rc);

View File

@@ -14,8 +14,8 @@ class SurfaceData
#if wxUSE_GRAPHICS_DIRECT2D #if wxUSE_GRAPHICS_DIRECT2D
#include <wx/msw/private/graphicsd2d.h> #include "wx/msw/private/graphicsd2d.h"
#include <wx/msw/private/comptr.h> #include "wx/msw/private/comptr.h"
class ScintillaWX; class ScintillaWX;