The Trunk: Graphics-nice.297.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Graphics-nice.297.mcz

commits-2
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.297.mcz

==================== Summary ====================

Name: Graphics-nice.297
Author: nice
Time: 22 July 2014, 11:25:29.615 pm
UUID: 4b40195c-20d5-4a12-9879-cb649a16c901
Ancestors: Graphics-nice.296

RWStream shoot them up: score of the evening nice 1/RWStream 0.
If writing with a WriteStream just works, why summon the devil?

=============== Diff against Graphics-nice.296 ===============

Item was changed:
  ----- Method: Bitmap>>compressGZip (in category 'filing') -----
  compressGZip
  | ba hackwa hackba blt rowsAtATime sourceOrigin rowsRemaining bufferStream gZipStream |
 
  "just hacking around to see if further compression would help Nebraska"
 
+ bufferStream := WriteStream on: (ByteArray new: 5000).
- bufferStream := RWBinaryOrTextStream on: (ByteArray new: 5000).
  gZipStream := GZipWriteStream on: bufferStream.
 
  ba := nil.
  rowsAtATime := 20000. "or 80000 bytes"
  hackwa := Form new hackBits: self.
  sourceOrigin := 0@0.
  [(rowsRemaining := hackwa height - sourceOrigin y) > 0] whileTrue: [
  rowsAtATime := rowsAtATime min: rowsRemaining.
  (ba isNil or: [ba size ~= (rowsAtATime * 4)]) ifTrue: [
  ba := ByteArray new: rowsAtATime * 4.
  hackba := Form new hackBits: ba.
  blt := (BitBlt toForm: hackba) sourceForm: hackwa.
  ].
  blt
  combinationRule: Form over;
  sourceOrigin: sourceOrigin;
  destX: 0 destY: 0 width: 4 height: rowsAtATime;
  copyBits.
  "bufferStream nextPutAll: ba."
  sourceOrigin := sourceOrigin x @ (sourceOrigin y + rowsAtATime).
  ].
  gZipStream close.
  ^bufferStream contents
  !