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

Function make_rectangle

modules/cairo-region.cpp:119–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119GJS_JSAPI_RETURN_CONVENTION
120static JSObject* make_rectangle(JSContext* cx, cairo_rectangle_int_t* rect) {
121 const GjsAtoms& atoms = GjsContextPrivate::atoms(cx);
122 JS::RootedObject rect_obj{cx, JS_NewPlainObject(cx)};
123 if (!rect_obj)
124 return nullptr;
125 JS::RootedValue val{cx};
126
127 val = JS::Int32Value(rect->x);
128 if (!JS_SetPropertyById(cx, rect_obj, atoms.x(), val))
129 return nullptr;
130
131 val = JS::Int32Value(rect->y);
132 if (!JS_SetPropertyById(cx, rect_obj, atoms.y(), val))
133 return nullptr;
134
135 val = JS::Int32Value(rect->width);
136 if (!JS_SetPropertyById(cx, rect_obj, atoms.width(), val))
137 return nullptr;
138
139 val = JS::Int32Value(rect->height);
140 if (!JS_SetPropertyById(cx, rect_obj, atoms.height(), val))
141 return nullptr;
142
143 return rect_obj;
144}
145
146GJS_JSAPI_RETURN_CONVENTION
147static bool num_rectangles_func(JSContext* cx, unsigned argc, JS::Value* vp) {

Callers 1

get_rectangle_funcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected