Image.load_tilesの誤差問題修正
@@ -101,8 +101,8 @@ | ||
101 | 101 | /* テクスチャデータ */ |
102 | 102 | struct DXRubyTexture { |
103 | 103 | LPDIRECT3DTEXTURE9 pD3DTexture; /* ピクチャに使うテクスチャ */ |
104 | - int width; | |
105 | - int height; | |
104 | + float width; | |
105 | + float height; | |
106 | 106 | int refcount; |
107 | 107 | }; |
108 | 108 |
@@ -109,10 +109,10 @@ | ||
109 | 109 | /* RenderTargetオブジェクトの中身 */ |
110 | 110 | struct DXRubyRenderTarget { |
111 | 111 | struct DXRubyTexture *texture; |
112 | - float x; /* x始点位置 */ | |
113 | - float y; /* y始点位置 */ | |
114 | - float width; /* イメージの幅 */ | |
115 | - float height;/* イメージの高さ */ | |
112 | + int x; /* x始点位置 */ | |
113 | + int y; /* y始点位置 */ | |
114 | + int width; /* イメージの幅 */ | |
115 | + int height;/* イメージの高さ */ | |
116 | 116 | // int lockcount; /* ロックカウント ここまでImageと共通 */ |
117 | 117 | IDirect3DSurface9 *surface; |
118 | 118 |
@@ -771,7 +771,7 @@ | ||
771 | 771 | else |
772 | 772 | { |
773 | 773 | color = D3DCOLOR_ARGB(NUM2INT(rb_ary_entry(vcolor, 0)), NUM2INT(rb_ary_entry(vcolor, 1)), |
774 | - NUM2INT(rb_ary_entry(vcolor, 2)), NUM2INT(rb_ary_entry(vcolor, 3))); | |
774 | + NUM2INT(rb_ary_entry(vcolor, 2)), NUM2INT(rb_ary_entry(vcolor, 3))); | |
775 | 775 | for( y = 0; y < image->height; y++ ) |
776 | 776 | { |
777 | 777 | int *p = (int*)((char *)texrect.pBits + y * texrect.Pitch); |
@@ -842,12 +842,11 @@ | ||
842 | 842 | obj = Data_Wrap_Struct(cImage, 0, Image_release, image); |
843 | 843 | |
844 | 844 | image->texture = texture; |
845 | - image->x = srcimage->x + j * srcimage->width / x; | |
846 | - image->y = srcimage->y + i * srcimage->height / y; | |
845 | + image->x = srcimage->x + j * (srcimage->width / x); | |
846 | + image->y = srcimage->y + i * (srcimage->height / y); | |
847 | 847 | image->width = srcimage->width / x; |
848 | 848 | image->height = srcimage->height / y; |
849 | 849 | // image->lockcount = 0; |
850 | - | |
851 | 850 | rb_ary_push( array, obj ); |
852 | 851 | g_iRefAll++; |
853 | 852 | } |
@@ -859,8 +858,8 @@ | ||
859 | 858 | { |
860 | 859 | for( j = 0; j < x; j++ ) |
861 | 860 | { |
862 | - VALUE ary[4] = {INT2FIX(srcimage->x + j * srcimage->width / x), | |
863 | - INT2FIX(srcimage->y + i * srcimage->height / y), | |
861 | + VALUE ary[4] = {INT2FIX(srcimage->x + j * (srcimage->width / x)), | |
862 | + INT2FIX(srcimage->y + i * (srcimage->height / y)), | |
864 | 863 | INT2FIX(srcimage->width / x), |
865 | 864 | INT2FIX(srcimage->height / y)}; |
866 | 865 | rb_ary_push( array, Image_slice_instance( 4, ary, obj ) ); |
@@ -1,10 +1,10 @@ | ||
1 | 1 | /* Imageオブジェクトの中身 */ |
2 | 2 | struct DXRubyImage { |
3 | 3 | struct DXRubyTexture *texture; |
4 | - float x; /* x始点位置 */ | |
5 | - float y; /* y始点位置 */ | |
6 | - float width; /* イメージの幅 */ | |
7 | - float height;/* イメージの高さ */ | |
4 | + int x; /* x始点位置 */ | |
5 | + int y; /* y始点位置 */ | |
6 | + int width; /* イメージの幅 */ | |
7 | + int height;/* イメージの高さ */ | |
8 | 8 | // int lockcount; /* ロックカウント */ |
9 | 9 | }; |
10 | 10 |