Depth24Image.st
changeset 8197 ac41cb09e3f6
parent 8170 baac5c2583e6
child 8325 4b86cb61f568
--- a/Depth24Image.st	Thu Oct 12 16:49:58 2017 +0200
+++ b/Depth24Image.st	Thu Oct 12 16:50:03 2017 +0200
@@ -163,19 +163,21 @@
      && __bothSmallInteger(x, y)
      && __bothSmallInteger(w, aPixelValue)
      && (__INST(pixelFunction)==nil) ) {
-	int _idx;
-
-	_idx = ((__intVal(w) * __intVal(y)) + __intVal(x))*3;
-	if (((unsigned)(_idx+2)) < __byteArraySize(b)) {
-	    unsigned char *pPix = &(__ByteArrayInstPtr(b)->ba_element[_idx]);
-	    unsigned int _pix = __intVal(aPixelValue);
-	    pPix[0] = (_pix>>16) & 0xFF;
-	    pPix[1] = (_pix>>8) & 0xFF;
-	    pPix[2] = (_pix) & 0xFF;
-	    RETURN( self );
-	}
+        int _idx;
+
+        _idx = ((__intVal(w) * __intVal(y)) + __intVal(x))*3;
+        if (((unsigned)(_idx+2)) < __byteArraySize(b)) {
+            unsigned char *pPix = &(__ByteArrayInstPtr(b)->ba_element[_idx]);
+            unsigned int _pix = __intVal(aPixelValue);
+            pPix[0] = (_pix>>16) & 0xFF;
+            pPix[1] = (_pix>>8) & 0xFF;
+            pPix[2] = (_pix) & 0xFF;
+            RETURN( self );
+        }
     }
 %}.
+    bytes isNil ifTrue:[ self createPixelStore ].
+
     index := 1 + (((width * y) + x) * 3).
     val := aPixelValue.
     bytes at:(index + 2) put:(val bitAnd:16rFF).