| 96 | } |
| 97 | |
| 98 | GJS_JSAPI_RETURN_CONVENTION |
| 99 | static bool getWidth_func(JSContext* cx, unsigned argc, JS::Value* vp) { |
| 100 | GJS_GET_THIS(cx, argc, vp, rec, obj); |
| 101 | |
| 102 | if (argc > 1) { |
| 103 | gjs_throw(cx, "ImageSurface.getWidth() takes no arguments"); |
| 104 | return false; |
| 105 | } |
| 106 | |
| 107 | cairo_surface_t* surface = CairoSurface::for_js(cx, obj); |
| 108 | if (!surface) |
| 109 | return false; |
| 110 | |
| 111 | int width = cairo_image_surface_get_width(surface); |
| 112 | |
| 113 | if (!gjs_cairo_check_status(cx, cairo_surface_status(surface), "surface")) |
| 114 | return false; |
| 115 | |
| 116 | rec.rval().setInt32(width); |
| 117 | return true; |
| 118 | } |
| 119 | |
| 120 | GJS_JSAPI_RETURN_CONVENTION |
| 121 | static bool getHeight_func(JSContext* cx, unsigned argc, JS::Value* vp) { |
nothing calls this directly
no test coverage detected