diff options
Diffstat (limited to 'src/page.c')
-rw-r--r-- | src/page.c | 1896 |
1 files changed, 1401 insertions, 495 deletions
@@ -1,4 +1,4 @@ -/* page.c generated by valac 0.13.1, the Vala compiler +/* page.c generated by valac 0.13.4, the Vala compiler * generated from page.vala, do not modify */ /* @@ -280,21 +280,39 @@ GType scan_direction_get_type (void) { Page* page_construct (GType object_type, gint width, gint height, gint dpi, ScanDirection scan_direction) { Page* self = NULL; gboolean _tmp0_ = FALSE; + ScanDirection _tmp1_; + gboolean _tmp3_; + gint _tmp8_; + ScanDirection _tmp9_; self = (Page*) g_type_create_instance (object_type); - if (scan_direction == SCAN_DIRECTION_TOP_TO_BOTTOM) { + _tmp1_ = scan_direction; + if (_tmp1_ == SCAN_DIRECTION_TOP_TO_BOTTOM) { _tmp0_ = TRUE; } else { - _tmp0_ = scan_direction == SCAN_DIRECTION_BOTTOM_TO_TOP; + ScanDirection _tmp2_; + _tmp2_ = scan_direction; + _tmp0_ = _tmp2_ == SCAN_DIRECTION_BOTTOM_TO_TOP; } - if (_tmp0_) { - self->priv->width = width; - self->priv->n_rows = height; + _tmp3_ = _tmp0_; + if (_tmp3_) { + gint _tmp4_; + gint _tmp5_; + _tmp4_ = width; + self->priv->width = _tmp4_; + _tmp5_ = height; + self->priv->n_rows = _tmp5_; } else { - self->priv->width = height; - self->priv->n_rows = width; - } - self->priv->dpi = dpi; - self->priv->scan_direction = scan_direction; + gint _tmp6_; + gint _tmp7_; + _tmp6_ = height; + self->priv->width = _tmp6_; + _tmp7_ = width; + self->priv->n_rows = _tmp7_; + } + _tmp8_ = dpi; + self->priv->dpi = _tmp8_; + _tmp9_ = scan_direction; + self->priv->scan_direction = _tmp9_; return self; } @@ -305,29 +323,89 @@ Page* page_new (gint width, gint height, gint dpi, ScanDirection scan_direction) void page_set_page_info (Page* self, ScanPageInfo* info) { - gint _tmp0_; + ScanPageInfo* _tmp0_; + gint _tmp1_; + ScanPageInfo* _tmp2_; + gdouble _tmp3_; + ScanPageInfo* _tmp4_; + gint _tmp5_; + ScanPageInfo* _tmp6_; + gint _tmp7_; + gint _tmp8_; + ScanPageInfo* _tmp10_; + gint _tmp11_; + ScanPageInfo* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gint _tmp15_; + gint _tmp16_; + gint _tmp17_; + gint _tmp18_; + gint _tmp19_ = 0; + guchar* _tmp20_; + gint _tmp20__length1; + gint _tmp21_; g_return_if_fail (self != NULL); g_return_if_fail (info != NULL); - self->priv->expected_rows = info->height; - self->priv->dpi = (gint) info->dpi; - self->priv->width = info->width; - self->priv->n_rows = info->height; - if (self->priv->n_rows < 0) { - self->priv->n_rows = self->priv->width / 2; - } - self->priv->depth = info->depth; - self->priv->n_channels = info->n_channels; - self->priv->rowstride = (((self->priv->width * self->priv->depth) * self->priv->n_channels) + 7) / 8; - _tmp0_ = self->priv->n_rows * self->priv->rowstride; - self->priv->pixels = g_renew (guchar, self->priv->pixels, self->priv->n_rows * self->priv->rowstride); - (_tmp0_ > self->priv->pixels_length1) ? memset (self->priv->pixels + self->priv->pixels_length1, 0, sizeof (guchar) * (_tmp0_ - self->priv->pixels_length1)) : NULL; - self->priv->pixels_length1 = _tmp0_; - self->priv->_pixels_size_ = _tmp0_; - g_return_if_fail (self->priv->pixels != NULL); - if (self->priv->depth == 1) { - memset (self->priv->pixels, 0x00, (gsize) (self->priv->n_rows * self->priv->rowstride)); + _tmp0_ = info; + _tmp1_ = _tmp0_->height; + self->priv->expected_rows = _tmp1_; + _tmp2_ = info; + _tmp3_ = _tmp2_->dpi; + self->priv->dpi = (gint) _tmp3_; + _tmp4_ = info; + _tmp5_ = _tmp4_->width; + self->priv->width = _tmp5_; + _tmp6_ = info; + _tmp7_ = _tmp6_->height; + self->priv->n_rows = _tmp7_; + _tmp8_ = self->priv->n_rows; + if (_tmp8_ < 0) { + gint _tmp9_; + _tmp9_ = self->priv->width; + self->priv->n_rows = _tmp9_ / 2; + } + _tmp10_ = info; + _tmp11_ = _tmp10_->depth; + self->priv->depth = _tmp11_; + _tmp12_ = info; + _tmp13_ = _tmp12_->n_channels; + self->priv->n_channels = _tmp13_; + _tmp14_ = self->priv->width; + _tmp15_ = self->priv->depth; + _tmp16_ = self->priv->n_channels; + self->priv->rowstride = (((_tmp14_ * _tmp15_) * _tmp16_) + 7) / 8; + _tmp17_ = self->priv->n_rows; + _tmp18_ = self->priv->rowstride; + _tmp19_ = _tmp17_ * _tmp18_; + self->priv->pixels = g_renew (guchar, self->priv->pixels, _tmp17_ * _tmp18_); + (_tmp19_ > self->priv->pixels_length1) ? memset (self->priv->pixels + self->priv->pixels_length1, 0, sizeof (guchar) * (_tmp19_ - self->priv->pixels_length1)) : NULL; + self->priv->pixels_length1 = _tmp19_; + self->priv->_pixels_size_ = _tmp19_; + _tmp20_ = self->priv->pixels; + _tmp20__length1 = self->priv->pixels_length1; + g_return_if_fail (_tmp20_ != NULL); + _tmp21_ = self->priv->depth; + if (_tmp21_ == 1) { + guchar* _tmp22_; + gint _tmp22__length1; + gint _tmp23_; + gint _tmp24_; + _tmp22_ = self->priv->pixels; + _tmp22__length1 = self->priv->pixels_length1; + _tmp23_ = self->priv->n_rows; + _tmp24_ = self->priv->rowstride; + memset (_tmp22_, 0x00, (gsize) (_tmp23_ * _tmp24_)); } else { - memset (self->priv->pixels, 0xFF, (gsize) (self->priv->n_rows * self->priv->rowstride)); + guchar* _tmp25_; + gint _tmp25__length1; + gint _tmp26_; + gint _tmp27_; + _tmp25_ = self->priv->pixels; + _tmp25__length1 = self->priv->pixels_length1; + _tmp26_ = self->priv->n_rows; + _tmp27_ = self->priv->rowstride; + memset (_tmp25_, 0xFF, (gsize) (_tmp26_ * _tmp27_)); } g_signal_emit_by_name (self, "size-changed"); g_signal_emit_by_name (self, "pixels-changed"); @@ -343,92 +421,167 @@ void page_start (Page* self) { gboolean page_is_scanning (Page* self) { gboolean result = FALSE; + gboolean _tmp0_; g_return_val_if_fail (self != NULL, FALSE); - result = self->priv->scanning; + _tmp0_ = self->priv->scanning; + result = _tmp0_; return result; } gboolean page_has_data (Page* self) { gboolean result = FALSE; + gboolean _tmp0_; g_return_val_if_fail (self != NULL, FALSE); - result = self->priv->has_data_; + _tmp0_ = self->priv->has_data_; + result = _tmp0_; return result; } gboolean page_is_color (Page* self) { gboolean result = FALSE; + gint _tmp0_; g_return_val_if_fail (self != NULL, FALSE); - result = self->priv->n_channels > 1; + _tmp0_ = self->priv->n_channels; + result = _tmp0_ > 1; return result; } gint page_get_scan_line (Page* self) { gint result = 0; + gint _tmp0_; g_return_val_if_fail (self != NULL, 0); - result = self->priv->scan_line; + _tmp0_ = self->priv->scan_line; + result = _tmp0_; return result; } static void page_parse_line (Page* self, ScanLine* line, gint n, gboolean* size_changed) { - gboolean _size_changed = FALSE; + gboolean _vala_size_changed = FALSE; gint line_number = 0; + ScanLine* _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp13_; + gint _tmp14_; gint offset; + gint _tmp15_; + ScanLine* _tmp16_; + gint _tmp17_; gint line_offset; + gint _tmp33_; g_return_if_fail (self != NULL); g_return_if_fail (line != NULL); - line_number = line->number + n; - _size_changed = FALSE; + _tmp0_ = line; + _tmp1_ = _tmp0_->number; + _tmp2_ = n; + line_number = _tmp1_ + _tmp2_; + _vala_size_changed = FALSE; while (TRUE) { - gint _tmp0_; + gint _tmp3_; + gint _tmp4_ = 0; gint rows = 0; - gint _tmp1_; - _tmp0_ = page_get_scan_height (self); - if (!(line_number >= _tmp0_)) { + gint _tmp5_; + gint _tmp6_; + gint _tmp7_; + gint _tmp8_; + gint _tmp9_; + gint _tmp10_; + gint _tmp11_; + gint _tmp12_ = 0; + _tmp3_ = line_number; + _tmp4_ = page_get_scan_height (self); + if (!(_tmp3_ >= _tmp4_)) { break; } - rows = self->priv->n_rows; - self->priv->n_rows = rows + (self->priv->width / 2); - g_debug ("page.vala:151: Extending image from %d lines to %d lines", rows, self->priv->n_rows); - _tmp1_ = self->priv->n_rows * self->priv->rowstride; - self->priv->pixels = g_renew (guchar, self->priv->pixels, self->priv->n_rows * self->priv->rowstride); - (_tmp1_ > self->priv->pixels_length1) ? memset (self->priv->pixels + self->priv->pixels_length1, 0, sizeof (guchar) * (_tmp1_ - self->priv->pixels_length1)) : NULL; - self->priv->pixels_length1 = _tmp1_; - self->priv->_pixels_size_ = _tmp1_; - _size_changed = TRUE; - } - offset = line_number * self->priv->rowstride; - line_offset = n * line->data_length; + _tmp5_ = self->priv->n_rows; + rows = _tmp5_; + _tmp6_ = rows; + _tmp7_ = self->priv->width; + self->priv->n_rows = _tmp6_ + (_tmp7_ / 2); + _tmp8_ = rows; + _tmp9_ = self->priv->n_rows; + g_debug ("page.vala:151: Extending image from %d lines to %d lines", _tmp8_, _tmp9_); + _tmp10_ = self->priv->n_rows; + _tmp11_ = self->priv->rowstride; + _tmp12_ = _tmp10_ * _tmp11_; + self->priv->pixels = g_renew (guchar, self->priv->pixels, _tmp10_ * _tmp11_); + (_tmp12_ > self->priv->pixels_length1) ? memset (self->priv->pixels + self->priv->pixels_length1, 0, sizeof (guchar) * (_tmp12_ - self->priv->pixels_length1)) : NULL; + self->priv->pixels_length1 = _tmp12_; + self->priv->_pixels_size_ = _tmp12_; + _vala_size_changed = TRUE; + } + _tmp13_ = line_number; + _tmp14_ = self->priv->rowstride; + offset = _tmp13_ * _tmp14_; + _tmp15_ = n; + _tmp16_ = line; + _tmp17_ = _tmp16_->data_length; + line_offset = _tmp15_ * _tmp17_; { gint i; i = 0; { - gboolean _tmp2_; - _tmp2_ = TRUE; + gboolean _tmp18_; + _tmp18_ = TRUE; while (TRUE) { - if (!_tmp2_) { - i++; + gboolean _tmp19_; + gint _tmp21_; + ScanLine* _tmp22_; + gint _tmp23_; + guchar* _tmp24_; + gint _tmp24__length1; + gint _tmp25_; + gint _tmp26_; + ScanLine* _tmp27_; + guchar* _tmp28_; + gint _tmp28__length1; + gint _tmp29_; + gint _tmp30_; + guchar _tmp31_; + guchar _tmp32_; + _tmp19_ = _tmp18_; + if (!_tmp19_) { + gint _tmp20_; + _tmp20_ = i; + i = _tmp20_ + 1; } - _tmp2_ = FALSE; - if (!(i < line->data_length)) { + _tmp18_ = FALSE; + _tmp21_ = i; + _tmp22_ = line; + _tmp23_ = _tmp22_->data_length; + if (!(_tmp21_ < _tmp23_)) { break; } - self->priv->pixels[offset + i] = line->data[line_offset + i]; + _tmp24_ = self->priv->pixels; + _tmp24__length1 = self->priv->pixels_length1; + _tmp25_ = offset; + _tmp26_ = i; + _tmp27_ = line; + _tmp28_ = _tmp27_->data; + _tmp28__length1 = _tmp27_->data_length1; + _tmp29_ = line_offset; + _tmp30_ = i; + _tmp31_ = _tmp28_[_tmp29_ + _tmp30_]; + _tmp24_[_tmp25_ + _tmp26_] = _tmp31_; + _tmp32_ = _tmp24_[_tmp25_ + _tmp26_]; } } } - self->priv->scan_line = line_number; + _tmp33_ = line_number; + self->priv->scan_line = _tmp33_; if (size_changed) { - *size_changed = _size_changed; + *size_changed = _vala_size_changed; } } void page_parse_scan_line (Page* self, ScanLine* line) { gboolean size_has_changed; + gboolean _tmp9_; g_return_if_fail (self != NULL); g_return_if_fail (line != NULL); size_has_changed = FALSE; @@ -440,20 +593,35 @@ void page_parse_scan_line (Page* self, ScanLine* line) { _tmp0_ = TRUE; while (TRUE) { gboolean _tmp1_; - if (!_tmp0_) { - i++; + gint _tmp3_; + ScanLine* _tmp4_; + gint _tmp5_; + ScanLine* _tmp6_; + gint _tmp7_; + gboolean _tmp8_ = FALSE; + _tmp1_ = _tmp0_; + if (!_tmp1_) { + gint _tmp2_; + _tmp2_ = i; + i = _tmp2_ + 1; } _tmp0_ = FALSE; - if (!(i < line->n_lines)) { + _tmp3_ = i; + _tmp4_ = line; + _tmp5_ = _tmp4_->n_lines; + if (!(_tmp3_ < _tmp5_)) { break; } - page_parse_line (self, line, i, &_tmp1_); - size_has_changed = _tmp1_; + _tmp6_ = line; + _tmp7_ = i; + page_parse_line (self, _tmp6_, _tmp7_, &_tmp8_); + size_has_changed = _tmp8_; } } } self->priv->has_data_ = TRUE; - if (size_has_changed) { + _tmp9_ = size_has_changed; + if (_tmp9_) { g_signal_emit_by_name (self, "size-changed"); } g_signal_emit_by_name (self, "scan-line-changed"); @@ -464,30 +632,50 @@ void page_parse_scan_line (Page* self, ScanLine* line) { void page_finish (Page* self) { gboolean size_has_changed; gboolean _tmp0_ = FALSE; + gint _tmp1_; + gboolean _tmp4_; + gboolean _tmp12_; g_return_if_fail (self != NULL); size_has_changed = FALSE; - if (self->priv->expected_rows < 0) { - gint _tmp1_; - _tmp1_ = page_get_scan_height (self); - _tmp0_ = self->priv->scan_line != _tmp1_; + _tmp1_ = self->priv->expected_rows; + if (_tmp1_ < 0) { + gint _tmp2_; + gint _tmp3_ = 0; + _tmp2_ = self->priv->scan_line; + _tmp3_ = page_get_scan_height (self); + _tmp0_ = _tmp2_ != _tmp3_; } else { _tmp0_ = FALSE; } - if (_tmp0_) { + _tmp4_ = _tmp0_; + if (_tmp4_) { gint rows = 0; - gint _tmp2_; - rows = self->priv->n_rows; - self->priv->n_rows = self->priv->scan_line; - _tmp2_ = self->priv->n_rows * self->priv->rowstride; - self->priv->pixels = g_renew (guchar, self->priv->pixels, self->priv->n_rows * self->priv->rowstride); - (_tmp2_ > self->priv->pixels_length1) ? memset (self->priv->pixels + self->priv->pixels_length1, 0, sizeof (guchar) * (_tmp2_ - self->priv->pixels_length1)) : NULL; - self->priv->pixels_length1 = _tmp2_; - self->priv->_pixels_size_ = _tmp2_; - g_debug ("page.vala:193: Trimming page from %d lines to %d lines", rows, self->priv->n_rows); + gint _tmp5_; + gint _tmp6_; + gint _tmp7_; + gint _tmp8_; + gint _tmp9_ = 0; + gint _tmp10_; + gint _tmp11_; + _tmp5_ = self->priv->n_rows; + rows = _tmp5_; + _tmp6_ = self->priv->scan_line; + self->priv->n_rows = _tmp6_; + _tmp7_ = self->priv->n_rows; + _tmp8_ = self->priv->rowstride; + _tmp9_ = _tmp7_ * _tmp8_; + self->priv->pixels = g_renew (guchar, self->priv->pixels, _tmp7_ * _tmp8_); + (_tmp9_ > self->priv->pixels_length1) ? memset (self->priv->pixels + self->priv->pixels_length1, 0, sizeof (guchar) * (_tmp9_ - self->priv->pixels_length1)) : NULL; + self->priv->pixels_length1 = _tmp9_; + self->priv->_pixels_size_ = _tmp9_; + _tmp10_ = rows; + _tmp11_ = self->priv->n_rows; + g_debug ("page.vala:193: Trimming page from %d lines to %d lines", _tmp10_, _tmp11_); size_has_changed = TRUE; } self->priv->scanning = FALSE; - if (size_has_changed) { + _tmp12_ = size_has_changed; + if (_tmp12_) { g_signal_emit_by_name (self, "size-changed"); } g_signal_emit_by_name (self, "scan-line-changed"); @@ -496,8 +684,10 @@ void page_finish (Page* self) { ScanDirection page_get_scan_direction (Page* self) { ScanDirection result = 0; + ScanDirection _tmp0_; g_return_val_if_fail (self != NULL, 0); - result = self->priv->scan_direction; + _tmp0_ = self->priv->scan_direction; + result = _tmp0_; return result; } @@ -508,72 +698,145 @@ static void page_set_scan_direction (Page* self, ScanDirection direction) { gboolean size_has_changed; gint width = 0; gint height = 0; - gint _tmp0_; - gint _tmp1_; + ScanDirection _tmp0_; + ScanDirection _tmp1_; + ScanDirection _tmp2_; + ScanDirection _tmp3_; + gint _tmp4_; + gint _tmp6_; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + gboolean _tmp9_; + ScanDirection _tmp33_; + gboolean _tmp34_; + gboolean _tmp35_; g_return_if_fail (self != NULL); size_has_changed = FALSE; - if (self->priv->scan_direction == direction) { + _tmp0_ = self->priv->scan_direction; + _tmp1_ = direction; + if (_tmp0_ == _tmp1_) { return; } - left_steps = (gint) (direction - self->priv->scan_direction); - if (left_steps < 0) { - left_steps = left_steps + 4; + _tmp2_ = direction; + _tmp3_ = self->priv->scan_direction; + left_steps = (gint) (_tmp2_ - _tmp3_); + _tmp4_ = left_steps; + if (_tmp4_ < 0) { + gint _tmp5_; + _tmp5_ = left_steps; + left_steps = _tmp5_ + 4; } - if (left_steps != 2) { + _tmp6_ = left_steps; + if (_tmp6_ != 2) { size_has_changed = TRUE; } - _tmp0_ = page_get_width (self); - width = _tmp0_; - _tmp1_ = page_get_height (self); - height = _tmp1_; - if (self->priv->has_crop_) { - switch (left_steps) { + _tmp7_ = page_get_width (self); + width = _tmp7_; + _tmp8_ = page_get_height (self); + height = _tmp8_; + _tmp9_ = self->priv->has_crop_; + if (_tmp9_) { + gint _tmp10_; + _tmp10_ = left_steps; + switch (_tmp10_) { case 1: { - t = self->priv->crop_x; - self->priv->crop_x = self->priv->crop_y; - self->priv->crop_y = width - (t + self->priv->crop_width); - t = self->priv->crop_width; - self->priv->crop_width = self->priv->crop_height; - self->priv->crop_height = t; + gint _tmp11_; + gint _tmp12_; + gint _tmp13_; + gint _tmp14_; + gint _tmp15_; + gint _tmp16_; + gint _tmp17_; + gint _tmp18_; + _tmp11_ = self->priv->crop_x; + t = _tmp11_; + _tmp12_ = self->priv->crop_y; + self->priv->crop_x = _tmp12_; + _tmp13_ = width; + _tmp14_ = t; + _tmp15_ = self->priv->crop_width; + self->priv->crop_y = _tmp13_ - (_tmp14_ + _tmp15_); + _tmp16_ = self->priv->crop_width; + t = _tmp16_; + _tmp17_ = self->priv->crop_height; + self->priv->crop_width = _tmp17_; + _tmp18_ = t; + self->priv->crop_height = _tmp18_; break; } case 2: { - self->priv->crop_x = width - (self->priv->crop_x + self->priv->crop_width); - self->priv->crop_y = width - (self->priv->crop_y + self->priv->crop_height); + gint _tmp19_; + gint _tmp20_; + gint _tmp21_; + gint _tmp22_; + gint _tmp23_; + gint _tmp24_; + _tmp19_ = width; + _tmp20_ = self->priv->crop_x; + _tmp21_ = self->priv->crop_width; + self->priv->crop_x = _tmp19_ - (_tmp20_ + _tmp21_); + _tmp22_ = width; + _tmp23_ = self->priv->crop_y; + _tmp24_ = self->priv->crop_height; + self->priv->crop_y = _tmp22_ - (_tmp23_ + _tmp24_); break; } case 3: { - t = self->priv->crop_y; - self->priv->crop_y = self->priv->crop_x; - self->priv->crop_x = height - (t + self->priv->crop_height); - t = self->priv->crop_width; - self->priv->crop_width = self->priv->crop_height; - self->priv->crop_height = t; + gint _tmp25_; + gint _tmp26_; + gint _tmp27_; + gint _tmp28_; + gint _tmp29_; + gint _tmp30_; + gint _tmp31_; + gint _tmp32_; + _tmp25_ = self->priv->crop_y; + t = _tmp25_; + _tmp26_ = self->priv->crop_x; + self->priv->crop_y = _tmp26_; + _tmp27_ = height; + _tmp28_ = t; + _tmp29_ = self->priv->crop_height; + self->priv->crop_x = _tmp27_ - (_tmp28_ + _tmp29_); + _tmp30_ = self->priv->crop_width; + t = _tmp30_; + _tmp31_ = self->priv->crop_height; + self->priv->crop_width = _tmp31_; + _tmp32_ = t; + self->priv->crop_height = _tmp32_; break; } default: break; } } - self->priv->scan_direction = direction; - if (size_has_changed) { + _tmp33_ = direction; + self->priv->scan_direction = _tmp33_; + _tmp34_ = size_has_changed; + if (_tmp34_) { g_signal_emit_by_name (self, "size-changed"); } g_signal_emit_by_name (self, "scan-direction-changed"); - if (self->priv->has_crop_) { + _tmp35_ = self->priv->has_crop_; + if (_tmp35_) { g_signal_emit_by_name (self, "crop-changed"); } } void page_rotate_left (Page* self) { + ScanDirection _tmp0_; ScanDirection direction; + ScanDirection _tmp1_; + ScanDirection _tmp2_; g_return_if_fail (self != NULL); - direction = self->priv->scan_direction; - switch (direction) { + _tmp0_ = self->priv->scan_direction; + direction = _tmp0_; + _tmp1_ = direction; + switch (_tmp1_) { case SCAN_DIRECTION_TOP_TO_BOTTOM: { direction = SCAN_DIRECTION_LEFT_TO_RIGHT; @@ -597,15 +860,21 @@ void page_rotate_left (Page* self) { default: break; } - page_set_scan_direction (self, direction); + _tmp2_ = direction; + page_set_scan_direction (self, _tmp2_); } void page_rotate_right (Page* self) { + ScanDirection _tmp0_; ScanDirection direction; + ScanDirection _tmp1_; + ScanDirection _tmp2_; g_return_if_fail (self != NULL); - direction = self->priv->scan_direction; - switch (direction) { + _tmp0_ = self->priv->scan_direction; + direction = _tmp0_; + _tmp1_ = direction; + switch (_tmp1_) { case SCAN_DIRECTION_TOP_TO_BOTTOM: { direction = SCAN_DIRECTION_RIGHT_TO_LEFT; @@ -629,22 +898,25 @@ void page_rotate_right (Page* self) { default: break; } - page_set_scan_direction (self, direction); + _tmp2_ = direction; + page_set_scan_direction (self, _tmp2_); } gint page_get_dpi (Page* self) { gint result = 0; + gint _tmp0_; g_return_val_if_fail (self != NULL, 0); - result = self->priv->dpi; + _tmp0_ = self->priv->dpi; + result = _tmp0_; return result; } gboolean page_is_landscape (Page* self) { gboolean result = FALSE; - gint _tmp0_; - gint _tmp1_; + gint _tmp0_ = 0; + gint _tmp1_ = 0; g_return_val_if_fail (self != NULL, FALSE); _tmp0_ = page_get_width (self); _tmp1_ = page_get_height (self); @@ -656,17 +928,27 @@ gboolean page_is_landscape (Page* self) { gint page_get_width (Page* self) { gint result = 0; gboolean _tmp0_ = FALSE; + ScanDirection _tmp1_; + gboolean _tmp3_; g_return_val_if_fail (self != NULL, 0); - if (self->priv->scan_direction == SCAN_DIRECTION_TOP_TO_BOTTOM) { + _tmp1_ = self->priv->scan_direction; + if (_tmp1_ == SCAN_DIRECTION_TOP_TO_BOTTOM) { _tmp0_ = TRUE; } else { - _tmp0_ = self->priv->scan_direction == SCAN_DIRECTION_BOTTOM_TO_TOP; - } - if (_tmp0_) { - result = self->priv->width; + ScanDirection _tmp2_; + _tmp2_ = self->priv->scan_direction; + _tmp0_ = _tmp2_ == SCAN_DIRECTION_BOTTOM_TO_TOP; + } + _tmp3_ = _tmp0_; + if (_tmp3_) { + gint _tmp4_; + _tmp4_ = self->priv->width; + result = _tmp4_; return result; } else { - result = self->priv->n_rows; + gint _tmp5_; + _tmp5_ = self->priv->n_rows; + result = _tmp5_; return result; } } @@ -675,17 +957,27 @@ gint page_get_width (Page* self) { gint page_get_height (Page* self) { gint result = 0; gboolean _tmp0_ = FALSE; + ScanDirection _tmp1_; + gboolean _tmp3_; g_return_val_if_fail (self != NULL, 0); - if (self->priv->scan_direction == SCAN_DIRECTION_TOP_TO_BOTTOM) { + _tmp1_ = self->priv->scan_direction; + if (_tmp1_ == SCAN_DIRECTION_TOP_TO_BOTTOM) { _tmp0_ = TRUE; } else { - _tmp0_ = self->priv->scan_direction == SCAN_DIRECTION_BOTTOM_TO_TOP; - } - if (_tmp0_) { - result = self->priv->n_rows; + ScanDirection _tmp2_; + _tmp2_ = self->priv->scan_direction; + _tmp0_ = _tmp2_ == SCAN_DIRECTION_BOTTOM_TO_TOP; + } + _tmp3_ = _tmp0_; + if (_tmp3_) { + gint _tmp4_; + _tmp4_ = self->priv->n_rows; + result = _tmp4_; return result; } else { - result = self->priv->width; + gint _tmp5_; + _tmp5_ = self->priv->width; + result = _tmp5_; return result; } } @@ -693,66 +985,82 @@ gint page_get_height (Page* self) { gint page_get_depth (Page* self) { gint result = 0; + gint _tmp0_; g_return_val_if_fail (self != NULL, 0); - result = self->priv->depth; + _tmp0_ = self->priv->depth; + result = _tmp0_; return result; } gint page_get_n_channels (Page* self) { gint result = 0; + gint _tmp0_; g_return_val_if_fail (self != NULL, 0); - result = self->priv->n_channels; + _tmp0_ = self->priv->n_channels; + result = _tmp0_; return result; } gint page_get_rowstride (Page* self) { gint result = 0; + gint _tmp0_; g_return_val_if_fail (self != NULL, 0); - result = self->priv->rowstride; + _tmp0_ = self->priv->rowstride; + result = _tmp0_; return result; } gint page_get_scan_width (Page* self) { gint result = 0; + gint _tmp0_; g_return_val_if_fail (self != NULL, 0); - result = self->priv->width; + _tmp0_ = self->priv->width; + result = _tmp0_; return result; } gint page_get_scan_height (Page* self) { gint result = 0; + gint _tmp0_; g_return_val_if_fail (self != NULL, 0); - result = self->priv->n_rows; + _tmp0_ = self->priv->n_rows; + result = _tmp0_; return result; } void page_set_color_profile (Page* self, const gchar* color_profile) { - gchar* _tmp0_; + const gchar* _tmp0_; + gchar* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = g_strdup (color_profile); + _tmp0_ = color_profile; + _tmp1_ = g_strdup (_tmp0_); _g_free0 (self->priv->color_profile); - self->priv->color_profile = _tmp0_; + self->priv->color_profile = _tmp1_; } gchar* page_get_color_profile (Page* self) { gchar* result = NULL; - gchar* _tmp0_; + const gchar* _tmp0_; + gchar* _tmp1_; g_return_val_if_fail (self != NULL, NULL); - _tmp0_ = g_strdup (self->priv->color_profile); - result = _tmp0_; + _tmp0_ = self->priv->color_profile; + _tmp1_ = g_strdup (_tmp0_); + result = _tmp1_; return result; } void page_set_no_crop (Page* self) { + gboolean _tmp0_; g_return_if_fail (self != NULL); - if (!self->priv->has_crop_) { + _tmp0_ = self->priv->has_crop_; + if (!_tmp0_) { return; } self->priv->has_crop_ = FALSE; @@ -761,35 +1069,61 @@ void page_set_no_crop (Page* self) { void page_set_custom_crop (Page* self, gint width, gint height) { - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; + gint _tmp0_; + gint _tmp1_; gboolean _tmp2_ = FALSE; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + const gchar* _tmp5_; + gboolean _tmp7_; + gboolean _tmp10_; + gboolean _tmp13_; + gint _tmp14_; + gint _tmp15_; g_return_if_fail (self != NULL); - g_return_if_fail (width >= 1); - g_return_if_fail (height >= 1); - if (self->priv->crop_name == NULL) { - _tmp2_ = self->priv->has_crop_; + _tmp0_ = width; + g_return_if_fail (_tmp0_ >= 1); + _tmp1_ = height; + g_return_if_fail (_tmp1_ >= 1); + _tmp5_ = self->priv->crop_name; + if (_tmp5_ == NULL) { + gboolean _tmp6_; + _tmp6_ = self->priv->has_crop_; + _tmp4_ = _tmp6_; } else { - _tmp2_ = FALSE; + _tmp4_ = FALSE; } - if (_tmp2_) { - _tmp1_ = self->priv->crop_width == width; + _tmp7_ = _tmp4_; + if (_tmp7_) { + gint _tmp8_; + gint _tmp9_; + _tmp8_ = self->priv->crop_width; + _tmp9_ = width; + _tmp3_ = _tmp8_ == _tmp9_; } else { - _tmp1_ = FALSE; - } - if (_tmp1_) { - _tmp0_ = self->priv->crop_height == height; + _tmp3_ = FALSE; + } + _tmp10_ = _tmp3_; + if (_tmp10_) { + gint _tmp11_; + gint _tmp12_; + _tmp11_ = self->priv->crop_height; + _tmp12_ = height; + _tmp2_ = _tmp11_ == _tmp12_; } else { - _tmp0_ = FALSE; + _tmp2_ = FALSE; } - if (_tmp0_) { + _tmp13_ = _tmp2_; + if (_tmp13_) { return; } _g_free0 (self->priv->crop_name); self->priv->crop_name = NULL; self->priv->has_crop_ = TRUE; - self->priv->crop_width = width; - self->priv->crop_height = height; + _tmp14_ = width; + self->priv->crop_width = _tmp14_; + _tmp15_ = height; + self->priv->crop_height = _tmp15_; g_signal_emit_by_name (self, "crop-changed"); } @@ -798,23 +1132,36 @@ void page_set_named_crop (Page* self, const gchar* name) { gdouble width = 0.0; gdouble height = 0.0; const gchar* _tmp0_; - GQuark _tmp1_; - static GQuark _tmp1__label0 = 0; - static GQuark _tmp1__label1 = 0; - static GQuark _tmp1__label2 = 0; - static GQuark _tmp1__label3 = 0; - static GQuark _tmp1__label4 = 0; - static GQuark _tmp1__label5 = 0; - gchar* _tmp2_; - gint _tmp3_; + const gchar* _tmp1_; + GQuark _tmp3_ = 0U; + static GQuark _tmp2_label0 = 0; + static GQuark _tmp2_label1 = 0; + static GQuark _tmp2_label2 = 0; + static GQuark _tmp2_label3 = 0; + static GQuark _tmp2_label4 = 0; + static GQuark _tmp2_label5 = 0; + const gchar* _tmp5_; + gchar* _tmp6_; + gint _tmp7_ = 0; gint pw; - gint _tmp4_; + gint _tmp8_ = 0; gint ph; + gint _tmp9_; + gint _tmp10_; + gdouble _tmp14_; + gint _tmp15_; + gdouble _tmp16_; + gint _tmp17_; + gint _tmp18_; + gint _tmp19_; + gint _tmp22_; + gint _tmp23_; g_return_if_fail (self != NULL); g_return_if_fail (name != NULL); _tmp0_ = name; - _tmp1_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_); - if (_tmp1_ == ((0 != _tmp1__label0) ? _tmp1__label0 : (_tmp1__label0 = g_quark_from_static_string ("A4")))) { + _tmp1_ = _tmp0_; + _tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_); + if (_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("A4")))) { switch (0) { default: { @@ -823,7 +1170,7 @@ void page_set_named_crop (Page* self, const gchar* name) { break; } } - } else if (_tmp1_ == ((0 != _tmp1__label1) ? _tmp1__label1 : (_tmp1__label1 = g_quark_from_static_string ("A5")))) { + } else if (_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("A5")))) { switch (0) { default: { @@ -832,7 +1179,7 @@ void page_set_named_crop (Page* self, const gchar* name) { break; } } - } else if (_tmp1_ == ((0 != _tmp1__label2) ? _tmp1__label2 : (_tmp1__label2 = g_quark_from_static_string ("A6")))) { + } else if (_tmp3_ == ((0 != _tmp2_label2) ? _tmp2_label2 : (_tmp2_label2 = g_quark_from_static_string ("A6")))) { switch (0) { default: { @@ -841,7 +1188,7 @@ void page_set_named_crop (Page* self, const gchar* name) { break; } } - } else if (_tmp1_ == ((0 != _tmp1__label3) ? _tmp1__label3 : (_tmp1__label3 = g_quark_from_static_string ("letter")))) { + } else if (_tmp3_ == ((0 != _tmp2_label3) ? _tmp2_label3 : (_tmp2_label3 = g_quark_from_static_string ("letter")))) { switch (0) { default: { @@ -850,7 +1197,7 @@ void page_set_named_crop (Page* self, const gchar* name) { break; } } - } else if (_tmp1_ == ((0 != _tmp1__label4) ? _tmp1__label4 : (_tmp1__label4 = g_quark_from_static_string ("legal")))) { + } else if (_tmp3_ == ((0 != _tmp2_label4) ? _tmp2_label4 : (_tmp2_label4 = g_quark_from_static_string ("legal")))) { switch (0) { default: { @@ -859,7 +1206,7 @@ void page_set_named_crop (Page* self, const gchar* name) { break; } } - } else if (_tmp1_ == ((0 != _tmp1__label5) ? _tmp1__label5 : (_tmp1__label5 = g_quark_from_static_string ("4x6")))) { + } else if (_tmp3_ == ((0 != _tmp2_label5) ? _tmp2_label5 : (_tmp2_label5 = g_quark_from_static_string ("4x6")))) { switch (0) { default: { @@ -872,34 +1219,61 @@ void page_set_named_crop (Page* self, const gchar* name) { switch (0) { default: { - g_warning ("page.vala:437: Unknown paper size '%s'", name); + const gchar* _tmp4_; + _tmp4_ = name; + g_warning ("page.vala:437: Unknown paper size '%s'", _tmp4_); return; } } } - _tmp2_ = g_strdup (name); + _tmp5_ = name; + _tmp6_ = g_strdup (_tmp5_); _g_free0 (self->priv->crop_name); - self->priv->crop_name = _tmp2_; + self->priv->crop_name = _tmp6_; self->priv->has_crop_ = TRUE; - _tmp3_ = page_get_width (self); - pw = _tmp3_; - _tmp4_ = page_get_height (self); - ph = _tmp4_; - if (pw > ph) { + _tmp7_ = page_get_width (self); + pw = _tmp7_; + _tmp8_ = page_get_height (self); + ph = _tmp8_; + _tmp9_ = pw; + _tmp10_ = ph; + if (_tmp9_ > _tmp10_) { gdouble t = 0.0; - t = width; - width = height; - height = t; - } - self->priv->crop_width = (gint) ((width * self->priv->dpi) + 0.5); - self->priv->crop_height = (gint) ((height * self->priv->dpi) + 0.5); - if (self->priv->crop_width < pw) { - self->priv->crop_x = (pw - self->priv->crop_width) / 2; + gdouble _tmp11_; + gdouble _tmp12_; + gdouble _tmp13_; + _tmp11_ = width; + t = _tmp11_; + _tmp12_ = height; + width = _tmp12_; + _tmp13_ = t; + height = _tmp13_; + } + _tmp14_ = width; + _tmp15_ = self->priv->dpi; + self->priv->crop_width = (gint) ((_tmp14_ * _tmp15_) + 0.5); + _tmp16_ = height; + _tmp17_ = self->priv->dpi; + self->priv->crop_height = (gint) ((_tmp16_ * _tmp17_) + 0.5); + _tmp18_ = self->priv->crop_width; + _tmp19_ = pw; + if (_tmp18_ < _tmp19_) { + gint _tmp20_; + gint _tmp21_; + _tmp20_ = pw; + _tmp21_ = self->priv->crop_width; + self->priv->crop_x = (_tmp20_ - _tmp21_) / 2; } else { self->priv->crop_x = 0; } - if (self->priv->crop_height < ph) { - self->priv->crop_y = (ph - self->priv->crop_height) / 2; + _tmp22_ = self->priv->crop_height; + _tmp23_ = ph; + if (_tmp22_ < _tmp23_) { + gint _tmp24_; + gint _tmp25_; + _tmp24_ = ph; + _tmp25_ = self->priv->crop_height; + self->priv->crop_y = (_tmp24_ - _tmp25_) / 2; } else { self->priv->crop_y = 0; } @@ -910,50 +1284,100 @@ void page_set_named_crop (Page* self, const gchar* name) { void page_move_crop (Page* self, gint x, gint y) { gint _tmp0_; gint _tmp1_; + gint _tmp2_; + gint _tmp3_ = 0; + gint _tmp4_; + gint _tmp5_ = 0; + gint _tmp6_; + gint _tmp7_; g_return_if_fail (self != NULL); - g_return_if_fail (x >= 0); - g_return_if_fail (y >= 0); - _tmp0_ = page_get_width (self); - g_return_if_fail (x < _tmp0_); - _tmp1_ = page_get_height (self); - g_return_if_fail (y < _tmp1_); - self->priv->crop_x = x; - self->priv->crop_y = y; + _tmp0_ = x; + g_return_if_fail (_tmp0_ >= 0); + _tmp1_ = y; + g_return_if_fail (_tmp1_ >= 0); + _tmp2_ = x; + _tmp3_ = page_get_width (self); + g_return_if_fail (_tmp2_ < _tmp3_); + _tmp4_ = y; + _tmp5_ = page_get_height (self); + g_return_if_fail (_tmp4_ < _tmp5_); + _tmp6_ = x; + self->priv->crop_x = _tmp6_; + _tmp7_ = y; + self->priv->crop_y = _tmp7_; g_signal_emit_by_name (self, "crop-changed"); } void page_rotate_crop (Page* self) { gint t = 0; + gboolean _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_; + const gchar* _tmp4_; g_return_if_fail (self != NULL); - if (!self->priv->has_crop_) { + _tmp0_ = self->priv->has_crop_; + if (!_tmp0_) { return; } - t = self->priv->crop_width; - self->priv->crop_width = self->priv->crop_height; - self->priv->crop_height = t; - if (self->priv->crop_name == NULL) { + _tmp1_ = self->priv->crop_width; + t = _tmp1_; + _tmp2_ = self->priv->crop_height; + self->priv->crop_width = _tmp2_; + _tmp3_ = t; + self->priv->crop_height = _tmp3_; + _tmp4_ = self->priv->crop_name; + if (_tmp4_ == NULL) { gint w = 0; gint h = 0; - gint _tmp0_; - gint _tmp1_; - _tmp0_ = page_get_width (self); - w = _tmp0_; - _tmp1_ = page_get_height (self); - h = _tmp1_; - if ((self->priv->crop_x + self->priv->crop_width) > w) { - self->priv->crop_x = w - self->priv->crop_width; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + gint _tmp7_; + gint _tmp8_; + gint _tmp9_; + gint _tmp12_; + gint _tmp14_; + gint _tmp15_; + gint _tmp16_; + gint _tmp19_; + _tmp5_ = page_get_width (self); + w = _tmp5_; + _tmp6_ = page_get_height (self); + h = _tmp6_; + _tmp7_ = self->priv->crop_x; + _tmp8_ = self->priv->crop_width; + _tmp9_ = w; + if ((_tmp7_ + _tmp8_) > _tmp9_) { + gint _tmp10_; + gint _tmp11_; + _tmp10_ = w; + _tmp11_ = self->priv->crop_width; + self->priv->crop_x = _tmp10_ - _tmp11_; } - if (self->priv->crop_x < 0) { + _tmp12_ = self->priv->crop_x; + if (_tmp12_ < 0) { + gint _tmp13_; self->priv->crop_x = 0; - self->priv->crop_width = w; + _tmp13_ = w; + self->priv->crop_width = _tmp13_; } - if ((self->priv->crop_y + self->priv->crop_height) > h) { - self->priv->crop_y = h - self->priv->crop_height; + _tmp14_ = self->priv->crop_y; + _tmp15_ = self->priv->crop_height; + _tmp16_ = h; + if ((_tmp14_ + _tmp15_) > _tmp16_) { + gint _tmp17_; + gint _tmp18_; + _tmp17_ = h; + _tmp18_ = self->priv->crop_height; + self->priv->crop_y = _tmp17_ - _tmp18_; } - if (self->priv->crop_y < 0) { + _tmp19_ = self->priv->crop_y; + if (_tmp19_ < 0) { + gint _tmp20_; self->priv->crop_y = 0; - self->priv->crop_height = h; + _tmp20_ = h; + self->priv->crop_height = _tmp20_; } } g_signal_emit_by_name (self, "crop-changed"); @@ -962,43 +1386,55 @@ void page_rotate_crop (Page* self) { gboolean page_has_crop (Page* self) { gboolean result = FALSE; + gboolean _tmp0_; g_return_val_if_fail (self != NULL, FALSE); - result = self->priv->has_crop_; + _tmp0_ = self->priv->has_crop_; + result = _tmp0_; return result; } void page_get_crop (Page* self, gint* x, gint* y, gint* width, gint* height) { - gint _x = 0; - gint _y = 0; - gint _width = 0; - gint _height = 0; + gint _vala_x = 0; + gint _vala_y = 0; + gint _vala_width = 0; + gint _vala_height = 0; + gint _tmp0_; + gint _tmp1_; + gint _tmp2_; + gint _tmp3_; g_return_if_fail (self != NULL); - _x = self->priv->crop_x; - _y = self->priv->crop_y; - _width = self->priv->crop_width; - _height = self->priv->crop_height; + _tmp0_ = self->priv->crop_x; + _vala_x = _tmp0_; + _tmp1_ = self->priv->crop_y; + _vala_y = _tmp1_; + _tmp2_ = self->priv->crop_width; + _vala_width = _tmp2_; + _tmp3_ = self->priv->crop_height; + _vala_height = _tmp3_; if (x) { - *x = _x; + *x = _vala_x; } if (y) { - *y = _y; + *y = _vala_y; } if (width) { - *width = _width; + *width = _vala_width; } if (height) { - *height = _height; + *height = _vala_height; } } gchar* page_get_named_crop (Page* self) { gchar* result = NULL; - gchar* _tmp0_; + const gchar* _tmp0_; + gchar* _tmp1_; g_return_val_if_fail (self != NULL, NULL); - _tmp0_ = g_strdup (self->priv->crop_name); - result = _tmp0_; + _tmp0_ = self->priv->crop_name; + _tmp1_ = g_strdup (_tmp0_); + result = _tmp1_; return result; } @@ -1006,12 +1442,18 @@ gchar* page_get_named_crop (Page* self) { guchar* page_get_pixels (Page* self, int* result_length1) { guchar* result = NULL; guchar* _tmp0_; + gint _tmp0__length1; + guchar* _tmp1_; + gint _tmp1__length1; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = self->priv->pixels; + _tmp0__length1 = self->priv->pixels_length1; + _tmp1_ = _tmp0_; + _tmp1__length1 = _tmp0__length1; if (result_length1) { - *result_length1 = self->priv->pixels_length1; + *result_length1 = _tmp1__length1; } - result = _tmp0_; + result = _tmp1_; return result; } @@ -1025,17 +1467,50 @@ static guchar page_get_sample (Page* self, guchar* pixels, int pixels_length1, g static void page_get_pixel (Page* self, gint x, gint y, guchar* pixel, int pixel_length1, gint offset) { - ScanDirection _tmp0_; - gint _tmp5_; + ScanDirection _tmp0_ = 0; + gint _tmp13_ = 0; gint depth; - gint _tmp6_; + gint _tmp14_ = 0; gint n_channels; - gint _tmp7_; + gint _tmp15_ = 0; + gint _tmp16_; gint line_offset; - gboolean _tmp8_ = FALSE; - guchar _tmp14_; - guchar _tmp15_; - guchar _tmp16_; + gboolean _tmp17_ = FALSE; + gint _tmp18_; + gboolean _tmp20_; + guchar* _tmp104_; + gint _tmp104__length1; + gint _tmp105_; + guchar* _tmp106_; + gint _tmp106__length1; + gint _tmp107_; + gint _tmp108_; + gint _tmp109_; + gint _tmp110_; + guchar _tmp111_ = '\0'; + guchar _tmp112_; + guchar* _tmp113_; + gint _tmp113__length1; + gint _tmp114_; + guchar* _tmp115_; + gint _tmp115__length1; + gint _tmp116_; + gint _tmp117_; + gint _tmp118_; + gint _tmp119_; + guchar _tmp120_ = '\0'; + guchar _tmp121_; + guchar* _tmp122_; + gint _tmp122__length1; + gint _tmp123_; + guchar* _tmp124_; + gint _tmp124__length1; + gint _tmp125_; + gint _tmp126_; + gint _tmp127_; + gint _tmp128_; + guchar _tmp129_ = '\0'; + guchar _tmp130_; g_return_if_fail (self != NULL); _tmp0_ = page_get_scan_direction (self); switch (_tmp0_) { @@ -1045,123 +1520,366 @@ static void page_get_pixel (Page* self, gint x, gint y, guchar* pixel, int pixel } case SCAN_DIRECTION_BOTTOM_TO_TOP: { - gint _tmp1_; + gint _tmp1_ = 0; gint _tmp2_; + gint _tmp3_ = 0; + gint _tmp4_; _tmp1_ = page_get_scan_width (self); - x = (_tmp1_ - x) - 1; - _tmp2_ = page_get_scan_height (self); - y = (_tmp2_ - y) - 1; + _tmp2_ = x; + x = (_tmp1_ - _tmp2_) - 1; + _tmp3_ = page_get_scan_height (self); + _tmp4_ = y; + y = (_tmp3_ - _tmp4_) - 1; break; } case SCAN_DIRECTION_LEFT_TO_RIGHT: { + gint _tmp5_; gint t; - gint _tmp3_; - t = x; - _tmp3_ = page_get_scan_width (self); - x = (_tmp3_ - y) - 1; - y = t; + gint _tmp6_ = 0; + gint _tmp7_; + gint _tmp8_; + _tmp5_ = x; + t = _tmp5_; + _tmp6_ = page_get_scan_width (self); + _tmp7_ = y; + x = (_tmp6_ - _tmp7_) - 1; + _tmp8_ = t; + y = _tmp8_; break; } case SCAN_DIRECTION_RIGHT_TO_LEFT: { + gint _tmp9_; gint t; - gint _tmp4_; - t = x; - x = y; - _tmp4_ = page_get_scan_height (self); - y = (_tmp4_ - t) - 1; + gint _tmp10_; + gint _tmp11_ = 0; + gint _tmp12_; + _tmp9_ = x; + t = _tmp9_; + _tmp10_ = y; + x = _tmp10_; + _tmp11_ = page_get_scan_height (self); + _tmp12_ = t; + y = (_tmp11_ - _tmp12_) - 1; break; } default: break; } - _tmp5_ = page_get_depth (self); - depth = _tmp5_; - _tmp6_ = page_get_n_channels (self); - n_channels = _tmp6_; - _tmp7_ = page_get_rowstride (self); - line_offset = _tmp7_ * y; - if (depth == 8) { - _tmp8_ = n_channels == 3; + _tmp13_ = page_get_depth (self); + depth = _tmp13_; + _tmp14_ = page_get_n_channels (self); + n_channels = _tmp14_; + _tmp15_ = page_get_rowstride (self); + _tmp16_ = y; + line_offset = _tmp15_ * _tmp16_; + _tmp18_ = depth; + if (_tmp18_ == 8) { + gint _tmp19_; + _tmp19_ = n_channels; + _tmp17_ = _tmp19_ == 3; } else { - _tmp8_ = FALSE; + _tmp17_ = FALSE; } - if (_tmp8_) { + _tmp20_ = _tmp17_; + if (_tmp20_) { + gint _tmp21_; + gint _tmp22_; + gint _tmp23_; gint o; - o = line_offset + (x * n_channels); - pixel[offset + 0] = self->priv->pixels[o]; - pixel[offset + 1] = self->priv->pixels[o + 1]; - pixel[offset + 2] = self->priv->pixels[o + 2]; + guchar* _tmp24_; + gint _tmp24__length1; + gint _tmp25_; + guchar* _tmp26_; + gint _tmp26__length1; + gint _tmp27_; + guchar _tmp28_; + guchar _tmp29_; + guchar* _tmp30_; + gint _tmp30__length1; + gint _tmp31_; + guchar* _tmp32_; + gint _tmp32__length1; + gint _tmp33_; + guchar _tmp34_; + guchar _tmp35_; + guchar* _tmp36_; + gint _tmp36__length1; + gint _tmp37_; + guchar* _tmp38_; + gint _tmp38__length1; + gint _tmp39_; + guchar _tmp40_; + guchar _tmp41_; + _tmp21_ = line_offset; + _tmp22_ = x; + _tmp23_ = n_channels; + o = _tmp21_ + (_tmp22_ * _tmp23_); + _tmp24_ = pixel; + _tmp24__length1 = pixel_length1; + _tmp25_ = offset; + _tmp26_ = self->priv->pixels; + _tmp26__length1 = self->priv->pixels_length1; + _tmp27_ = o; + _tmp28_ = _tmp26_[_tmp27_]; + _tmp24_[_tmp25_ + 0] = _tmp28_; + _tmp29_ = _tmp24_[_tmp25_ + 0]; + _tmp30_ = pixel; + _tmp30__length1 = pixel_length1; + _tmp31_ = offset; + _tmp32_ = self->priv->pixels; + _tmp32__length1 = self->priv->pixels_length1; + _tmp33_ = o; + _tmp34_ = _tmp32_[_tmp33_ + 1]; + _tmp30_[_tmp31_ + 1] = _tmp34_; + _tmp35_ = _tmp30_[_tmp31_ + 1]; + _tmp36_ = pixel; + _tmp36__length1 = pixel_length1; + _tmp37_ = offset; + _tmp38_ = self->priv->pixels; + _tmp38__length1 = self->priv->pixels_length1; + _tmp39_ = o; + _tmp40_ = _tmp38_[_tmp39_ + 2]; + _tmp36_[_tmp37_ + 2] = _tmp40_; + _tmp41_ = _tmp36_[_tmp37_ + 2]; return; } else { - gboolean _tmp9_ = FALSE; - if (depth == 8) { - _tmp9_ = n_channels == 1; + gboolean _tmp42_ = FALSE; + gint _tmp43_; + gboolean _tmp45_; + _tmp43_ = depth; + if (_tmp43_ == 8) { + gint _tmp44_; + _tmp44_ = n_channels; + _tmp42_ = _tmp44_ == 1; } else { - _tmp9_ = FALSE; + _tmp42_ = FALSE; } - if (_tmp9_) { + _tmp45_ = _tmp42_; + if (_tmp45_) { + guchar* _tmp46_; + gint _tmp46__length1; + gint _tmp47_; + gint _tmp48_; + guchar _tmp49_; guchar p; - p = self->priv->pixels[line_offset + x]; - pixel[offset + 2] = p; - pixel[offset + 1] = pixel[offset + 2]; - pixel[offset + 0] = pixel[offset + 1]; + guchar* _tmp50_; + gint _tmp50__length1; + gint _tmp51_; + guchar* _tmp52_; + gint _tmp52__length1; + gint _tmp53_; + guchar* _tmp54_; + gint _tmp54__length1; + gint _tmp55_; + guchar _tmp56_; + guchar _tmp57_; + guchar _tmp58_; + guchar _tmp59_; + _tmp46_ = self->priv->pixels; + _tmp46__length1 = self->priv->pixels_length1; + _tmp47_ = line_offset; + _tmp48_ = x; + _tmp49_ = _tmp46_[_tmp47_ + _tmp48_]; + p = _tmp49_; + _tmp50_ = pixel; + _tmp50__length1 = pixel_length1; + _tmp51_ = offset; + _tmp52_ = pixel; + _tmp52__length1 = pixel_length1; + _tmp53_ = offset; + _tmp54_ = pixel; + _tmp54__length1 = pixel_length1; + _tmp55_ = offset; + _tmp56_ = p; + _tmp54_[_tmp55_ + 2] = _tmp56_; + _tmp57_ = _tmp54_[_tmp55_ + 2]; + _tmp52_[_tmp53_ + 1] = _tmp57_; + _tmp58_ = _tmp52_[_tmp53_ + 1]; + _tmp50_[_tmp51_ + 0] = _tmp58_; + _tmp59_ = _tmp50_[_tmp51_ + 0]; return; } else { - gboolean _tmp10_ = FALSE; - if (depth == 1) { - _tmp10_ = n_channels == 1; + gboolean _tmp60_ = FALSE; + gint _tmp61_; + gboolean _tmp63_; + _tmp61_ = depth; + if (_tmp61_ == 1) { + gint _tmp62_; + _tmp62_ = n_channels; + _tmp60_ = _tmp62_ == 1; } else { - _tmp10_ = FALSE; + _tmp60_ = FALSE; } - if (_tmp10_) { + _tmp63_ = _tmp60_; + if (_tmp63_) { + guchar* _tmp64_; + gint _tmp64__length1; + gint _tmp65_; + gint _tmp66_; + guchar _tmp67_; guchar p; - gint _tmp11_ = 0; - p = self->priv->pixels[line_offset + (x / 8)]; - if (((gint) (p & (0x80 >> (x % 8)))) != 0) { - _tmp11_ = 0x00; + gint _tmp68_ = 0; + guchar _tmp69_; + gint _tmp70_; + guchar* _tmp71_; + gint _tmp71__length1; + gint _tmp72_; + guchar* _tmp73_; + gint _tmp73__length1; + gint _tmp74_; + guchar* _tmp75_; + gint _tmp75__length1; + gint _tmp76_; + gint _tmp77_; + guchar _tmp78_; + guchar _tmp79_; + guchar _tmp80_; + _tmp64_ = self->priv->pixels; + _tmp64__length1 = self->priv->pixels_length1; + _tmp65_ = line_offset; + _tmp66_ = x; + _tmp67_ = _tmp64_[_tmp65_ + (_tmp66_ / 8)]; + p = _tmp67_; + _tmp69_ = p; + _tmp70_ = x; + if (((gint) (_tmp69_ & (0x80 >> (_tmp70_ % 8)))) != 0) { + _tmp68_ = 0x00; } else { - _tmp11_ = 0xFF; + _tmp68_ = 0xFF; } - pixel[offset + 2] = (guchar) _tmp11_; - pixel[offset + 1] = pixel[offset + 2]; - pixel[offset + 0] = pixel[offset + 1]; + _tmp71_ = pixel; + _tmp71__length1 = pixel_length1; + _tmp72_ = offset; + _tmp73_ = pixel; + _tmp73__length1 = pixel_length1; + _tmp74_ = offset; + _tmp75_ = pixel; + _tmp75__length1 = pixel_length1; + _tmp76_ = offset; + _tmp77_ = _tmp68_; + _tmp75_[_tmp76_ + 2] = (guchar) _tmp77_; + _tmp78_ = _tmp75_[_tmp76_ + 2]; + _tmp73_[_tmp74_ + 1] = _tmp78_; + _tmp79_ = _tmp73_[_tmp74_ + 1]; + _tmp71_[_tmp72_ + 0] = _tmp79_; + _tmp80_ = _tmp71_[_tmp72_ + 0]; return; } else { - gboolean _tmp12_ = FALSE; - if (depth == 2) { - _tmp12_ = n_channels == 1; + gboolean _tmp81_ = FALSE; + gint _tmp82_; + gboolean _tmp84_; + _tmp82_ = depth; + if (_tmp82_ == 2) { + gint _tmp83_; + _tmp83_ = n_channels; + _tmp81_ = _tmp83_ == 1; } else { - _tmp12_ = FALSE; + _tmp81_ = FALSE; } - if (_tmp12_) { - gint _tmp13_[4] = {0}; + _tmp84_ = _tmp81_; + if (_tmp84_) { + gint _tmp85_[4] = {0}; gint block_shift[4]; + guchar* _tmp86_; + gint _tmp86__length1; + gint _tmp87_; + gint _tmp88_; + guchar _tmp89_; guchar p; + guchar _tmp90_; + gint _tmp91_; + gint _tmp92_; gint sample; - _tmp13_[0] = 6; - _tmp13_[1] = 4; - _tmp13_[2] = 2; - _tmp13_[3] = 0; - memcpy (block_shift, _tmp13_, 4 * sizeof (gint)); - p = self->priv->pixels[line_offset + (x / 4)]; - sample = (p >> block_shift[x % 4]) & 0x3; - sample = (sample * 255) / 3; - pixel[offset + 2] = (guchar) sample; - pixel[offset + 1] = pixel[offset + 2]; - pixel[offset + 0] = pixel[offset + 1]; + gint _tmp93_; + guchar* _tmp94_; + gint _tmp94__length1; + gint _tmp95_; + guchar* _tmp96_; + gint _tmp96__length1; + gint _tmp97_; + guchar* _tmp98_; + gint _tmp98__length1; + gint _tmp99_; + gint _tmp100_; + guchar _tmp101_; + guchar _tmp102_; + guchar _tmp103_; + _tmp85_[0] = 6; + _tmp85_[1] = 4; + _tmp85_[2] = 2; + _tmp85_[3] = 0; + memcpy (block_shift, _tmp85_, 4 * sizeof (gint)); + _tmp86_ = self->priv->pixels; + _tmp86__length1 = self->priv->pixels_length1; + _tmp87_ = line_offset; + _tmp88_ = x; + _tmp89_ = _tmp86_[_tmp87_ + (_tmp88_ / 4)]; + p = _tmp89_; + _tmp90_ = p; + _tmp91_ = x; + _tmp92_ = block_shift[_tmp91_ % 4]; + sample = (_tmp90_ >> _tmp92_) & 0x3; + _tmp93_ = sample; + sample = (_tmp93_ * 255) / 3; + _tmp94_ = pixel; + _tmp94__length1 = pixel_length1; + _tmp95_ = offset; + _tmp96_ = pixel; + _tmp96__length1 = pixel_length1; + _tmp97_ = offset; + _tmp98_ = pixel; + _tmp98__length1 = pixel_length1; + _tmp99_ = offset; + _tmp100_ = sample; + _tmp98_[_tmp99_ + 2] = (guchar) _tmp100_; + _tmp101_ = _tmp98_[_tmp99_ + 2]; + _tmp96_[_tmp97_ + 1] = _tmp101_; + _tmp102_ = _tmp96_[_tmp97_ + 1]; + _tmp94_[_tmp95_ + 0] = _tmp102_; + _tmp103_ = _tmp94_[_tmp95_ + 0]; return; } } } } - _tmp14_ = page_get_sample (self, self->priv->pixels, self->priv->pixels_length1, line_offset, x, depth, n_channels, 0); - pixel[offset + 0] = _tmp14_; - _tmp15_ = page_get_sample (self, self->priv->pixels, self->priv->pixels_length1, line_offset, x, depth, n_channels, 1); - pixel[offset + 1] = _tmp15_; - _tmp16_ = page_get_sample (self, self->priv->pixels, self->priv->pixels_length1, line_offset, x, depth, n_channels, 2); - pixel[offset + 2] = _tmp16_; + _tmp104_ = pixel; + _tmp104__length1 = pixel_length1; + _tmp105_ = offset; + _tmp106_ = self->priv->pixels; + _tmp106__length1 = self->priv->pixels_length1; + _tmp107_ = line_offset; + _tmp108_ = x; + _tmp109_ = depth; + _tmp110_ = n_channels; + _tmp111_ = page_get_sample (self, _tmp106_, _tmp106__length1, _tmp107_, _tmp108_, _tmp109_, _tmp110_, 0); + _tmp104_[_tmp105_ + 0] = _tmp111_; + _tmp112_ = _tmp104_[_tmp105_ + 0]; + _tmp113_ = pixel; + _tmp113__length1 = pixel_length1; + _tmp114_ = offset; + _tmp115_ = self->priv->pixels; + _tmp115__length1 = self->priv->pixels_length1; + _tmp116_ = line_offset; + _tmp117_ = x; + _tmp118_ = depth; + _tmp119_ = n_channels; + _tmp120_ = page_get_sample (self, _tmp115_, _tmp115__length1, _tmp116_, _tmp117_, _tmp118_, _tmp119_, 1); + _tmp113_[_tmp114_ + 1] = _tmp120_; + _tmp121_ = _tmp113_[_tmp114_ + 1]; + _tmp122_ = pixel; + _tmp122__length1 = pixel_length1; + _tmp123_ = offset; + _tmp124_ = self->priv->pixels; + _tmp124__length1 = self->priv->pixels_length1; + _tmp125_ = line_offset; + _tmp126_ = x; + _tmp127_ = depth; + _tmp128_ = n_channels; + _tmp129_ = page_get_sample (self, _tmp124_, _tmp124__length1, _tmp125_, _tmp126_, _tmp127_, _tmp128_, 2); + _tmp122_[_tmp123_ + 2] = _tmp129_; + _tmp130_ = _tmp122_[_tmp123_ + 2]; } @@ -1172,92 +1890,168 @@ GdkPixbuf* page_get_image (Page* self, gboolean apply_crop) { gint t = 0; gint b = 0; gboolean _tmp0_ = FALSE; - GdkPixbuf* _tmp7_ = NULL; + gboolean _tmp1_; + gboolean _tmp3_; + gint _tmp20_; + gint _tmp21_; + gint _tmp22_; + gint _tmp23_; + GdkPixbuf* _tmp24_; GdkPixbuf* image; - guint8* _tmp8_ = NULL; + GdkPixbuf* _tmp25_; + guint8* _tmp26_ = NULL; guint8* image_pixels; gint image_pixels_length1; gint _image_pixels_size_; g_return_val_if_fail (self != NULL, NULL); - if (apply_crop) { - _tmp0_ = self->priv->has_crop_; + _tmp1_ = apply_crop; + if (_tmp1_) { + gboolean _tmp2_; + _tmp2_ = self->priv->has_crop_; + _tmp0_ = _tmp2_; } else { _tmp0_ = FALSE; } - if (_tmp0_) { - gint _tmp1_; - gint _tmp3_; - l = self->priv->crop_x; - r = l + self->priv->crop_width; - t = self->priv->crop_y; - b = t + self->priv->crop_height; - if (l < 0) { + _tmp3_ = _tmp0_; + if (_tmp3_) { + gint _tmp4_; + gint _tmp5_; + gint _tmp6_; + gint _tmp7_; + gint _tmp8_; + gint _tmp9_; + gint _tmp10_; + gint _tmp11_; + gint _tmp12_ = 0; + gint _tmp14_; + gint _tmp15_; + gint _tmp16_ = 0; + _tmp4_ = self->priv->crop_x; + l = _tmp4_; + _tmp5_ = l; + _tmp6_ = self->priv->crop_width; + r = _tmp5_ + _tmp6_; + _tmp7_ = self->priv->crop_y; + t = _tmp7_; + _tmp8_ = t; + _tmp9_ = self->priv->crop_height; + b = _tmp8_ + _tmp9_; + _tmp10_ = l; + if (_tmp10_ < 0) { l = 0; } - _tmp1_ = page_get_width (self); - if (r > _tmp1_) { - gint _tmp2_; - _tmp2_ = page_get_width (self); - r = _tmp2_; + _tmp11_ = r; + _tmp12_ = page_get_width (self); + if (_tmp11_ > _tmp12_) { + gint _tmp13_ = 0; + _tmp13_ = page_get_width (self); + r = _tmp13_; } - if (t < 0) { + _tmp14_ = t; + if (_tmp14_ < 0) { t = 0; } - _tmp3_ = page_get_height (self); - if (b > _tmp3_) { - gint _tmp4_; - _tmp4_ = page_get_height (self); - b = _tmp4_; + _tmp15_ = b; + _tmp16_ = page_get_height (self); + if (_tmp15_ > _tmp16_) { + gint _tmp17_ = 0; + _tmp17_ = page_get_height (self); + b = _tmp17_; } } else { - gint _tmp5_; - gint _tmp6_; + gint _tmp18_ = 0; + gint _tmp19_ = 0; l = 0; - _tmp5_ = page_get_width (self); - r = _tmp5_; + _tmp18_ = page_get_width (self); + r = _tmp18_; t = 0; - _tmp6_ = page_get_height (self); - b = _tmp6_; - } - _tmp7_ = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, r - l, b - t); - image = _tmp7_; - _tmp8_ = gdk_pixbuf_get_pixels (image); - image_pixels = _tmp8_; + _tmp19_ = page_get_height (self); + b = _tmp19_; + } + _tmp20_ = r; + _tmp21_ = l; + _tmp22_ = b; + _tmp23_ = t; + _tmp24_ = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, _tmp20_ - _tmp21_, _tmp22_ - _tmp23_); + image = _tmp24_; + _tmp25_ = image; + _tmp26_ = gdk_pixbuf_get_pixels (_tmp25_); + image_pixels = _tmp26_; image_pixels_length1 = -1; _image_pixels_size_ = image_pixels_length1; { + gint _tmp27_; gint y; - y = t; + _tmp27_ = t; + y = _tmp27_; { - gboolean _tmp9_; - _tmp9_ = TRUE; + gboolean _tmp28_; + _tmp28_ = TRUE; while (TRUE) { - gint _tmp10_; + gboolean _tmp29_; + gint _tmp31_; + gint _tmp32_; + GdkPixbuf* _tmp33_; + gint _tmp34_ = 0; + gint _tmp35_; + gint _tmp36_; gint offset; - if (!_tmp9_) { - y++; + _tmp29_ = _tmp28_; + if (!_tmp29_) { + gint _tmp30_; + _tmp30_ = y; + y = _tmp30_ + 1; } - _tmp9_ = FALSE; - if (!(y < b)) { + _tmp28_ = FALSE; + _tmp31_ = y; + _tmp32_ = b; + if (!(_tmp31_ < _tmp32_)) { break; } - _tmp10_ = gdk_pixbuf_get_rowstride (image); - offset = _tmp10_ * (y - t); + _tmp33_ = image; + _tmp34_ = gdk_pixbuf_get_rowstride (_tmp33_); + _tmp35_ = y; + _tmp36_ = t; + offset = _tmp34_ * (_tmp35_ - _tmp36_); { + gint _tmp37_; gint x; - x = l; + _tmp37_ = l; + x = _tmp37_; { - gboolean _tmp11_; - _tmp11_ = TRUE; + gboolean _tmp38_; + _tmp38_ = TRUE; while (TRUE) { - if (!_tmp11_) { - x++; + gboolean _tmp39_; + gint _tmp41_; + gint _tmp42_; + gint _tmp43_; + gint _tmp44_; + guint8* _tmp45_; + gint _tmp45__length1; + gint _tmp46_; + gint _tmp47_; + gint _tmp48_; + _tmp39_ = _tmp38_; + if (!_tmp39_) { + gint _tmp40_; + _tmp40_ = x; + x = _tmp40_ + 1; } - _tmp11_ = FALSE; - if (!(x < r)) { + _tmp38_ = FALSE; + _tmp41_ = x; + _tmp42_ = r; + if (!(_tmp41_ < _tmp42_)) { break; } - page_get_pixel (self, x, y, image_pixels, image_pixels_length1, offset + ((x - l) * 3)); + _tmp43_ = x; + _tmp44_ = y; + _tmp45_ = image_pixels; + _tmp45__length1 = image_pixels_length1; + _tmp46_ = offset; + _tmp47_ = x; + _tmp48_ = l; + page_get_pixel (self, _tmp43_, _tmp44_, _tmp45_, _tmp45__length1, _tmp46_ + ((_tmp47_ - _tmp48_) * 3)); } } } @@ -1272,26 +2066,38 @@ GdkPixbuf* page_get_image (Page* self, gboolean apply_crop) { static gchar* string_to_utf8 (const gchar* self, int* result_length1) { gchar* result = NULL; gint _tmp0_; - gchar* _tmp1_ = NULL; + gint _tmp1_; + gchar* _tmp2_ = NULL; gchar* _result_; gint _result__length1; gint __result__size_; - gint _tmp2_; - gchar* _tmp3_; + gint _tmp3_; + gchar* _tmp4_; + gint _tmp4__length1; + gint _tmp5_; + gint _tmp6_; + gchar* _tmp7_; + gint _tmp7__length1; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = strlen (self); - _tmp1_ = g_new0 (gchar, _tmp0_ + 1); - _result_ = _tmp1_; - _result__length1 = _tmp0_ + 1; + _tmp1_ = _tmp0_; + _tmp2_ = g_new0 (gchar, _tmp1_ + 1); + _result_ = _tmp2_; + _result__length1 = _tmp1_ + 1; __result__size_ = _result__length1; - _result__length1--; - _tmp2_ = strlen (self); - memcpy (_result_, self, (gsize) _tmp2_); - _tmp3_ = _result_; + _tmp3_ = _result__length1; + _result__length1 = _tmp3_ - 1; + _tmp4_ = _result_; + _tmp4__length1 = _result__length1; + _tmp5_ = strlen (self); + _tmp6_ = _tmp5_; + memcpy (_tmp4_, self, (gsize) _tmp6_); + _tmp7_ = _result_; + _tmp7__length1 = _result__length1; if (result_length1) { - *result_length1 = _result__length1; + *result_length1 = _tmp7__length1; } - result = _tmp3_; + result = _tmp7_; return result; } @@ -1299,20 +2105,23 @@ static gchar* string_to_utf8 (const gchar* self, int* result_length1) { static gchar* page_get_icc_data_encoded (Page* self, const gchar* icc_profile_filename) { gchar* result = NULL; gchar* contents = NULL; - gint _tmp1_; - gchar* _tmp2_ = NULL; - guchar* _tmp3_; - gint _tmp3__length1; - gchar* _tmp4_ = NULL; - gchar* _tmp5_; + const gchar* _tmp4_; + gint _tmp5_ = 0; + gchar* _tmp6_ = NULL; + guchar* _tmp7_; + gint _tmp7__length1; + gchar* _tmp8_ = NULL; + gchar* _tmp9_; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (icc_profile_filename != NULL, NULL); { - gchar* _tmp0_ = NULL; - g_file_get_contents (icc_profile_filename, &_tmp0_, NULL, &_inner_error_); + const gchar* _tmp0_; + gchar* _tmp1_ = NULL; + _tmp0_ = icc_profile_filename; + g_file_get_contents (_tmp0_, &_tmp1_, NULL, &_inner_error_); _g_free0 (contents); - contents = _tmp0_; + contents = _tmp1_; if (_inner_error_ != NULL) { goto __catch2_g_error; } @@ -1321,9 +2130,13 @@ static gchar* page_get_icc_data_encoded (Page* self, const gchar* icc_profile_fi __catch2_g_error: { GError* e = NULL; + GError* _tmp2_; + const gchar* _tmp3_; e = _inner_error_; _inner_error_ = NULL; - g_warning ("page.vala:670: failed to get icc profile data: %s", e->message); + _tmp2_ = e; + _tmp3_ = _tmp2_->message; + g_warning ("page.vala:670: failed to get icc profile data: %s", _tmp3_); result = NULL; _g_error_free0 (e); _g_free0 (contents); @@ -1336,75 +2149,100 @@ static gchar* page_get_icc_data_encoded (Page* self, const gchar* icc_profile_fi g_clear_error (&_inner_error_); return NULL; } - _tmp2_ = string_to_utf8 (contents, &_tmp1_); - _tmp3_ = (guchar*) _tmp2_; - _tmp3__length1 = _tmp1_; - _tmp4_ = g_base64_encode (_tmp3_, _tmp1_); - _tmp5_ = _tmp4_; - _tmp3_ = (g_free (_tmp3_), NULL); - result = _tmp5_; + _tmp4_ = contents; + _tmp6_ = string_to_utf8 (_tmp4_, &_tmp5_); + _tmp7_ = (guchar*) _tmp6_; + _tmp7__length1 = _tmp5_; + _tmp8_ = g_base64_encode (_tmp7_, _tmp5_); + _tmp9_ = _tmp8_; + _tmp7_ = (g_free (_tmp7_), NULL); + result = _tmp9_; _g_free0 (contents); return result; } void page_save (Page* self, const gchar* type, GFile* file, GError** error) { - GFileOutputStream* _tmp0_ = NULL; + GFile* _tmp0_; + GFileOutputStream* _tmp1_ = NULL; GFileOutputStream* stream; - PixbufWriter* _tmp1_ = NULL; + GFileOutputStream* _tmp2_; + PixbufWriter* _tmp3_; PixbufWriter* writer; - GdkPixbuf* _tmp2_ = NULL; + GdkPixbuf* _tmp4_ = NULL; GdkPixbuf* image; gchar* icc_profile_data; - gint _tmp4_; + const gchar* _tmp5_; + GCompareFunc _tmp8_; + const gchar* _tmp9_; + gint _tmp10_ = 0; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (type != NULL); g_return_if_fail (file != NULL); - _tmp0_ = g_file_replace (file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &_inner_error_); - stream = _tmp0_; + _tmp0_ = file; + _tmp1_ = g_file_replace (_tmp0_, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &_inner_error_); + stream = _tmp1_; if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); return; } - _tmp1_ = pixbuf_writer_new (stream); - writer = _tmp1_; - _tmp2_ = page_get_image (self, TRUE); - image = _tmp2_; + _tmp2_ = stream; + _tmp3_ = pixbuf_writer_new (_tmp2_); + writer = _tmp3_; + _tmp4_ = page_get_image (self, TRUE); + image = _tmp4_; icc_profile_data = NULL; - if (self->priv->color_profile != NULL) { - gchar* _tmp3_ = NULL; - _tmp3_ = page_get_icc_data_encoded (self, self->priv->color_profile); + _tmp5_ = self->priv->color_profile; + if (_tmp5_ != NULL) { + const gchar* _tmp6_; + gchar* _tmp7_ = NULL; + _tmp6_ = self->priv->color_profile; + _tmp7_ = page_get_icc_data_encoded (self, _tmp6_); _g_free0 (icc_profile_data); - icc_profile_data = _tmp3_; - } - _tmp4_ = g_strcmp0 (type, "jpeg"); - if (_tmp4_ == 0) { - gchar* _tmp5_; - gchar** _tmp6_ = NULL; + icc_profile_data = _tmp7_; + } + _tmp8_ = g_strcmp0; + _tmp9_ = type; + _tmp10_ = _tmp8_ (_tmp9_, "jpeg"); + if (_tmp10_ == 0) { + gchar* _tmp11_; + gchar** _tmp12_ = NULL; gchar** keys; gint keys_length1; gint _keys_size_; - gchar* _tmp7_; - gchar** _tmp8_ = NULL; + gchar* _tmp13_; + gchar** _tmp14_ = NULL; gchar** values; gint values_length1; gint _values_size_; - _tmp5_ = g_strdup ("quality"); - _tmp6_ = g_new0 (gchar*, 2 + 1); - _tmp6_[0] = _tmp5_; - _tmp6_[1] = NULL; - keys = _tmp6_; + PixbufWriter* _tmp15_; + GdkPixbuf* _tmp16_; + gchar** _tmp17_; + gint _tmp17__length1; + gchar** _tmp18_; + gint _tmp18__length1; + _tmp11_ = g_strdup ("quality"); + _tmp12_ = g_new0 (gchar*, 2 + 1); + _tmp12_[0] = _tmp11_; + _tmp12_[1] = NULL; + keys = _tmp12_; keys_length1 = 2; _keys_size_ = keys_length1; - _tmp7_ = g_strdup ("90"); - _tmp8_ = g_new0 (gchar*, 2 + 1); - _tmp8_[0] = _tmp7_; - _tmp8_[1] = NULL; - values = _tmp8_; + _tmp13_ = g_strdup ("90"); + _tmp14_ = g_new0 (gchar*, 2 + 1); + _tmp14_[0] = _tmp13_; + _tmp14_[1] = NULL; + values = _tmp14_; values_length1 = 2; _values_size_ = values_length1; - pixbuf_writer_save (writer, image, "jpeg", keys, keys_length1, values, values_length1, &_inner_error_); + _tmp15_ = writer; + _tmp16_ = image; + _tmp17_ = keys; + _tmp17__length1 = keys_length1; + _tmp18_ = values; + _tmp18__length1 = values_length1; + pixbuf_writer_save (_tmp15_, _tmp16_, "jpeg", _tmp17_, _tmp17__length1, _tmp18_, _tmp18__length1, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); values = (_vala_array_free (values, values_length1, (GDestroyNotify) g_free), NULL); @@ -1418,40 +2256,64 @@ void page_save (Page* self, const gchar* type, GFile* file, GError** error) { values = (_vala_array_free (values, values_length1, (GDestroyNotify) g_free), NULL); keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL); } else { - gint _tmp9_; - _tmp9_ = g_strcmp0 (type, "png"); - if (_tmp9_ == 0) { - gchar* _tmp10_; - gchar** _tmp11_ = NULL; + GCompareFunc _tmp19_; + const gchar* _tmp20_; + gint _tmp21_ = 0; + _tmp19_ = g_strcmp0; + _tmp20_ = type; + _tmp21_ = _tmp19_ (_tmp20_, "png"); + if (_tmp21_ == 0) { + gchar* _tmp22_; + gchar** _tmp23_ = NULL; gchar** keys; gint keys_length1; gint _keys_size_; - gchar* _tmp12_; - gchar** _tmp13_ = NULL; + const gchar* _tmp24_; + gchar* _tmp25_; + gchar** _tmp26_ = NULL; gchar** values; gint values_length1; gint _values_size_; - _tmp10_ = g_strdup ("icc-profile"); - _tmp11_ = g_new0 (gchar*, 2 + 1); - _tmp11_[0] = _tmp10_; - _tmp11_[1] = NULL; - keys = _tmp11_; + const gchar* _tmp27_; + PixbufWriter* _tmp30_; + GdkPixbuf* _tmp31_; + gchar** _tmp32_; + gint _tmp32__length1; + gchar** _tmp33_; + gint _tmp33__length1; + _tmp22_ = g_strdup ("icc-profile"); + _tmp23_ = g_new0 (gchar*, 2 + 1); + _tmp23_[0] = _tmp22_; + _tmp23_[1] = NULL; + keys = _tmp23_; keys_length1 = 2; _keys_size_ = keys_length1; - _tmp12_ = g_strdup (icc_profile_data); - _tmp13_ = g_new0 (gchar*, 2 + 1); - _tmp13_[0] = _tmp12_; - _tmp13_[1] = NULL; - values = _tmp13_; + _tmp24_ = icc_profile_data; + _tmp25_ = g_strdup (_tmp24_); + _tmp26_ = g_new0 (gchar*, 2 + 1); + _tmp26_[0] = _tmp25_; + _tmp26_[1] = NULL; + values = _tmp26_; values_length1 = 2; _values_size_ = values_length1; - if (icc_profile_data == NULL) { - gchar* _tmp14_; - _tmp14_ = NULL; - _g_free0 (keys[0]); - keys[0] = _tmp14_; + _tmp27_ = icc_profile_data; + if (_tmp27_ == NULL) { + gchar** _tmp28_; + gint _tmp28__length1; + gchar* _tmp29_; + _tmp28_ = keys; + _tmp28__length1 = keys_length1; + _g_free0 (_tmp28_[0]); + _tmp28_[0] = NULL; + _tmp29_ = _tmp28_[0]; } - pixbuf_writer_save (writer, image, "png", keys, keys_length1, values, values_length1, &_inner_error_); + _tmp30_ = writer; + _tmp31_ = image; + _tmp32_ = keys; + _tmp32__length1 = keys_length1; + _tmp33_ = values; + _tmp33__length1 = values_length1; + pixbuf_writer_save (_tmp30_, _tmp31_, "png", _tmp32_, _tmp32__length1, _tmp33_, _tmp33__length1, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); values = (_vala_array_free (values, values_length1, (GDestroyNotify) g_free), NULL); @@ -1465,46 +2327,70 @@ void page_save (Page* self, const gchar* type, GFile* file, GError** error) { values = (_vala_array_free (values, values_length1, (GDestroyNotify) g_free), NULL); keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL); } else { - gint _tmp15_; - _tmp15_ = g_strcmp0 (type, "tiff"); - if (_tmp15_ == 0) { - gchar* _tmp16_; - gchar* _tmp17_; - gchar** _tmp18_ = NULL; + GCompareFunc _tmp34_; + const gchar* _tmp35_; + gint _tmp36_ = 0; + _tmp34_ = g_strcmp0; + _tmp35_ = type; + _tmp36_ = _tmp34_ (_tmp35_, "tiff"); + if (_tmp36_ == 0) { + gchar* _tmp37_; + gchar* _tmp38_; + gchar** _tmp39_ = NULL; gchar** keys; gint keys_length1; gint _keys_size_; - gchar* _tmp19_; - gchar* _tmp20_; - gchar** _tmp21_ = NULL; + gchar* _tmp40_; + const gchar* _tmp41_; + gchar* _tmp42_; + gchar** _tmp43_ = NULL; gchar** values; gint values_length1; gint _values_size_; - _tmp16_ = g_strdup ("compression"); - _tmp17_ = g_strdup ("icc-profile"); - _tmp18_ = g_new0 (gchar*, 3 + 1); - _tmp18_[0] = _tmp16_; - _tmp18_[1] = _tmp17_; - _tmp18_[2] = NULL; - keys = _tmp18_; + const gchar* _tmp44_; + PixbufWriter* _tmp47_; + GdkPixbuf* _tmp48_; + gchar** _tmp49_; + gint _tmp49__length1; + gchar** _tmp50_; + gint _tmp50__length1; + _tmp37_ = g_strdup ("compression"); + _tmp38_ = g_strdup ("icc-profile"); + _tmp39_ = g_new0 (gchar*, 3 + 1); + _tmp39_[0] = _tmp37_; + _tmp39_[1] = _tmp38_; + _tmp39_[2] = NULL; + keys = _tmp39_; keys_length1 = 3; _keys_size_ = keys_length1; - _tmp19_ = g_strdup ("8"); - _tmp20_ = g_strdup (icc_profile_data); - _tmp21_ = g_new0 (gchar*, 3 + 1); - _tmp21_[0] = _tmp19_; - _tmp21_[1] = _tmp20_; - _tmp21_[2] = NULL; - values = _tmp21_; + _tmp40_ = g_strdup ("8"); + _tmp41_ = icc_profile_data; + _tmp42_ = g_strdup (_tmp41_); + _tmp43_ = g_new0 (gchar*, 3 + 1); + _tmp43_[0] = _tmp40_; + _tmp43_[1] = _tmp42_; + _tmp43_[2] = NULL; + values = _tmp43_; values_length1 = 3; _values_size_ = values_length1; - if (icc_profile_data == NULL) { - gchar* _tmp22_; - _tmp22_ = NULL; - _g_free0 (keys[1]); - keys[1] = _tmp22_; + _tmp44_ = icc_profile_data; + if (_tmp44_ == NULL) { + gchar** _tmp45_; + gint _tmp45__length1; + gchar* _tmp46_; + _tmp45_ = keys; + _tmp45__length1 = keys_length1; + _g_free0 (_tmp45_[1]); + _tmp45_[1] = NULL; + _tmp46_ = _tmp45_[1]; } - pixbuf_writer_save (writer, image, "tiff", keys, keys_length1, values, values_length1, &_inner_error_); + _tmp47_ = writer; + _tmp48_ = image; + _tmp49_ = keys; + _tmp49__length1 = keys_length1; + _tmp50_ = values; + _tmp50__length1 = values_length1; + pixbuf_writer_save (_tmp47_, _tmp48_, "tiff", _tmp49_, _tmp49__length1, _tmp50_, _tmp50__length1, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); values = (_vala_array_free (values, values_length1, (GDestroyNotify) g_free), NULL); @@ -1706,11 +2592,13 @@ static gpointer _g_object_ref0 (gpointer self) { PixbufWriter* pixbuf_writer_construct (GType object_type, GFileOutputStream* stream) { PixbufWriter* self = NULL; GFileOutputStream* _tmp0_; + GFileOutputStream* _tmp1_; g_return_val_if_fail (stream != NULL, NULL); self = (PixbufWriter*) g_type_create_instance (object_type); - _tmp0_ = _g_object_ref0 (stream); + _tmp0_ = stream; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->stream); - self->stream = _tmp0_; + self->stream = _tmp1_; return self; } @@ -1728,11 +2616,23 @@ static gboolean _pixbuf_writer_write_pixbuf_data_gdk_pixbuf_save_func (guint8* b void pixbuf_writer_save (PixbufWriter* self, GdkPixbuf* image, const gchar* type, gchar** option_keys, int option_keys_length1, gchar** option_values, int option_values_length1, GError** error) { + GdkPixbuf* _tmp0_; + const gchar* _tmp1_; + gchar** _tmp2_; + gint _tmp2__length1; + gchar** _tmp3_; + gint _tmp3__length1; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (image != NULL); g_return_if_fail (type != NULL); - gdk_pixbuf_save_to_callbackv (image, _pixbuf_writer_write_pixbuf_data_gdk_pixbuf_save_func, self, type, option_keys, option_values, &_inner_error_); + _tmp0_ = image; + _tmp1_ = type; + _tmp2_ = option_keys; + _tmp2__length1 = option_keys_length1; + _tmp3_ = option_values; + _tmp3__length1 = option_values_length1; + gdk_pixbuf_save_to_callbackv (_tmp0_, _pixbuf_writer_write_pixbuf_data_gdk_pixbuf_save_func, self, _tmp1_, _tmp2_, _tmp3_, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); return; @@ -1742,9 +2642,15 @@ void pixbuf_writer_save (PixbufWriter* self, GdkPixbuf* image, const gchar* type static gboolean pixbuf_writer_write_pixbuf_data (PixbufWriter* self, guint8* buf, int buf_length1, GError** error) { gboolean result = FALSE; + GFileOutputStream* _tmp0_; + guint8* _tmp1_; + gint _tmp1__length1; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, FALSE); - g_output_stream_write_all ((GOutputStream*) self->stream, buf, (gsize) buf_length1, NULL, NULL, &_inner_error_); + _tmp0_ = self->stream; + _tmp1_ = buf; + _tmp1__length1 = buf_length1; + g_output_stream_write_all ((GOutputStream*) _tmp0_, _tmp1_, (gsize) _tmp1__length1, NULL, NULL, &_inner_error_); if (_inner_error_ != NULL) { g_propagate_error (error, _inner_error_); return FALSE; |