rfreeimage 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cb4d72821a2692757ac7884a3c3e1d5648aec1a
4
- data.tar.gz: 8600d968acee4d6e23e2869a5bc9a46d635dc674
3
+ metadata.gz: a4b988773094fee17bb5d9dc7815ec8d2c44f053
4
+ data.tar.gz: 1fad08335ed9ba58ff109715254b73293d0e59bb
5
5
  SHA512:
6
- metadata.gz: 881f6afa3eaf93e049d5be9b19c48dd3007b65dfbc06f6d276697f1c812e1bbd4689152959193208211243f80f41f27ed444e50547b1cef4db740265532a12ce
7
- data.tar.gz: '09baa889f097f74cba721dba6ba3ad8fda1c52ec7b91df41eecfc6db6af7a952509bf4acce371b52dcfece12e1b107edad2c461199b4002fd0542db5b9b3f36c'
6
+ metadata.gz: e3bd93eafac76ce447ae422ed096a4a9aa0b0922693cc59f9e7d7e96f15aa5cf902562dec048cd8e5c3703254373a42fc29d42c138e1f017c8ec6082f3e76651
7
+ data.tar.gz: 60ed61b07b748c07caa421861300cb5f4cf49768b8475fc42d380b183d9192a329c5b42d6948fbd01c9a85045469f35272a29f5658a0f13fcb66a54fc4a22564
@@ -16,6 +16,15 @@ static void __rfi_module_uninit() {
16
16
  FreeImage_DeInitialise();
17
17
  }
18
18
 
19
+ static void try_sort(int *x, int *y)
20
+ {
21
+ if(*y < *x ){
22
+ int tmp = *x;
23
+ *x = *y;
24
+ *y = tmp;
25
+ }
26
+ }
27
+
19
28
  static VALUE rb_rfi_version(VALUE self)
20
29
  {
21
30
  return rb_ary_new3(3, INT2NUM(FREEIMAGE_MAJOR_VERSION),
@@ -681,6 +690,9 @@ static VALUE Image_draw_rectangle(VALUE self, VALUE _x1, VALUE _y1,
681
690
  Data_Get_Struct(self, struct native_image, img);
682
691
  RFI_CHECK_IMG(img);
683
692
 
693
+ try_sort(&x1, &x2);
694
+ try_sort(&y1, &y2);
695
+
684
696
  for(i = -hs; i <= hs; i++) {
685
697
  for(j = x1; j <= x2; j++) {
686
698
  FreeImage_SetPixelColor(img->handle, j, img->h - (y1 + i) - 1, (RGBQUAD*)&bgra);
@@ -708,11 +720,14 @@ static VALUE Image_fill_rectangle(VALUE self, VALUE _x1, VALUE _y1,
708
720
  int x2 = NUM2INT(_x2);
709
721
  int y2 = NUM2INT(_y2);
710
722
  unsigned int bgra = NUM2UINT(color);
723
+ int i, j;
711
724
 
712
725
  Data_Get_Struct(self, struct native_image, img);
713
726
  RFI_CHECK_IMG(img);
714
727
 
715
- int i, j;
728
+ try_sort(&x1, &x2);
729
+ try_sort(&y1, &y2);
730
+
716
731
  for(i = x1; i <= x2; i++) {
717
732
  for(j = y1; j <= y2; j++) {
718
733
  FreeImage_SetPixelColor(img->handle, i, img->h - j, (RGBQUAD*)&bgra);
@@ -1,3 +1,3 @@
1
1
  module RFreeImage
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rfreeimage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuheng Chen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-17 00:00:00.000000000 Z
11
+ date: 2018-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler