MCPcopy Create free account
hub / github.com/GNOME/gjs / getFormat_func

Function getFormat_func

modules/cairo-image-surface.cpp:76–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76GJS_JSAPI_RETURN_CONVENTION
77static 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
98GJS_JSAPI_RETURN_CONVENTION
99static bool getWidth_func(JSContext* cx, unsigned argc, JS::Value* vp) {

Callers

nothing calls this directly

Calls 2

gjs_throwFunction · 0.85
gjs_cairo_check_statusFunction · 0.85

Tested by

no test coverage detected