diff --git a/lime/_backend/native/NativeCFFI.hx b/lime/_backend/native/NativeCFFI.hx index 9a06b7b19..d3ed0f9c1 100644 --- a/lime/_backend/native/NativeCFFI.hx +++ b/lime/_backend/native/NativeCFFI.hx @@ -743,7 +743,7 @@ class NativeCFFI { @:hlNative("lime", "lime_cairo_fill_extents") private static function lime_cairo_fill_extents (handle:CFFIPointer, x1:Float, y1:Float, x2:Float, y2:Float):Void {} @:hlNative("lime", "lime_cairo_fill_preserve") private static function lime_cairo_fill_preserve (handle:CFFIPointer):Void {} @:hlNative("lime", "lime_cairo_get_antialias") private static function lime_cairo_get_antialias (handle:CFFIPointer):Int { return 0; } - @:hlNative("lime", "lime_cairo_get_current_point") private static function lime_cairo_get_current_point (handle:CFFIPointer):Vector2 { return null; } + @:hlNative("lime", "lime_cairo_get_current_point") private static function lime_cairo_get_current_point (handle:CFFIPointer, out:Vector2):Vector2 { return null; } @:hlNative("lime", "lime_cairo_get_dash") private static function lime_cairo_get_dash (handle:CFFIPointer):hl.NativeArray { return null; } @:hlNative("lime", "lime_cairo_get_dash_count") private static function lime_cairo_get_dash_count (handle:CFFIPointer):Int { return 0; } @:hlNative("lime", "lime_cairo_get_fill_rule") private static function lime_cairo_get_fill_rule (handle:CFFIPointer):Int { return 0; } @@ -753,7 +753,7 @@ class NativeCFFI { @:hlNative("lime", "lime_cairo_get_line_cap") private static function lime_cairo_get_line_cap (handle:CFFIPointer):Int { return 0; } @:hlNative("lime", "lime_cairo_get_line_join") private static function lime_cairo_get_line_join (handle:CFFIPointer):Int { return 0; } @:hlNative("lime", "lime_cairo_get_line_width") private static function lime_cairo_get_line_width (handle:CFFIPointer):Float { return 0; } - @:hlNative("lime", "lime_cairo_get_matrix") private static function lime_cairo_get_matrix (handle:CFFIPointer):Matrix3 { return null; } + @:hlNative("lime", "lime_cairo_get_matrix") private static function lime_cairo_get_matrix (handle:CFFIPointer, out:Matrix3):Matrix3 { return null; } @:hlNative("lime", "lime_cairo_get_miter_limit") private static function lime_cairo_get_miter_limit (handle:CFFIPointer):Float { return 0; } @:hlNative("lime", "lime_cairo_get_operator") private static function lime_cairo_get_operator (handle:CFFIPointer):Int { return 0; } @:hlNative("lime", "lime_cairo_get_source") private static function lime_cairo_get_source (handle:CFFIPointer):CFFIPointer { return null; } @@ -793,7 +793,7 @@ class NativeCFFI { @:hlNative("lime", "lime_cairo_set_line_cap") private static function lime_cairo_set_line_cap (handle:CFFIPointer, cap:Int):Void {} @:hlNative("lime", "lime_cairo_set_line_join") private static function lime_cairo_set_line_join (handle:CFFIPointer, join:Int):Void {} @:hlNative("lime", "lime_cairo_set_line_width") private static function lime_cairo_set_line_width (handle:CFFIPointer, width:Float):Void {} - @:hlNative("lime", "lime_cairo_set_matrix") private static function lime_cairo_set_matrix (handle:CFFIPointer, a:Float, b:Float, c:Float, d:Float, tx:Float, ty:Float):Void {} + @:hlNative("lime", "lime_cairo_set_matrix") private static function lime_cairo_set_matrix (handle:CFFIPointer, matrix:Matrix3):Void {} // @:hlNative("lime", "lime_cairo_create") private static function lime_cairo_set_matrix (handle:CFFIPointer, matrix:Dynamic):Void {} @:hlNative("lime", "lime_cairo_set_miter_limit") private static function lime_cairo_set_miter_limit (handle:CFFIPointer, miterLimit:Float):Void {} @:hlNative("lime", "lime_cairo_set_operator") private static function lime_cairo_set_operator (handle:CFFIPointer, op:Int):Void {} @@ -842,7 +842,7 @@ class NativeCFFI { @:hlNative("lime", "lime_cairo_pattern_get_color_stop_count") private static function lime_cairo_pattern_get_color_stop_count (handle:CFFIPointer):Int { return 0; } @:hlNative("lime", "lime_cairo_pattern_get_extend") private static function lime_cairo_pattern_get_extend (handle:CFFIPointer):Int { return 0; } @:hlNative("lime", "lime_cairo_pattern_get_filter") private static function lime_cairo_pattern_get_filter (handle:CFFIPointer):Int { return 0; } - @:hlNative("lime", "lime_cairo_pattern_get_matrix") private static function lime_cairo_pattern_get_matrix (handle:CFFIPointer):Matrix3 { return null; } + @:hlNative("lime", "lime_cairo_pattern_get_matrix") private static function lime_cairo_pattern_get_matrix (handle:CFFIPointer, out:Matrix3):Matrix3 { return null; } @:hlNative("lime", "lime_cairo_pattern_set_extend") private static function lime_cairo_pattern_set_extend (handle:CFFIPointer, extend:Int):Void {} @:hlNative("lime", "lime_cairo_pattern_set_filter") private static function lime_cairo_pattern_set_filter (handle:CFFIPointer, filter:Int):Void {} @:hlNative("lime", "lime_cairo_pattern_set_matrix") private static function lime_cairo_pattern_set_matrix (handle:CFFIPointer, matrix:Matrix3):Void {} diff --git a/lime/_backend/native/NativeRenderer.hx b/lime/_backend/native/NativeRenderer.hx index f9eab448c..5c4dba454 100644 --- a/lime/_backend/native/NativeRenderer.hx +++ b/lime/_backend/native/NativeRenderer.hx @@ -73,8 +73,6 @@ class NativeRenderer { var type:String = NativeCFFI.lime_renderer_get_type (handle); #end - trace (type); - switch (type) { case "opengl": diff --git a/lime/graphics/cairo/Cairo.hx b/lime/graphics/cairo/Cairo.hx index ec7526494..8a1600563 100644 --- a/lime/graphics/cairo/Cairo.hx +++ b/lime/graphics/cairo/Cairo.hx @@ -554,9 +554,13 @@ class Cairo { @:noCompletion private function get_currentPoint ():Vector2 { #if (lime_cffi && lime_cairo && !macro) + #if hl + return NativeCFFI.lime_cairo_get_current_point (handle, new Vector2 ()); + #else var vec:Dynamic = NativeCFFI.lime_cairo_get_current_point (handle); return new Vector2 (vec.x, vec.y); #end + #end return null; @@ -768,9 +772,13 @@ class Cairo { @:noCompletion private function get_matrix ():Matrix3 { #if (lime_cffi && lime_cairo && !macro) + #if hl + return NativeCFFI.lime_cairo_get_matrix (handle, new Matrix3 ()); + #else var m:Dynamic = NativeCFFI.lime_cairo_get_matrix (handle); return new Matrix3 (m.a, m.b, m.c, m.d, m.tx, m.ty); #end + #end return null; @@ -780,9 +788,13 @@ class Cairo { @:noCompletion private function set_matrix (value:Matrix3):Matrix3 { #if (lime_cffi && lime_cairo && !macro) + #if hl + NativeCFFI.lime_cairo_set_matrix (handle, value); + #else NativeCFFI.lime_cairo_set_matrix (handle, value.a, value.b, value.c, value.d, value.tx, value.ty); //NativeCFFI.lime_cairo_set_matrix (handle, value); #end + #end return value; diff --git a/lime/graphics/cairo/CairoPattern.hx b/lime/graphics/cairo/CairoPattern.hx index 1d1fcda71..601f33d80 100644 --- a/lime/graphics/cairo/CairoPattern.hx +++ b/lime/graphics/cairo/CairoPattern.hx @@ -162,8 +162,12 @@ abstract CairoPattern(CFFIPointer) from CFFIPointer to CFFIPointer { @:noCompletion private function get_matrix ():Matrix3 { #if (lime_cffi && lime_cairo && !macro) + #if hl + return NativeCFFI.lime_cairo_pattern_get_matrix (this, new Matrix3 ()); + #else var m:Dynamic = NativeCFFI.lime_cairo_pattern_get_matrix (this); return new Matrix3 (m.a, m.b, m.c, m.d, m.tx, m.ty); + #end #else return null; #end diff --git a/project/include/graphics/Image.h b/project/include/graphics/Image.h index cab2a53d6..721709eac 100644 --- a/project/include/graphics/Image.h +++ b/project/include/graphics/Image.h @@ -18,7 +18,7 @@ namespace lime { int height; int offsetX; int offsetY; - HL_Rectangle* rect; + Rectangle* rect; /*ImageType*/ int type; int version; int width; diff --git a/project/include/math/Matrix3.h b/project/include/math/Matrix3.h index 196a7f831..3d715147b 100644 --- a/project/include/math/Matrix3.h +++ b/project/include/math/Matrix3.h @@ -8,7 +8,7 @@ namespace lime { - struct HL_Matrix3 { + struct Matrix3 { hl_type* t; double a; @@ -18,29 +18,12 @@ namespace lime { double tx; double ty; - }; - - - class Matrix3 { - - - public: - - Matrix3 (); - Matrix3 (double a, double b, double c, double d, double tx, double ty); - Matrix3 (value matrix3); - Matrix3 (HL_Matrix3* matrix3); - - vdynamic* Dynamic (); - value Value (); - - double a; - double b; - double c; - double d; - double tx; - double ty; + Matrix3 (double a, double b, double c, double d, double tx, double ty); + Matrix3 (value matrix3); + void SetTo (double a, double b, double c, double d, double tx, double ty); + value Value (); + value Value (value matrix3); }; diff --git a/project/include/math/Rectangle.h b/project/include/math/Rectangle.h index 8b7458d3e..1d22bbeee 100644 --- a/project/include/math/Rectangle.h +++ b/project/include/math/Rectangle.h @@ -8,7 +8,7 @@ namespace lime { - struct HL_Rectangle { + struct Rectangle { hl_type* t; double height; @@ -16,27 +16,13 @@ namespace lime { double x; double y; - }; - - - class Rectangle { - - - public: - - Rectangle (); - Rectangle (double x, double y, double width, double height); - Rectangle (value rect); - Rectangle (HL_Rectangle* rect); - - void Contract (double x, double y, double width, double height); - value Value (); - - double height; - double width; - double x; - double y; + Rectangle (double x, double y, double width, double height); + Rectangle (value rect); + void Contract (double x, double y, double width, double height); + void SetTo (double x, double y, double width, double height); + value Value (); + value Value (value rect); }; diff --git a/project/include/math/Vector2.h b/project/include/math/Vector2.h index ce61808f1..c768e94e9 100644 --- a/project/include/math/Vector2.h +++ b/project/include/math/Vector2.h @@ -8,32 +8,19 @@ namespace lime { - struct HL_Vector2 { + struct Vector2 { hl_type* t; double length; double x; double y; - }; - - - class Vector2 { - - - public: - - Vector2 (); - Vector2 (double x, double y); - Vector2 (value vec); - Vector2 (HL_Vector2* vec); - - vdynamic* Dynamic (); - value Value (); - - double x; - double y; + Vector2 (double x, double y); + Vector2 (value vec); + void SetTo (double x, double y); + value Value (); + value Value (value vec); }; diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index 7690407a5..fbd8c9b55 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -1904,11 +1904,10 @@ namespace lime { } - HL_PRIM void hl_lime_image_data_util_color_transform (Image* image, HL_Rectangle* rect, ArrayBufferView* colorMatrix) { + HL_PRIM void hl_lime_image_data_util_color_transform (Image* image, Rectangle* rect, ArrayBufferView* colorMatrix) { - Rectangle _rect = Rectangle (rect); ColorMatrix _colorMatrix = ColorMatrix (colorMatrix); - ImageDataUtil::ColorTransform (image, &_rect, &_colorMatrix); + ImageDataUtil::ColorTransform (image, rect, &_colorMatrix); } @@ -1924,11 +1923,9 @@ namespace lime { } - HL_PRIM void hl_lime_image_data_util_copy_channel (Image* image, Image* sourceImage, HL_Rectangle* sourceRect, HL_Vector2* destPoint, int srcChannel, int destChannel) { + HL_PRIM void hl_lime_image_data_util_copy_channel (Image* image, Image* sourceImage, Rectangle* sourceRect, Vector2* destPoint, int srcChannel, int destChannel) { - Rectangle _sourceRect = Rectangle (sourceRect); - Vector2 _destPoint = Vector2 (destPoint); - ImageDataUtil::CopyChannel (image, sourceImage, &_sourceRect, &_destPoint, srcChannel, destChannel); + ImageDataUtil::CopyChannel (image, sourceImage, sourceRect, destPoint, srcChannel, destChannel); } @@ -1956,20 +1953,15 @@ namespace lime { } - HL_PRIM void hl_lime_image_data_util_copy_pixels (Image* image, Image* sourceImage, HL_Rectangle* sourceRect, HL_Vector2* destPoint, Image* alphaImage, HL_Vector2* alphaPoint, bool mergeAlpha) { - - Rectangle _sourceRect = Rectangle (sourceRect); - Vector2 _destPoint = Vector2 (destPoint); + HL_PRIM void hl_lime_image_data_util_copy_pixels (Image* image, Image* sourceImage, Rectangle* sourceRect, Vector2* destPoint, Image* alphaImage, Vector2* alphaPoint, bool mergeAlpha) { if (!alphaImage) { - ImageDataUtil::CopyPixels (image, sourceImage, &_sourceRect, &_destPoint, NULL, NULL, mergeAlpha); + ImageDataUtil::CopyPixels (image, sourceImage, sourceRect, destPoint, NULL, NULL, mergeAlpha); } else { - Vector2 _alphaPoint = Vector2 (alphaPoint); - - ImageDataUtil::CopyPixels (image, sourceImage, &_sourceRect, &_destPoint, alphaImage, &_alphaPoint, mergeAlpha); + ImageDataUtil::CopyPixels (image, sourceImage, sourceRect, destPoint, alphaImage, alphaPoint, mergeAlpha); } @@ -1986,11 +1978,10 @@ namespace lime { } - HL_PRIM void hl_lime_image_data_util_fill_rect (Image* image, HL_Rectangle* rect, int rg, int ba) { + HL_PRIM void hl_lime_image_data_util_fill_rect (Image* image, Rectangle* rect, int rg, int ba) { - Rectangle _rect = Rectangle (rect); int32_t color = (rg << 16) | ba; - ImageDataUtil::FillRect (image, &_rect, color); + ImageDataUtil::FillRect (image, rect, color); } @@ -2023,11 +2014,9 @@ namespace lime { } - HL_PRIM void hl_lime_image_data_util_get_pixels (Image* image, HL_Rectangle* rect, int format, Bytes* bytes) { + HL_PRIM void hl_lime_image_data_util_get_pixels (Image* image, Rectangle* rect, PixelFormat format, Bytes* bytes) { - Rectangle _rect = Rectangle (rect); - PixelFormat _format = (PixelFormat)format; - ImageDataUtil::GetPixels (image, &_rect, _format, bytes); + ImageDataUtil::GetPixels (image, rect, format, bytes); } @@ -2043,11 +2032,9 @@ namespace lime { } - HL_PRIM void hl_lime_image_data_util_merge (Image* image, Image* sourceImage, HL_Rectangle* sourceRect, HL_Vector2* destPoint, int redMultiplier, int greenMultiplier, int blueMultiplier, int alphaMultiplier) { + HL_PRIM void hl_lime_image_data_util_merge (Image* image, Image* sourceImage, Rectangle* sourceRect, Vector2* destPoint, int redMultiplier, int greenMultiplier, int blueMultiplier, int alphaMultiplier) { - Rectangle _sourceRect = Rectangle (sourceRect); - Vector2 _destPoint = Vector2 (destPoint); - ImageDataUtil::Merge (image, sourceImage, &_sourceRect, &_destPoint, redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier); + ImageDataUtil::Merge (image, sourceImage, sourceRect, destPoint, redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier); } @@ -2111,10 +2098,9 @@ namespace lime { } - HL_PRIM void hl_lime_image_data_util_set_pixels (Image* image, HL_Rectangle* rect, Bytes* bytes, int offset, PixelFormat format, Endian endian) { + HL_PRIM void hl_lime_image_data_util_set_pixels (Image* image, Rectangle* rect, Bytes* bytes, int offset, PixelFormat format, Endian endian) { - Rectangle _rect = Rectangle (rect); - ImageDataUtil::SetPixels (image, &_rect, bytes, offset, format, endian); + ImageDataUtil::SetPixels (image, rect, bytes, offset, format, endian); } @@ -2133,14 +2119,12 @@ namespace lime { } - HL_PRIM int hl_lime_image_data_util_threshold (Image* image, Image* sourceImage, HL_Rectangle* sourceRect, HL_Vector2* destPoint, int operation, int thresholdRG, int thresholdBA, int colorRG, int colorBA, int maskRG, int maskBA, bool copySource) { + HL_PRIM int hl_lime_image_data_util_threshold (Image* image, Image* sourceImage, Rectangle* sourceRect, Vector2* destPoint, int operation, int thresholdRG, int thresholdBA, int colorRG, int colorBA, int maskRG, int maskBA, bool copySource) { - Rectangle _sourceRect = Rectangle (sourceRect); - Vector2 _destPoint = Vector2 (destPoint); int32_t threshold = (thresholdRG << 16) | thresholdBA; int32_t color = (colorRG << 16) | colorBA; int32_t mask = (maskRG << 16) | maskBA; - return ImageDataUtil::Threshold (image, sourceImage, &_sourceRect, &_destPoint, operation, threshold, color, mask, copySource); + return ImageDataUtil::Threshold (image, sourceImage, sourceRect, destPoint, operation, threshold, color, mask, copySource); } @@ -2823,14 +2807,13 @@ namespace lime { } - HL_PRIM ImageBuffer* hl_lime_renderer_read_pixels (HL_CFFIPointer* renderer, HL_Rectangle* rect, ImageBuffer* imageBuffer) { + HL_PRIM ImageBuffer* hl_lime_renderer_read_pixels (HL_CFFIPointer* renderer, Rectangle* rect, ImageBuffer* imageBuffer) { Renderer* targetRenderer = (Renderer*)renderer->ptr; if (rect) { - Rectangle _rect = Rectangle (rect); - targetRenderer->ReadPixels (imageBuffer, &_rect); + targetRenderer->ReadPixels (imageBuffer, rect); } else { diff --git a/project/src/graphics/cairo/CairoBindings.cpp b/project/src/graphics/cairo/CairoBindings.cpp index 7eac099e8..9c5134cfc 100644 --- a/project/src/graphics/cairo/CairoBindings.cpp +++ b/project/src/graphics/cairo/CairoBindings.cpp @@ -519,7 +519,7 @@ namespace lime { Font* font = (Font*)face->ptr; cairo_font_face_t* cairoFont = cairo_ft_font_face_create_for_ft_face ((FT_Face)font->face, flags); - ValuePointer* fontReference = new ValuePointer ((vdynamic*)face->ptr); + ValuePointer* fontReference = new ValuePointer ((vobj*)face->ptr); cairo_font_face_set_user_data (cairoFont, &userData, fontReference, gc_user_data); HL_CFFIPointer* object = HLCFFIPointer (cairoFont, (hl_finalizer)hl_gc_cairo_font_face); @@ -558,12 +558,10 @@ namespace lime { } - HL_PRIM HL_Vector2* hl_lime_cairo_get_current_point (HL_CFFIPointer* handle) { + HL_PRIM Vector2* hl_lime_cairo_get_current_point (HL_CFFIPointer* handle, Vector2* out) { - double x, y; - cairo_get_current_point ((cairo_t*)handle->ptr, &x, &y); - Vector2 vec2 = Vector2 (x, y); - return (HL_Vector2*)vec2.Dynamic (); + cairo_get_current_point ((cairo_t*)handle->ptr, &out->x, &out->y); + return out; } @@ -795,12 +793,18 @@ namespace lime { } - HL_PRIM HL_Matrix3* hl_lime_cairo_get_matrix (HL_CFFIPointer* handle) { + HL_PRIM Matrix3* hl_lime_cairo_get_matrix (HL_CFFIPointer* handle, Matrix3* out) { - cairo_matrix_t cm; - cairo_get_matrix ((cairo_t*)handle->ptr, &cm); - Matrix3 mat3 = Matrix3 (cm.xx, cm.yx, cm.xy, cm.yy, cm.x0, cm.y0); - return (HL_Matrix3*)mat3.Dynamic (); + // cairo_matrix_t cm; + // cairo_get_matrix ((cairo_t*)handle->ptr, &cm); + // out->a = cm.xx; + // out->b = cm.yx; + // out->c = cm.xy; + // out->d = cm.yy; + // out->tx = cm.x0; + // out->ty = cm.y0; + cairo_get_matrix ((cairo_t*)handle->ptr, (cairo_matrix_t*)&out->a); + return out; } @@ -1443,12 +1447,18 @@ namespace lime { } - HL_PRIM HL_Matrix3* hl_lime_cairo_pattern_get_matrix (HL_CFFIPointer* handle) { + HL_PRIM Matrix3* hl_lime_cairo_pattern_get_matrix (HL_CFFIPointer* handle, Matrix3* out) { - cairo_matrix_t cm; - cairo_pattern_get_matrix ((cairo_pattern_t*)handle->ptr, &cm); - Matrix3 mat3 = Matrix3 (cm.xx, cm.yx, cm.xy, cm.yy, cm.x0, cm.y0); - return (HL_Matrix3*)mat3.Dynamic (); + // cairo_matrix_t cm; + // cairo_pattern_get_matrix ((cairo_pattern_t*)handle->ptr, &cm); + // out->a = cm.xx; + // out->b = cm.yx; + // out->c = cm.xy; + // out->d = cm.yy; + // out->tx = cm.x0; + // out->ty = cm.y0; + cairo_pattern_get_matrix ((cairo_pattern_t*)handle->ptr, (cairo_matrix_t*)&out->a); + return out; } @@ -1493,14 +1503,14 @@ namespace lime { } - HL_PRIM void hl_lime_cairo_pattern_set_matrix (HL_CFFIPointer* handle, HL_Matrix3* matrix) { + HL_PRIM void hl_lime_cairo_pattern_set_matrix (HL_CFFIPointer* handle, Matrix3* matrix) { - Matrix3 mat3 = Matrix3 (matrix); + // cairo_matrix_t cm; + // cairo_matrix_init (&cm, mat3.a, mat3.b, mat3.c, mat3.d, mat3.tx, mat3.ty); - cairo_matrix_t cm; - cairo_matrix_init (&cm, mat3.a, mat3.b, mat3.c, mat3.d, mat3.tx, mat3.ty); + // cairo_pattern_set_matrix ((cairo_pattern_t*)handle->ptr, &cm); - cairo_pattern_set_matrix ((cairo_pattern_t*)handle->ptr, &cm); + cairo_pattern_set_matrix ((cairo_pattern_t*)handle->ptr, (cairo_matrix_t*)&matrix->a); } @@ -1908,12 +1918,12 @@ namespace lime { } - HL_PRIM void hl_lime_cairo_set_matrix (HL_CFFIPointer* handle, double a, double b, double c, double d, double tx, double ty) { + HL_PRIM void hl_lime_cairo_set_matrix (HL_CFFIPointer* handle, Matrix3* matrix) { - cairo_matrix_t cm; - cairo_matrix_init (&cm, a, b, c, d, tx, ty); + // cairo_matrix_t cm; + // cairo_matrix_init (&cm, a, b, c, d, tx, ty); - cairo_set_matrix ((cairo_t*)handle->ptr, &cm); + cairo_set_matrix ((cairo_t*)handle->ptr, (cairo_matrix_t*)&matrix->a); } @@ -2209,14 +2219,14 @@ namespace lime { } - HL_PRIM void hl_lime_cairo_transform (HL_CFFIPointer* handle, HL_Matrix3* matrix) { + HL_PRIM void hl_lime_cairo_transform (HL_CFFIPointer* handle, Matrix3* matrix) { - Matrix3 mat3 = Matrix3 (matrix); + // cairo_matrix_t cm; + // cairo_matrix_init (&cm, mat3.a, mat3.b, mat3.c, mat3.d, mat3.tx, mat3.ty); - cairo_matrix_t cm; - cairo_matrix_init (&cm, mat3.a, mat3.b, mat3.c, mat3.d, mat3.tx, mat3.ty); + // cairo_transform ((cairo_t*)handle->ptr, &cm); - cairo_transform ((cairo_t*)handle->ptr, &cm); + cairo_transform ((cairo_t*)handle->ptr, (cairo_matrix_t*)&matrix->a); } @@ -2414,7 +2424,7 @@ namespace lime { DEFINE_HL_PRIM (_VOID, lime_cairo_font_options_set_hint_style, _TCFFIPOINTER _I32); DEFINE_HL_PRIM (_VOID, lime_cairo_font_options_set_hint_metrics, _TCFFIPOINTER _I32); DEFINE_HL_PRIM (_I32, lime_cairo_get_antialias, _TCFFIPOINTER); - DEFINE_HL_PRIM (_TVECTOR2, lime_cairo_get_current_point, _TCFFIPOINTER); + DEFINE_HL_PRIM (_TVECTOR2, lime_cairo_get_current_point, _TCFFIPOINTER _TVECTOR2); DEFINE_HL_PRIM (_ARR, lime_cairo_get_dash, _TCFFIPOINTER); DEFINE_HL_PRIM (_I32, lime_cairo_get_dash_count, _TCFFIPOINTER); DEFINE_HL_PRIM (_I32, lime_cairo_get_fill_rule, _TCFFIPOINTER); @@ -2424,7 +2434,7 @@ namespace lime { DEFINE_HL_PRIM (_I32, lime_cairo_get_line_cap, _TCFFIPOINTER); DEFINE_HL_PRIM (_I32, lime_cairo_get_line_join, _TCFFIPOINTER); DEFINE_HL_PRIM (_F64, lime_cairo_get_line_width, _TCFFIPOINTER); - DEFINE_HL_PRIM (_TMATRIX3, lime_cairo_get_matrix, _TCFFIPOINTER); + DEFINE_HL_PRIM (_TMATRIX3, lime_cairo_get_matrix, _TCFFIPOINTER _TMATRIX3); DEFINE_HL_PRIM (_F64, lime_cairo_get_miter_limit, _TCFFIPOINTER); DEFINE_HL_PRIM (_I32, lime_cairo_get_operator, _TCFFIPOINTER); DEFINE_HL_PRIM (_TCFFIPOINTER, lime_cairo_get_source, _TCFFIPOINTER); @@ -2459,7 +2469,7 @@ namespace lime { DEFINE_HL_PRIM (_I32, lime_cairo_pattern_get_color_stop_count, _TCFFIPOINTER); DEFINE_HL_PRIM (_I32, lime_cairo_pattern_get_extend, _TCFFIPOINTER); DEFINE_HL_PRIM (_I32, lime_cairo_pattern_get_filter, _TCFFIPOINTER); - DEFINE_HL_PRIM (_TMATRIX3, lime_cairo_pattern_get_matrix, _TCFFIPOINTER); + DEFINE_HL_PRIM (_TMATRIX3, lime_cairo_pattern_get_matrix, _TCFFIPOINTER _TMATRIX3); DEFINE_HL_PRIM (_VOID, lime_cairo_pattern_set_extend, _TCFFIPOINTER _I32); DEFINE_HL_PRIM (_VOID, lime_cairo_pattern_set_filter, _TCFFIPOINTER _I32); DEFINE_HL_PRIM (_VOID, lime_cairo_pattern_set_matrix, _TCFFIPOINTER _TMATRIX3); @@ -2485,7 +2495,7 @@ namespace lime { DEFINE_HL_PRIM (_VOID, lime_cairo_set_line_cap, _TCFFIPOINTER _I32); DEFINE_HL_PRIM (_VOID, lime_cairo_set_line_join, _TCFFIPOINTER _I32); DEFINE_HL_PRIM (_VOID, lime_cairo_set_line_width, _TCFFIPOINTER _F64); - DEFINE_HL_PRIM (_VOID, lime_cairo_set_matrix, _TCFFIPOINTER _F64 _F64 _F64 _F64 _F64 _F64); + DEFINE_HL_PRIM (_VOID, lime_cairo_set_matrix, _TCFFIPOINTER _TMATRIX3); DEFINE_HL_PRIM (_VOID, lime_cairo_set_miter_limit, _TCFFIPOINTER _F64); DEFINE_HL_PRIM (_VOID, lime_cairo_set_operator, _TCFFIPOINTER _I32); DEFINE_HL_PRIM (_VOID, lime_cairo_set_source, _TCFFIPOINTER _TCFFIPOINTER); diff --git a/project/src/graphics/opengl/OpenGLBindings.cpp b/project/src/graphics/opengl/OpenGLBindings.cpp index 4c4f6e09e..bf4c06093 100644 --- a/project/src/graphics/opengl/OpenGLBindings.cpp +++ b/project/src/graphics/opengl/OpenGLBindings.cpp @@ -3871,7 +3871,7 @@ namespace lime { HL_PRIM HL_CFFIPointer* hl_lime_gl_object_register (int id, int type, void* object) { GLObjectType _type = (GLObjectType)type; - HL_CFFIPointer* handle = HLCFFIPointer ((vdynamic*)object, (hl_finalizer)gc_gl_object); + HL_CFFIPointer* handle = HLCFFIPointer ((vobj*)object, (hl_finalizer)gc_gl_object); //if (glObjects[_type].find (id) != glObjects[_type].end ()) { // diff --git a/project/src/math/Matrix3.cpp b/project/src/math/Matrix3.cpp index 03a98fae3..11abcb3a9 100644 --- a/project/src/math/Matrix3.cpp +++ b/project/src/math/Matrix3.cpp @@ -13,26 +13,11 @@ namespace lime { static bool init = false; - Matrix3::Matrix3 () { - - a = 1; - b = 0; - c = 0; - d = 1; - tx = 0; - ty = 0; - - } - - Matrix3::Matrix3 (double a, double b, double c, double d, double tx, double ty) { - this->a = a; - this->b = b; - this->c = c; - this->d = d; - this->tx = tx; - this->ty = ty; + t = 0; + + SetTo (a, b, c, d, tx, ty); } @@ -61,42 +46,34 @@ namespace lime { } - Matrix3::Matrix3 (HL_Matrix3* matrix3) { + void Matrix3::SetTo (double a, double b, double c, double d, double tx, double ty) { - a = matrix3->a; - b = matrix3->b; - c = matrix3->c; - d = matrix3->d; - tx = matrix3->tx; - ty = matrix3->ty; - - } - - - vdynamic* Matrix3::Dynamic () { - - HL_Matrix3* result = (HL_Matrix3*)malloc (sizeof (HL_Matrix3)); - result->a = a; - result->b = b; - result->c = c; - result->d = d; - result->tx = tx; - result->ty = ty; - return (vdynamic*) result; + this->a = a; + this->b = b; + this->c = c; + this->d = d; + this->tx = tx; + this->ty = ty; } value Matrix3::Value () { - value result = alloc_empty_object (); - alloc_field (result, id_a, alloc_float (a)); - alloc_field (result, id_b, alloc_float (b)); - alloc_field (result, id_c, alloc_float (c)); - alloc_field (result, id_d, alloc_float (d)); - alloc_field (result, id_tx, alloc_float (tx)); - alloc_field (result, id_ty, alloc_float (ty)); - return result; + return Value (alloc_empty_object ()); + + } + + + value Matrix3::Value (value matrix3) { + + alloc_field (matrix3, id_a, alloc_float (a)); + alloc_field (matrix3, id_b, alloc_float (b)); + alloc_field (matrix3, id_c, alloc_float (c)); + alloc_field (matrix3, id_d, alloc_float (d)); + alloc_field (matrix3, id_tx, alloc_float (tx)); + alloc_field (matrix3, id_ty, alloc_float (ty)); + return matrix3; } diff --git a/project/src/math/Rectangle.cpp b/project/src/math/Rectangle.cpp index 1ddcf5573..8659b0d3f 100644 --- a/project/src/math/Rectangle.cpp +++ b/project/src/math/Rectangle.cpp @@ -11,22 +11,11 @@ namespace lime { static bool init = false; - Rectangle::Rectangle () { - - height = 0; - width = 0; - x = 0; - y = 0; - - } - - Rectangle::Rectangle (double x, double y, double width, double height) { - this->height = height; - this->width = width; - this->x = x; - this->y = y; + t = 0; + + SetTo (x, y, width, height); } @@ -51,16 +40,6 @@ namespace lime { } - Rectangle::Rectangle (HL_Rectangle* rect) { - - width = rect->width; - height = rect->height; - x = rect->x; - y = rect->y; - - } - - void Rectangle::Contract (double x, double y, double width, double height) { if (this->width == 0 && this->height == 0) { @@ -80,8 +59,25 @@ namespace lime { } + void Rectangle::SetTo (double x, double y, double width, double height) { + + this->height = height; + this->width = width; + this->x = x; + this->y = y; + + } + + value Rectangle::Value () { + return Value (alloc_empty_object ()); + + } + + + value Rectangle::Value (value rect) { + if (!init) { id_height = val_id ("height"); @@ -92,7 +88,6 @@ namespace lime { } - value rect = alloc_empty_object (); alloc_field (rect, id_height, alloc_float (height)); alloc_field (rect, id_width, alloc_float (width)); alloc_field (rect, id_x, alloc_float (x)); diff --git a/project/src/math/Vector2.cpp b/project/src/math/Vector2.cpp index 3ec03634e..bdd67eefe 100644 --- a/project/src/math/Vector2.cpp +++ b/project/src/math/Vector2.cpp @@ -9,18 +9,11 @@ namespace lime { static bool init = false; - Vector2::Vector2 () { - - x = 0; - y = 0; - - } - - Vector2::Vector2 (double x, double y) { - this->x = x; - this->y = y; + t = 0; + + SetTo (x, y); } @@ -50,26 +43,23 @@ namespace lime { } - Vector2::Vector2 (HL_Vector2* vec) { + void Vector2::SetTo (double x, double y) { - x = vec->x; - y = vec->y; - - } - - - vdynamic* Vector2::Dynamic () { - - HL_Vector2* result = (HL_Vector2*)malloc (sizeof (HL_Vector2)); - result->x = x; - result->y = y; - return (vdynamic*) result; + this->x = x; + this->y = y; } value Vector2::Value () { + return Value (alloc_empty_object ()); + + } + + + value Vector2::Value (value vec) { + if (!init) { id_x = val_id ("x"); @@ -78,10 +68,9 @@ namespace lime { } - value result = alloc_empty_object (); - alloc_field (result, id_x, alloc_float (x)); - alloc_field (result, id_y, alloc_float (y)); - return result; + alloc_field (vec, id_x, alloc_float (x)); + alloc_field (vec, id_y, alloc_float (y)); + return vec; }