More TIFF things,

Disabled leaking debug code.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4766 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 1999-11-29 18:36:02 +00:00
parent b8aa1680f2
commit 0b72db08a7
4 changed files with 16 additions and 17 deletions

View File

@ -224,8 +224,8 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
dc.DrawText( "PNM handler", 30, 1285 ); dc.DrawText( "PNM handler", 30, 1285 );
if (my_horse_pnm && my_horse_pnm->Ok()) dc.DrawBitmap( *my_horse_pnm, 30, 1300 ); if (my_horse_pnm && my_horse_pnm->Ok()) dc.DrawBitmap( *my_horse_pnm, 30, 1300 );
dc.DrawText( "TIFF handler", 30, 1415 ); dc.DrawText( "TIFF handler", 30, 1515 );
if (my_horse_tiff && my_horse_tiff->Ok()) dc.DrawBitmap( *my_horse_pnm, 30, 1430 ); if (my_horse_tiff && my_horse_tiff->Ok()) dc.DrawBitmap( *my_horse_pnm, 30, 1530 );
} }
void MyCanvas::CreateAntiAliasedBitmap() void MyCanvas::CreateAntiAliasedBitmap()

View File

@ -52,8 +52,7 @@ _tiffReadProc(thandle_t handle, tdata_t buf, tsize_t size)
{ {
wxInputStream *stream = (wxInputStream*) handle; wxInputStream *stream = (wxInputStream*) handle;
stream->Read( (void*) buf, (size_t) size ); stream->Read( (void*) buf, (size_t) size );
if (!*stream) return 0; return stream->LastRead();
return size;
} }
static tsize_t static tsize_t
@ -61,8 +60,7 @@ _tiffWriteProc(thandle_t handle, tdata_t buf, tsize_t size)
{ {
wxOutputStream *stream = (wxOutputStream*) handle; wxOutputStream *stream = (wxOutputStream*) handle;
stream->Write( (void*) buf, (size_t) size ); stream->Write( (void*) buf, (size_t) size );
if (!*stream) return 0; return stream->LastWrite();
return size;
} }
static toff_t static toff_t
@ -91,8 +89,7 @@ static toff_t
_tiffSizeProc(thandle_t handle) _tiffSizeProc(thandle_t handle)
{ {
wxInputStream *stream = (wxInputStream*) handle; wxInputStream *stream = (wxInputStream*) handle;
long fsize; return (toff_t) stream->GetSize();
return ((fsize = stream->SeekI(0, wxFromEnd)) < 0 ? 0 : fsize);
} }
static int static int
@ -126,7 +123,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
{ {
image->Destroy(); image->Destroy();
TIFF *tif = TIFFwxOpen( stream, "horse.tif", "r" ); TIFF *tif = TIFFwxOpen( stream, "image", "r" );
if (!tif) if (!tif)
{ {
@ -228,15 +225,13 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
bool wxTIFFHandler::DoCanRead( wxInputStream& stream ) bool wxTIFFHandler::DoCanRead( wxInputStream& stream )
{ {
return TRUE; unsigned char hdr[2];
/* stream.Read(&hdr, 2);
unsigned char hdr[4]; stream.SeekI(-2, wxFromCurrent);
stream.Read(&hdr, 4); return ((hdr[0] == 0x49 && hdr[1] == 0x49) ||
stream.SeekI(-4, wxFromCurrent); (hdr[0] == 0x4D && hdr[1] == 0x4D));
return (hdr[0] == 'T' && hdr[1] == 'I' && hdr[2] == 'F' && hdr[3] == 'F');
*/
} }

View File

@ -223,6 +223,7 @@ static gint gtk_debug_focus_in_callback( GtkWidget *WXUNUSED(widget),
void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window ) void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window )
{ {
/*
wxString tmp = name; wxString tmp = name;
tmp += wxT(" FROM "); tmp += wxT(" FROM ");
tmp += window; tmp += window;
@ -233,6 +234,7 @@ void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window
gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event", gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
GTK_SIGNAL_FUNC(gtk_debug_focus_in_callback), (gpointer)s ); GTK_SIGNAL_FUNC(gtk_debug_focus_in_callback), (gpointer)s );
*/
} }
#endif // Debug #endif // Debug

View File

@ -223,6 +223,7 @@ static gint gtk_debug_focus_in_callback( GtkWidget *WXUNUSED(widget),
void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window ) void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window )
{ {
/*
wxString tmp = name; wxString tmp = name;
tmp += wxT(" FROM "); tmp += wxT(" FROM ");
tmp += window; tmp += window;
@ -233,6 +234,7 @@ void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window
gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event", gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
GTK_SIGNAL_FUNC(gtk_debug_focus_in_callback), (gpointer)s ); GTK_SIGNAL_FUNC(gtk_debug_focus_in_callback), (gpointer)s );
*/
} }
#endif // Debug #endif // Debug