• R/O
  • SSH
  • HTTPS

dxruby: Commit


Commit MetaInfo

Revision395 (tree)
Time2013-10-12 23:12:24
Authormirichi

Log Message

Image.load_tilesの誤差問題修正

Change Summary

Incremental Difference

--- branches/1.5dev/dxruby.h (revision 394)
+++ branches/1.5dev/dxruby.h (revision 395)
@@ -101,8 +101,8 @@
101101 /* テクスチャデータ */
102102 struct DXRubyTexture {
103103 LPDIRECT3DTEXTURE9 pD3DTexture; /* ピクチャに使うテクスチャ */
104- int width;
105- int height;
104+ float width;
105+ float height;
106106 int refcount;
107107 };
108108
@@ -109,10 +109,10 @@
109109 /* RenderTargetオブジェクトの中身 */
110110 struct DXRubyRenderTarget {
111111 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;/* イメージの高さ */
116116 // int lockcount; /* ロックカウント ここまでImageと共通 */
117117 IDirect3DSurface9 *surface;
118118
--- branches/1.5dev/image.c (revision 394)
+++ branches/1.5dev/image.c (revision 395)
@@ -771,7 +771,7 @@
771771 else
772772 {
773773 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)));
775775 for( y = 0; y < image->height; y++ )
776776 {
777777 int *p = (int*)((char *)texrect.pBits + y * texrect.Pitch);
@@ -842,12 +842,11 @@
842842 obj = Data_Wrap_Struct(cImage, 0, Image_release, image);
843843
844844 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);
847847 image->width = srcimage->width / x;
848848 image->height = srcimage->height / y;
849849 // image->lockcount = 0;
850-
851850 rb_ary_push( array, obj );
852851 g_iRefAll++;
853852 }
@@ -859,8 +858,8 @@
859858 {
860859 for( j = 0; j < x; j++ )
861860 {
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)),
864863 INT2FIX(srcimage->width / x),
865864 INT2FIX(srcimage->height / y)};
866865 rb_ary_push( array, Image_slice_instance( 4, ary, obj ) );
--- branches/1.5dev/image.h (revision 394)
+++ branches/1.5dev/image.h (revision 395)
@@ -1,10 +1,10 @@
11 /* Imageオブジェクトの中身 */
22 struct DXRubyImage {
33 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;/* イメージの高さ */
88 // int lockcount; /* ロックカウント */
99 };
1010
Show on old repository browser