From 869692a6fd3adddf84c66f0c7ca5f73efcef75b1 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 21 Apr 2011 14:33:34 +0000 Subject: [PATCH] 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 --- xvaga/xvtart.cpp | 4 ++-- xvaga/xvtextra.cpp | 5 +++++ xvaga/xvtpdf.cpp | 13 ++++++------- xvaga/xvtwin.cpp | 6 ++++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/xvaga/xvtart.cpp b/xvaga/xvtart.cpp index cd92d771c..68e1aaca3 100755 --- a/xvaga/xvtart.cpp +++ b/xvaga/xvtart.cpp @@ -348,8 +348,8 @@ unsigned int xvt_sys_load_icon(const char* file) { wxASSERT(_TheArtProvider != NULL); const wxArtID id = file; - _TheArtProvider->GetIcon(id); - return _TheArtProvider->GetIconBundleNumber(id); + const wxIcon ico = _TheArtProvider->GetIcon(id); + return ico.IsOk() ? _TheArtProvider->GetIconBundleNumber(id) : ICON_RSRC; } WX_DECLARE_HASH_MAP(int, wxCursor, wxIntegerHash, wxIntegerEqual, TCursorHashTable); diff --git a/xvaga/xvtextra.cpp b/xvaga/xvtextra.cpp index 4cf15eab3..bd1bb9c09 100755 --- a/xvaga/xvtextra.cpp +++ b/xvaga/xvtextra.cpp @@ -325,6 +325,11 @@ void TwxPrintOutCache::Reset() { delete m_po; 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(); } } diff --git a/xvaga/xvtpdf.cpp b/xvaga/xvtpdf.cpp index 082aec88a..54389187f 100755 --- a/xvaga/xvtpdf.cpp +++ b/xvaga/xvtpdf.cpp @@ -92,7 +92,7 @@ void TwxPDFDC::EndDoc () { wxCHECK_RET( m_ok, wxT("invalid PDF dc") ); - m_clipping = false; + ResetClipping(); 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") ); - if (m_clipping) - DestroyClippingRegion(); - - wxDC::DoSetClippingRegion(x, y, w, h); - + ResetClipping(); // Almost useless + + m_clipX1 = x; m_clipX2 = x+w; + m_clipY1 = y; m_clipY2 = y+h; m_clipping = true; 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)); } } - wxDC::DestroyClippingRegion(); + ResetClipping(); } diff --git a/xvaga/xvtwin.cpp b/xvaga/xvtwin.cpp index 44fd09443..b6a966963 100755 --- a/xvaga/xvtwin.cpp +++ b/xvaga/xvtwin.cpp @@ -248,6 +248,8 @@ bool is_printer_dc(wxDC * dc) } #endif +#define NULL_CLIP_SIZE 32000 + wxDC& TDC::GetDC(bool bPaint) { if (bPaint) @@ -347,7 +349,7 @@ wxDC& TDC::GetDC(bool bPaint) if (_dirty < 0 || ClipChanged()) { _dc->DestroyClippingRegion(); - if (_clip.bottom < 4096) + if (_clip.bottom < NULL_CLIP_SIZE) _dc->SetClippingRegion(RCT2Rect(&_clip)); _real_clip = _clip; } @@ -379,7 +381,7 @@ void TDC::SetClippingBox(const RCT* pRct) else { _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; } }