mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +01:00
wrlib: Added clean-up of library internals in 'RShutdown'
The library uses internally a cache of tables to convert image to different depths, there is now an internal function 'r_destroy_conversion_tables' to free them.
This commit is contained in:
committed by
Carlos R. Mafra
parent
e237ec15a0
commit
1b2e8a6491
@@ -28,6 +28,7 @@ libwraster_la_SOURCES = \
|
|||||||
save.c \
|
save.c \
|
||||||
gradient.c \
|
gradient.c \
|
||||||
xpixmap.c \
|
xpixmap.c \
|
||||||
|
convert.h \
|
||||||
convert.c \
|
convert.c \
|
||||||
context.c \
|
context.c \
|
||||||
misc.c \
|
misc.c \
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "wraster.h"
|
#include "wraster.h"
|
||||||
|
#include "convert.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_XSHM
|
#ifdef USE_XSHM
|
||||||
extern Pixmap R_CreateXImageMappedPixmap(RContext * context, RXImage * ximage);
|
extern Pixmap R_CreateXImageMappedPixmap(RContext * context, RXImage * ximage);
|
||||||
@@ -62,6 +64,38 @@ typedef struct RStdConversionTable {
|
|||||||
static RConversionTable *conversionTable = NULL;
|
static RConversionTable *conversionTable = NULL;
|
||||||
static RStdConversionTable *stdConversionTable = NULL;
|
static RStdConversionTable *stdConversionTable = NULL;
|
||||||
|
|
||||||
|
static void release_conversion_table(void)
|
||||||
|
{
|
||||||
|
RConversionTable *tmp = conversionTable;
|
||||||
|
|
||||||
|
while (tmp) {
|
||||||
|
RConversionTable *tmp_to_delete = tmp;
|
||||||
|
|
||||||
|
tmp = tmp->next;
|
||||||
|
free(tmp_to_delete);
|
||||||
|
}
|
||||||
|
conversionTable = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void release_std_conversion_table(void)
|
||||||
|
{
|
||||||
|
RStdConversionTable *tmp = stdConversionTable;
|
||||||
|
|
||||||
|
while (tmp) {
|
||||||
|
RStdConversionTable *tmp_to_delete = tmp;
|
||||||
|
|
||||||
|
tmp = tmp->next;
|
||||||
|
free(tmp_to_delete);
|
||||||
|
}
|
||||||
|
stdConversionTable = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void r_destroy_conversion_tables(void)
|
||||||
|
{
|
||||||
|
release_conversion_table();
|
||||||
|
release_std_conversion_table();
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned short *computeTable(unsigned short mask)
|
static unsigned short *computeTable(unsigned short mask)
|
||||||
{
|
{
|
||||||
RConversionTable *tmp = conversionTable;
|
RConversionTable *tmp = conversionTable;
|
||||||
|
|||||||
39
wrlib/convert.h
Normal file
39
wrlib/convert.h
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Raster graphics library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014 Window Maker Team
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions to convert images to given color depths
|
||||||
|
*
|
||||||
|
* The functions here are for WRaster library's internal use only,
|
||||||
|
* Please use functions in 'wraster.h' in applications
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WRASTER_CONVERT_H
|
||||||
|
#define WRASTER_CONVERT_H
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function for to release internal Conversion Tables
|
||||||
|
*/
|
||||||
|
void r_destroy_conversion_tables(void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "wraster.h"
|
#include "wraster.h"
|
||||||
#include "imgformat.h"
|
#include "imgformat.h"
|
||||||
|
#include "convert.h"
|
||||||
|
|
||||||
|
|
||||||
void RBevelImage(RImage * image, int bevel_type)
|
void RBevelImage(RImage * image, int bevel_type)
|
||||||
@@ -252,4 +253,5 @@ void RShutdown(void)
|
|||||||
RReleaseMagick();
|
RReleaseMagick();
|
||||||
#endif
|
#endif
|
||||||
RReleaseCache();
|
RReleaseCache();
|
||||||
|
r_destroy_conversion_tables();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user