mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-10-01 12:23:22 +08:00
100 lines
3.2 KiB
C
100 lines
3.2 KiB
C
///////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// IMPORTANT NOTICE
|
|
//
|
|
// The following open source license statement does not apply to any
|
|
// entity in the Exception List published by FMSoft.
|
|
//
|
|
// For more information, please visit:
|
|
//
|
|
// https://www.fmsoft.cn/exception-list
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
/*
|
|
* This file is part of MiniGUI, a mature cross-platform windowing
|
|
* and Graphics User Interface (GUI) support system for embedded systems
|
|
* and smart IoT devices.
|
|
*
|
|
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
|
* Copyright (C) 1998~2002, WEI Yongming
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program 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 General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Or,
|
|
*
|
|
* As this program is a library, any link to this program must follow
|
|
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
|
* GPLv3, you need to be licensed from FMSoft.
|
|
*
|
|
* If you have got a commercial license of this program, please use it
|
|
* under the terms and conditions of the commercial license.
|
|
*
|
|
* For more information about the commercial license, please refer to
|
|
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
|
*/
|
|
#define JPEG_INTERNALS
|
|
#include "jpeglib.h"
|
|
|
|
|
|
GLOBAL(void)
|
|
jpeg_abort (j_common_ptr cinfo)
|
|
{
|
|
int pool;
|
|
|
|
/* Releasing pools in reverse order might help avoid fragmentation
|
|
* with some (brain-damaged) malloc libraries.
|
|
*/
|
|
for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) {
|
|
(*cinfo->mem->free_pool) (cinfo, pool);
|
|
}
|
|
|
|
/* Reset overall state for possible reuse of object */
|
|
cinfo->global_state = (cinfo->is_decompressor ? DSTATE_START : CSTATE_START);
|
|
}
|
|
|
|
|
|
GLOBAL(void)
|
|
jpeg_destroy (j_common_ptr cinfo)
|
|
{
|
|
/* We need only tell the memory manager to release everything. */
|
|
/* NB: mem pointer is NULL if memory mgr failed to initialize. */
|
|
if (cinfo->mem != NULL)
|
|
(*cinfo->mem->self_destruct) (cinfo);
|
|
cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */
|
|
cinfo->global_state = 0; /* mark it destroyed */
|
|
}
|
|
|
|
GLOBAL(JQUANT_TBL *)
|
|
jpeg_alloc_quant_table (j_common_ptr cinfo)
|
|
{
|
|
JQUANT_TBL *tbl;
|
|
|
|
tbl = (JQUANT_TBL *)
|
|
(*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL));
|
|
tbl->sent_table = FALSE; /* make sure this is false in any new table */
|
|
return tbl;
|
|
}
|
|
|
|
|
|
GLOBAL(JHUFF_TBL *)
|
|
jpeg_alloc_huff_table (j_common_ptr cinfo)
|
|
{
|
|
JHUFF_TBL *tbl;
|
|
|
|
tbl = (JHUFF_TBL *)
|
|
(*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL));
|
|
tbl->sent_table = FALSE; /* make sure this is false in any new table */
|
|
return tbl;
|
|
}
|