| 74 | } |
| 75 | |
| 76 | GJS_JSAPI_RETURN_CONVENTION |
| 77 | static bool getFormat_func(JSContext* cx, unsigned argc, JS::Value* vp) { |
| 78 | GJS_GET_THIS(cx, argc, vp, rec, obj); |
| 79 | |
| 80 | if (argc > 1) { |
| 81 | gjs_throw(cx, "ImageSurface.getFormat() takes no arguments"); |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | cairo_surface_t* surface = CairoSurface::for_js(cx, obj); |
| 86 | if (!surface) |
| 87 | return false; |
| 88 | |
| 89 | cairo_format_t format = cairo_image_surface_get_format(surface); |
| 90 | |
| 91 | if (!gjs_cairo_check_status(cx, cairo_surface_status(surface), "surface")) |
| 92 | return false; |
| 93 | |
| 94 | rec.rval().setInt32(format); |
| 95 | return true; |
| 96 | } |
| 97 | |
| 98 | GJS_JSAPI_RETURN_CONVENTION |
| 99 | static bool getWidth_func(JSContext* cx, unsigned argc, JS::Value* vp) { |
nothing calls this directly
no test coverage detected