* @brief Replace the plot title; passing NULL clears it to "". * * Deep-copies @p title into the plot, then frees the previous title * string. Passing NULL stores the empty string "" (which renders as * a blank title bar) rather than leaving the field NULL — so the * renderer can always safely dereference @c plot->title. * * Ownership semantics: the caller may free its copy of @p title * i
| 948 | } |
| 949 | |
| 950 | /* Reuse a window that is already open (closing it would tear down the |
| 951 | caller's context); otherwise open a hidden one just for the export. */ |
| 952 | bool ownWindow = !IsWindowReady(); |
| 953 | if (ownWindow) { |
| 954 | SetTraceLogLevel(LOG_NONE); |
| 955 | SetConfigFlags(FLAG_WINDOW_HIDDEN); |
| 956 | InitWindow(plot->width, plot->height, "Plot Export"); |
| 957 | if (!IsWindowReady()) { |
| 958 | /* no display / GL context: the GL calls below would crash */ |
| 959 | SetTraceLogLevel(LOG_INFO); |
| 960 | PLOT_LOG("[plot_export_image]: InitWindow failed -> false"); |
| 961 | return false; |
| 962 | } |
| 963 | } |
| 964 | |
| 965 | RenderTexture2D target = LoadRenderTexture(plot->width, plot->height); |
| 966 | if (target.id == 0) { |
| 967 | if (ownWindow) { |
| 968 | CloseWindow(); |
| 969 | SetTraceLogLevel(LOG_INFO); |
| 970 | } |
nothing calls this directly
no test coverage detected