Commit 63f62819e416da33062cd4397231e9fed88f6c1d
- Diff rendering mode:
- inline
- side by side
WebCore/platform/qt/TileCacheQt.cpp
(20 / 16)
|   | |||
| 138 | 138 | void invalidate(const IntRect&); | |
| 139 | 139 | void updateBuffer(); | |
| 140 | 140 | void swapBuffer(); | |
| 141 | bool isReadyToPaint() const { return m_buffer; } | ||
| 141 | 142 | void paint(QPainter* painter, const IntRect& rect); | |
| 142 | 143 | ||
| 143 | 144 | const TileCache::TileCoordinate coordinate() const { return m_tileCoordinate; } | |
| … | … | ||
| 172 | 172 | , m_pixmapNeedsReset(false) | |
| 173 | 173 | { | |
| 174 | 174 | #if ENABLE(ENGINE_THREAD) | |
| 175 | qDebug() << (EngineThread::isCurrent() ? "EngineThread " : "MainThread ") << "CREATING tile " << QRectF(m_tileRect); | ||
| 175 | // qDebug() << (EngineThread::isCurrent() ? "EngineThread " : "MainThread ") << "CREATING tile " << QRectF(m_tileRect); | ||
| 176 | 176 | #endif | |
| 177 | 177 | } | |
| 178 | 178 | ||
| 179 | 179 | Tile::~Tile() | |
| 180 | 180 | { | |
| 181 | 181 | #if ENABLE(ENGINE_THREAD) | |
| 182 | qDebug() << (EngineThread::isCurrent() ? "EngineThread " : "MainThread ") << "DELETING tile " << QRectF(m_tileRect); | ||
| 182 | // qDebug() << (EngineThread::isCurrent() ? "EngineThread " : "MainThread ") << "DELETING tile " << QRectF(m_tileRect); | ||
| 183 | 183 | #endif | |
| 184 | 184 | delete m_buffer; | |
| 185 | 185 | delete m_backBuffer; | |
| … | … | ||
| 204 | 204 | if (!m_backBuffer) { | |
| 205 | 205 | // Copy the current buffer if this is not a full tile update (or a new tile | |
| 206 | 206 | if (!m_buffer) | |
| 207 | m_backBuffer = new QImage(m_cache->tileSize().width(), m_cache->tileSize().height(), QImage::Format_RGB32); | ||
| 207 | m_backBuffer = new QImage(m_cache->tileSize().width(), m_cache->tileSize().height(), QImage::Format_RGB16); | ||
| 208 | 208 | else | |
| 209 | 209 | m_backBuffer = new QImage(m_buffer->copy()); | |
| 210 | 210 | } | |
| … | … | ||
| 220 | 220 | } | |
| 221 | 221 | ||
| 222 | 222 | #if ENABLE(ENGINE_THREAD) | |
| 223 | qDebug() << (EngineThread::isCurrent() ? "EngineThread " : "MainThread ") << "BUFFERING tile " << QRectF(m_tileRect) << " dirty rects " << dirtyRects; | ||
| 223 | // qDebug() << (EngineThread::isCurrent() ? "EngineThread " : "MainThread ") << "BUFFERING tile " << QRectF(m_tileRect) << " dirty rects " << dirtyRects; | ||
| 224 | 224 | #endif | |
| 225 | 225 | ||
| 226 | 226 | // Paint to backbuffer, no locks held. | |
| … | … | ||
| 254 | 254 | if (!m_buffer) | |
| 255 | 255 | return; | |
| 256 | 256 | ||
| 257 | if (m_bufferPixmap.isNull() || m_pixmapNeedsReset) | ||
| 258 | m_bufferPixmap = QPixmap::fromImage(*m_buffer); | ||
| 257 | // if (m_bufferPixmap.isNull() || m_pixmapNeedsReset) | ||
| 258 | // m_bufferPixmap = QPixmap::fromImage(*m_buffer); | ||
| 259 | 259 | m_pixmapNeedsReset = false; | |
| 260 | 260 | ||
| 261 | 261 | FloatRect target = intersection(FloatRect(rect), m_tileRect); | |
| … | … | ||
| 268 | 268 | source.scale(scale.width(), scale.height()); | |
| 269 | 269 | ||
| 270 | 270 | #if ENABLE(ENGINE_THREAD) | |
| 271 | qDebug() << (EngineThread::isCurrent() ? "EngineThread " : "MainThread ") << "painting tile " << QRectF(m_tileRect) << " source " << QRectF(source) << " target " << QRectF(target); | ||
| 271 | // qDebug() << (EngineThread::isCurrent() ? "EngineThread " : "MainThread ") << "painting tile " << QRectF(m_tileRect) << " source " << QRectF(source) << " target " << QRectF(target); | ||
| 272 | 272 | #endif | |
| 273 | // painter->drawImage(target, *m_buffer, source); | ||
| 274 | painter->drawPixmap(target, m_bufferPixmap, source); | ||
| 273 | painter->drawImage(target, *m_buffer, source); | ||
| 274 | //painter->drawPixmap(target, m_bufferPixmap, source); | ||
| 275 | 275 | ||
| 276 | 276 | } | |
| 277 | 277 | ||
| … | … | ||
| 338 | 338 | for (unsigned n = 0; n < rectCount; ++n) | |
| 339 | 339 | paintedArea.append(qrects[n]); | |
| 340 | 340 | ||
| 341 | m_client->tileCachePaintEnd(paintedArea); | ||
| 342 | #if ENABLE(ENGINE_THREAD) | ||
| 343 | EngineThread::unlock(); | ||
| 344 | #endif | ||
| 345 | 341 | { | |
| 346 | 342 | // Swap the buffers atomically | |
| 347 | 343 | #if ENABLE(ENGINE_THREAD) | |
| … | … | ||
| 346 | 346 | for (unsigned n = 0; n < size; ++n) | |
| 347 | 347 | m_dirtyTiles[n]->swapBuffer(); | |
| 348 | 348 | } | |
| 349 | |||
| 350 | m_client->tileCachePaintEnd(paintedArea); | ||
| 351 | |||
| 352 | #if ENABLE(ENGINE_THREAD) | ||
| 353 | EngineThread::unlock(); | ||
| 354 | #endif | ||
| 355 | |||
| 349 | 356 | } | |
| 350 | 357 | ||
| 351 | 358 | void TileCache::paintCheckerPattern(QPainter* painter, const IntRect& rect, TileCoordinate coordinate) | |
| … | … | ||
| 398 | 398 | for (unsigned xCoordinate = topLeft.x(); xCoordinate <= bottomRight.x(); ++xCoordinate) { | |
| 399 | 399 | TileCoordinate currentCoordinate(xCoordinate, yCoordinate); | |
| 400 | 400 | RefPtr<Tile> currentTile = tile(currentCoordinate); | |
| 401 | if (currentTile) | ||
| 401 | if (currentTile && currentTile->isReadyToPaint()) | ||
| 402 | 402 | currentTile->paint(painter, rect); | |
| 403 | 403 | else | |
| 404 | 404 | paintCheckerPattern(painter, rect, currentCoordinate); | |
| … | … | ||
| 418 | 418 | m_scale = scale; | |
| 419 | 419 | ||
| 420 | 420 | if (!m_tileCreationTimer->isActive()) | |
| 421 | m_tileCreationTimer->startOneShot(0); | ||
| 421 | m_tileCreationTimer->startOneShot(.1); | ||
| 422 | 422 | } | |
| 423 | 423 | ||
| 424 | 424 | double TileCache::tileDistance(const IntRect& viewport, const TileCache::TileCoordinate& tileCoordinate) | |
| … | … | ||
| 496 | 496 | ||
| 497 | 497 | // Keep creating tiles until the whole coverRect is covered. | |
| 498 | 498 | if (requiredTileCount) | |
| 499 | m_tileCreationTimer->startOneShot(.3); | ||
| 499 | m_tileCreationTimer->startOneShot(.1); | ||
| 500 | 500 | } | |
| 501 | 501 | ||
| 502 | 502 | void TileCache::dropOverhangingTiles() |

