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

Function getWidth_func

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

Source from the content-addressed store, hash-verified

96}
97
98GJS_JSAPI_RETURN_CONVENTION
99static 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
120GJS_JSAPI_RETURN_CONVENTION
121static bool getHeight_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