Mercurial > projects > dwt-linux
changeset 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 | 14bc18df0c25 |
children | 311ea7977d1f |
files | dsss.conf dwt/dwthelper/InflaterInputStream.d dwt/internal/image/FileFormat.d dwt/internal/image/PNGFileFormat.d dwt/internal/image/PngChunk.d dwt/internal/image/PngIendChunk.d dwtexamples/controlexample/ControlExample.d |
diffstat | 7 files changed, 14 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/dsss.conf Mon Jan 21 15:42:00 2008 +0100 +++ b/dsss.conf Mon Jan 21 18:38:19 2008 +0100 @@ -96,6 +96,7 @@ buildflags+=-L-lglib-2.0 buildflags+=-L-lcairo buildflags+=-g -gc +buildflags+=-I/home/frank/jive buildflags+=-Jdwtexamples/controlexample
--- 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;
--- a/dwt/internal/image/FileFormat.d Mon Jan 21 15:42:00 2008 +0100 +++ b/dwt/internal/image/FileFormat.d Mon Jan 21 18:38:19 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0
--- a/dwt/internal/image/PNGFileFormat.d Mon Jan 21 15:42:00 2008 +0100 +++ b/dwt/internal/image/PNGFileFormat.d Mon Jan 21 18:38:19 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0
--- a/dwt/internal/image/PngChunk.d Mon Jan 21 15:42:00 2008 +0100 +++ b/dwt/internal/image/PngChunk.d Mon Jan 21 18:38:19 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -312,6 +312,7 @@ int chunkLength = tempChunk.getSize(); byte[] chunk = new byte[chunkLength]; + result = stream.read(chunk, 0, chunkLength); if (result !is chunkLength) return null;
--- a/dwt/internal/image/PngIendChunk.d Mon Jan 21 15:42:00 2008 +0100 +++ b/dwt/internal/image/PngIendChunk.d Mon Jan 21 18:38:19 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -37,7 +37,7 @@ /** * Answer whether the chunk is a valid IEND chunk. */ -void validate(PngFileReadState readState, PngIhdrChunk headerChunk) { +override void validate(PngFileReadState readState, PngIhdrChunk headerChunk) { // An IEND chunk is invalid if no IHDR has been read. // Or if a palette is required and has not been read. // Or if no IDAT chunk has been read.
--- a/dwtexamples/controlexample/ControlExample.d Mon Jan 21 15:42:00 2008 +0100 +++ b/dwtexamples/controlexample/ControlExample.d Mon Jan 21 18:38:19 2008 +0100 @@ -80,6 +80,8 @@ import tango.util.PathUtil; /*** Linker workaround end ***/ +import jive.stacktrace; + void main(){ ControlExample.main( null ); }