mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
make gray raster functions available without object
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
f1ee06a269
commit
272fe353ca
5 changed files with 32 additions and 169 deletions
|
@ -44,7 +44,6 @@ set(GUI_HEADERS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qpaintengine_raster_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qdrawhelper_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qrasterdefs_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgrayraster_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qbackingstore_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qmath_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qdatabuffer_p.h
|
||||
|
|
|
@ -145,7 +145,6 @@
|
|||
#define QT_FT_END_HEADER
|
||||
|
||||
#include <qrasterdefs_p.h>
|
||||
#include <qgrayraster_p.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
@ -254,10 +253,10 @@
|
|||
QT_FT_BBox clip_box;
|
||||
|
||||
QT_FT_Span gray_spans[QT_FT_MAX_GRAY_SPANS];
|
||||
int num_gray_spans;
|
||||
int num_gray_spans;
|
||||
|
||||
QT_FT_Raster_Span_Func render_span;
|
||||
void* render_span_data;
|
||||
QT_FT_SpanFunc render_span;
|
||||
void* render_span_data;
|
||||
|
||||
int band_size;
|
||||
int band_shoot;
|
||||
|
@ -1348,8 +1347,7 @@
|
|||
/**** RASTER OBJECT CREATION: In standalone mode, we simply use *****/
|
||||
/**** a static object. *****/
|
||||
|
||||
static int
|
||||
gray_raster_new( QT_FT_Raster* araster )
|
||||
int gray_raster_new( QT_FT_Raster* araster )
|
||||
{
|
||||
*araster = malloc(sizeof(TRaster));
|
||||
if (!*araster) {
|
||||
|
@ -1362,8 +1360,7 @@
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
gray_raster_reset( QT_FT_Raster raster, char* pool_base )
|
||||
void gray_raster_reset( QT_FT_Raster raster, char* pool_base )
|
||||
{
|
||||
PRaster rast = (PRaster)raster;
|
||||
if ( raster && pool_base )
|
||||
|
@ -1384,8 +1381,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
gray_raster_render( QT_FT_Raster raster,
|
||||
int gray_raster_render( QT_FT_Raster raster,
|
||||
const QT_FT_Raster_Params* params )
|
||||
{
|
||||
const QT_FT_Outline* outline = (const QT_FT_Outline*)params->source;
|
||||
|
@ -1429,17 +1425,10 @@
|
|||
ras.outline = *outline;
|
||||
ras.band_size = raster->band_size;
|
||||
|
||||
ras.render_span = (QT_FT_Raster_Span_Func)params->gray_spans;
|
||||
ras.render_span = (QT_FT_SpanFunc)params->gray_spans;
|
||||
ras.render_span_data = params->user;
|
||||
|
||||
return gray_convert_glyph( worker );
|
||||
}
|
||||
|
||||
const QT_FT_Raster_Funcs qt_ft_grays_raster =
|
||||
{
|
||||
(QT_FT_Raster_New_Func) gray_raster_new,
|
||||
(QT_FT_Raster_Reset_Func) gray_raster_reset,
|
||||
(QT_FT_Raster_Render_Func) gray_raster_render,
|
||||
};
|
||||
|
||||
/* END */
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* qgrayraster_p.h, derived from ftgrays.h */
|
||||
/* */
|
||||
/* FreeType smooth renderer declaration */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, ../../3rdparty/freetype/docs/FTL.TXT. By continuing to use, */
|
||||
/* modify, or distribute this file you indicate that you have read */
|
||||
/* the license and understand and accept it fully. */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef __FTGRAYS_H__
|
||||
#define __FTGRAYS_H__
|
||||
|
||||
/*
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include <qrasterdefs_p.h>
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* To make ftgrays.h independent from configuration files we check */
|
||||
/* whether QT_FT_EXPORT_VAR has been defined already. */
|
||||
/* */
|
||||
/* On some systems and compilers (Win32 mostly), an extra keyword is */
|
||||
/* necessary to compile the library as a DLL. */
|
||||
/* */
|
||||
#ifndef QT_FT_EXPORT_VAR
|
||||
#define QT_FT_EXPORT_VAR( x ) extern x
|
||||
#endif
|
||||
|
||||
/* Minimum buffer size for raster object, that accounts
|
||||
for TWorker and TCell sizes.*/
|
||||
#define RASTER_POOL_SIZE 8192
|
||||
|
||||
QT_FT_EXPORT_VAR( const QT_FT_Raster_Funcs ) qt_ft_grays_raster;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __FTGRAYS_H__ */
|
||||
|
||||
/* END */
|
|
@ -46,8 +46,6 @@
|
|||
#define QT_FT_END_HEADER
|
||||
|
||||
#include <qrasterdefs_p.h>
|
||||
#include <qgrayraster_p.h>
|
||||
|
||||
#include <qpainterpath.h>
|
||||
#include <qdebug.h>
|
||||
#include <qhash.h>
|
||||
|
@ -172,7 +170,7 @@ QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() :
|
|||
// The antialiasing raster.
|
||||
grayRaster = new QT_FT_Raster;
|
||||
Q_CHECK_PTR(grayRaster);
|
||||
if (qt_ft_grays_raster.raster_new(grayRaster)) {
|
||||
if (gray_raster_new(grayRaster)) {
|
||||
// an error creating the raster is caused by a bad malloc
|
||||
QT_THROW(std::bad_alloc());
|
||||
}
|
||||
|
@ -3092,7 +3090,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
|
|||
}
|
||||
|
||||
char pool_base[RASTER_POOL_SIZE];
|
||||
qt_ft_grays_raster.raster_reset(*grayRaster, pool_base);
|
||||
gray_raster_reset(*grayRaster, pool_base);
|
||||
|
||||
QT_FT_BBox clip_box = { deviceRect.x(),
|
||||
deviceRect.y(),
|
||||
|
@ -3106,7 +3104,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
|
|||
rasterParams.clip_box = clip_box;
|
||||
rasterParams.gray_spans = callback;
|
||||
rasterParams.skip_spans = 0;
|
||||
qt_ft_grays_raster.raster_render(*grayRaster, &rasterParams);
|
||||
gray_raster_render(*grayRaster, &rasterParams);
|
||||
}
|
||||
|
||||
QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color)
|
||||
|
|
|
@ -362,8 +362,6 @@ QT_FT_BEGIN_HEADER
|
|||
const QT_FT_Span* spans,
|
||||
void* worker);
|
||||
|
||||
#define QT_FT_Raster_Span_Func QT_FT_SpanFunc
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
|
@ -424,8 +422,8 @@ QT_FT_BEGIN_HEADER
|
|||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* QT_FT_Raster_NewFunc */
|
||||
/* <Func> */
|
||||
/* gray_raster_new */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A function used to create a new raster object. */
|
||||
|
@ -436,15 +434,16 @@ QT_FT_BEGIN_HEADER
|
|||
/* <Return> */
|
||||
/* Error code. 0 means success. */
|
||||
/* */
|
||||
typedef int
|
||||
(*QT_FT_Raster_NewFunc)( QT_FT_Raster* raster );
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int gray_raster_new( QT_FT_Raster* raster );
|
||||
|
||||
#define QT_FT_Raster_New_Func QT_FT_Raster_NewFunc
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* QT_FT_Raster_ResetFunc */
|
||||
/* <Func> */
|
||||
/* gray_raster_reset */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* FreeType provides an area of memory called the `render pool', */
|
||||
|
@ -466,15 +465,16 @@ QT_FT_BEGIN_HEADER
|
|||
/* passed to the raster constructor). However, this is not */
|
||||
/* recommended for efficiency purposes. */
|
||||
/* */
|
||||
typedef void
|
||||
(*QT_FT_Raster_ResetFunc)( QT_FT_Raster raster, char* pool);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
void gray_raster_reset( QT_FT_Raster raster, char* pool);
|
||||
|
||||
#define QT_FT_Raster_Reset_Func QT_FT_Raster_ResetFunc
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* QT_FT_Raster_RenderFunc */
|
||||
/* <Func> */
|
||||
/* gray_raster_render */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Invokes a given raster to scan-convert a given glyph image into a */
|
||||
|
@ -505,36 +505,18 @@ QT_FT_BEGIN_HEADER
|
|||
/* examples of distinct implementations which support direct */
|
||||
/* composition). */
|
||||
/* */
|
||||
typedef int
|
||||
(*QT_FT_Raster_RenderFunc)( QT_FT_Raster raster,
|
||||
QT_FT_Raster_Params* params );
|
||||
|
||||
#define QT_FT_Raster_Render_Func QT_FT_Raster_RenderFunc
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int gray_raster_render( QT_FT_Raster raster,
|
||||
const QT_FT_Raster_Params* params );
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Struct> */
|
||||
/* QT_FT_Raster_Funcs */
|
||||
/* Minimum buffer size for raster object, that accounts for TWorker and */
|
||||
/* TCell sizes. */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A structure used to describe a given raster class to the library. */
|
||||
/* */
|
||||
/* <Fields> */
|
||||
/* raster_new :: The raster constructor. */
|
||||
/* */
|
||||
/* raster_reset :: Used to reset the render pool within the raster. */
|
||||
/* */
|
||||
/* raster_render :: A function to render a glyph into a given bitmap. */
|
||||
/* */
|
||||
/* */
|
||||
typedef struct QT_FT_Raster_Funcs_
|
||||
{
|
||||
QT_FT_Raster_NewFunc raster_new;
|
||||
QT_FT_Raster_ResetFunc raster_reset;
|
||||
QT_FT_Raster_RenderFunc raster_render;
|
||||
|
||||
} QT_FT_Raster_Funcs;
|
||||
|
||||
#define RASTER_POOL_SIZE 8192
|
||||
|
||||
/* */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue