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

Function getSource_func

modules/cairo-context.cpp:690–713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

688 return true;
689}
690GJS_JSAPI_RETURN_CONVENTION
691static bool getSource_func(JSContext* cx, unsigned argc, JS::Value* vp) {
692 GJS_CAIRO_CONTEXT_GET_PRIV_CR_CHECKED(cx, argc, vp, rec, obj);
693
694 if (argc > 0) {
695 gjs_throw(cx, "Context.getSource() takes no arguments");
696 return false;
697 }
698
699 cairo_pattern_t* pattern = cairo_get_source(cr);
700 if (!gjs_cairo_check_status(cx, cairo_status(cr), "context"))
701 return false;
702
703 // pattern belongs to the context, so keep the reference
704 JSObject* pattern_wrapper = gjs_cairo_pattern_from_pattern(cx, pattern);
705 if (!pattern_wrapper) {
706 gjs_throw(cx, "failed to create pattern");
707 return false;
708 }
709
710 rec.rval().setObject(*pattern_wrapper);
711
712 return true;
713}
714
715GJS_JSAPI_RETURN_CONVENTION
716static bool getTarget_func(JSContext* cx, unsigned argc, JS::Value* vp) {

Callers

nothing calls this directly

Calls 3

gjs_throwFunction · 0.85
gjs_cairo_check_statusFunction · 0.85

Tested by

no test coverage detected