blitter: Kill the isBlitterLocked variable of the QBlitterPaintEngine

It starts with being initialized wrongly, the call to buffer() will
lock the data while we think it is not locked, it can also get out of
sync by someone calling buffer() again. Remove the variable and
check with the QBlittable if we need to lock the resource into memory.

Change-Id: I350375011138d1b4c2c48c100b7b30b8ea2ae460
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
This commit is contained in:
Holger Hans Peter Freyther 2012-01-01 19:58:20 +01:00 committed by Qt by Nokia
parent 24c88ebcde
commit 3ec27f827e
3 changed files with 11 additions and 10 deletions

View File

@ -100,6 +100,12 @@ void QBlittable::unlock()
}
}
bool QBlittable::isLocked() const
{
Q_D(const QBlittable);
return d->locked;
}
QT_END_NAMESPACE
#endif //QT_NO_BLITTABLE

View File

@ -80,6 +80,8 @@ public:
QImage *lock();
void unlock();
bool isLocked() const;
protected:
virtual QImage *doLock() = 0;
virtual void doUnlock() = 0;

View File

@ -188,7 +188,6 @@ public:
: QPaintEngineExPrivate()
, pmData(p)
, caps(pmData->blittable()->capabilities())
, isBlitterLocked(false)
, hasXForm(false)
{
@ -196,17 +195,12 @@ public:
}
inline void lock() {
if (!isBlitterLocked) {
raster->d_func()->rasterBuffer->prepare(pmData->blittable()->lock());
isBlitterLocked = true;
}
if (!pmData->blittable()->isLocked())
raster->d_func()->rasterBuffer->prepare(pmData->buffer());
}
inline void unlock() {
if (isBlitterLocked) {
pmData->blittable()->unlock();
isBlitterLocked = false;
}
pmData->blittable()->unlock();
}
void fillRect(const QRectF &rect, const QColor &color) {
@ -275,7 +269,6 @@ public:
QBlittablePlatformPixmap *pmData;
CapabilitiesToStateMask caps;
bool isBlitterLocked;
uint hasXForm;
};