Sha256: 36b0189ea3bf9427a7e53f9d2bc7c220b5c09f0d2a3e7ccda900f3c18c4211ff
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
#include "psd_native_ext.h" VALUE psd_native_decode_rle_channel(VALUE self) { //int bytes, len, val; // TODO(MG): val must not be an integer VALUE val; int bytes, len; int i, j, k, l; int height = FIX2INT(rb_funcall(self, rb_intern("height"), 0)); VALUE channel_data = rb_iv_get(self, "@channel_data"); VALUE* byte_counts = RARRAY_PTR(rb_iv_get(self, "@byte_counts")); int line_index = FIX2INT(rb_iv_get(self, "@line_index")); int chan_pos = FIX2INT(rb_iv_get(self, "@chan_pos")); VALUE byte_data; for (i = 0; i < height; i++) { bytes = FIX2INT(byte_counts[line_index + i]); for (j = 0; j < bytes;) { len = FIX2INT(psd_file_read_byte(self)); j++; if (len < 128) { len++; l = 0; byte_data = psd_file_read_bytes(self, len); for (k = chan_pos; k < chan_pos + len; k++) { rb_ary_store(channel_data, k, rb_ary_entry(byte_data, l++)); } chan_pos += len; j += len; } else if (len > 128) { len ^= 0xff; len += 2; val = psd_file_read_byte(self); for (k = chan_pos; k < chan_pos + len; k++) { rb_ary_store(channel_data, k, val); } chan_pos += len; j++; } } } rb_iv_set(self, "@chan_pos", INT2FIX(chan_pos)); return Qnil; }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bench9000-0.1 | vendor/psd_native/ext/psd_native/rle_decoding.c |