Mercurial > projects > dwt-linux
diff dwt/dwthelper/InflaterInputStream.d @ 134:116d23207a86
changed PNG loader to use internal inflating
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 21 Jan 2008 18:38:19 +0100 |
parents | e22f9b443521 |
children | e10de397beb1 |
line wrap: on
line diff
--- a/dwt/dwthelper/InflaterInputStream.d Mon Jan 21 15:42:00 2008 +0100 +++ b/dwt/dwthelper/InflaterInputStream.d Mon Jan 21 18:38:19 2008 +0100 @@ -6,6 +6,7 @@ public import dwt.dwthelper.InputStream; import dwt.dwthelper.utils; import tango.io.Stdout; +import tango.io.compress.ZlibStream; class InputStreamWrapper : tango.io.model.IConduit.InputStream { @@ -16,8 +17,7 @@ } uint read (void[] dst){ - int res = istr.read( cast(byte[])dst, 0, dst.length ); - //Stdout.formatln( "read {}/{}", dst.length, res ); + int res = istr.read( cast(byte[])dst ); return res; } @@ -48,16 +48,16 @@ protected int len; package bool usesDefaultInflater = false; - InputStreamWrapper tangoIstr; + ZlibInput tangoIstr; public this ( dwt.dwthelper.InputStream.InputStream istr ){ - tangoIstr = new InputStreamWrapper(istr ); + tangoIstr = new ZlibInput( new InputStreamWrapper(istr )); } public int read(){ ubyte[1] data; uint res = tangoIstr.read( data ); - if( res !is tango.io.model.IConduit.IOStream.Eof ){ + if( res !is 1 ){ return data[0] & 0xFF; } return -1;