summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/kmolcalc.cpp2
-rw-r--r--noncore/games/kbill/MCursor.cc6
-rw-r--r--noncore/games/kbill/Picture.cc6
-rw-r--r--noncore/unsupported/qpdf/QOutputDev.cpp12
4 files changed, 14 insertions, 12 deletions
diff --git a/noncore/apps/oxygen/kmolcalc.cpp b/noncore/apps/oxygen/kmolcalc.cpp
index 33666b1..1d41b0f 100644
--- a/noncore/apps/oxygen/kmolcalc.cpp
+++ b/noncore/apps/oxygen/kmolcalc.cpp
@@ -1,115 +1,115 @@
/*
* kmolcalc.cpp
*
* Copyright (C) 2000,2001 Tomislav Gountchev <tomi@idiom.com>
* Copyright (C) 2002 Carsten Niehaus <cniehaus@handhelds.org>
*/
/**
* KMOLCALC is the calculation engine. It knows about a hashtable of user defined atomic
* weights and group definitions ELSTABLE, and the currently processed formula, stored
* as a list of elements and their coefficients, ELEMENTS.
*/
#include "kmolcalc.h"
#include <qdict.h>
#include <qdir.h>
#include <qfile.h>
#include <qpe/qpeapplication.h>
-#include <iostream.h>
+#include <iostream>
/**
* Construct a new calculator object.
*/
KMolCalc::KMolCalc() {
elements = new ElementList;
elstable = NULL;
readElstable();
}
KMolCalc::~KMolCalc() {
delete elements;
}
void KMolCalc::readElstable() {
weight = -1; // not calculated yet
if (elstable) delete elstable;
elstable = new QDict<SubUnit> (197, TRUE);
elstable->setAutoDelete(TRUE);
mwfile = QPEApplication::qpeDir() +"share/oxygen/kmolweights";
QFile f(mwfile);
if (f.exists()) readMwfile(f);
}
/**
* Parse a string S and construct the ElementList this->ELEMENTS, representing the
* composition of S. Returns 0 if successful, or an error code (currently -1) if
* parsing failed.
* The elements is S must be valid element or group symbols, as stored in this->ELSTABLE.
* See help files for correct formula syntax.
*/
QString KMolCalc::readFormula(const QString& s) {
weight = -1;
if (elements) delete elements;
elements = new ElementList;
return KMolCalc::readGroup(s, elements);
}
// read a formula group recursively. Called by readFormula.
QString KMolCalc::readGroup(const QString& s, ElementList* els) {
if (s.isEmpty()) return QString ("Enter a formula."); //ERROR
int sl = s.length();
int i = 0;
QString errors ("OK");
bool ok = TRUE;
while (i < sl && ((s[i] <= '9' && s[i] >= '0') || s[i] == '.')) i++;
double prefix = (i == 0 ? 1 : s.left(i).toDouble(&ok));
if (! ok || i == sl || prefix == 0) return QString ("Bad formula."); // ERROR
ElementList* elstemp = new ElementList;
while (i < sl) {
int j = i;
if (s[i] == '(') {
ElementList* inner = new ElementList;
int level = 1; // count levels of nested ( ).
while (1) {
if (i++ == sl) {
delete inner;
delete elstemp;
return QString ("Bad formula."); //ERROR
}
if (s[i] == '(') level++;
if (s[i] == ')') level--;
if (level == 0) break;
}
errors = KMolCalc::readGroup(s.mid(j+1, i-j-1), inner);
j = ++i;
while (i < sl && ((s[i] <= '9' && s[i] >= '0') || s[i] == '.')) i++;
double suffix = (i == j ? 1 : s.mid(j, i-j).toDouble(&ok));
if (! ok || suffix == 0) {
delete inner;
delete elstemp;
return QString ("Bad formula."); // ERROR
}
inner->addTo(*elstemp, suffix);
delete inner;
inner = NULL;
} else if ((s[i] >= 'A' && s[i] <= 'Z') || (s[i] >= 'a' && s[i] <= 'z')) {
while (++i < sl && ((s[i] >= 'a' && s[i] <= 'z') || s[i] == '*' ||
s[i] == '\''));
QString elname = s.mid(j, i-j);
j = i;
while (i < sl && ((s[i] <= '9' && s[i] >= '0') || s[i] == '.')) i++;
double suffix = (i == j ? 1 : s.mid(j, i-j).toDouble(&ok));
if (! ok || suffix == 0) {
delete elstemp;
return QString ("Bad formula."); // ERROR
}
SubUnit* group = elstable->find(elname);
if (group == 0) {
delete elstemp;
return QString ("Undefined symbol: ") + elname; //ERROR
}
group->addTo(*elstemp, suffix);
} else if (s[i] == '+') {
diff --git a/noncore/games/kbill/MCursor.cc b/noncore/games/kbill/MCursor.cc
index 30f7577..a3cb340 100644
--- a/noncore/games/kbill/MCursor.cc
+++ b/noncore/games/kbill/MCursor.cc
@@ -1,69 +1,69 @@
/***************************************************************************
MCursor.cc - description
-------------------
begin : Thu Dec 30 1999
copyright : (C) 1999 by Jurrien Loonstra
email : j.h.loonstra@st.hanze.nl
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "MCursor.h"
#include "objects.h"
#include <qcursor.h>
#include <qbitmap.h>
#include <qwidget.h>
#include <qstring.h>
#ifdef KDEVER
#include <kapp.h>
#include <kstandarddirs.h>
#endif
-#include <iostream.h>
+#include <iostream>
#include <qpe/resource.h>
MCursor::~MCursor() {
delete cursor;
}
void MCursor::load(const char *name, int masked) {
#ifdef KDEVER
QString file, mfile;
KStandardDirs dirs;
file = dirs.findResource("data","kbill/bitmaps/" + QString::fromLocal8Bit(name) + ".xbm");
QBitmap bitmap, mask;
if (bitmap.load(file) == FALSE) {
- cerr << "cannot open " << file << endl;
+ std::cerr << "cannot open " << file << std::endl;
exit(1);
}
if (masked == SEP_MASK) {
// mfile.sprintf ("%sbitmaps/%s_mask.xbm", (const char*)dir, name);
mfile = file = dirs.findResource("data","kbill/bitmaps/" + QString::fromLocal8Bit(name) + "_mask.xbm");
if (mask.load(mfile) == FALSE) {
- cerr << "cannot open " << file << endl;
+ std::cerr << "cannot open " << file << std::endl;
exit(1);
}
}
else
mask = bitmap;
#endif
QBitmap bitmap, mask;
bitmap = Resource::loadBitmap("kbill/bitmaps/" + QString::fromLocal8Bit(name));
if (masked == SEP_MASK)
mask = bitmap = Resource::loadBitmap("kbill/bitmaps/" + QString::fromLocal8Bit(name) + "_mask.xbm");
else
mask = bitmap;
cursor = new QCursor(bitmap, mask, bitmap.width() / 2, bitmap.height() / 2);
}
diff --git a/noncore/games/kbill/Picture.cc b/noncore/games/kbill/Picture.cc
index 79e19ba..fe0eff8 100644
--- a/noncore/games/kbill/Picture.cc
+++ b/noncore/games/kbill/Picture.cc
@@ -1,72 +1,72 @@
/***************************************************************************
Picture.cc - description
-------------------
begin : Thu Dec 30 1999
copyright : (C) 1999 by Jurrien Loonstra
email : j.h.loonstra@st.hanze.nl
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "Picture.h"
#include "objects.h"
-#include <iostream.h>
+#include <iostream>
#include <qstring.h>
#include <qpe/resource.h>
#ifdef KDEVER
#include <kapp.h>
#include <kstandarddirs.h>
#include <kdebug.h>
#endif
void Picture::load(const char *name, int index) {
//QString dir = KApplication::kde_datadir(), file;
// QString dir = locate("data",""),file;
// dir += "/kbill/";
// if (index>=0)
// file.sprintf ("%spixmaps/%s_%d.xpm", (const char *)dir, name, index);
// else
// file.sprintf("%spixmaps/%s.xpm", (const char *)dir, name);
#ifdef KDEVER
KStandardDirs dirs;
QString file;
if (index>=0) {
//kdDebug() << "Here";
QString sindex;
sindex.setNum(index);
// kdDebug() << "kbill/pixmaps/" + QString::fromLocal8Bit(name) + "_" + sindex + ".xpm";
file = dirs.findResource("data","kbill/pixmaps/" + QString::fromLocal8Bit(name) + "_" + sindex + ".xpm");
} else {
file = dirs.findResource("data","kbill/pixmaps/" + QString::fromLocal8Bit(name) + ".xpm");
}
- kdDebug() << file << endl;
+ kdDebug() << file << std::endl;
pix = new QPixmap();
if (pix->load(file) == FALSE)
- cerr << "cannot open " << file << endl;
+ std::cerr << "cannot open " << file << std::endl;
width = pix->width();
height = pix->height();
#endif
QString sindex;
pix = new QPixmap();
sindex.setNum(index);
if (index>=0)
pix->load(Resource::findPixmap("kbill/pixmaps/" + QString::fromLocal8Bit(name) +"_"+ sindex));
else
pix->load(Resource::findPixmap("kbill/pixmaps/" + QString::fromLocal8Bit(name)));
width = pix->width();
height = pix->height();
}
QPixmap* Picture::getPixmap() {
return pix;
}
diff --git a/noncore/unsupported/qpdf/QOutputDev.cpp b/noncore/unsupported/qpdf/QOutputDev.cpp
index f587a33..52237f5 100644
--- a/noncore/unsupported/qpdf/QOutputDev.cpp
+++ b/noncore/unsupported/qpdf/QOutputDev.cpp
@@ -1,117 +1,119 @@
///========================================================================
//
// QOutputDev.cc
//
// Copyright 1996 Derek B. Noonburg
// CopyRight 2002 Robert Griebl
//
//========================================================================
#ifdef __GNUC__
#pragma implementation
#endif
#include <aconf.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
+#include <iostream>
+
#include "GString.h"
#include "Object.h"
#include "Stream.h"
#include "Link.h"
#include "GfxState.h"
#include "GfxFont.h"
#include "UnicodeMap.h"
#include "CharCodeToUnicode.h"
#include "FontFile.h"
#include "Error.h"
#include "TextOutputDev.h"
#include "QOutputDev.h"
#include <qpixmap.h>
#include <qimage.h>
#include <qpainter.h>
#include <qdict.h>
#include <qtimer.h>
#include <qapplication.h>
#include <qclipboard.h>
//#define QPDFDBG(x) x // special debug mode
#define QPDFDBG(x) // normal compilation
//------------------------------------------------------------------------
// Constants and macros
//------------------------------------------------------------------------
static inline QColor q_col ( const GfxRGB &rgb )
{
return QColor ( lrint ( rgb. r * 255 ), lrint ( rgb. g * 255 ), lrint ( rgb. b * 255 ));
}
//------------------------------------------------------------------------
// Font substitutions
//------------------------------------------------------------------------
struct QOutFontSubst {
char * m_name;
char * m_sname;
bool m_bold;
bool m_italic;
QFont::StyleHint m_hint;
};
static QOutFontSubst qStdFonts [] = {
{ "Helvetica", "Helvetica", false, false, QFont::Helvetica },
{ "Helvetica-Oblique", "Helvetica", false, true, QFont::Helvetica },
{ "Helvetica-Bold", "Helvetica", true, false, QFont::Helvetica },
{ "Helvetica-BoldOblique", "Helvetica", true, true, QFont::Helvetica },
{ "Times-Roman", "Times", false, false, QFont::Times },
{ "Times-Italic", "Times", false, true, QFont::Times },
{ "Times-Bold", "Times", true, false, QFont::Times },
{ "Times-BoldItalic", "Times", true, true, QFont::Times },
{ "Courier", "Courier", false, false, QFont::Courier },
{ "Courier-Oblique", "Courier", false, true, QFont::Courier },
{ "Courier-Bold", "Courier", true, false, QFont::Courier },
{ "Courier-BoldOblique", "Courier", true, true, QFont::Courier },
{ "Symbol", 0, false, false, QFont::AnyStyle },
{ "Zapf-Dingbats", 0, false, false, QFont::AnyStyle },
{ 0, 0, false, false, QFont::AnyStyle }
};
QFont QOutputDev::matchFont ( GfxFont *gfxFont, fp_t m11, fp_t m12, fp_t m21, fp_t m22 )
{
static QDict<QOutFontSubst> stdfonts;
// build dict for std. fonts on first invocation
if ( stdfonts. isEmpty ( )) {
for ( QOutFontSubst *ptr = qStdFonts; ptr-> m_name; ptr++ ) {
stdfonts. insert ( QString ( ptr-> m_name ), ptr );
}
}
// compute size and normalized transform matrix
int size = lrint ( sqrt ( m21 * m21 + m22 * m22 ));
QPDFDBG( printf ( "SET FONT: Name=%s, Size=%d, Bold=%d, Italic=%d, Mono=%d, Serif=%d, Symbol=%d, CID=%d, EmbFN=%s, M=(%f,%f,%f,%f)\n",
(( gfxFont-> getName ( )) ? gfxFont-> getName ( )-> getCString ( ) : "<n/a>" ),
size,
gfxFont-> isBold ( ),
gfxFont-> isItalic ( ),
gfxFont-> isFixedWidth ( ),
gfxFont-> isSerif ( ),
@@ -577,430 +579,430 @@ int QOutputDev::convertSubpath ( GfxState *state, GfxSubpath *subpath, QPointArr
QPointArray tmp;
tmp. setPoints ( 4, lrint ( x0 ), lrint ( y0 ), lrint ( x1 ), lrint ( y1 ),
lrint ( x2 ), lrint ( y2 ), lrint ( x3 ), lrint ( y3 ));
#if QT_VERSION < 300
tmp = tmp. quadBezier ( );
for ( uint loop = 0; loop < tmp. count ( ); loop++ ) {
QPoint p = tmp. point ( loop );
points. putPoints ( points. count ( ), 1, p. x ( ), p. y ( ));
}
#else
tmp = tmp. cubicBezier ( );
points. putPoints ( points. count ( ), tmp. count ( ), tmp );
#endif
i += 3;
}
else {
state-> transform ( subpath-> getX ( i ), subpath-> getY ( i ), &x1, &y1 );
points. putPoints ( points. count ( ), 1, lrint ( x1 ), lrint ( y1 ));
++i;
}
}
return points. count ( ) - oldcnt;
}
void QOutputDev::beginString ( GfxState *state, GString */*s*/ )
{
m_text-> beginString ( state );
}
void QOutputDev::endString ( GfxState */*state*/ )
{
m_text-> endString ( );
}
void QOutputDev::drawChar ( GfxState *state, fp_t x, fp_t y,
fp_t dx, fp_t dy, fp_t originX, fp_t originY,
CharCode code, Unicode *u, int uLen )
{
fp_t x1, y1, dx1, dy1;
if ( uLen > 0 )
m_text-> addChar ( state, x, y, dx, dy, u, uLen );
// check for invisible text -- this is used by Acrobat Capture
if (( state-> getRender ( ) & 3 ) == 3 ) {
return;
}
x -= originX;
y -= originY;
state-> transform ( x, y, &x1, &y1 );
state-> transformDelta ( dx, dy, &dx1, &dy1 );
if ( uLen > 0 ) {
QString str;
QFontMetrics fm = m_painter-> fontMetrics ( );
for ( int i = 0; i < uLen; i++ ) {
QChar c = QChar ( u [i] );
if ( fm. inFont ( c )) {
str [i] = QChar ( u [i] );
}
else {
str [i] = ' ';
QPDFDBG( printf ( "CHARACTER NOT IN FONT: %hx\n", c. unicode ( )));
}
}
if (( uLen == 1 ) && ( str [0] == ' ' ))
return;
fp_t m11, m12, m21, m22;
state-> getFontTransMat ( &m11, &m12, &m21, &m22 );
m11 *= state-> getHorizScaling ( );
m12 *= state-> getHorizScaling ( );
fp_t fsize = m_painter-> font ( ). pixelSize ( );
#ifndef QT_NO_TRANSFORMATIONS
QWMatrix oldmat;
bool dorot = (( m12 < -0.1 ) || ( m12 > 0.1 )) && (( m21 < -0.1 ) || ( m21 > 0.1 ));
if ( dorot ) {
oldmat = m_painter-> worldMatrix ( );
- cerr << endl << "ROTATED: " << m11 << ", " << m12 << ", " << m21 << ", " << m22 << " / SIZE: " << fsize << " / TEXT: " << str. local8Bit ( ) << endl << endl;
+ std::cerr << std::endl << "ROTATED: " << m11 << ", " << m12 << ", " << m21 << ", " << m22 << " / SIZE: " << fsize << " / TEXT: " << str. local8Bit ( ) << endl << endl;
QWMatrix mat ( lrint ( m11 / fsize ), lrint ( m12 / fsize ), -lrint ( m21 / fsize ), -lrint ( m22 / fsize ), lrint ( x1 ), lrint ( y1 ));
m_painter-> setWorldMatrix ( mat );
x1 = 0;
y1 = 0;
}
#endif
QPen oldpen = m_painter-> pen ( );
if (!( state-> getRender ( ) & 1 )) {
QPen fillpen = oldpen;
fillpen. setColor ( m_painter-> brush ( ). color ( ));
m_painter-> setPen ( fillpen );
}
if ( fsize > 5 )
m_painter-> drawText ( lrint ( x1 ), lrint ( y1 ), str );
else
m_painter-> fillRect ( lrint ( x1 ), lrint ( y1 ), lrint ( QMAX( fp_t(1), dx1 )), lrint ( QMAX( fsize, dy1 )), m_painter-> pen ( ). color ( ));
m_painter-> setPen ( oldpen );
#ifndef QT_NO_TRANSFORMATIONS
if ( dorot )
m_painter-> setWorldMatrix ( oldmat );
#endif
QPDFDBG( printf ( "DRAW TEXT: \"%s\" at (%ld/%ld)\n", str. local8Bit ( ). data ( ), lrint ( x1 ), lrint ( y1 )));
}
else if ( code != 0 ) {
// some PDF files use CID 0, which is .notdef, so just ignore it
qWarning ( "Unknown character (CID=%d Unicode=%hx)\n", code, (unsigned short) ( uLen > 0 ? u [0] : (Unicode) 0 ));
}
qApp-> processEvents ( );
}
void QOutputDev::drawImageMask ( GfxState *state, Object */*ref*/, Stream *str, int width, int height, GBool invert, GBool inlineImg )
{
// get CTM, check for singular matrix
fp_t *ctm = state-> getCTM ( );
if ( fabs ( ctm [0] * ctm [3] - ctm [1] * ctm [2] ) < 0.000001 ) {
qWarning ( "Singular CTM in drawImage\n" );
if ( inlineImg ) {
str-> reset ( );
int j = height * (( width + 7 ) / 8 );
for ( int i = 0; i < j; i++ )
str->getChar();
str->close();
}
return;
}
GfxRGB rgb;
state-> getFillRGB ( &rgb );
uint val = ( lrint ( rgb. r * 255 ) & 0xff ) << 16 | ( lrint ( rgb. g * 255 ) & 0xff ) << 8 | ( lrint ( rgb. b * 255 ) & 0xff );
QImage img ( width, height, 32 );
img. setAlphaBuffer ( true );
QPDFDBG( printf ( "IMAGE MASK (%dx%d)\n", width, height ));
// initialize the image stream
ImageStream *imgStr = new ImageStream ( str, width, 1, 1 );
imgStr-> reset ( );
uchar **scanlines = img. jumpTable ( );
if ( ctm [3] > 0 )
scanlines += ( height - 1 );
for ( int y = 0; y < height; y++ ) {
QRgb *scanline = (QRgb *) *scanlines;
if ( ctm [0] < 0 )
scanline += ( width - 1 );
for ( int x = 0; x < width; x++ ) {
Guchar alpha;
imgStr-> getPixel ( &alpha );
if ( invert )
alpha ^= 1;
*scanline = ( alpha == 0 ) ? 0xff000000 | val : val;
ctm [0] < 0 ? scanline-- : scanline++;
}
ctm [3] > 0 ? scanlines-- : scanlines++;
qApp-> processEvents ( );
}
#ifndef QT_NO_TRANSFORMATIONS
QWMatrix mat ( ctm [0] / width, ctm [1], ctm [2], ctm [3] / height, ctm [4], ctm [5] );
- cerr << "MATRIX T=" << mat. dx ( ) << "/" << mat. dy ( ) << endl
- << " - M=" << mat. m11 ( ) << "/" << mat. m12 ( ) << "/" << mat. m21 ( ) << "/" << mat. m22 ( ) << endl;
+ std::cerr << "MATRIX T=" << mat. dx ( ) << "/" << mat. dy ( ) << std::endl
+ << " - M=" << mat. m11 ( ) << "/" << mat. m12 ( ) << "/" << mat. m21 ( ) << "/" << mat. m22 ( ) << std::endl;
QWMatrix oldmat = m_painter-> worldMatrix ( );
m_painter-> setWorldMatrix ( mat, true );
#ifdef QWS
QPixmap pm;
pm. convertFromImage ( img );
m_painter-> drawPixmap ( 0, 0, pm );
#else
m_painter-> drawImage ( QPoint ( 0, 0 ), img );
#endif
m_painter-> setWorldMatrix ( oldmat );
#else
if (( ctm [1] < -0.1 ) || ( ctm [1] > 0.1 ) || ( ctm [2] < -0.1 ) || ( ctm [2] > 0.1 )) {
QPDFDBG( printf ( "### ROTATED / SHEARED / ETC -- CANNOT DISPLAY THIS IMAGE\n" ));
}
else {
int x = lrint ( ctm [4] );
int y = lrint ( ctm [5] );
int w = lrint ( ctm [0] );
int h = lrint ( ctm [3] );
if ( w < 0 ) {
x += w;
w = -w;
}
if ( h < 0 ) {
y += h;
h = -h;
}
QPDFDBG( printf ( "DRAWING IMAGE MASKED: %d/%d - %dx%d\n", x, y, w, h ));
img = img. smoothScale ( w, h );
qApp-> processEvents ( );
m_painter-> drawImage ( x, y, img );
}
#endif
delete imgStr;
qApp-> processEvents ( );
}
void QOutputDev::drawImage(GfxState *state, Object */*ref*/, Stream *str, int width, int height, GfxImageColorMap *colorMap, int *maskColors, GBool inlineImg )
{
int nComps, nVals, nBits;
// image parameters
nComps = colorMap->getNumPixelComps ( );
nVals = width * nComps;
nBits = colorMap-> getBits ( );
// get CTM, check for singular matrix
fp_t *ctm = state-> getCTM ( );
if ( fabs ( ctm [0] * ctm [3] - ctm [1] * ctm [2] ) < 0.000001 ) {
qWarning ( "Singular CTM in drawImage\n" );
if ( inlineImg ) {
str-> reset ( );
int j = height * (( nVals * nBits + 7 ) / 8 );
for ( int i = 0; i < j; i++ )
str->getChar();
str->close();
}
return;
}
QImage img ( width, height, 32 );
if ( maskColors )
img. setAlphaBuffer ( true );
QPDFDBG( printf ( "IMAGE (%dx%d)\n", width, height ));
// initialize the image stream
ImageStream *imgStr = new ImageStream ( str, width, nComps, nBits );
imgStr-> reset ( );
Guchar pixBuf [gfxColorMaxComps];
GfxRGB rgb;
uchar **scanlines = img. jumpTable ( );
if ( ctm [3] > 0 )
scanlines += ( height - 1 );
for ( int y = 0; y < height; y++ ) {
QRgb *scanline = (QRgb *) *scanlines;
if ( ctm [0] < 0 )
scanline += ( width - 1 );
for ( int x = 0; x < width; x++ ) {
imgStr-> getPixel ( pixBuf );
colorMap-> getRGB ( pixBuf, &rgb );
uint val = ( lrint ( rgb. r * 255 ) & 0xff ) << 16 | ( lrint ( rgb. g * 255 ) & 0xff ) << 8 | ( lrint ( rgb. b * 255 ) & 0xff );
if ( maskColors ) {
for ( int k = 0; k < nComps; ++k ) {
if (( pixBuf [k] < maskColors [2 * k] ) || ( pixBuf [k] > maskColors [2 * k] )) {
val |= 0xff000000;
break;
}
}
}
*scanline = val;
ctm [0] < 0 ? scanline-- : scanline++;
}
ctm [3] > 0 ? scanlines-- : scanlines++;
qApp-> processEvents ( );
}
#ifndef QT_NO_TRANSFORMATIONS
QWMatrix mat ( ctm [0] / width, ctm [1], ctm [2], ctm [3] / height, ctm [4], ctm [5] );
- cerr << "MATRIX T=" << mat. dx ( ) << "/" << mat. dy ( ) << endl
- << " - M=" << mat. m11 ( ) << "/" << mat. m12 ( ) << "/" << mat. m21 ( ) << "/" << mat. m22 ( ) << endl;
+ std::cerr << "MATRIX T=" << mat. dx ( ) << "/" << mat. dy ( ) << std::endl
+ << " - M=" << mat. m11 ( ) << "/" << mat. m12 ( ) << "/" << mat. m21 ( ) << "/" << mat. m22 ( ) << std::endl;
QWMatrix oldmat = m_painter-> worldMatrix ( );
m_painter-> setWorldMatrix ( mat, true );
#ifdef QWS
QPixmap pm;
pm. convertFromImage ( img );
m_painter-> drawPixmap ( 0, 0, pm );
#else
m_painter-> drawImage ( QPoint ( 0, 0 ), img );
#endif
m_painter-> setWorldMatrix ( oldmat );
#else // QT_NO_TRANSFORMATIONS
if (( ctm [1] < -0.1 ) || ( ctm [1] > 0.1 ) || ( ctm [2] < -0.1 ) || ( ctm [2] > 0.1 )) {
QPDFDBG( printf ( "### ROTATED / SHEARED / ETC -- CANNOT DISPLAY THIS IMAGE\n" ));
}
else {
int x = lrint ( ctm [4] );
int y = lrint ( ctm [5] );
int w = lrint ( ctm [0] );
int h = lrint ( ctm [3] );
if ( w < 0 ) {
x += w;
w = -w;
}
if ( h < 0 ) {
y += h;
h = -h;
}
QPDFDBG( printf ( "DRAWING IMAGE: %d/%d - %dx%d\n", x, y, w, h ));
img = img. smoothScale ( w, h );
qApp-> processEvents ( );
m_painter-> drawImage ( x, y, img );
}
#endif
delete imgStr;
qApp-> processEvents ( );
}
bool QOutputDev::findText ( const QString &str, QRect &r, bool top, bool bottom )
{
int l, t, w, h;
r. rect ( &l, &t, &w, &h );
bool res = findText ( str, l, t, w, h, top, bottom );
r. setRect ( l, t, w, h );
return res;
}
bool QOutputDev::findText ( const QString &str, int &l, int &t, int &w, int &h, bool top, bool bottom )
{
bool found = false;
uint len = str. length ( );
Unicode *s = new Unicode [len];
for ( uint i = 0; i < len; i++ )
s [i] = str [i]. unicode ( );
fp_t x1 = (fp_t) l;
fp_t y1 = (fp_t) t;
fp_t x2 = (fp_t) l + w - 1;
fp_t y2 = (fp_t) t + h - 1;
if ( m_text-> findText ( s, len, top, bottom, &x1, &y1, &x2, &y2 )) {
l = lrint ( x1 );
t = lrint ( y1 );
w = lrint ( x2 ) - l + 1;
h = lrint ( y2 ) - t + 1;
found = true;
}
delete [] s;
return found;
}
GBool QOutputDev::findText ( Unicode *s, int len, GBool top, GBool bottom, int *xMin, int *yMin, int *xMax, int *yMax )
{
bool found = false;
fp_t xMin1 = (double) *xMin;
fp_t yMin1 = (double) *yMin;
fp_t xMax1 = (double) *xMax;
fp_t yMax1 = (double) *yMax;