| 688 | return true; |
| 689 | } |
| 690 | GJS_JSAPI_RETURN_CONVENTION |
| 691 | static 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 | |
| 715 | GJS_JSAPI_RETURN_CONVENTION |
| 716 | static bool getTarget_func(JSContext* cx, unsigned argc, JS::Value* vp) { |
nothing calls this directly
no test coverage detected