summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJani Hautakangas <ext-jani.hautakangas@nokia.com>2009-10-08 13:06:24 +0300
committerJani Hautakangas <ext-jani.hautakangas@nokia.com>2009-10-08 13:17:04 +0300
commit5987274b8ce244d0020359d113800e7305367c68 (patch)
treeb8cec0e6d12a744896b85addea0c0a7398026d82 /src
parent013503f8f1a29f12789a8f88bd095597170ff76b (diff)
Fix to Symbian accelerated scrolling problem.
The reason for scrolling bug was that CFbsBitmapDevice wasn't informed if CFbsBitmap was resized. However, it seems that scroll implementation in QRasterPixmapData is faster that CFbsBitGc->CopyRect so this is also a patch which changes QS60PixmapData's scroll function to call QRasterPixmapData::scroll(). Reviewed-by: Janne Koskinen
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qpixmap_s60.cpp45
-rw-r--r--src/gui/image/qpixmap_s60_p.h4
2 files changed, 21 insertions, 28 deletions
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 37b64381cc..554c0f30e7 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -229,24 +229,15 @@ static CFbsBitmap* uncompress(CFbsBitmap* bitmap)
lock.relock();
- CBitmapContext *bitmapContext = 0;
CFbsBitmapDevice* bitmapDevice = 0;
+ CFbsBitGc *bitmapGc = 0;
QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(uncompressed));
- TInt err = bitmapDevice->CreateBitmapContext(bitmapContext);
- if (err != KErrNone) {
- delete bitmap;
- delete bitmapDevice;
- bitmap = 0;
- bitmapDevice = 0;
-
- lock.relock();
+ QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL());
+ bitmapGc->Activate(bitmapDevice);
- return bitmap;
- }
+ bitmapGc->DrawBitmap(TPoint(), bitmap);
- bitmapContext->DrawBitmap(TPoint(), bitmap);
-
- delete bitmapContext;
+ delete bitmapGc;
delete bitmapDevice;
return uncompressed;
@@ -355,7 +346,7 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
symbianBitmapDataAccess(new QSymbianBitmapDataAccess),
cfbsBitmap(0),
bitmapDevice(0),
- bitmapContext(0),
+ bitmapGc(0),
pengine(0),
bytes(0)
{
@@ -365,6 +356,7 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
QS60PixmapData::~QS60PixmapData()
{
release();
+ delete symbianBitmapDataAccess;
}
void QS60PixmapData::resize(int width, int height)
@@ -391,6 +383,8 @@ void QS60PixmapData::resize(int width, int height)
if(cfbsBitmap->SizeInPixels() != newSize) {
cfbsBitmap->Resize(TSize(width, height));
+ bitmapDevice->Resize(TSize(width, height));
+ bitmapGc->Resized();
if(pengine) {
delete pengine;
pengine = 0;
@@ -404,12 +398,9 @@ void QS60PixmapData::resize(int width, int height)
bool QS60PixmapData::initSymbianBitmapContext()
{
QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(cfbsBitmap));
- TInt err = bitmapDevice->CreateBitmapContext(bitmapContext);
- if (err != KErrNone) {
- delete bitmapDevice;
- bitmapDevice = 0;
- return false;
- }
+ QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL());
+ bitmapGc->Activate(bitmapDevice);
+
return true;
}
@@ -417,7 +408,7 @@ void QS60PixmapData::release()
{
if (cfbsBitmap) {
QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
- delete bitmapContext;
+ delete bitmapGc;
delete bitmapDevice;
delete cfbsBitmap;
lock.relock();
@@ -426,7 +417,7 @@ void QS60PixmapData::release()
delete pengine;
image = QImage();
cfbsBitmap = 0;
- bitmapContext = 0;
+ bitmapGc = 0;
bitmapDevice = 0;
pengine = 0;
bytes = 0;
@@ -559,13 +550,15 @@ void QS60PixmapData::copy(const QPixmapData *data, const QRect &rect)
resize(rect.width(), rect.height());
cfbsBitmap->SetDisplayMode(s60Data->cfbsBitmap->DisplayMode());
- bitmapContext->BitBlt(TPoint(0, 0), s60Data->cfbsBitmap, qt_QRect2TRect(rect));
+ bitmapGc->BitBlt(TPoint(0, 0), s60Data->cfbsBitmap, qt_QRect2TRect(rect));
}
bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect)
{
- bitmapContext->CopyRect(TPoint(dx, dy), qt_QRect2TRect(rect));
- return true;
+ beginDataAccess();
+ bool res = QRasterPixmapData::scroll(dx, dy, rect);
+ endDataAccess();
+ return res;
}
int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h
index 4498c05460..b23961a148 100644
--- a/src/gui/image/qpixmap_s60_p.h
+++ b/src/gui/image/qpixmap_s60_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
class CFbsBitmap;
class CFbsBitmapDevice;
-class CBitmapContext;
+class CFbsBitGc;
class QSymbianBitmapDataAccess;
@@ -114,7 +114,7 @@ private:
CFbsBitmap *cfbsBitmap;
CFbsBitmapDevice *bitmapDevice;
- CBitmapContext *bitmapContext;
+ CFbsBitGc *bitmapGc;
QPaintEngine *pengine;
uchar* bytes;