mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 10:22:55 +00:00
remove Blitter painting engine
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
4c843f2cbd
commit
89d52933bd
18 changed files with 51 additions and 1893 deletions
1
README
1
README
|
@ -23,6 +23,7 @@ There are several things you should be aware before considering Katie:
|
|||
- updated bundled Harfbuzz from upstream (not Harfbuzz-NG)
|
||||
- Symbian, QWS and QPA are no longer supported platforms
|
||||
- OpenVG is no longer supported graphics output
|
||||
- Blitter is no longer supported painting engine
|
||||
- QML debugger and inspector have been removed, potentially dangerous
|
||||
- removed non-open source DB2, OCI and TDS database drivers
|
||||
- removed 3rd party sources that are very common nowdays
|
||||
|
|
|
@ -19,7 +19,6 @@ set(GUI_HEADERS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/image/qpictureformatplugin.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmap.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmap_raster_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmap_blitter_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmapcache.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmapcache_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmapdata_p.h
|
||||
|
@ -57,7 +56,6 @@ set(GUI_SOURCES
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/image/qiconengineplugin.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image/qmovie.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmap_raster.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image/qpixmap_blitter.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image/qnativeimage.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image/qimagepixmapcleanuphooks.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image/qvolatileimage.cpp
|
||||
|
|
|
@ -272,7 +272,6 @@ private:
|
|||
QImageData *d;
|
||||
|
||||
friend class QRasterPixmapData;
|
||||
friend class QBlittablePixmapData;
|
||||
friend class QPixmapCacheEntry;
|
||||
|
||||
public:
|
||||
|
|
|
@ -1,321 +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$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qpixmap_blitter_p.h"
|
||||
|
||||
#include <qpainter.h>
|
||||
#include <qimage.h>
|
||||
|
||||
#include <qapplication_p.h>
|
||||
#include <qgraphicssystem_p.h>
|
||||
#include <qblittable_p.h>
|
||||
|
||||
#include <qdrawhelper_p.h>
|
||||
#include <qfont_p.h>
|
||||
|
||||
#ifndef QT_NO_BLITTABLE
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static int global_ser_no = 0;
|
||||
|
||||
QBlittablePixmapData::QBlittablePixmapData()
|
||||
: QPixmapData(QPixmapData::PixmapType,BlitterClass)
|
||||
, m_alpha(false)
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
,m_rasterOverlay(0), m_unmergedCopy(0)
|
||||
#endif //QT_BLITTER_RASTEROVERLAY
|
||||
{
|
||||
setSerialNumber(++global_ser_no);
|
||||
}
|
||||
|
||||
QBlittablePixmapData::~QBlittablePixmapData()
|
||||
{
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
delete m_rasterOverlay;
|
||||
delete m_unmergedCopy;
|
||||
#endif //QT_BLITTER_RASTEROVERLAY
|
||||
}
|
||||
|
||||
QBlittable *QBlittablePixmapData::blittable() const
|
||||
{
|
||||
if (!m_blittable) {
|
||||
QBlittablePixmapData *that = const_cast<QBlittablePixmapData *>(this);
|
||||
that->m_blittable.reset(this->createBlittable(QSize(w,h), m_alpha));
|
||||
}
|
||||
|
||||
return m_blittable.data();
|
||||
}
|
||||
|
||||
void QBlittablePixmapData::setBlittable(QBlittable *blittable)
|
||||
{
|
||||
resize(blittable->size().width(),blittable->size().height());
|
||||
m_blittable.reset(blittable);
|
||||
}
|
||||
|
||||
void QBlittablePixmapData::resize(int width, int height)
|
||||
{
|
||||
|
||||
m_blittable.reset(0);
|
||||
m_engine.reset(0);
|
||||
w = width;
|
||||
h = height;
|
||||
is_null = (w <= 0 || h <= 0);
|
||||
setSerialNumber(++global_ser_no);
|
||||
}
|
||||
|
||||
int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
|
||||
{
|
||||
switch (metric) {
|
||||
case QPaintDevice::PdmWidth:
|
||||
return w;
|
||||
case QPaintDevice::PdmHeight:
|
||||
return h;
|
||||
case QPaintDevice::PdmWidthMM:
|
||||
return qRound(w * 25.4 / qt_defaultDpiX());
|
||||
case QPaintDevice::PdmHeightMM:
|
||||
return qRound(h * 25.4 / qt_defaultDpiY());
|
||||
case QPaintDevice::PdmDepth:
|
||||
return 32;
|
||||
case QPaintDevice::PdmDpiX: // fall-through
|
||||
case QPaintDevice::PdmPhysicalDpiX:
|
||||
return qt_defaultDpiX();
|
||||
case QPaintDevice::PdmDpiY: // fall-through
|
||||
case QPaintDevice::PdmPhysicalDpiY:
|
||||
return qt_defaultDpiY();
|
||||
default:
|
||||
qWarning("QRasterPixmapData::metric(): Unhandled metric type %d", metric);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QBlittablePixmapData::fill(const QColor &color)
|
||||
{
|
||||
if (blittable()->capabilities() & QBlittable::AlphaFillRectCapability) {
|
||||
blittable()->unlock();
|
||||
blittable()->alphaFillRect(QRectF(0,0,w,h),color,QPainter::CompositionMode_Source);
|
||||
} else if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) {
|
||||
blittable()->unlock();
|
||||
blittable()->fillRect(QRectF(0,0,w,h),color);
|
||||
} else {
|
||||
// Need to be backed with an alpha channel now. It would be nice
|
||||
// if we could just change the format, e.g. when going from
|
||||
// RGB32 -> ARGB8888.
|
||||
if (color.alpha() != 255 && !hasAlphaChannel()) {
|
||||
m_blittable.reset(0);
|
||||
m_engine.reset(0);
|
||||
m_alpha = true;
|
||||
}
|
||||
|
||||
uint pixel;
|
||||
switch (blittable()->lock()->format()) {
|
||||
case QImage::Format_ARGB32_Premultiplied:
|
||||
pixel = PREMUL(color.rgba());
|
||||
break;
|
||||
case QImage::Format_ARGB8565_Premultiplied:
|
||||
pixel = qargb8565(color.rgba()).rawValue();
|
||||
break;
|
||||
case QImage::Format_ARGB8555_Premultiplied:
|
||||
pixel = qargb8555(color.rgba()).rawValue();
|
||||
break;
|
||||
case QImage::Format_ARGB6666_Premultiplied:
|
||||
pixel = qargb6666(color.rgba()).rawValue();
|
||||
break;
|
||||
case QImage::Format_ARGB4444_Premultiplied:
|
||||
pixel = qargb4444(color.rgba()).rawValue();
|
||||
break;
|
||||
default:
|
||||
pixel = color.rgba();
|
||||
break;
|
||||
}
|
||||
//so premultiplied formats are supported and ARGB32 and RGB32
|
||||
blittable()->lock()->fill(pixel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QImage *QBlittablePixmapData::buffer()
|
||||
{
|
||||
return blittable()->lock();
|
||||
}
|
||||
|
||||
QImage QBlittablePixmapData::toImage() const
|
||||
{
|
||||
return blittable()->lock()->copy();
|
||||
}
|
||||
|
||||
bool QBlittablePixmapData::hasAlphaChannel() const
|
||||
{
|
||||
return blittable()->lock()->hasAlphaChannel();
|
||||
}
|
||||
|
||||
void QBlittablePixmapData::fromImage(const QImage &image,
|
||||
Qt::ImageConversionFlags flags)
|
||||
{
|
||||
m_alpha = image.hasAlphaChannel();
|
||||
resize(image.width(),image.height());
|
||||
markRasterOverlay(QRect(0,0,w,h));
|
||||
QImage *thisImg = buffer();
|
||||
|
||||
QImage correctFormatPic = image;
|
||||
if (correctFormatPic.format() != thisImg->format())
|
||||
correctFormatPic = correctFormatPic.convertToFormat(thisImg->format(), flags);
|
||||
|
||||
uchar *mem = thisImg->bits();
|
||||
const uchar *bits = correctFormatPic.bits();
|
||||
int bytesCopied = 0;
|
||||
while (bytesCopied < correctFormatPic.byteCount()) {
|
||||
memcpy(mem,bits,correctFormatPic.bytesPerLine());
|
||||
mem += thisImg->bytesPerLine();
|
||||
bits += correctFormatPic.bytesPerLine();
|
||||
bytesCopied+=correctFormatPic.bytesPerLine();
|
||||
}
|
||||
}
|
||||
|
||||
QPaintEngine *QBlittablePixmapData::paintEngine() const
|
||||
{
|
||||
if (!m_engine) {
|
||||
QBlittablePixmapData *that = const_cast<QBlittablePixmapData *>(this);
|
||||
that->m_engine.reset(new QBlitterPaintEngine(that));
|
||||
}
|
||||
return m_engine.data();
|
||||
}
|
||||
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
|
||||
static bool showRasterOverlay = !qgetenv("QT_BLITTER_RASTEROVERLAY").isEmpty();
|
||||
|
||||
void QBlittablePixmapData::mergeOverlay()
|
||||
{
|
||||
if (m_unmergedCopy || !showRasterOverlay)
|
||||
return;
|
||||
m_unmergedCopy = new QImage(buffer()->copy());
|
||||
QPainter p(buffer());
|
||||
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
|
||||
p.drawImage(0,0,*overlay());
|
||||
p.end();
|
||||
}
|
||||
|
||||
void QBlittablePixmapData::unmergeOverlay()
|
||||
{
|
||||
if (!m_unmergedCopy || !showRasterOverlay)
|
||||
return;
|
||||
QPainter p(buffer());
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
p.drawImage(0,0,*m_unmergedCopy);
|
||||
p.end();
|
||||
|
||||
delete m_unmergedCopy;
|
||||
m_unmergedCopy = 0;
|
||||
}
|
||||
|
||||
QImage *QBlittablePixmapData::overlay()
|
||||
{
|
||||
if (!m_rasterOverlay||
|
||||
m_rasterOverlay->size() != QSize(w,h)){
|
||||
m_rasterOverlay = new QImage(w,h,QImage::Format_ARGB32_Premultiplied);
|
||||
m_rasterOverlay->fill(0x00000000);
|
||||
uint color = (qrand() % 11)+7;
|
||||
m_overlayColor = QColor(Qt::GlobalColor(color));
|
||||
m_overlayColor.setAlpha(0x88);
|
||||
|
||||
}
|
||||
return m_rasterOverlay;
|
||||
}
|
||||
|
||||
void QBlittablePixmapData::markRasterOverlayImpl(const QRectF &rect)
|
||||
{
|
||||
if (!showRasterOverlay)
|
||||
return;
|
||||
QRectF transformationRect = clipAndTransformRect(rect);
|
||||
if(!transformationRect.isEmpty()) {
|
||||
QPainter p(overlay());
|
||||
p.setBrush(m_overlayColor);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
p.fillRect(transformationRect,QBrush(m_overlayColor));
|
||||
}
|
||||
}
|
||||
|
||||
void QBlittablePixmapData::unmarkRasterOverlayImpl(const QRectF &rect)
|
||||
{
|
||||
if (!showRasterOverlay)
|
||||
return;
|
||||
QRectF transformationRect = clipAndTransformRect(rect);
|
||||
if (!transformationRect.isEmpty()) {
|
||||
QPainter p(overlay());
|
||||
QColor color(0x00,0x00,0x00,0x00);
|
||||
p.setBrush(color);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
p.fillRect(transformationRect,QBrush(color));
|
||||
}
|
||||
}
|
||||
|
||||
QRectF QBlittablePixmapData::clipAndTransformRect(const QRectF &rect) const
|
||||
{
|
||||
QRectF transformationRect = rect;
|
||||
paintEngine();
|
||||
if (m_engine->state()) {
|
||||
transformationRect = m_engine->state()->matrix.mapRect(rect);
|
||||
const QClipData *clipData = m_engine->clip();
|
||||
if (clipData) {
|
||||
if (clipData->hasRectClip) {
|
||||
transformationRect &= clipData->clipRect;
|
||||
} else if (clipData->hasRegionClip) {
|
||||
const QVector<QRect> rects = clipData->clipRegion.rects();
|
||||
for (int i = 0; i < rects.size(); i++) {
|
||||
transformationRect &= rects.at(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return transformationRect;
|
||||
}
|
||||
|
||||
#endif //QT_BLITTER_RASTEROVERLAY
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif //QT_NO_BLITTABLE
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,199 +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$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QPIXMAP_BLITTER_P_H
|
||||
#define QPIXMAP_BLITTER_P_H
|
||||
|
||||
#include <qpixmapdata_p.h>
|
||||
#include <qpaintengine_blitter_p.h>
|
||||
|
||||
#ifndef QT_NO_BLITTABLE
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Q_GUI_EXPORT QBlittablePixmapData : public QPixmapData
|
||||
{
|
||||
// Q_DECLARE_PRIVATE(QBlittablePixmapData);
|
||||
public:
|
||||
QBlittablePixmapData();
|
||||
~QBlittablePixmapData();
|
||||
|
||||
virtual QBlittable *createBlittable(const QSize &size, bool alpha) const = 0;
|
||||
QBlittable *blittable() const;
|
||||
void setBlittable(QBlittable *blittable);
|
||||
|
||||
void resize(int width, int height);
|
||||
int metric(QPaintDevice::PaintDeviceMetric metric) const;
|
||||
void fill(const QColor &color);
|
||||
QImage *buffer();
|
||||
QImage toImage() const;
|
||||
bool hasAlphaChannel() const;
|
||||
void fromImage(const QImage &image, Qt::ImageConversionFlags flags);
|
||||
|
||||
QPaintEngine *paintEngine() const;
|
||||
|
||||
void markRasterOverlay(const QRectF &);
|
||||
void markRasterOverlay(const QPointF &, const QTextItem &);
|
||||
void markRasterOverlay(const QVectorPath &);
|
||||
void markRasterOverlay(const QPainterPath &);
|
||||
void markRasterOverlay(const QRect *rects, int rectCount);
|
||||
void markRasterOverlay(const QRectF *rects, int rectCount);
|
||||
void markRasterOverlay(const QPointF *points, int pointCount);
|
||||
void markRasterOverlay(const QPoint *points, int pointCount);
|
||||
void unmarkRasterOverlay(const QRectF &);
|
||||
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
void mergeOverlay();
|
||||
void unmergeOverlay();
|
||||
QImage *overlay();
|
||||
|
||||
#endif //QT_BLITTER_RASTEROVERLAY
|
||||
protected:
|
||||
QScopedPointer<QBlitterPaintEngine> m_engine;
|
||||
QScopedPointer<QBlittable> m_blittable;
|
||||
bool m_alpha;
|
||||
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
QImage *m_rasterOverlay;
|
||||
QImage *m_unmergedCopy;
|
||||
QColor m_overlayColor;
|
||||
|
||||
void markRasterOverlayImpl(const QRectF &);
|
||||
void unmarkRasterOverlayImpl(const QRectF &);
|
||||
QRectF clipAndTransformRect(const QRectF &) const;
|
||||
#endif //QT_BLITTER_RASTEROVERLAY
|
||||
|
||||
};
|
||||
|
||||
inline void QBlittablePixmapData::markRasterOverlay(const QRectF &rect)
|
||||
{
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
markRasterOverlayImpl(rect);
|
||||
#else
|
||||
Q_UNUSED(rect)
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void QBlittablePixmapData::markRasterOverlay(const QVectorPath &path)
|
||||
{
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
markRasterOverlayImpl(path.convertToPainterPath().boundingRect());
|
||||
#else
|
||||
Q_UNUSED(path)
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void QBlittablePixmapData::markRasterOverlay(const QPointF &pos, const QTextItem &ti)
|
||||
{
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
QFontMetricsF fm(ti.font());
|
||||
QRectF rect = fm.tightBoundingRect(ti.text());
|
||||
rect.moveBottomLeft(pos);
|
||||
markRasterOverlay(rect);
|
||||
#else
|
||||
Q_UNUSED(pos)
|
||||
Q_UNUSED(ti)
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void QBlittablePixmapData::markRasterOverlay(const QRect *rects, int rectCount)
|
||||
{
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
for (int i = 0; i < rectCount; i++) {
|
||||
markRasterOverlay(rects[i]);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(rects)
|
||||
Q_UNUSED(rectCount)
|
||||
#endif
|
||||
}
|
||||
inline void QBlittablePixmapData::markRasterOverlay(const QRectF *rects, int rectCount)
|
||||
{
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
for (int i = 0; i < rectCount; i++) {
|
||||
markRasterOverlay(rects[i]);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(rects)
|
||||
Q_UNUSED(rectCount)
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void QBlittablePixmapData::markRasterOverlay(const QPointF *points, int pointCount)
|
||||
{
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
#error "not ported yet"
|
||||
#else
|
||||
Q_UNUSED(points);
|
||||
Q_UNUSED(pointCount);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void QBlittablePixmapData::markRasterOverlay(const QPoint *points, int pointCount)
|
||||
{
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
#error "not ported yet"
|
||||
#else
|
||||
Q_UNUSED(points);
|
||||
Q_UNUSED(pointCount);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void QBlittablePixmapData::markRasterOverlay(const QPainterPath& path)
|
||||
{
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
#error "not ported yet"
|
||||
#else
|
||||
Q_UNUSED(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void QBlittablePixmapData::unmarkRasterOverlay(const QRectF &rect)
|
||||
{
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
unmarkRasterOverlayImpl(rect);
|
||||
#else
|
||||
Q_UNUSED(rect)
|
||||
#endif
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif // QT_NO_BLITTABLE
|
||||
#endif // QPIXMAP_BLITTER_P_H
|
|
@ -70,7 +70,7 @@ public:
|
|||
PixmapType, BitmapType
|
||||
};
|
||||
enum ClassId { RasterClass, X11Class, MacClass, DirectFBClass,
|
||||
OpenGLClass, RuntimeClass, BlitterClass,
|
||||
OpenGLClass, RuntimeClass,
|
||||
CustomClass = 1024 };
|
||||
|
||||
QPixmapData(PixelType pixelType, int classId);
|
||||
|
|
|
@ -51,8 +51,6 @@ set(GUI_HEADERS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qblendfunctions_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qrasterdefs_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgrayraster_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qpaintengine_blitter_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qblittable_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
|
||||
|
@ -117,8 +115,6 @@ set(GUI_SOURCES
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qdrawhelper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qimagescale.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgrayraster.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qpaintengine_blitter.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qblittable.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qbackingstore.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystem_raster.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystem_runtime.cpp
|
||||
|
|
|
@ -1,115 +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$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qblittable_p.h"
|
||||
|
||||
#ifndef QT_NO_BLITTABLE
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBlittablePrivate
|
||||
{
|
||||
public:
|
||||
QBlittablePrivate(const QSize &size, QBlittable::Capabilities caps)
|
||||
: caps(caps), m_size(size), locked(false), cachedImg(0)
|
||||
{}
|
||||
QBlittable::Capabilities caps;
|
||||
QSize m_size;
|
||||
bool locked;
|
||||
QImage *cachedImg;
|
||||
};
|
||||
|
||||
|
||||
QBlittable::QBlittable(const QSize &size, Capabilities caps)
|
||||
: d_ptr(new QBlittablePrivate(size,caps))
|
||||
{
|
||||
}
|
||||
|
||||
QBlittable::~QBlittable()
|
||||
{
|
||||
delete d_ptr;
|
||||
}
|
||||
|
||||
|
||||
QBlittable::Capabilities QBlittable::capabilities() const
|
||||
{
|
||||
Q_D(const QBlittable);
|
||||
return d->caps;
|
||||
}
|
||||
|
||||
QSize QBlittable::size() const
|
||||
{
|
||||
Q_D(const QBlittable);
|
||||
return d->m_size;
|
||||
}
|
||||
|
||||
bool QBlittable::isLocked() const
|
||||
{
|
||||
Q_D(const QBlittable);
|
||||
return d->locked;
|
||||
}
|
||||
|
||||
QImage *QBlittable::lock()
|
||||
{
|
||||
Q_D(QBlittable);
|
||||
if (!d->locked) {
|
||||
d->cachedImg = doLock();
|
||||
d->locked = true;
|
||||
}
|
||||
|
||||
return d->cachedImg;
|
||||
}
|
||||
|
||||
void QBlittable::unlock()
|
||||
{
|
||||
Q_D(QBlittable);
|
||||
if (d->locked) {
|
||||
doUnlock();
|
||||
d->locked = false;
|
||||
}
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif //QT_NO_BLITTABLE
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,107 +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$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBLITTABLE_P_H
|
||||
#define QBLITTABLE_P_H
|
||||
|
||||
#include <QtCore/qsize.h>
|
||||
#include <QtGui/qpixmap_blitter_p.h>
|
||||
|
||||
|
||||
#ifndef QT_NO_BLITTABLE
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QImage;
|
||||
class QBlittablePrivate;
|
||||
|
||||
class Q_GUI_EXPORT QBlittable
|
||||
{
|
||||
Q_DECLARE_PRIVATE(QBlittable)
|
||||
public:
|
||||
enum Capability {
|
||||
|
||||
SolidRectCapability = 0x0001,
|
||||
SourcePixmapCapability = 0x0002,
|
||||
SourceOverPixmapCapability = 0x0004,
|
||||
SourceOverScaledPixmapCapability = 0x0008,
|
||||
AlphaFillRectCapability = 0x0010,
|
||||
OpacityPixmapCapability = 0x0020
|
||||
};
|
||||
Q_DECLARE_FLAGS(Capabilities, Capability)
|
||||
|
||||
QBlittable(const QSize &size, Capabilities caps);
|
||||
virtual ~QBlittable();
|
||||
|
||||
Capabilities capabilities() const;
|
||||
QSize size() const;
|
||||
|
||||
virtual void fillRect(const QRectF &rect, const QColor &color) = 0;
|
||||
virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect) = 0;
|
||||
virtual void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode) {
|
||||
Q_UNUSED(rect);
|
||||
Q_UNUSED(color);
|
||||
Q_UNUSED(cmode);
|
||||
qWarning("Please implement alphaFillRect function in your platform or remove AlphaFillRectCapability from it");
|
||||
}
|
||||
virtual void drawPixmapOpacity(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect, QPainter::CompositionMode cmode, qreal opacity) {
|
||||
Q_UNUSED(rect);
|
||||
Q_UNUSED(pixmap);
|
||||
Q_UNUSED(subrect);
|
||||
Q_UNUSED(cmode);
|
||||
Q_UNUSED(opacity);
|
||||
qWarning("Please implement drawPixmapOpacity function in your platform or remove OpacityPixmapCapability from it");
|
||||
}
|
||||
|
||||
|
||||
bool isLocked() const;
|
||||
|
||||
QImage *lock();
|
||||
void unlock();
|
||||
|
||||
protected:
|
||||
virtual QImage *doLock() = 0;
|
||||
virtual void doUnlock() = 0;
|
||||
QBlittablePrivate *d_ptr;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif //QT_NO_BLITTABLE
|
||||
#endif //QBLITTABLE_P_H
|
|
@ -55,14 +55,12 @@
|
|||
|
||||
#include "qpixmapdata_p.h"
|
||||
#include "qwindowsurface_p.h"
|
||||
#include "qpaintengine_blitter_p.h"
|
||||
|
||||
#include <qdebug.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QPixmapFilter;
|
||||
class QBlittable;
|
||||
class QGraphicsSystemEx;
|
||||
|
||||
class Q_GUI_EXPORT QGraphicsSystem
|
||||
|
|
|
@ -1553,25 +1553,6 @@
|
|||
} TBand;
|
||||
|
||||
|
||||
static int
|
||||
gray_convert_glyph_inner( RAS_ARG )
|
||||
{
|
||||
volatile int error = 0;
|
||||
|
||||
if ( qt_ft_setjmp( ras.jump_buffer ) == 0 )
|
||||
{
|
||||
error = QT_FT_Outline_Decompose( &ras.outline, &ras );
|
||||
gray_record_cell( RAS_VAR );
|
||||
}
|
||||
else
|
||||
{
|
||||
error = ErrRaster_Memory_Overflow;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
gray_convert_glyph( RAS_ARG )
|
||||
{
|
||||
|
@ -1683,7 +1664,15 @@
|
|||
ras.max_ey = band->max;
|
||||
ras.count_ey = band->max - band->min;
|
||||
|
||||
error = gray_convert_glyph_inner( RAS_VAR );
|
||||
if ( qt_ft_setjmp( ras.jump_buffer ) == 0 )
|
||||
{
|
||||
error = QT_FT_Outline_Decompose( &ras.outline, &ras );
|
||||
gray_record_cell( RAS_VAR );
|
||||
}
|
||||
else
|
||||
{
|
||||
error = ErrRaster_Memory_Overflow;
|
||||
}
|
||||
|
||||
if ( !error )
|
||||
{
|
||||
|
@ -1859,13 +1848,6 @@
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
gray_raster_done( QT_FT_Raster raster )
|
||||
{
|
||||
free(raster);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gray_raster_reset( QT_FT_Raster raster,
|
||||
char* pool_base,
|
||||
|
|
|
@ -386,7 +386,6 @@ void QPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDraw
|
|||
\value MaxUser Last user type ID
|
||||
\value OpenGL2
|
||||
\value PaintBuffer
|
||||
\value Blitter
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
|
|
@ -211,7 +211,6 @@ public:
|
|||
Pdf,
|
||||
OpenGL2,
|
||||
PaintBuffer,
|
||||
Blitter,
|
||||
|
||||
User = 50, // first user type id
|
||||
MaxUser = 100 // last user type id
|
||||
|
|
|
@ -1,802 +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$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qpaintengine_blitter_p.h"
|
||||
|
||||
#include "qblittable_p.h"
|
||||
#include "qpaintengine_raster_p.h"
|
||||
#include "qpainter_p.h"
|
||||
#include "qapplication_p.h"
|
||||
#include "qpixmap_blitter_p.h"
|
||||
|
||||
#ifndef QT_NO_BLITTABLE
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#define STATE_XFORM_SCALE 0x00000001
|
||||
#define STATE_XFORM_COMPLEX 0x00000002
|
||||
|
||||
#define STATE_BRUSH_PATTERN 0x00000010
|
||||
#define STATE_BRUSH_ALPHA 0x00000020
|
||||
|
||||
#define STATE_PEN_ENABLED 0x00000100
|
||||
|
||||
#define STATE_ANTIALIASING 0x00001000
|
||||
#define STATE_ALPHA 0x00002000
|
||||
#define STATE_BLENDING_COMPLEX 0x00004000
|
||||
|
||||
#define STATE_CLIPSYS_COMPLEX 0x00010000
|
||||
#define STATE_CLIP_COMPLEX 0x00020000
|
||||
|
||||
|
||||
class CapabilitiesToStateMask
|
||||
{
|
||||
public:
|
||||
CapabilitiesToStateMask(QBlittable::Capabilities capabilities)
|
||||
: m_capabilities(capabilities)
|
||||
, fillRectMask(0)
|
||||
, drawRectMask(0)
|
||||
, drawPixmapMask(0)
|
||||
, alphaFillRectMask(0)
|
||||
, opacityPixmapMask(0)
|
||||
, capabillitiesState(0)
|
||||
{
|
||||
if (capabilities & QBlittable::SolidRectCapability)
|
||||
setFillRectMask();
|
||||
if (capabilities & QBlittable::SourcePixmapCapability)
|
||||
setSourcePixmapMask();
|
||||
if (capabilities & QBlittable::SourceOverPixmapCapability)
|
||||
setSourceOverPixmapMask();
|
||||
if (capabilities & QBlittable::SourceOverScaledPixmapCapability)
|
||||
setSourceOverScaledPixmapMask();
|
||||
if (capabilities & QBlittable::AlphaFillRectCapability)
|
||||
setAlphaFillRectMask();
|
||||
if (capabilities & QBlittable::OpacityPixmapCapability)
|
||||
setOpacityPixmapMask();
|
||||
}
|
||||
|
||||
inline bool canBlitterFillRect() const
|
||||
{
|
||||
return checkStateAgainstMask(capabillitiesState, fillRectMask);
|
||||
}
|
||||
|
||||
inline bool canBlitterAlphaFillRect() const
|
||||
{
|
||||
return checkStateAgainstMask(capabillitiesState, alphaFillRectMask);
|
||||
}
|
||||
|
||||
inline bool canBlitterDrawRectMask() const
|
||||
{
|
||||
return checkStateAgainstMask(capabillitiesState, drawRectMask);
|
||||
}
|
||||
|
||||
bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const
|
||||
{
|
||||
if (pm.pixmapData()->classId() != QPixmapData::BlitterClass)
|
||||
return false;
|
||||
if (checkStateAgainstMask(capabillitiesState, drawPixmapMask)) {
|
||||
if (m_capabilities & (QBlittable::SourceOverPixmapCapability
|
||||
| QBlittable::SourceOverScaledPixmapCapability)) {
|
||||
if (r.size() != sr.size())
|
||||
return m_capabilities & QBlittable::SourceOverScaledPixmapCapability;
|
||||
else
|
||||
return m_capabilities & QBlittable::SourceOverPixmapCapability;
|
||||
}
|
||||
if ((m_capabilities & QBlittable::SourcePixmapCapability) && r.size() == sr.size() && !pm.hasAlphaChannel())
|
||||
return m_capabilities & QBlittable::SourcePixmapCapability;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool canBlitterDrawPixmapOpacity(const QPixmap &pm) const
|
||||
{
|
||||
if (pm.pixmapData()->classId() != QPixmapData::BlitterClass)
|
||||
return false;
|
||||
|
||||
return checkStateAgainstMask(capabillitiesState, opacityPixmapMask);
|
||||
}
|
||||
|
||||
inline void updateState(uint mask, bool on) {
|
||||
updateStateBits(&capabillitiesState, mask, on);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static inline void updateStateBits(uint *state, uint mask, bool on)
|
||||
{
|
||||
*state = on ? (*state | mask) : (*state & ~mask);
|
||||
}
|
||||
|
||||
static inline bool checkStateAgainstMask(uint state, uint mask)
|
||||
{
|
||||
return !state || (state & mask && !(state & ~mask));
|
||||
}
|
||||
|
||||
void setFillRectMask() {
|
||||
updateStateBits(&fillRectMask, STATE_XFORM_SCALE, false);
|
||||
updateStateBits(&fillRectMask, STATE_XFORM_COMPLEX, false);
|
||||
|
||||
updateStateBits(&fillRectMask, STATE_BRUSH_PATTERN, false);
|
||||
updateStateBits(&fillRectMask, STATE_BRUSH_ALPHA, false);
|
||||
|
||||
updateStateBits(&fillRectMask, STATE_PEN_ENABLED, true);
|
||||
|
||||
//Sub-pixel aliasing should not be sent to the blitter
|
||||
updateStateBits(&fillRectMask, STATE_ANTIALIASING, true);
|
||||
updateStateBits(&fillRectMask, STATE_ALPHA, false);
|
||||
updateStateBits(&fillRectMask, STATE_BLENDING_COMPLEX, false);
|
||||
|
||||
updateStateBits(&fillRectMask, STATE_CLIPSYS_COMPLEX, false);
|
||||
updateStateBits(&fillRectMask, STATE_CLIP_COMPLEX, false);
|
||||
}
|
||||
|
||||
void setAlphaFillRectMask() {
|
||||
updateStateBits(&alphaFillRectMask, STATE_XFORM_SCALE, false);
|
||||
updateStateBits(&alphaFillRectMask, STATE_XFORM_COMPLEX, false);
|
||||
|
||||
updateStateBits(&alphaFillRectMask, STATE_BRUSH_PATTERN, false);
|
||||
updateStateBits(&alphaFillRectMask, STATE_BRUSH_ALPHA, true);
|
||||
|
||||
updateStateBits(&alphaFillRectMask, STATE_PEN_ENABLED, true);
|
||||
|
||||
//Sub-pixel aliasing should not be sent to the blitter
|
||||
updateStateBits(&alphaFillRectMask, STATE_ANTIALIASING, true);
|
||||
updateStateBits(&alphaFillRectMask, STATE_ALPHA, false);
|
||||
updateStateBits(&alphaFillRectMask, STATE_BLENDING_COMPLEX, false);
|
||||
|
||||
updateStateBits(&alphaFillRectMask, STATE_CLIPSYS_COMPLEX, false);
|
||||
updateStateBits(&alphaFillRectMask, STATE_CLIP_COMPLEX, false);
|
||||
}
|
||||
|
||||
void setSourcePixmapMask() {
|
||||
updateStateBits(&drawPixmapMask, STATE_XFORM_SCALE, true);
|
||||
updateStateBits(&drawPixmapMask, STATE_XFORM_COMPLEX, false);
|
||||
|
||||
updateStateBits(&drawPixmapMask, STATE_BRUSH_PATTERN, true);
|
||||
updateStateBits(&drawPixmapMask, STATE_BRUSH_ALPHA, false);
|
||||
|
||||
updateStateBits(&drawPixmapMask, STATE_PEN_ENABLED, true);
|
||||
|
||||
updateStateBits(&drawPixmapMask, STATE_ANTIALIASING, true);
|
||||
updateStateBits(&drawPixmapMask, STATE_ALPHA, false);
|
||||
updateStateBits(&drawPixmapMask, STATE_BLENDING_COMPLEX, false);
|
||||
|
||||
updateStateBits(&drawPixmapMask, STATE_CLIPSYS_COMPLEX, false);
|
||||
updateStateBits(&drawPixmapMask, STATE_CLIP_COMPLEX, false);
|
||||
}
|
||||
|
||||
void setSourceOverPixmapMask() {
|
||||
setSourcePixmapMask();
|
||||
}
|
||||
|
||||
void setSourceOverScaledPixmapMask() {
|
||||
setSourceOverPixmapMask();
|
||||
updateStateBits(&drawRectMask, STATE_XFORM_SCALE, true);
|
||||
}
|
||||
|
||||
void setOpacityPixmapMask() {
|
||||
updateStateBits(&opacityPixmapMask, STATE_XFORM_SCALE, true);
|
||||
updateStateBits(&opacityPixmapMask, STATE_XFORM_COMPLEX, false);
|
||||
|
||||
updateStateBits(&opacityPixmapMask, STATE_BRUSH_PATTERN, true);
|
||||
updateStateBits(&opacityPixmapMask, STATE_BRUSH_ALPHA, true);
|
||||
|
||||
updateStateBits(&opacityPixmapMask, STATE_PEN_ENABLED, true);
|
||||
|
||||
updateStateBits(&opacityPixmapMask, STATE_ANTIALIASING, true);
|
||||
updateStateBits(&opacityPixmapMask, STATE_ALPHA, true);
|
||||
updateStateBits(&opacityPixmapMask, STATE_BLENDING_COMPLEX, false);
|
||||
|
||||
updateStateBits(&opacityPixmapMask, STATE_CLIPSYS_COMPLEX, false);
|
||||
updateStateBits(&opacityPixmapMask, STATE_CLIP_COMPLEX, false);
|
||||
}
|
||||
|
||||
QBlittable::Capabilities m_capabilities;
|
||||
uint fillRectMask;
|
||||
uint drawRectMask;
|
||||
uint drawPixmapMask;
|
||||
uint alphaFillRectMask;
|
||||
uint opacityPixmapMask;
|
||||
uint capabillitiesState;
|
||||
};
|
||||
|
||||
class QBlitterPaintEnginePrivate : public QRasterPaintEnginePrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QBlitterPaintEngine)
|
||||
public:
|
||||
QBlitterPaintEnginePrivate(QBlittablePixmapData *p)
|
||||
: QRasterPaintEnginePrivate()
|
||||
, pmData(p)
|
||||
, caps(pmData->blittable()->capabilities())
|
||||
, hasXForm(false)
|
||||
|
||||
{}
|
||||
|
||||
void lock();
|
||||
void unlock();
|
||||
void fillRect(const QRectF& rect, const QColor&, bool alpha);
|
||||
void clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr, bool opacity);
|
||||
|
||||
|
||||
void updateCompleteState(QPainterState *s);
|
||||
void updatePenState(QPainterState *s);
|
||||
void updateBrushState(QPainterState *s);
|
||||
void updateOpacityState(QPainterState *s);
|
||||
void updateCompositionModeState(QPainterState *s);
|
||||
void updateRenderHintsState(QPainterState *s);
|
||||
void updateTransformState(QPainterState *s);
|
||||
void updateClipState(QPainterState *s);
|
||||
|
||||
QBlittablePixmapData *pmData;
|
||||
CapabilitiesToStateMask caps;
|
||||
uint hasXForm;
|
||||
};
|
||||
|
||||
inline void QBlitterPaintEnginePrivate::lock()
|
||||
{
|
||||
if (!pmData->blittable()->isLocked())
|
||||
rasterBuffer->prepare(pmData->buffer());
|
||||
}
|
||||
|
||||
inline void QBlitterPaintEnginePrivate::unlock()
|
||||
{
|
||||
pmData->blittable()->unlock();
|
||||
}
|
||||
|
||||
// State tracking to make decisions
|
||||
void QBlitterPaintEnginePrivate::updateCompleteState(QPainterState *s)
|
||||
{
|
||||
updatePenState(s);
|
||||
updateBrushState(s);
|
||||
updateOpacityState(s);
|
||||
updateCompositionModeState(s);
|
||||
updateRenderHintsState(s);
|
||||
updateTransformState(s);
|
||||
updateClipState(s);
|
||||
}
|
||||
|
||||
void QBlitterPaintEnginePrivate::updatePenState(QPainterState *s)
|
||||
{
|
||||
caps.updateState(STATE_PEN_ENABLED, qpen_style(s->pen) != Qt::NoPen);
|
||||
}
|
||||
|
||||
void QBlitterPaintEnginePrivate::updateBrushState(QPainterState *s)
|
||||
{
|
||||
Qt::BrushStyle style = qbrush_style(s->brush);
|
||||
|
||||
caps.updateState(STATE_BRUSH_PATTERN, style > Qt::SolidPattern);
|
||||
caps.updateState(STATE_BRUSH_ALPHA,
|
||||
qbrush_color(s->brush).alpha() < 255);
|
||||
}
|
||||
|
||||
void QBlitterPaintEnginePrivate::updateOpacityState(QPainterState *s)
|
||||
{
|
||||
bool translucent = s->opacity < 1;
|
||||
caps.updateState(STATE_ALPHA, translucent);
|
||||
}
|
||||
|
||||
void QBlitterPaintEnginePrivate::updateCompositionModeState(QPainterState *s)
|
||||
{
|
||||
bool nonTrivial = s->composition_mode != QPainter::CompositionMode_SourceOver
|
||||
&& s->composition_mode != QPainter::CompositionMode_Source;
|
||||
|
||||
caps.updateState(STATE_BLENDING_COMPLEX, nonTrivial);
|
||||
}
|
||||
|
||||
void QBlitterPaintEnginePrivate::updateRenderHintsState(QPainterState *s)
|
||||
{
|
||||
bool aa = s->renderHints & QPainter::Antialiasing;
|
||||
caps.updateState(STATE_ANTIALIASING, aa);
|
||||
}
|
||||
|
||||
void QBlitterPaintEnginePrivate::updateTransformState(QPainterState *s)
|
||||
{
|
||||
QTransform::TransformationType type = s->matrix.type();
|
||||
|
||||
// consider scaling operations with a negative factor as "complex" for now.
|
||||
// as some blitters could handle axisymmetrical operations, we should improve blitter
|
||||
// paint engine to handle them as a capability
|
||||
caps.updateState(STATE_XFORM_COMPLEX, (type > QTransform::TxScale) ||
|
||||
((type == QTransform::TxScale) && ((s->matrix.m11() < 0.0) || (s->matrix.m22() < 0.0))));
|
||||
caps.updateState(STATE_XFORM_SCALE, type > QTransform::TxTranslate);
|
||||
|
||||
hasXForm = type >= QTransform::TxTranslate;
|
||||
}
|
||||
|
||||
void QBlitterPaintEnginePrivate::updateClipState(QPainterState *)
|
||||
{
|
||||
const QClipData *clipData = clip();
|
||||
bool complexClip = clipData && !(clipData->hasRectClip || clipData->hasRegionClip);
|
||||
caps.updateState(STATE_CLIP_COMPLEX, complexClip);
|
||||
}
|
||||
|
||||
void QBlitterPaintEnginePrivate::fillRect(const QRectF &rect, const QColor &color, bool alpha)
|
||||
{
|
||||
Q_Q(QBlitterPaintEngine);
|
||||
pmData->unmarkRasterOverlay(rect);
|
||||
QRectF targetRect = rect;
|
||||
if (hasXForm)
|
||||
targetRect = q->state()->matrix.mapRect(rect);
|
||||
const QClipData *clipData = clip();
|
||||
if (clipData) {
|
||||
if (clipData->hasRectClip) {
|
||||
unlock();
|
||||
if (alpha)
|
||||
pmData->blittable()->alphaFillRect(targetRect & clipData->clipRect, color, q->state()->compositionMode());
|
||||
else
|
||||
pmData->blittable()->fillRect(targetRect & clipData->clipRect, color);
|
||||
} else if (clipData->hasRegionClip) {
|
||||
QVector<QRect> rects = clipData->clipRegion.rects();
|
||||
for (int i = 0; i < rects.size(); ++i) {
|
||||
QRect intersectRect = rects.at(i).intersected(targetRect.toRect());
|
||||
if (!intersectRect.isEmpty()) {
|
||||
unlock();
|
||||
if (alpha)
|
||||
pmData->blittable()->alphaFillRect(intersectRect, color, q->state()->compositionMode());
|
||||
else
|
||||
pmData->blittable()->fillRect(intersectRect, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (targetRect.x() >= 0 && targetRect.y() >= 0
|
||||
&& targetRect.width() <= q->paintDevice()->width()
|
||||
&& targetRect.height() <= q->paintDevice()->height()) {
|
||||
unlock();
|
||||
if (alpha)
|
||||
pmData->blittable()->alphaFillRect(targetRect, color, q->state()->compositionMode());
|
||||
else
|
||||
pmData->blittable()->fillRect(targetRect, color);
|
||||
} else {
|
||||
QRectF deviceRect(0, 0, q->paintDevice()->width(), q->paintDevice()->height());
|
||||
unlock();
|
||||
if (alpha)
|
||||
pmData->blittable()->alphaFillRect(deviceRect & targetRect, color, q->state()->compositionMode());
|
||||
else
|
||||
pmData->blittable()->fillRect(deviceRect & targetRect, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QBlitterPaintEnginePrivate::clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr, bool opacity)
|
||||
{
|
||||
Q_Q(QBlitterPaintEngine);
|
||||
QRectF intersectedRect = clip.intersected(target);
|
||||
if (intersectedRect.isEmpty())
|
||||
return;
|
||||
QRectF source = sr;
|
||||
if (intersectedRect.size() != target.size()) {
|
||||
if (sr.size() == target.size()) {
|
||||
// no resize
|
||||
qreal deltaTop = target.top() - intersectedRect.top();
|
||||
qreal deltaLeft = target.left() - intersectedRect.left();
|
||||
qreal deltaBottom = target.bottom() - intersectedRect.bottom();
|
||||
qreal deltaRight = target.right() - intersectedRect.right();
|
||||
source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom);
|
||||
} else {
|
||||
// resize case
|
||||
qreal hFactor = sr.size().width() / target.size().width();
|
||||
qreal vFactor = sr.size().height() / target.size().height();
|
||||
qreal deltaTop = (target.top() - intersectedRect.top()) * vFactor;
|
||||
qreal deltaLeft = (target.left() - intersectedRect.left()) * hFactor;
|
||||
qreal deltaBottom = (target.bottom() - intersectedRect.bottom()) * vFactor;
|
||||
qreal deltaRight = (target.right() - intersectedRect.right()) * hFactor;
|
||||
source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom);
|
||||
}
|
||||
}
|
||||
pmData->unmarkRasterOverlay(intersectedRect);
|
||||
if (opacity)
|
||||
pmData->blittable()->drawPixmapOpacity(intersectedRect, pm, source, q->state()->compositionMode(), q->state()->opacity);
|
||||
else
|
||||
pmData->blittable()->drawPixmap(intersectedRect, pm, source);
|
||||
}
|
||||
|
||||
QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePixmapData *p)
|
||||
: QRasterPaintEngine(*(new QBlitterPaintEnginePrivate(p)), p->buffer())
|
||||
{}
|
||||
|
||||
// State tracking
|
||||
void QBlitterPaintEngine::penChanged()
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
|
||||
QRasterPaintEngine::penChanged();
|
||||
d->updatePenState(state());
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::brushChanged()
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
|
||||
QRasterPaintEngine::brushChanged();
|
||||
d->updateBrushState(state());
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::opacityChanged()
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
|
||||
QRasterPaintEngine::opacityChanged();
|
||||
d->updateOpacityState(state());
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::compositionModeChanged()
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
|
||||
QRasterPaintEngine::compositionModeChanged();
|
||||
d->updateCompositionModeState(state());
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::renderHintsChanged()
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
|
||||
QRasterPaintEngine::renderHintsChanged();
|
||||
d->updateRenderHintsState(state());
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::transformChanged()
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
|
||||
QRasterPaintEngine::transformChanged();
|
||||
d->updateTransformState(state());
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::clipEnabledChanged()
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
QRasterPaintEngine::clipEnabledChanged();
|
||||
d->updateClipState(state());
|
||||
}
|
||||
|
||||
bool QBlitterPaintEngine::begin(QPaintDevice *pdev)
|
||||
{
|
||||
bool ok = QRasterPaintEngine::begin(pdev);
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->pmData->unmergeOverlay();
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool QBlitterPaintEngine::end()
|
||||
{
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->pmData->mergeOverlay();
|
||||
#endif
|
||||
|
||||
return QRasterPaintEngine::end();
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::setState(QPainterState *s)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
|
||||
QRasterPaintEngine::setState(s);
|
||||
d->updateCompleteState(s);
|
||||
}
|
||||
|
||||
// Accelerated paths
|
||||
void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
if (path.shape() == QVectorPath::RectangleHint) {
|
||||
QRectF rect(((QPointF *) path.points())[0], ((QPointF *) path.points())[2]);
|
||||
fillRect(rect, brush);
|
||||
} else {
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(path);
|
||||
QRasterPaintEngine::fill(path, brush);
|
||||
}
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::fillRect(const QRectF &rect, const QColor &color)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
if (d->caps.canBlitterAlphaFillRect()) {
|
||||
d->fillRect(rect, color, true);
|
||||
} else if (d->caps.canBlitterFillRect() && color.alpha() == 0xff) {
|
||||
d->fillRect(rect, color, false);
|
||||
} else {
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(rect);
|
||||
QRasterPaintEngine::fillRect(rect, color);
|
||||
}
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
|
||||
{
|
||||
if (rect.size().isEmpty())
|
||||
return;
|
||||
|
||||
Q_D(QBlitterPaintEngine);
|
||||
|
||||
if (qbrush_style(brush) == Qt::SolidPattern
|
||||
&& d->caps.canBlitterAlphaFillRect()) {
|
||||
d->fillRect(rect, qbrush_color(brush), true);
|
||||
} else if (qbrush_style(brush) == Qt::SolidPattern
|
||||
&& qbrush_color(brush).alpha() == 0xff
|
||||
&& d->caps.canBlitterFillRect()) {
|
||||
d->fillRect(rect, qbrush_color(brush), false);
|
||||
} else if ((brush.style() == Qt::TexturePattern) &&
|
||||
(brush.transform().type() <= QTransform::TxTranslate) &&
|
||||
((d->caps.canBlitterDrawPixmapOpacity(brush.texture())) ||
|
||||
(d->caps.canBlitterDrawPixmap(rect, brush.texture(), rect)))) {
|
||||
bool rectIsFilled = false;
|
||||
QRectF transformedRect = state()->matrix.mapRect(rect);
|
||||
qreal x = transformedRect.x();
|
||||
qreal y = transformedRect.y();
|
||||
QPixmap pm = brush.texture();
|
||||
d->unlock();
|
||||
int srcX = int(rect.x() - state()->brushOrigin.x() - brush.transform().dx()) % pm.width();
|
||||
if (srcX < 0)
|
||||
srcX = pm.width() + srcX;
|
||||
const int startX = srcX;
|
||||
int srcY = int(rect.y() - state()->brushOrigin.y() - brush.transform().dy()) % pm.height();
|
||||
if (srcY < 0)
|
||||
srcY = pm.height() + srcY;
|
||||
while (!rectIsFilled) {
|
||||
qreal blitWidth = (pm.width() ) - srcX;
|
||||
qreal blitHeight = (pm.height() ) - srcY;
|
||||
if (x + blitWidth > transformedRect.right())
|
||||
blitWidth = transformedRect.right() -x;
|
||||
if (y + blitHeight > transformedRect.bottom())
|
||||
blitHeight = transformedRect.bottom() - y;
|
||||
const QClipData *clipData = d->clip();
|
||||
if (clipData->hasRectClip) {
|
||||
QRect targetRect = QRect(x, y, blitWidth, blitHeight).intersected(clipData->clipRect);
|
||||
if (targetRect.isValid()) {
|
||||
int tmpSrcX = srcX + (targetRect.x() - x);
|
||||
int tmpSrcY = srcY + (targetRect.y() - y);
|
||||
QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height());
|
||||
d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect);
|
||||
}
|
||||
} else if (clipData->hasRegionClip) {
|
||||
QVector<QRect> clipRects = clipData->clipRegion.rects();
|
||||
QRect unclippedTargetRect(x, y, blitWidth, blitHeight);
|
||||
QRegion intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect);
|
||||
|
||||
for (int i = 0; i < intersectedRects.rects().size(); ++i) {
|
||||
QRect targetRect = intersectedRects.rects().at(i);
|
||||
if (!targetRect.isValid() || targetRect.isEmpty())
|
||||
continue;
|
||||
int tmpSrcX = srcX + (targetRect.x() - x);
|
||||
int tmpSrcY = srcY + (targetRect.y() - y);
|
||||
QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height());
|
||||
d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect);
|
||||
}
|
||||
}
|
||||
x+=blitWidth;
|
||||
if (qFuzzyCompare(x, transformedRect.right())) {
|
||||
x = transformedRect.x();
|
||||
srcX = startX;
|
||||
srcY = 0;
|
||||
y += blitHeight;
|
||||
if (qFuzzyCompare(y, transformedRect.bottom()))
|
||||
rectIsFilled = true;
|
||||
} else
|
||||
srcX = 0;
|
||||
}
|
||||
} else {
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(rect);
|
||||
QRasterPaintEngine::fillRect(rect, brush);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
if (d->caps.canBlitterDrawRectMask()) {
|
||||
for (int i=0; i<rectCount; ++i)
|
||||
d->fillRect(rects[i], qbrush_color(state()->brush), false);
|
||||
} else {
|
||||
d->pmData->markRasterOverlay(rects, rectCount);
|
||||
QRasterPaintEngine::drawRects(rects, rectCount);
|
||||
}
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::drawRects(const QRectF *rects, int rectCount)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
if (d->caps.canBlitterDrawRectMask()) {
|
||||
for (int i = 0; i < rectCount; ++i)
|
||||
d->fillRect(rects[i], qbrush_color(state()->brush), false);
|
||||
} else {
|
||||
d->pmData->markRasterOverlay(rects, rectCount);
|
||||
QRasterPaintEngine::drawRects(rects, rectCount);
|
||||
}
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pm)
|
||||
{
|
||||
drawPixmap(QRectF(pos, pm.size()), pm, pm.rect());
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
bool canDrawOpacity;
|
||||
|
||||
canDrawOpacity = d->caps.canBlitterDrawPixmapOpacity(pm);
|
||||
if (canDrawOpacity || (d->caps.canBlitterDrawPixmap(r, pm, sr))) {
|
||||
|
||||
d->unlock();
|
||||
QRectF targetRect = r;
|
||||
if (d->hasXForm)
|
||||
targetRect = state()->matrix.mapRect(r);
|
||||
const QClipData *clipData = d->clip();
|
||||
if (clipData) {
|
||||
if (clipData->hasRectClip) {
|
||||
d->clipAndDrawPixmap(clipData->clipRect, targetRect, pm, sr, canDrawOpacity);
|
||||
} else if (clipData->hasRegionClip) {
|
||||
QVector<QRect>rects = clipData->clipRegion.rects();
|
||||
for (int i = 0; i<rects.size(); ++i)
|
||||
d->clipAndDrawPixmap(rects.at(i), targetRect, pm, sr, canDrawOpacity);
|
||||
}
|
||||
} else {
|
||||
QRectF deviceRect(0, 0, paintDevice()->width(), paintDevice()->height());
|
||||
d->clipAndDrawPixmap(deviceRect, targetRect, pm, sr, canDrawOpacity);
|
||||
}
|
||||
}else {
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(r);
|
||||
QRasterPaintEngine::drawPixmap(r, pm, sr);
|
||||
}
|
||||
}
|
||||
|
||||
// Overriden methods to lock the graphics memory
|
||||
void QBlitterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(points, pointCount);
|
||||
QRasterPaintEngine::drawPolygon(points, pointCount, mode);
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(points, pointCount);
|
||||
QRasterPaintEngine::drawPolygon(points, pointCount, mode);
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::fillPath(const QPainterPath &path, QSpanData *fillData)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(path);
|
||||
QRasterPaintEngine::fillPath(path, fillData);
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(points, pointCount);
|
||||
QRasterPaintEngine::fillPolygon(points, pointCount, mode);
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::drawEllipse(const QRectF &r)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(r);
|
||||
QRasterPaintEngine::drawEllipse(r);
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::drawImage(const QPointF &pos, const QImage &image)
|
||||
{
|
||||
drawImage(QRectF(pos, image.size()), image, image.rect());
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
|
||||
Qt::ImageConversionFlags flags)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(r);
|
||||
QRasterPaintEngine::drawImage(r, pm, sr, flags);
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(r);
|
||||
QRasterPaintEngine::drawTiledPixmap(r, pm, sr);
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::drawTextItem(const QPointF &pos, const QTextItem &ti)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(pos, ti);
|
||||
QRasterPaintEngine::drawTextItem(pos, ti);
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::drawPoints(const QPointF *points, int pointCount)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(points, pointCount);
|
||||
QRasterPaintEngine::drawPoints(points, pointCount);
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::drawPoints(const QPoint *points, int pointCount)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(points, pointCount);
|
||||
QRasterPaintEngine::drawPoints(points, pointCount);
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->lock();
|
||||
d->pmData->markRasterOverlay(path);
|
||||
QRasterPaintEngine::stroke(path, pen);
|
||||
}
|
||||
|
||||
void QBlitterPaintEngine::drawStaticTextItem(QStaticTextItem *sti)
|
||||
{
|
||||
Q_D(QBlitterPaintEngine);
|
||||
d->lock();
|
||||
QRasterPaintEngine::drawStaticTextItem(sti);
|
||||
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
//#### d->pmData->markRasterOverlay(sti);
|
||||
qWarning("not implemented: markRasterOverlay for QStaticTextItem");
|
||||
#endif
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif //QT_NO_BLITTABLE
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,104 +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$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QPAINTENGINE_BLITTER_P_H
|
||||
#define QPAINTENGINE_BLITTER_P_H
|
||||
|
||||
#include "qpaintengine_raster_p.h"
|
||||
|
||||
#ifndef QT_NO_BLITTABLE
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBlitterPaintEnginePrivate;
|
||||
class QBlittablePixmapData;
|
||||
class QBlittable;
|
||||
|
||||
class Q_GUI_EXPORT QBlitterPaintEngine : public QRasterPaintEngine
|
||||
{
|
||||
Q_DECLARE_PRIVATE(QBlitterPaintEngine)
|
||||
public:
|
||||
QBlitterPaintEngine(QBlittablePixmapData *p);
|
||||
|
||||
virtual QPaintEngine::Type type() const { return Blitter; }
|
||||
|
||||
virtual bool begin(QPaintDevice *pdev);
|
||||
virtual bool end();
|
||||
|
||||
// Call down into QBlittable
|
||||
virtual void fill(const QVectorPath &path, const QBrush &brush);
|
||||
virtual void fillRect(const QRectF &rect, const QBrush &brush);
|
||||
virtual void fillRect(const QRectF &rect, const QColor &color);
|
||||
virtual void drawRects(const QRect *rects, int rectCount);
|
||||
virtual void drawRects(const QRectF *rects, int rectCount);
|
||||
void drawPixmap(const QPointF &p, const QPixmap &pm);
|
||||
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
|
||||
|
||||
// State tracking
|
||||
void setState(QPainterState *s);
|
||||
virtual void clipEnabledChanged();
|
||||
virtual void penChanged();
|
||||
virtual void brushChanged();
|
||||
virtual void opacityChanged();
|
||||
virtual void compositionModeChanged();
|
||||
virtual void renderHintsChanged();
|
||||
virtual void transformChanged();
|
||||
|
||||
// Override to lock the QBlittable before using raster
|
||||
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
|
||||
void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
|
||||
void fillPath(const QPainterPath &path, QSpanData *fillData);
|
||||
void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
|
||||
void drawEllipse(const QRectF &rect);
|
||||
void drawImage(const QPointF &p, const QImage &img);
|
||||
void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
|
||||
Qt::ImageConversionFlags flags = Qt::AutoColor);
|
||||
void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr);
|
||||
void drawTextItem(const QPointF &p, const QTextItem &textItem);
|
||||
void drawPoints(const QPointF *points, int pointCount);
|
||||
void drawPoints(const QPoint *points, int pointCount);
|
||||
void stroke(const QVectorPath &path, const QPen &pen);
|
||||
void drawStaticTextItem(QStaticTextItem *);
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif //QT_NO_BLITTABLE
|
||||
#endif // QPAINTENGINE_BLITTER_P_H
|
||||
|
|
@ -389,7 +389,7 @@ bool QRasterPaintEngine::begin(QPaintDevice *device)
|
|||
if (device->devType() == QInternal::Pixmap) {
|
||||
QPixmap *pixmap = static_cast<QPixmap *>(device);
|
||||
QPixmapData *pd = pixmap->pixmapData();
|
||||
if (pd->classId() == QPixmapData::RasterClass || pd->classId() == QPixmapData::BlitterClass)
|
||||
if (pd->classId() == QPixmapData::RasterClass)
|
||||
d->device = pd->buffer();
|
||||
} else {
|
||||
d->device = device;
|
||||
|
@ -568,7 +568,6 @@ void QRasterPaintEngine::updateMatrix(const QTransform &matrix)
|
|||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -3596,8 +3595,6 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
|
|||
rasterParams.flags = QT_FT_RASTER_FLAG_CLIP;
|
||||
rasterParams.gray_spans = 0;
|
||||
rasterParams.black_spans = 0;
|
||||
rasterParams.bit_test = 0;
|
||||
rasterParams.bit_set = 0;
|
||||
rasterParams.user = data;
|
||||
rasterParams.clip_box = clip_box;
|
||||
|
||||
|
|
|
@ -243,8 +243,6 @@ protected:
|
|||
QRasterPaintEngine(QRasterPaintEnginePrivate &d, QPaintDevice *);
|
||||
private:
|
||||
friend struct QSpanData;
|
||||
friend class QBlitterPaintEngine;
|
||||
friend class QBlitterPaintEnginePrivate;
|
||||
void init();
|
||||
|
||||
void fillRect(const QRectF &rect, QSpanData *data);
|
||||
|
|
|
@ -213,68 +213,6 @@ QT_FT_BEGIN_HEADER
|
|||
} QT_FT_Pixel_Mode;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Enum> */
|
||||
/* qt_ft_pixel_mode_xxx */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A list of deprecated constants. Use the corresponding */
|
||||
/* @QT_FT_Pixel_Mode values instead. */
|
||||
/* */
|
||||
/* <Values> */
|
||||
/* qt_ft_pixel_mode_none :: see @QT_FT_PIXEL_MODE_NONE */
|
||||
/* qt_ft_pixel_mode_mono :: see @QT_FT_PIXEL_MODE_MONO */
|
||||
/* qt_ft_pixel_mode_grays :: see @QT_FT_PIXEL_MODE_GRAY */
|
||||
/* qt_ft_pixel_mode_pal2 :: see @QT_FT_PIXEL_MODE_GRAY2 */
|
||||
/* qt_ft_pixel_mode_pal4 :: see @QT_FT_PIXEL_MODE_GRAY4 */
|
||||
/* */
|
||||
#define qt_ft_pixel_mode_none QT_FT_PIXEL_MODE_NONE
|
||||
#define qt_ft_pixel_mode_mono QT_FT_PIXEL_MODE_MONO
|
||||
#define qt_ft_pixel_mode_grays QT_FT_PIXEL_MODE_GRAY
|
||||
#define qt_ft_pixel_mode_pal2 QT_FT_PIXEL_MODE_GRAY2
|
||||
#define qt_ft_pixel_mode_pal4 QT_FT_PIXEL_MODE_GRAY4
|
||||
|
||||
/* */
|
||||
|
||||
#if 0
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Enum> */
|
||||
/* QT_FT_Palette_Mode */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* THIS TYPE IS DEPRECATED. DO NOT USE IT! */
|
||||
/* */
|
||||
/* An enumeration type used to describe the format of a bitmap */
|
||||
/* palette, used with qt_ft_pixel_mode_pal4 and qt_ft_pixel_mode_pal8. */
|
||||
/* */
|
||||
/* <Fields> */
|
||||
/* qt_ft_palette_mode_rgb :: The palette is an array of 3-bytes RGB */
|
||||
/* records. */
|
||||
/* */
|
||||
/* qt_ft_palette_mode_rgba :: The palette is an array of 4-bytes RGBA */
|
||||
/* records. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* As qt_ft_pixel_mode_pal2, pal4 and pal8 are currently unused by */
|
||||
/* FreeType, these types are not handled by the library itself. */
|
||||
/* */
|
||||
typedef enum QT_FT_Palette_Mode_
|
||||
{
|
||||
qt_ft_palette_mode_rgb = 0,
|
||||
qt_ft_palette_mode_rgba,
|
||||
|
||||
qt_ft_palettte_mode_max /* do not remove */
|
||||
|
||||
} QT_FT_Palette_Mode;
|
||||
|
||||
/* */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Struct> */
|
||||
|
@ -402,16 +340,16 @@ QT_FT_BEGIN_HEADER
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Enum> */
|
||||
/* QT_FT_OUTLINE_FLAGS */
|
||||
/* QT_FT_OUTLINE_FLAGS */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A list of bit-field constants use for the flags in an outline's */
|
||||
/* `flags' field. */
|
||||
/* */
|
||||
/* <Values> */
|
||||
/* QT_FT_OUTLINE_NONE :: Value 0 is reserved. */
|
||||
/* QT_FT_OUTLINE_NONE :: Value 0 is reserved. */
|
||||
/* */
|
||||
/* QT_FT_OUTLINE_OWNER :: If set, this flag indicates that the */
|
||||
/* QT_FT_OUTLINE_OWNER :: If set, this flag indicates that the */
|
||||
/* outline's field arrays (i.e. */
|
||||
/* `points', `flags' & `contours') are */
|
||||
/* `owned' by the outline object, and */
|
||||
|
@ -424,7 +362,7 @@ QT_FT_BEGIN_HEADER
|
|||
/* the even-odd fill rule (only works */
|
||||
/* with the smooth raster). */
|
||||
/* */
|
||||
/* QT_FT_OUTLINE_REVERSE_FILL :: By default, outside contours of an */
|
||||
/* QT_FT_OUTLINE_REVERSE_FILL :: By default, outside contours of an */
|
||||
/* outline are oriented in clock-wise */
|
||||
/* direction, as defined in the TrueType */
|
||||
/* specification. This flag is set if */
|
||||
|
@ -434,14 +372,14 @@ QT_FT_BEGIN_HEADER
|
|||
/* scan-converter. However, it is very */
|
||||
/* important for the auto-hinter. */
|
||||
/* */
|
||||
/* QT_FT_OUTLINE_IGNORE_DROPOUTS :: By default, the scan converter will */
|
||||
/* QT_FT_OUTLINE_IGNORE_DROPOUTS :: By default, the scan converter will */
|
||||
/* try to detect drop-outs in an outline */
|
||||
/* and correct the glyph bitmap to */
|
||||
/* ensure consistent shape continuity. */
|
||||
/* If set, this flag hints the scan-line */
|
||||
/* converter to ignore such cases. */
|
||||
/* */
|
||||
/* QT_FT_OUTLINE_HIGH_PRECISION :: This flag indicates that the */
|
||||
/* QT_FT_OUTLINE_HIGH_PRECISION :: This flag indicates that the */
|
||||
/* scan-line converter should try to */
|
||||
/* convert this outline to bitmaps with */
|
||||
/* the highest possible quality. It is */
|
||||
|
@ -450,7 +388,7 @@ QT_FT_BEGIN_HEADER
|
|||
/* hint, that might be completely */
|
||||
/* ignored by a given scan-converter. */
|
||||
/* */
|
||||
/* QT_FT_OUTLINE_SINGLE_PASS :: This flag is set to force a given */
|
||||
/* QT_FT_OUTLINE_SINGLE_PASS :: This flag is set to force a given */
|
||||
/* scan-converter to only use a single */
|
||||
/* pass over the outline to render a */
|
||||
/* bitmap glyph image. Normally, it is */
|
||||
|
@ -468,33 +406,6 @@ QT_FT_BEGIN_HEADER
|
|||
#define QT_FT_OUTLINE_HIGH_PRECISION 0x100
|
||||
#define QT_FT_OUTLINE_SINGLE_PASS 0x200
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* @enum:
|
||||
* qt_ft_outline_flags
|
||||
*
|
||||
* @description:
|
||||
* These constants are deprecated. Please use the corresponding
|
||||
* @QT_FT_OUTLINE_FLAGS values.
|
||||
*
|
||||
* @values:
|
||||
* qt_ft_outline_none :: See @QT_FT_OUTLINE_NONE.
|
||||
* qt_ft_outline_owner :: See @QT_FT_OUTLINE_OWNER.
|
||||
* qt_ft_outline_even_odd_fill :: See @QT_FT_OUTLINE_EVEN_ODD_FILL.
|
||||
* qt_ft_outline_reverse_fill :: See @QT_FT_OUTLINE_REVERSE_FILL.
|
||||
* qt_ft_outline_ignore_dropouts :: See @QT_FT_OUTLINE_IGNORE_DROPOUTS.
|
||||
* qt_ft_outline_high_precision :: See @QT_FT_OUTLINE_HIGH_PRECISION.
|
||||
* qt_ft_outline_single_pass :: See @QT_FT_OUTLINE_SINGLE_PASS.
|
||||
*/
|
||||
#define qt_ft_outline_none QT_FT_OUTLINE_NONE
|
||||
#define qt_ft_outline_owner QT_FT_OUTLINE_OWNER
|
||||
#define qt_ft_outline_even_odd_fill QT_FT_OUTLINE_EVEN_ODD_FILL
|
||||
#define qt_ft_outline_reverse_fill QT_FT_OUTLINE_REVERSE_FILL
|
||||
#define qt_ft_outline_ignore_dropouts QT_FT_OUTLINE_IGNORE_DROPOUTS
|
||||
#define qt_ft_outline_high_precision QT_FT_OUTLINE_HIGH_PRECISION
|
||||
#define qt_ft_outline_single_pass QT_FT_OUTLINE_SINGLE_PASS
|
||||
|
||||
/* */
|
||||
|
||||
#define QT_FT_CURVE_TAG( flag ) ( flag & 3 )
|
||||
|
@ -518,7 +429,7 @@ QT_FT_BEGIN_HEADER
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* QT_FT_Outline_MoveToFunc */
|
||||
/* QT_FT_Outline_MoveToFunc */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A function pointer type used to describe the signature of a `move */
|
||||
|
@ -544,7 +455,7 @@ QT_FT_BEGIN_HEADER
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* QT_FT_Outline_LineToFunc */
|
||||
/* QT_FT_Outline_LineToFunc */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A function pointer type used to describe the signature of a `line */
|
||||
|
@ -570,7 +481,7 @@ QT_FT_BEGIN_HEADER
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* QT_FT_Outline_ConicToFunc */
|
||||
/* QT_FT_Outline_ConicToFunc */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A function pointer type use to describe the signature of a `conic */
|
||||
|
@ -601,7 +512,7 @@ QT_FT_BEGIN_HEADER
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* QT_FT_Outline_CubicToFunc */
|
||||
/* QT_FT_Outline_CubicToFunc */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A function pointer type used to describe the signature of a `cubic */
|
||||
|
@ -634,7 +545,7 @@ QT_FT_BEGIN_HEADER
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Struct> */
|
||||
/* QT_FT_Outline_Funcs */
|
||||
/* QT_FT_Outline_Funcs */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A structure to hold various function pointers used during outline */
|
||||
|
@ -691,7 +602,7 @@ QT_FT_BEGIN_HEADER
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Macro> */
|
||||
/* QT_FT_IMAGE_TAG */
|
||||
/* QT_FT_IMAGE_TAG */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* This macro converts four letter tags into an unsigned long. */
|
||||
|
@ -701,7 +612,7 @@ QT_FT_BEGIN_HEADER
|
|||
/* should redefine this macro in case of problems to something like */
|
||||
/* this: */
|
||||
/* */
|
||||
/* #define QT_FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */
|
||||
/* #define QT_FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */
|
||||
/* */
|
||||
/* to get a simple enumeration without assigning special numbers. */
|
||||
/* */
|
||||
|
@ -767,18 +678,18 @@ QT_FT_BEGIN_HEADER
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Enum> */
|
||||
/* qt_ft_glyph_format_xxx */
|
||||
/* qt_ft_glyph_format_xxx */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A list of decprecated constants. Use the corresponding */
|
||||
/* @QT_FT_Glyph_Format values instead. */
|
||||
/* @QT_FT_Glyph_Format values instead. */
|
||||
/* */
|
||||
/* <Values> */
|
||||
/* qt_ft_glyph_format_none :: see @QT_FT_GLYPH_FORMAT_NONE */
|
||||
/* qt_ft_glyph_format_composite :: see @QT_FT_GLYPH_FORMAT_COMPOSITE */
|
||||
/* qt_ft_glyph_format_bitmap :: see @QT_FT_GLYPH_FORMAT_BITMAP */
|
||||
/* qt_ft_glyph_format_outline :: see @QT_FT_GLYPH_FORMAT_OUTLINE */
|
||||
/* qt_ft_glyph_format_plotter :: see @QT_FT_GLYPH_FORMAT_PLOTTER */
|
||||
/* qt_ft_glyph_format_none :: see @QT_FT_GLYPH_FORMAT_NONE */
|
||||
/* qt_ft_glyph_format_composite :: see @QT_FT_GLYPH_FORMAT_COMPOSITE */
|
||||
/* qt_ft_glyph_format_bitmap :: see @QT_FT_GLYPH_FORMAT_BITMAP */
|
||||
/* qt_ft_glyph_format_outline :: see @QT_FT_GLYPH_FORMAT_OUTLINE */
|
||||
/* qt_ft_glyph_format_plotter :: see @QT_FT_GLYPH_FORMAT_PLOTTER */
|
||||
/* */
|
||||
#define qt_ft_glyph_format_none QT_FT_GLYPH_FORMAT_NONE
|
||||
#define qt_ft_glyph_format_composite QT_FT_GLYPH_FORMAT_COMPOSITE
|
||||
|
@ -830,7 +741,7 @@ QT_FT_BEGIN_HEADER
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Type> */
|
||||
/* QT_FT_Raster */
|
||||
/* QT_FT_Raster */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A handle (pointer) to a raster object. Each object can be used */
|
||||
|
@ -842,7 +753,7 @@ QT_FT_BEGIN_HEADER
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Struct> */
|
||||
/* QT_FT_Span */
|
||||
/* QT_FT_Span */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A structure used to model a single span of gray (or black) pixels */
|
||||
|
@ -859,11 +770,11 @@ QT_FT_BEGIN_HEADER
|
|||
/* */
|
||||
/* <Note> */
|
||||
/* This structure is used by the span drawing callback type named */
|
||||
/* QT_FT_SpanFunc which takes the y-coordinate of the span as a */
|
||||
/* QT_FT_SpanFunc which takes the y-coordinate of the span as a */
|
||||
/* a parameter. */
|
||||
/* */
|
||||
/* The coverage value is always between 0 and 255, even if the number */
|
||||
/* of gray levels have been set through QT_FT_Set_Gray_Levels(). */
|
||||
/* of gray levels have been set through QT_FT_Set_Gray_Levels(). */
|
||||
/* */
|
||||
typedef struct QT_FT_Span_
|
||||
{
|
||||
|
@ -877,7 +788,7 @@ QT_FT_BEGIN_HEADER
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* QT_FT_SpanFunc */
|
||||
/* QT_FT_SpanFunc */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A function used as a call-back by the anti-aliased renderer in */
|
||||
|
@ -901,7 +812,7 @@ QT_FT_BEGIN_HEADER
|
|||
/* given background bitmap, and even perform translucency. */
|
||||
/* */
|
||||
/* Note that the `count' field cannot be greater than a fixed value */
|
||||
/* defined by the QT_FT_MAX_GRAY_SPANS configuration macro in */
|
||||
/* defined by the QT_FT_MAX_GRAY_SPANS configuration macro in */
|
||||
/* ftoption.h. By default, this value is set to 32, which means that */
|
||||
/* if there are more than 32 spans on a given scanline, the callback */
|
||||
/* will be called several times with the same `y' parameter in order */
|
||||
|
@ -917,82 +828,24 @@ QT_FT_BEGIN_HEADER
|
|||
|
||||
#define QT_FT_Raster_Span_Func QT_FT_SpanFunc
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* QT_FT_Raster_BitTest_Func */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* THIS TYPE IS DEPRECATED. DO NOT USE IT. */
|
||||
/* */
|
||||
/* A function used as a call-back by the monochrome scan-converter */
|
||||
/* to test whether a given target pixel is already set to the drawing */
|
||||
/* `color'. These tests are crucial to implement drop-out control */
|
||||
/* per-se the TrueType spec. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* y :: The pixel's y-coordinate. */
|
||||
/* */
|
||||
/* x :: The pixel's x-coordinate. */
|
||||
/* */
|
||||
/* user :: User-supplied data that is passed to the callback. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* 1 if the pixel is `set', 0 otherwise. */
|
||||
/* */
|
||||
typedef int
|
||||
(*QT_FT_Raster_BitTest_Func)( int y,
|
||||
int x,
|
||||
void* user );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* QT_FT_Raster_BitSet_Func */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* THIS TYPE IS DEPRECATED. DO NOT USE IT. */
|
||||
/* */
|
||||
/* A function used as a call-back by the monochrome scan-converter */
|
||||
/* to set an individual target pixel. This is crucial to implement */
|
||||
/* drop-out control according to the TrueType specification. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* y :: The pixel's y-coordinate. */
|
||||
/* */
|
||||
/* x :: The pixel's x-coordinate. */
|
||||
/* */
|
||||
/* user :: User-supplied data that is passed to the callback. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* 1 if the pixel is `set', 0 otherwise. */
|
||||
/* */
|
||||
typedef void
|
||||
(*QT_FT_Raster_BitSet_Func)( int y,
|
||||
int x,
|
||||
void* user );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Enum> */
|
||||
/* QT_FT_RASTER_FLAG_XXX */
|
||||
/* QT_FT_RASTER_FLAG_XXX */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A list of bit flag constants as used in the `flags' field of a */
|
||||
/* @QT_FT_Raster_Params structure. */
|
||||
/* @QT_FT_Raster_Params structure. */
|
||||
/* */
|
||||
/* <Values> */
|
||||
/* QT_FT_RASTER_FLAG_DEFAULT :: This value is 0. */
|
||||
/* QT_FT_RASTER_FLAG_DEFAULT :: This value is 0. */
|
||||
/* */
|
||||
/* QT_FT_RASTER_FLAG_AA :: This flag is set to indicate that an */
|
||||
/* QT_FT_RASTER_FLAG_AA :: This flag is set to indicate that an */
|
||||
/* anti-aliased glyph image should be */
|
||||
/* generated. Otherwise, it will be */
|
||||
/* monochrome (1-bit). */
|
||||
/* */
|
||||
/* QT_FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */
|
||||
/* QT_FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */
|
||||
/* rendering. In this mode, client */
|
||||
/* applications must provide their own span */
|
||||
/* callback. This lets them directly */
|
||||
|
@ -1004,7 +857,7 @@ QT_FT_BEGIN_HEADER
|
|||
/* Note that for now, direct rendering is */
|
||||
/* only possible with anti-aliased glyphs. */
|
||||
/* */
|
||||
/* QT_FT_RASTER_FLAG_CLIP :: This flag is only used in direct */
|
||||
/* QT_FT_RASTER_FLAG_CLIP :: This flag is only used in direct */
|
||||
/* rendering mode. If set, the output will */
|
||||
/* be clipped to a box specified in the */
|
||||
/* "clip_box" field of the QT_FT_Raster_Params */
|
||||
|
@ -1020,17 +873,11 @@ QT_FT_BEGIN_HEADER
|
|||
#define QT_FT_RASTER_FLAG_DIRECT 0x2
|
||||
#define QT_FT_RASTER_FLAG_CLIP 0x4
|
||||
|
||||
/* deprecated */
|
||||
#define qt_ft_raster_flag_default QT_FT_RASTER_FLAG_DEFAULT
|
||||
#define qt_ft_raster_flag_aa QT_FT_RASTER_FLAG_AA
|
||||
#define qt_ft_raster_flag_direct QT_FT_RASTER_FLAG_DIRECT
|
||||
#define qt_ft_raster_flag_clip QT_FT_RASTER_FLAG_CLIP
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Struct> */
|
||||
/* QT_FT_Raster_Params */
|
||||
/* QT_FT_Raster_Params */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A structure to hold the arguments used by a raster's render */
|
||||
|
@ -1040,7 +887,7 @@ QT_FT_BEGIN_HEADER
|
|||
/* target :: The target bitmap. */
|
||||
/* */
|
||||
/* source :: A pointer to the source glyph image (e.g. an */
|
||||
/* QT_FT_Outline). */
|
||||
/* QT_FT_Outline). */
|
||||
/* */
|
||||
/* flags :: The rendering flags. */
|
||||
/* */
|
||||
|
@ -1048,10 +895,6 @@ QT_FT_BEGIN_HEADER
|
|||
/* */
|
||||
/* black_spans :: The black span drawing callback. */
|
||||
/* */
|
||||
/* bit_test :: The bit test callback. UNIMPLEMENTED! */
|
||||
/* */
|
||||
/* bit_set :: The bit set callback. UNIMPLEMENTED! */
|
||||
/* */
|
||||
/* user :: User-supplied data that is passed to each drawing */
|
||||
/* callback. */
|
||||
/* */
|
||||
|
@ -1065,13 +908,12 @@ QT_FT_BEGIN_HEADER
|
|||
/* flag is set in the `flags' field, otherwise a monochrome bitmap */
|
||||
/* will be generated. */
|
||||
/* */
|
||||
/* If the QT_FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the */
|
||||
/* If the QT_FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the */
|
||||
/* raster will call the `gray_spans' callback to draw gray pixel */
|
||||
/* spans, in the case of an aa glyph bitmap, it will call */
|
||||
/* `black_spans', and `bit_test' and `bit_set' in the case of a */
|
||||
/* monochrome bitmap. This allows direct composition over a */
|
||||
/* pre-existing bitmap through user-provided callbacks to perform the */
|
||||
/* span drawing/composition. */
|
||||
/* `black_spans' in the case of a monochrome bitmap. This allows */
|
||||
/* direct composition over a pre-existing bitmap through */
|
||||
/* user-provided callbacks to perform the span drawing/composition. */
|
||||
/* */
|
||||
/* Note that the `bit_test' and `bit_set' callbacks are required when */
|
||||
/* rendering a monochrome bitmap, as they are crucial to implement */
|
||||
|
@ -1084,8 +926,6 @@ QT_FT_BEGIN_HEADER
|
|||
int flags;
|
||||
QT_FT_SpanFunc gray_spans;
|
||||
QT_FT_SpanFunc black_spans;
|
||||
QT_FT_Raster_BitTest_Func bit_test; /* doesn't work! */
|
||||
QT_FT_Raster_BitSet_Func bit_set; /* doesn't work! */
|
||||
void* user;
|
||||
QT_FT_BBox clip_box;
|
||||
int skip_spans;
|
||||
|
@ -1238,7 +1078,6 @@ QT_FT_BEGIN_HEADER
|
|||
/* */
|
||||
/* raster_render :: A function to render a glyph into a given bitmap. */
|
||||
/* */
|
||||
/* raster_done :: The raster destructor. */
|
||||
/* */
|
||||
typedef struct QT_FT_Raster_Funcs_
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue