Patch level :

Files correlati     : xvaga.dll
Ricompilazione Demo : [ ]
Commento            :
Migliorato clipping nei PDF


git-svn-id: svn://10.65.10.50/branches/R_10_00@22015 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2011-04-21 14:33:34 +00:00
parent db2c63af9a
commit 869692a6fd
4 changed files with 17 additions and 11 deletions

View File

@ -348,8 +348,8 @@ unsigned int xvt_sys_load_icon(const char* file)
{ {
wxASSERT(_TheArtProvider != NULL); wxASSERT(_TheArtProvider != NULL);
const wxArtID id = file; const wxArtID id = file;
_TheArtProvider->GetIcon(id); const wxIcon ico = _TheArtProvider->GetIcon(id);
return _TheArtProvider->GetIconBundleNumber(id); return ico.IsOk() ? _TheArtProvider->GetIconBundleNumber(id) : ICON_RSRC;
} }
WX_DECLARE_HASH_MAP(int, wxCursor, wxIntegerHash, wxIntegerEqual, TCursorHashTable); WX_DECLARE_HASH_MAP(int, wxCursor, wxIntegerHash, wxIntegerEqual, TCursorHashTable);

View File

@ -325,6 +325,11 @@ void TwxPrintOutCache::Reset()
{ {
delete m_po; delete m_po;
m_po = NULL; m_po = NULL;
// Marca come non valido anche il puntatore al DC contenuto nel defunto m_po
TDCMapper& m = GetTDCMapper();
if (m.HasValidDC(PRINTER_WIN))
m.GetTDC(PRINTER_WIN).KillDC();
} }
} }

View File

@ -92,7 +92,7 @@ void TwxPDFDC::EndDoc ()
{ {
wxCHECK_RET( m_ok, wxT("invalid PDF dc") ); wxCHECK_RET( m_ok, wxT("invalid PDF dc") );
m_clipping = false; ResetClipping();
PDF_TRY_DL(m_PDFlib, m_p) PDF_TRY_DL(m_PDFlib, m_p)
{ {
@ -1189,11 +1189,10 @@ void TwxPDFDC::DoSetClippingRegion (wxCoord x, wxCoord y, wxCoord w, wxCoord h)
{ {
wxCHECK_RET( m_ok, wxT("invalid PDF dc") ); wxCHECK_RET( m_ok, wxT("invalid PDF dc") );
if (m_clipping) ResetClipping(); // Almost useless
DestroyClippingRegion();
m_clipX1 = x; m_clipX2 = x+w;
wxDC::DoSetClippingRegion(x, y, w, h); m_clipY1 = y; m_clipY2 = y+h;
m_clipping = true; m_clipping = true;
PDF_TRY_DL(m_PDFlib, m_p) PDF_TRY_DL(m_PDFlib, m_p)
@ -1229,6 +1228,6 @@ void TwxPDFDC::DestroyClippingRegion()
wxLogError("%s: %s", m_PDFlib->PDF_get_apiname(m_p), m_PDFlib->PDF_get_errmsg(m_p)); wxLogError("%s: %s", m_PDFlib->PDF_get_apiname(m_p), m_PDFlib->PDF_get_errmsg(m_p));
} }
} }
wxDC::DestroyClippingRegion(); ResetClipping();
} }

View File

@ -248,6 +248,8 @@ bool is_printer_dc(wxDC * dc)
} }
#endif #endif
#define NULL_CLIP_SIZE 32000
wxDC& TDC::GetDC(bool bPaint) wxDC& TDC::GetDC(bool bPaint)
{ {
if (bPaint) if (bPaint)
@ -347,7 +349,7 @@ wxDC& TDC::GetDC(bool bPaint)
if (_dirty < 0 || ClipChanged()) if (_dirty < 0 || ClipChanged())
{ {
_dc->DestroyClippingRegion(); _dc->DestroyClippingRegion();
if (_clip.bottom < 4096) if (_clip.bottom < NULL_CLIP_SIZE)
_dc->SetClippingRegion(RCT2Rect(&_clip)); _dc->SetClippingRegion(RCT2Rect(&_clip));
_real_clip = _clip; _real_clip = _clip;
} }
@ -379,7 +381,7 @@ void TDC::SetClippingBox(const RCT* pRct)
else else
{ {
_clip.left = _clip.top = 0; _clip.left = _clip.top = 0;
_clip.right = _clip.bottom = 32000; // 32000 serve per i TDC di stampa (aumentare quando possibile) per il video basterebbe 4096 _clip.right = _clip.bottom = NULL_CLIP_SIZE;
} }
} }