summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorWater-Team <water@pad.test.qt.nokia.com>2011-12-15 00:00:12 (GMT)
committerWater-Team <water@pad.test.qt.nokia.com>2011-12-15 00:00:12 (GMT)
commit8d856c470fd4a5abea3e0047c2837a7e45831812 (patch)
treed044164a9f4aaa3ae875c2c6859573fc1259168d /src/gui
parente23f6932e7e27d46ffefb4b30dafa3ec5851d973 (diff)
parente2b42a54ddd25e4ceb76b4aeb7de1ffb971feb83 (diff)
downloadQt-8d856c470fd4a5abea3e0047c2837a7e45831812.zip
Qt-8d856c470fd4a5abea3e0047c2837a7e45831812.tar.gz
Qt-8d856c470fd4a5abea3e0047c2837a7e45831812.tar.bz2
Merge branch '4.8-upstream' into master-water
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qfiledialog_symbian.cpp4
-rw-r--r--src/gui/image/qpixmap_blitter.cpp34
-rw-r--r--src/gui/image/qpixmap_blitter_p.h7
-rw-r--r--src/gui/painting/qpaintengine_blitter.cpp10
4 files changed, 32 insertions, 23 deletions
diff --git a/src/gui/dialogs/qfiledialog_symbian.cpp b/src/gui/dialogs/qfiledialog_symbian.cpp
index 1ffbf1d..01c7b9b 100644
--- a/src/gui/dialogs/qfiledialog_symbian.cpp
+++ b/src/gui/dialogs/qfiledialog_symbian.cpp
@@ -143,8 +143,8 @@ static QString launchSymbianDialog(const QString dialogCaption, const QString st
tryCount = 0;
} else {
// Symbian native file dialog doesn't allow accessing files outside C:/Data
- // It will always leave in that case, so default into QDir::rootPath() in error cases.
- QString dir = QDir::toNativeSeparators(QDir::rootPath());
+ // It will always leave in that case, so default into QDir::homePath() in error cases.
+ QString dir = QDir::toNativeSeparators(QDir::homePath());
startFolder = qt_QString2TPtrC(dir);
}
}
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index f3a4318..c73e6a9 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -57,7 +57,8 @@ QT_BEGIN_NAMESPACE
static int global_ser_no = 0;
QBlittablePixmapData::QBlittablePixmapData()
- : QPixmapData(QPixmapData::PixmapType,BlitterClass), m_engine(0), m_blittable(0)
+ : QPixmapData(QPixmapData::PixmapType,BlitterClass)
+ , m_alpha(false)
#ifdef QT_BLITTER_RASTEROVERLAY
,m_rasterOverlay(0), m_unmergedCopy(0)
#endif //QT_BLITTER_RASTEROVERLAY
@@ -67,8 +68,6 @@ QBlittablePixmapData::QBlittablePixmapData()
QBlittablePixmapData::~QBlittablePixmapData()
{
- delete m_blittable;
- delete m_engine;
#ifdef QT_BLITTER_RASTEROVERLAY
delete m_rasterOverlay;
delete m_unmergedCopy;
@@ -79,31 +78,30 @@ QBlittable *QBlittablePixmapData::blittable() const
{
if (!m_blittable) {
QBlittablePixmapData *that = const_cast<QBlittablePixmapData *>(this);
- that->m_blittable = this->createBlittable(QSize(w,h));
+ that->m_blittable.reset(this->createBlittable(QSize(w,h), m_alpha));
}
- return m_blittable;
+ return m_blittable.data();
}
void QBlittablePixmapData::setBlittable(QBlittable *blittable)
{
resize(blittable->size().width(),blittable->size().height());
- m_blittable = blittable;
+ m_blittable.reset(blittable);
}
void QBlittablePixmapData::resize(int width, int height)
{
- delete m_blittable;
- m_blittable = 0;
- delete m_engine;
- m_engine = 0;
+ m_blittable.reset(0);
+ m_engine.reset(0);
#ifdef Q_WS_QPA
d = QApplicationPrivate::platformIntegration()->screens().at(0)->depth();
#endif
w = width;
h = height;
is_null = (w <= 0 || h <= 0);
+ setSerialNumber(++global_ser_no);
}
int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
@@ -139,7 +137,16 @@ void QBlittablePixmapData::fill(const QColor &color)
if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) {
blittable()->unlock();
blittable()->fillRect(QRectF(0,0,w,h),color);
- }else {
+ } 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:
@@ -185,6 +192,7 @@ bool QBlittablePixmapData::hasAlphaChannel() const
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();
@@ -208,9 +216,9 @@ QPaintEngine *QBlittablePixmapData::paintEngine() const
{
if (!m_engine) {
QBlittablePixmapData *that = const_cast<QBlittablePixmapData *>(this);
- that->m_engine = new QBlitterPaintEngine(that);
+ that->m_engine.reset(new QBlitterPaintEngine(that));
}
- return m_engine;
+ return m_engine.data();
}
#ifdef QT_BLITTER_RASTEROVERLAY
diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h
index 07791e5..4742a83 100644
--- a/src/gui/image/qpixmap_blitter_p.h
+++ b/src/gui/image/qpixmap_blitter_p.h
@@ -55,7 +55,7 @@ public:
QBlittablePixmapData();
~QBlittablePixmapData();
- virtual QBlittable *createBlittable(const QSize &size) const = 0;
+ virtual QBlittable *createBlittable(const QSize &size, bool alpha) const = 0;
QBlittable *blittable() const;
void setBlittable(QBlittable *blittable);
@@ -83,8 +83,9 @@ public:
#endif //QT_BLITTER_RASTEROVERLAY
protected:
- QBlitterPaintEngine *m_engine;
- QBlittable *m_blittable;
+ QScopedPointer<QBlitterPaintEngine> m_engine;
+ QScopedPointer<QBlittable> m_blittable;
+ bool m_alpha;
#ifdef QT_BLITTER_RASTEROVERLAY
QImage *m_rasterOverlay;
diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp
index 75efa20..69f0301 100644
--- a/src/gui/painting/qpaintengine_blitter.cpp
+++ b/src/gui/painting/qpaintengine_blitter.cpp
@@ -198,8 +198,8 @@ public:
hasXForm(false)
{
- raster = new QRasterPaintEngine(p->buffer());
- capabillities = new CapabilitiesToStateMask(pmData->blittable()->capabilities());
+ raster.reset(new QRasterPaintEngine(p->buffer()));
+ capabillities.reset(new CapabilitiesToStateMask(pmData->blittable()->capabilities()));
}
inline void lock() {
@@ -279,12 +279,12 @@ public:
raster->d_func()->systemStateChanged();
}
- QRasterPaintEngine *raster;
+ QScopedPointer<QRasterPaintEngine> raster;
QBlittablePixmapData *pmData;
bool isBlitterLocked;
- CapabilitiesToStateMask *capabillities;
+ QScopedPointer<CapabilitiesToStateMask> capabillities;
uint hasXForm;
};
@@ -655,7 +655,7 @@ void QBlitterPaintEngine::setState(QPainterState *s)
inline QRasterPaintEngine *QBlitterPaintEngine::raster() const
{
Q_D(const QBlitterPaintEngine);
- return d->raster;
+ return d->raster.data();
}
QT_END_NAMESPACE