summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qgrayraster.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qgrayraster.c')
-rw-r--r--src/gui/painting/qgrayraster.c80
1 files changed, 24 insertions, 56 deletions
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index 8eb6c11f3f..3c222c49e1 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://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 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/***************************************************************************/
/* */
@@ -187,6 +151,7 @@ typedef ptrdiff_t QT_FT_PtrDist;
#include <stdlib.h>
#include <stdio.h>
+#include <assert.h>
#define QT_FT_UNUSED( x ) (void) x
@@ -1101,7 +1066,7 @@ QT_FT_END_STMNT
L = QT_FT_HYPOT( dx_, dy_ );
/* Avoid possible arithmetic overflow below by splitting. */
- if ( L > 32767 )
+ if ( L >= (1 << 23) )
goto Split;
/* Max deviation may be as much as (s/L) * 3/4 (if Hain's v = 1). */
@@ -1251,13 +1216,13 @@ QT_FT_END_STMNT
y += (TCoord)ras.min_ey;
x += (TCoord)ras.min_ex;
- /* QT_FT_Span.x is a 16-bit short, so limit our coordinates appropriately */
- if ( x >= 32767 )
- x = 32767;
+ /* QT_FT_Span.x is an int, so limit our coordinates appropriately */
+ if ( x >= (1 << 23) )
+ x = (1 << 23) - 1;
- /* QT_FT_Span.y is a 16-bit short, so limit our coordinates appropriately */
- if ( y >= 32767 )
- y = 32767;
+ /* QT_FT_Span.y is an int, so limit our coordinates appropriately */
+ if ( y >= (1 << 23) )
+ y = (1 << 23) - 1;
if ( coverage )
{
@@ -1271,10 +1236,10 @@ QT_FT_END_STMNT
span = ras.gray_spans + count - 1;
if ( count > 0 &&
span->y == y &&
- (int)span->x + span->len == (int)x &&
+ span->x + span->len == x &&
span->coverage == coverage )
{
- span->len = (unsigned short)( span->len + acount );
+ span->len = span->len + acount;
return;
}
@@ -1317,9 +1282,9 @@ QT_FT_END_STMNT
span++;
/* add a gray span to the current list */
- span->x = (short)x;
- span->len = (unsigned short)acount;
- span->y = (short)y;
+ span->x = x;
+ span->len = acount;
+ span->y = y;
span->coverage = (unsigned char)coverage;
ras.num_gray_spans++;
@@ -1837,8 +1802,11 @@ QT_FT_END_STMNT
if ( !raster || !raster->buffer || !raster->buffer_size )
return ErrRaster_Invalid_Argument;
- if ( raster->worker )
- raster->worker->skip_spans = params->skip_spans;
+ /* Should always be non-null, it is set by raster_reset() which is always */
+ /* called with a non-null pool, and a pool_size >= MINIMUM_POOL_SIZE. */
+ assert(raster->worker);
+
+ raster->worker->skip_spans = params->skip_spans;
/* If raster object and raster buffer are allocated, but */
/* raster size isn't of the minimum size, indicate out of */
@@ -1895,10 +1863,10 @@ QT_FT_END_STMNT
}
else
{
- ras.clip_box.xMin = -32768L;
- ras.clip_box.yMin = -32768L;
- ras.clip_box.xMax = 32767L;
- ras.clip_box.yMax = 32767L;
+ ras.clip_box.xMin = -(1 << 23);
+ ras.clip_box.yMin = -(1 << 23);
+ ras.clip_box.xMax = (1 << 23) - 1;
+ ras.clip_box.yMax = (1 << 23) - 1;
}
gray_init_cells( worker, raster->buffer, raster->buffer_size );