# HG changeset patch # User Claus Gittinger # Date 1202302015 -3600 # Node ID 6530518443827182938801690c3be8f6bae2fc0d # Parent 9bed66cb8c21777245c8686cd35d72dc63b93abb *** empty log message *** diff -r 9bed66cb8c21 -r 653051844382 Depth4Image.st --- a/Depth4Image.st Tue Feb 05 21:02:33 2008 +0100 +++ b/Depth4Image.st Wed Feb 06 13:46:55 2008 +0100 @@ -77,12 +77,17 @@ x = width-1, y=height-1 for lower right pixel" |lineIndex "{ Class: SmallInteger }" + byteIndex "{ Class: SmallInteger }" byte "{ Class: SmallInteger }" | lineIndex := (self bytesPerRow * y) + 1. + byteIndex := lineIndex + (x // 2). "left pixel in high bits" - byte := bytes at:(lineIndex + (x // 2)). + byteIndex > bytes size ifTrue:[ + ^ 0 + ]. + byte := bytes at:byteIndex. x even ifTrue:[ ^ (byte bitShift:-4) bitAnd:16rF. ]. @@ -792,9 +797,11 @@ value "{ Class: SmallInteger }" x1 "{ Class: SmallInteger }" x2 "{ Class: SmallInteger }" + byteSize "{ Class: SmallInteger }" colorArray bytes| bytes := self bits. + byteSize := bytes size. colorArray := ((0 to:15) collect:[:i | self colorFromValue:i]) asArray. x1 := xLow. @@ -815,7 +822,11 @@ shift := -4. srcIndex := srcIndex + 1. ] ifFalse:[ - byte := bytes at:srcIndex. + srcIndex > byteSize ifTrue:[ + byte := 0. + ] ifFalse:[ + byte := bytes at:srcIndex. + ]. value := (byte bitShift:-4) bitAnd:16rF. shift := 0 ]. @@ -1036,5 +1047,5 @@ !Depth4Image class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/Depth4Image.st,v 1.49 2007-05-29 17:20:06 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview/Depth4Image.st,v 1.50 2008-02-06 12:46:55 cg Exp $' ! !