Changeset 134:116d23207a86
- Timestamp:
- 01/21/08 12:38:19
(9 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
changed PNG loader to use internal inflating
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r132 |
r134 |
|
| 97 | 97 | buildflags+=-L-lcairo |
|---|
| 98 | 98 | buildflags+=-g -gc |
|---|
| | 99 | buildflags+=-I/home/frank/jive |
|---|
| 99 | 100 | buildflags+=-Jdwtexamples/controlexample |
|---|
| 100 | 101 | |
|---|
| r132 |
r134 |
|
| 7 | 7 | import dwt.dwthelper.utils; |
|---|
| 8 | 8 | import tango.io.Stdout; |
|---|
| | 9 | import tango.io.compress.ZlibStream; |
|---|
| 9 | 10 | |
|---|
| 10 | 11 | class InputStreamWrapper : tango.io.model.IConduit.InputStream { |
|---|
| … | … | |
| 17 | 18 | |
|---|
| 18 | 19 | uint read (void[] dst){ |
|---|
| 19 | | int res = istr.read( cast(byte[])dst, 0, dst.length ); |
|---|
| 20 | | //Stdout.formatln( "read {}/{}", dst.length, res ); |
|---|
| | 20 | int res = istr.read( cast(byte[])dst ); |
|---|
| 21 | 21 | return res; |
|---|
| 22 | 22 | } |
|---|
| … | … | |
| 49 | 49 | package bool usesDefaultInflater = false; |
|---|
| 50 | 50 | |
|---|
| 51 | | InputStreamWrapper tangoIstr; |
|---|
| | 51 | ZlibInput tangoIstr; |
|---|
| 52 | 52 | |
|---|
| 53 | 53 | public this ( dwt.dwthelper.InputStream.InputStream istr ){ |
|---|
| 54 | | tangoIstr = new InputStreamWrapper(istr ); |
|---|
| | 54 | tangoIstr = new ZlibInput( new InputStreamWrapper(istr )); |
|---|
| 55 | 55 | } |
|---|
| 56 | 56 | |
|---|
| … | … | |
| 58 | 58 | ubyte[1] data; |
|---|
| 59 | 59 | uint res = tangoIstr.read( data ); |
|---|
| 60 | | if( res !is tango.io.model.IConduit.IOStream.Eof ){ |
|---|
| | 60 | if( res !is 1 ){ |
|---|
| 61 | 61 | return data[0] & 0xFF; |
|---|
| 62 | 62 | } |
|---|
| r131 |
r134 |
|
| 1 | | /******************************************************************************* |
|---|
| | 1 | /******************************************************************************* |
|---|
| 2 | 2 | * Copyright (c) 2000, 2006 IBM Corporation and others. |
|---|
| 3 | 3 | * All rights reserved. This program and the accompanying materials |
|---|
| r131 |
r134 |
|
| 1 | | /******************************************************************************* |
|---|
| | 1 | /******************************************************************************* |
|---|
| 2 | 2 | * Copyright (c) 2000, 2006 IBM Corporation and others. |
|---|
| 3 | 3 | * All rights reserved. This program and the accompanying materials |
|---|
| r131 |
r134 |
|
| 1 | | /******************************************************************************* |
|---|
| | 1 | /******************************************************************************* |
|---|
| 2 | 2 | * Copyright (c) 2000, 2006 IBM Corporation and others. |
|---|
| 3 | 3 | * All rights reserved. This program and the accompanying materials |
|---|
| … | … | |
| 313 | 313 | int chunkLength = tempChunk.getSize(); |
|---|
| 314 | 314 | byte[] chunk = new byte[chunkLength]; |
|---|
| | 315 | |
|---|
| 315 | 316 | result = stream.read(chunk, 0, chunkLength); |
|---|
| 316 | 317 | if (result !is chunkLength) return null; |
|---|
| r108 |
r134 |
|
| 1 | | /******************************************************************************* |
|---|
| | 1 | /******************************************************************************* |
|---|
| 2 | 2 | * Copyright (c) 2000, 2006 IBM Corporation and others. |
|---|
| 3 | 3 | * All rights reserved. This program and the accompanying materials |
|---|
| … | … | |
| 38 | 38 | * Answer whether the chunk is a valid IEND chunk. |
|---|
| 39 | 39 | */ |
|---|
| 40 | | void validate(PngFileReadState readState, PngIhdrChunk headerChunk) { |
|---|
| | 40 | override void validate(PngFileReadState readState, PngIhdrChunk headerChunk) { |
|---|
| 41 | 41 | // An IEND chunk is invalid if no IHDR has been read. |
|---|
| 42 | 42 | // Or if a palette is required and has not been read. |
|---|
| r132 |
r134 |
|
| 80 | 80 | import tango.util.PathUtil; |
|---|
| 81 | 81 | /*** Linker workaround end ***/ |
|---|
| | 82 | |
|---|
| | 83 | import jive.stacktrace; |
|---|
| 82 | 84 | |
|---|
| 83 | 85 | void main(){ |
|---|