[gjs/mozjs102: 46/62] cairo-context: Move $dispose() implementation inside CairoContext class
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/mozjs102: 46/62] cairo-context: Move $dispose() implementation inside CairoContext class
- Date: Sun, 7 Aug 2022 17:53:00 +0000 (UTC)
commit 2b1e8df65e4bb33796288a9e40be36ee257fe060
Author: Philip Chimento <philip chimento gmail com>
Date: Sat Aug 6 15:55:42 2022 -0700
cairo-context: Move $dispose() implementation inside CairoContext class
Access to the wrapper object's cairo_t* is currently not encapsulated,
but it will be if we move from JS::SetPrivate to reserved slots. So, this
method needs to be part of the class.
modules/cairo-context.cpp | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/modules/cairo-context.cpp b/modules/cairo-context.cpp
index e321a6f26..fd6429870 100644
--- a/modules/cairo-context.cpp
+++ b/modules/cairo-context.cpp
@@ -353,12 +353,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC2(translate, cairo_translate, "ff", double, tx, do
_GJS_CAIRO_CONTEXT_DEFINE_FUNC2FFAFF(userToDevice, cairo_user_to_device, "x", "y")
_GJS_CAIRO_CONTEXT_DEFINE_FUNC2FFAFF(userToDeviceDistance, cairo_user_to_device_distance, "x", "y")
-GJS_JSAPI_RETURN_CONVENTION
-static bool
-dispose_func(JSContext *context,
- unsigned argc,
- JS::Value *vp)
-{
+bool CairoContext::dispose(JSContext* context, unsigned argc, JS::Value* vp) {
_GJS_CAIRO_CONTEXT_GET_PRIV_CR_CHECKED(context, argc, vp, rec, obj);
cairo_destroy(cr);
@@ -821,7 +816,7 @@ static bool textExtents_func(JSContext* cx, unsigned argc, JS::Value* vp) {
// clang-format off
const JSFunctionSpec CairoContext::proto_funcs[] = {
- JS_FN("$dispose", dispose_func, 0, 0),
+ JS_FN("$dispose", &CairoContext::dispose, 0, 0),
JS_FN("appendPath", appendPath_func, 0, 0),
JS_FN("arc", arc_func, 0, 0),
JS_FN("arcNegative", arcNegative_func, 0, 0),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]