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:
committed by
New Pagodi
parent
df1456e4e2
commit
8d75368a30
@@ -4500,7 +4500,8 @@ wxGraphicsRenderer* wxGraphicsRenderer::GetDirect2DRenderer()
|
||||
return gs_D2DRenderer;
|
||||
}
|
||||
|
||||
wxD2DRenderer::wxD2DRenderer():m_direct2dFactory(wxD2D1Factory())
|
||||
wxD2DRenderer::wxD2DRenderer()
|
||||
: m_direct2dFactory(wxD2D1Factory())
|
||||
{
|
||||
if ( m_direct2dFactory.get() == NULL )
|
||||
{
|
||||
|
@@ -91,16 +91,14 @@ class wxFontWithAscent : public wxFont
|
||||
public:
|
||||
explicit wxFontWithAscent(const 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)
|
||||
@@ -111,8 +109,8 @@ public:
|
||||
void SetAscent(int ascent) { m_ascent = ascent; }
|
||||
int GetAscent() const { return m_ascent; }
|
||||
|
||||
SurfaceData* GetSurfaceFontData() const {return m_surfaceFontData;}
|
||||
void SetSurfaceFontData(SurfaceData* data){m_surfaceFontData=data;}
|
||||
SurfaceData* GetSurfaceFontData() const { return m_surfaceFontData; }
|
||||
void SetSurfaceFontData(SurfaceData* data) { m_surfaceFontData=data; }
|
||||
|
||||
private:
|
||||
int m_ascent;
|
||||
@@ -847,10 +845,12 @@ bool SurfaceFontDataD2D::Initialised() const
|
||||
//----------------------------------------------------------------------
|
||||
// SurfaceDataD2D
|
||||
|
||||
SurfaceDataD2D::SurfaceDataD2D(ScintillaWX* editor):m_editor(editor),
|
||||
m_pD2DFactory(::wxD2D1Factory()), m_pDWriteFactory(::wxDWriteFactory())
|
||||
SurfaceDataD2D::SurfaceDataD2D(ScintillaWX* editor)
|
||||
: m_editor(editor),
|
||||
m_pD2DFactory(::wxD2D1Factory()),
|
||||
m_pDWriteFactory(::wxDWriteFactory())
|
||||
{
|
||||
if( Initialised() )
|
||||
if ( Initialised() )
|
||||
{
|
||||
HRESULT hr =
|
||||
m_pDWriteFactory->CreateRenderingParams(&m_defaultRenderingParams);
|
||||
@@ -1044,7 +1044,8 @@ private:
|
||||
FontID m_curFontID;
|
||||
};
|
||||
|
||||
SurfaceD2D::SurfaceD2D():m_pDWriteFactory(::wxDWriteFactory())
|
||||
SurfaceD2D::SurfaceD2D()
|
||||
: m_pDWriteFactory(::wxDWriteFactory())
|
||||
{
|
||||
m_unicodeMode = false;
|
||||
m_x = 0;
|
||||
@@ -1068,7 +1069,7 @@ SurfaceD2D::~SurfaceD2D()
|
||||
Release();
|
||||
}
|
||||
|
||||
void SurfaceD2D::Init(WindowID WXUNUSED(wid) )
|
||||
void SurfaceD2D::Init(WindowID WXUNUSED(wid))
|
||||
{
|
||||
Release();
|
||||
|
||||
@@ -1080,32 +1081,24 @@ void SurfaceD2D::Init(SurfaceID sid, WindowID wid)
|
||||
{
|
||||
Release();
|
||||
|
||||
wxDC* dc = static_cast<wxDC*>(sid);
|
||||
wxStyledTextCtrl* stc(NULL);
|
||||
ScintillaWX* sciwx(NULL);
|
||||
wxWindow* win = wxDynamicCast(wid,wxWindow);
|
||||
wxSize sz = dc->GetSize();
|
||||
RECT rc;
|
||||
HRESULT hr;
|
||||
|
||||
if ( win && win->GetName() == "wxSTCCallTip" )
|
||||
{
|
||||
stc = wxDynamicCast(win->GetParent(),wxStyledTextCtrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
stc = wxDynamicCast(wid,wxStyledTextCtrl);
|
||||
}
|
||||
win = win->GetParent();
|
||||
|
||||
wxStyledTextCtrl* const stc = wxDynamicCast(wid, wxStyledTextCtrl);
|
||||
if ( stc )
|
||||
{
|
||||
wxDC* const dc = static_cast<wxDC*>(sid);
|
||||
const wxSize sz = dc->GetSize();
|
||||
SetScale(dc);
|
||||
sciwx = reinterpret_cast<ScintillaWX*>(stc->GetDirectPointer());
|
||||
ScintillaWX* const
|
||||
sciwx = reinterpret_cast<ScintillaWX*>(stc->GetDirectPointer());
|
||||
m_surfaceData = static_cast<SurfaceDataD2D*>(sciwx->GetSurfaceData());
|
||||
hr = m_surfaceData->CreateGraphicsResources();
|
||||
HRESULT hr = m_surfaceData->CreateGraphicsResources();
|
||||
|
||||
if ( SUCCEEDED(hr) )
|
||||
{
|
||||
RECT rc;
|
||||
::SetRect(&rc,0,0,sz.GetWidth(),sz.GetHeight());
|
||||
hr = m_surfaceData->GetRenderTarget()
|
||||
->BindDC(reinterpret_cast<HDC>(dc->GetHandle()),&rc);
|
||||
|
@@ -8,67 +8,67 @@ wxColour wxColourFromCD(const ColourDesired& ca);
|
||||
|
||||
class SurfaceData
|
||||
{
|
||||
public:
|
||||
virtual ~SurfaceData(){}
|
||||
public:
|
||||
virtual ~SurfaceData(){}
|
||||
};
|
||||
|
||||
#if wxUSE_GRAPHICS_DIRECT2D
|
||||
|
||||
#include <wx/msw/private/graphicsd2d.h>
|
||||
#include <wx/msw/private/comptr.h>
|
||||
#include "wx/msw/private/graphicsd2d.h"
|
||||
#include "wx/msw/private/comptr.h"
|
||||
|
||||
class ScintillaWX;
|
||||
|
||||
class SurfaceDataD2D: public SurfaceData
|
||||
{
|
||||
public:
|
||||
SurfaceDataD2D(ScintillaWX*);
|
||||
bool Initialised() const;
|
||||
void DiscardGraphicsResources();
|
||||
HRESULT CreateGraphicsResources();
|
||||
void SetEditorPaintAbandoned();
|
||||
public:
|
||||
SurfaceDataD2D(ScintillaWX*);
|
||||
bool Initialised() const;
|
||||
void DiscardGraphicsResources();
|
||||
HRESULT CreateGraphicsResources();
|
||||
void SetEditorPaintAbandoned();
|
||||
|
||||
ID2D1DCRenderTarget* GetRenderTarget() const {return m_pRenderTarget.get();}
|
||||
ID2D1SolidColorBrush* GetSolidBrush() const {return m_pSolidBrush.get();}
|
||||
ID2D1BitmapBrush* GetPatternBrush() const {return m_pPatternBrush.get();}
|
||||
IDWriteRenderingParams* GetDefaultRenderingParams() const
|
||||
{return m_defaultRenderingParams;}
|
||||
IDWriteRenderingParams* GetCustomClearTypeRenderingParams() const
|
||||
{return m_customClearTypeRenderingParams;}
|
||||
ID2D1DCRenderTarget* GetRenderTarget() const { return m_pRenderTarget.get(); }
|
||||
ID2D1SolidColorBrush* GetSolidBrush() const { return m_pSolidBrush.get(); }
|
||||
ID2D1BitmapBrush* GetPatternBrush() const { return m_pPatternBrush.get(); }
|
||||
IDWriteRenderingParams* GetDefaultRenderingParams() const
|
||||
{ return m_defaultRenderingParams; }
|
||||
IDWriteRenderingParams* GetCustomClearTypeRenderingParams() const
|
||||
{ return m_customClearTypeRenderingParams; }
|
||||
|
||||
private:
|
||||
wxCOMPtr<ID2D1Factory> m_pD2DFactory;
|
||||
wxCOMPtr<IDWriteFactory> m_pDWriteFactory;
|
||||
wxCOMPtr<ID2D1DCRenderTarget> m_pRenderTarget;
|
||||
wxCOMPtr<ID2D1SolidColorBrush> m_pSolidBrush;
|
||||
wxCOMPtr<ID2D1BitmapBrush> m_pPatternBrush;
|
||||
wxCOMPtr<IDWriteRenderingParams> m_defaultRenderingParams;
|
||||
wxCOMPtr<IDWriteRenderingParams> m_customClearTypeRenderingParams;
|
||||
private:
|
||||
wxCOMPtr<ID2D1Factory> m_pD2DFactory;
|
||||
wxCOMPtr<IDWriteFactory> m_pDWriteFactory;
|
||||
wxCOMPtr<ID2D1DCRenderTarget> m_pRenderTarget;
|
||||
wxCOMPtr<ID2D1SolidColorBrush> m_pSolidBrush;
|
||||
wxCOMPtr<ID2D1BitmapBrush> m_pPatternBrush;
|
||||
wxCOMPtr<IDWriteRenderingParams> m_defaultRenderingParams;
|
||||
wxCOMPtr<IDWriteRenderingParams> m_customClearTypeRenderingParams;
|
||||
|
||||
ScintillaWX* m_editor;
|
||||
ScintillaWX* m_editor;
|
||||
};
|
||||
|
||||
class SurfaceFontDataD2D: public SurfaceData
|
||||
{
|
||||
public:
|
||||
SurfaceFontDataD2D(const FontParameters& fp);
|
||||
bool Initialised() const;
|
||||
public:
|
||||
SurfaceFontDataD2D(const FontParameters& fp);
|
||||
bool Initialised() const;
|
||||
|
||||
XYPOSITION GetAscent() const {return m_ascent;}
|
||||
XYPOSITION GetDescent() const {return m_descent;}
|
||||
XYPOSITION GetInternalLeading() const {return m_internalLeading;}
|
||||
XYPOSITION GetAverageCharWidth() const {return m_averageCharWidth;}
|
||||
XYPOSITION GetAscent() const { return m_ascent; }
|
||||
XYPOSITION GetDescent() const { return m_descent; }
|
||||
XYPOSITION GetInternalLeading() const { return m_internalLeading; }
|
||||
XYPOSITION GetAverageCharWidth() const { return m_averageCharWidth; }
|
||||
|
||||
D2D1_TEXT_ANTIALIAS_MODE GetFontQuality() const {return m_aaMode;}
|
||||
IDWriteTextFormat* GetFormat() const {return m_pTextFormat.get();}
|
||||
D2D1_TEXT_ANTIALIAS_MODE GetFontQuality() const { return m_aaMode; }
|
||||
IDWriteTextFormat* GetFormat() const { return m_pTextFormat.get(); }
|
||||
|
||||
private:
|
||||
XYPOSITION m_ascent;
|
||||
XYPOSITION m_descent;
|
||||
XYPOSITION m_internalLeading;
|
||||
XYPOSITION m_averageCharWidth;
|
||||
D2D1_TEXT_ANTIALIAS_MODE m_aaMode;
|
||||
wxCOMPtr<IDWriteTextFormat> m_pTextFormat;
|
||||
private:
|
||||
XYPOSITION m_ascent;
|
||||
XYPOSITION m_descent;
|
||||
XYPOSITION m_internalLeading;
|
||||
XYPOSITION m_averageCharWidth;
|
||||
D2D1_TEXT_ANTIALIAS_MODE m_aaMode;
|
||||
wxCOMPtr<IDWriteTextFormat> m_pTextFormat;
|
||||
};
|
||||
|
||||
#endif // wxUSE_GRAPHICS_DIRECT2D
|
||||
|
Reference in New Issue
Block a user