void CoordinatedGraphicsLayer::tiledBackingStorePaintEnd(const Vector<IntRect>& updatedRects) { if (!isShowingRepaintCounter() || updatedRects.isEmpty()) return; m_layerState.repaintCount = incrementRepaintCount(); m_layerState.repaintCountChanged = true; }
void CoordinatedGraphicsLayer::didUpdateTileBuffers() { if (!isShowingRepaintCounter()) return; m_layerState.repaintCount = incrementRepaintCount(); m_layerState.repaintCountChanged = true; }
void GraphicsLayerTextureMapper::prepareBackingStore() { TextureMapper* textureMapper = m_layer->textureMapper(); if (!textureMapper) return; if (!shouldHaveBackingStore()) { m_backingStore.clear(); return; } IntRect dirtyRect = enclosingIntRect(FloatRect(FloatPoint::zero(), m_size)); if (!m_needsDisplay) dirtyRect.intersect(enclosingIntRect(m_needsDisplayRect)); if (dirtyRect.isEmpty()) return; if (!m_backingStore) m_backingStore = TextureMapperTiledBackingStore::create(); #if PLATFORM(QT) ASSERT(dynamic_cast<TextureMapperTiledBackingStore*>(m_backingStore.get())); #endif TextureMapperTiledBackingStore* backingStore = static_cast<TextureMapperTiledBackingStore*>(m_backingStore.get()); if (isShowingRepaintCounter()) incrementRepaintCount(); // Paint into an intermediate buffer to avoid painting content more than once. bool paintOnce = true; const IntSize maxTextureSize = textureMapper->maxTextureSize(); // We need to paint directly if the dirty rect exceeds one of the maximum dimensions. if (dirtyRect.width() > maxTextureSize.width() || dirtyRect.height() > maxTextureSize.height()) paintOnce = false; if (paintOnce) { OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(dirtyRect.size()); GraphicsContext* context = imageBuffer->context(); context->setImageInterpolationQuality(textureMapper->imageInterpolationQuality()); context->setTextDrawingMode(textureMapper->textDrawingMode()); context->translate(-dirtyRect.x(), -dirtyRect.y()); paintGraphicsLayerContents(*context, dirtyRect); if (isShowingRepaintCounter()) drawRepaintCounter(context); RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore); backingStore->updateContents(textureMapper, image.get(), m_size, dirtyRect, BitmapTexture::UpdateCanModifyOriginalImageData); } else backingStore->updateContents(textureMapper, this, m_size, dirtyRect, BitmapTexture::UpdateCanModifyOriginalImageData); backingStore->setShowDebugBorders(isShowingDebugBorder()); backingStore->setDebugBorder(m_debugBorderColor, m_debugBorderWidth); m_needsDisplay = false; m_needsDisplayRect = IntRect(); }
void GraphicsLayerTextureMapper::updateDebugBorderAndRepaintCount() { if (isShowingDebugBorder()) updateDebugIndicators(); // When this has its own backing store (e.g. Qt WK1), update the repaint count before calling TextureMapperLayer::flushCompositingStateForThisLayerOnly(). bool needsToRepaint = shouldHaveBackingStore() && (m_needsDisplay || !m_needsDisplayRect.isEmpty()); if (isShowingRepaintCounter() && needsToRepaint) { incrementRepaintCount(); m_changeMask |= RepaintCountChange; } }