int MinuiBackendAdf::InterfaceInit() { adf_interface_data intf_data; int err = adf_get_interface_data(intf_fd, &intf_data); if (err < 0) return err; int ret = 0; err = SurfaceInit(&intf_data.current_mode, &surfaces[0]); if (err < 0) { fprintf(stderr, "allocating surface 0 failed: %s\n", strerror(-err)); ret = err; goto done; } err = SurfaceInit(&intf_data.current_mode, &surfaces[1]); if (err < 0) { fprintf(stderr, "allocating surface 1 failed: %s\n", strerror(-err)); surfaces[1] = {}; n_surfaces = 1; } else { n_surfaces = 2; } done: adf_free_interface_data(&intf_data); return ret; }
int Tkpath_Init(Tcl_Interp *interp) /* Tcl interpreter. */ { #if defined(USE_TCL_STUBS) if (Tcl_InitStubs(interp, TKPATH_REQUIRE, 0) == NULL) { return TCL_ERROR; } #endif if (Tcl_PkgRequire(interp, "Tcl", TKPATH_REQUIRE, 0) == NULL) { return TCL_ERROR; } #if defined(USE_TK_STUBS) if (Tk_InitStubs(interp, TKPATH_REQUIRE, 0) == NULL) { return TCL_ERROR; } #endif if (Tcl_PkgRequire(interp, "Tk", TKPATH_REQUIRE, 0) == NULL) { return TCL_ERROR; } if (Tcl_CreateNamespace(interp, "::tkp", NULL, NULL) == NULL) { Tcl_ResetResult(interp); } Tcl_CreateObjCommand(interp, "::tkp::canvas", Tk_PathCanvasObjCmd, (ClientData) Tk_MainWindow(interp), NULL); gInterp = interp; /* * Link the ::tkp::antialias variable to control antialiasing. */ if (Tcl_LinkVar(interp, "::tkp::antialias", (char *) &gAntiAlias, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } /* * With gSurfaceCopyPremultiplyAlpha true we ignore the "premultiply alpha" * and use RGB as is. Else we need to divide each RGB with alpha * to get "true" values. */ if (Tcl_LinkVar(interp, "::tkp::premultiplyalpha", (char *) &gSurfaceCopyPremultiplyAlpha, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } if (Tcl_LinkVar(interp, "::tkp::depixelize", (char *) &gDepixelize, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } Tcl_CreateObjCommand(interp, "::tkp::pixelalign", PixelAlignObjCmd, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); /* * Make separate gradient objects, similar to SVG. */ PathGradientInit(interp); SurfaceInit(interp); /* * Style object. */ PathStyleInit(interp); return Tcl_PkgProvide(interp, "tkpath", TKPATH_PATCHLEVEL); }