Changeset 122275 in webkit
- Timestamp:
- Jul 10, 2012 4:06:16 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r122272 r122275 1 2012-07-10 Helder Correia <helder.correia@nokia.com> 2 3 [Qt] Repaint counter for accelerated compositing 4 https://bugs.webkit.org/show_bug.cgi?id=90116 5 6 Reviewed by Noam Rosenthal. 7 8 No new tests, just introducing a debug feature. 9 10 For this feature to be enabled, the environment variable 11 QT_WEBKIT_SHOW_COMPOSITING_DEBUG_VISUALS must be set to 1. Once enabled, 12 both repaint counters and tile borders will be painted. 13 14 Important notes: 15 - Only WebKit2 is targetted for now. 16 - There is no integration with Preferences. That aproach was 17 taken initially but revealed complex and overkill for such a 18 debugging-only functionality. Thus, to disable it simply restart with 19 the environment variable unset or set to some other value. 20 21 A Qt-specific drawRepaintCounter() function was added to 22 TextureMapperGL. A QImage is used as scratch buffer to paint borders and 23 counters. It is then uploaded to a BitmapTexture acquired from the pool 24 and finally draw by TextureMapper. The actual compositing happens inside 25 LayerBackingStore::paintToTextureMapper(). Each LayerBackingStoreTile 26 now has a repaint counter which gets incremented in 27 LayerBackingStore::updateTile(). 28 29 * platform/graphics/texmap/TextureMapper.h: 30 * platform/graphics/texmap/TextureMapperGL.cpp: 31 (WebCore): 32 (WebCore::TextureMapperGL::drawRepaintCounter): 33 * platform/graphics/texmap/TextureMapperGL.h: 34 * platform/graphics/texmap/TextureMapperImageBuffer.h: 35 1 36 2012-07-09 Dana Jansens <danakj@chromium.org> 2 37 -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h
r121729 r122275 123 123 124 124 virtual void drawBorder(const Color&, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) = 0; 125 virtual void drawRepaintCounter(int value, int pointSize, const FloatPoint&, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) = 0; 125 126 virtual void drawTexture(const BitmapTexture&, const FloatRect& target, const TransformationMatrix& modelViewMatrix = TransformationMatrix(), float opacity = 1.0f, const BitmapTexture* maskTexture = 0, unsigned exposedEdges = AllEdges) = 0; 126 127 -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
r121793 r122275 25 25 #include "GraphicsContext3D.h" 26 26 #include "Image.h" 27 #include "NotImplemented.h" 27 28 #include "TextureMapperShaderManager.h" 28 29 #include "Timer.h" … … 359 360 360 361 drawQuad(targetRect, modelViewMatrix, program.get(), GL_LINE_LOOP, color.hasAlpha()); 362 } 363 364 void TextureMapperGL::drawRepaintCounter(int value, int pointSize, const FloatPoint& targetPoint, const TransformationMatrix& modelViewMatrix) 365 { 366 #if PLATFORM(QT) 367 QString counterString = QString::number(value); 368 369 QFont font(QString::fromLatin1("Monospace"), pointSize, QFont::Bold); 370 font.setStyleHint(QFont::TypeWriter); 371 372 QFontMetrics fontMetrics(font); 373 int width = fontMetrics.width(counterString) + 4; 374 int height = fontMetrics.height(); 375 376 IntSize size(width, height); 377 IntRect sourceRect(IntPoint::zero(), size); 378 IntRect targetRect(roundedIntPoint(targetPoint), size); 379 380 QImage image(size, QImage::Format_ARGB32_Premultiplied); 381 QPainter painter(&image); 382 painter.fillRect(sourceRect, Qt::blue); // Since we won't swap R+B for speed, this will paint red. 383 painter.setFont(font); 384 painter.setPen(Qt::white); 385 painter.drawText(2, height * 0.85, counterString); 386 387 RefPtr<BitmapTexture> texture = acquireTextureFromPool(size); 388 const uchar* bits = image.bits(); 389 texture->updateContents(bits, sourceRect, IntPoint::zero(), image.bytesPerLine()); 390 drawTexture(*texture, targetRect, modelViewMatrix, 1.0f, 0, AllEdges); 391 #else 392 notImplemented(); 393 #endif 361 394 } 362 395 -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h
r121729 r122275 51 51 // TextureMapper implementation 52 52 virtual void drawBorder(const Color&, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) OVERRIDE; 53 virtual void drawRepaintCounter(int value, int pointSize, const FloatPoint&, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) OVERRIDE; 53 54 virtual void drawTexture(const BitmapTexture&, const FloatRect&, const TransformationMatrix&, float opacity, const BitmapTexture* maskTexture, unsigned exposedEdges) OVERRIDE; 54 55 virtual void drawTexture(uint32_t texture, Flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, const BitmapTexture* maskTexture, unsigned exposedEdges = AllEdges); -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h
r121729 r122275 53 53 // TextureMapper implementation 54 54 virtual void drawBorder(const Color& color, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) OVERRIDE { }; 55 virtual void drawRepaintCounter(int value, int pointSize, const FloatPoint&, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) OVERRIDE { }; 55 56 virtual void drawTexture(const BitmapTexture&, const FloatRect& targetRect, const TransformationMatrix&, float opacity, const BitmapTexture* maskTexture, unsigned exposedEdges) OVERRIDE; 56 57 virtual void beginClip(const TransformationMatrix&, const FloatRect&) OVERRIDE; -
trunk/Source/WebKit2/ChangeLog
r122270 r122275 1 2012-07-10 Helder Correia <helder.correia@nokia.com> 2 3 [Qt] Repaint counter for accelerated compositing 4 https://bugs.webkit.org/show_bug.cgi?id=90116 5 6 Reviewed by Noam Rosenthal. 7 8 No new tests, just introducing a debug feature. 9 10 For this feature to be enabled, the environment variable 11 QT_WEBKIT_SHOW_COMPOSITING_DEBUG_VISUALS must be set to 1. Once enabled, 12 both repaint counters and tile borders will be painted. 13 14 Important notes: 15 - Only WebKit2 is targetted for now. 16 - There is no integration with Preferences. That aproach was 17 taken initially but revealed complex and overkill for such a 18 debugging-only functionality. Thus, to disable it simply restart with 19 the environment variable unset or set to some other value. 20 21 A Qt-specific drawRepaintCounter() function was added to 22 TextureMapperGL. A QImage is used as scratch buffer to paint borders and 23 counters. It is then uploaded to a BitmapTexture acquired from the pool 24 and finally draw by TextureMapper. The actual compositing happens inside 25 LayerBackingStore::paintToTextureMapper(). Each LayerBackingStoreTile 26 now has a repaint counter which gets incremented in 27 LayerBackingStore::updateTile(). 28 29 * UIProcess/texmap/LayerBackingStore.cpp: 30 (WebKit::LayerBackingStore::updateTile): 31 (WebKit): 32 (WebKit::shouldShowTileDebugVisuals): 33 (WebKit::LayerBackingStore::paintToTextureMapper): 34 * UIProcess/texmap/LayerBackingStore.h: 35 (WebKit::LayerBackingStoreTile::LayerBackingStoreTile): 36 (LayerBackingStoreTile): 37 (WebKit::LayerBackingStoreTile::incrementRepaintCount): 38 (WebKit::LayerBackingStoreTile::repaintCount): 39 1 40 2012-07-10 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> 2 41 -
trunk/Source/WebKit2/UIProcess/texmap/LayerBackingStore.cpp
r121729 r122275 81 81 HashMap<int, LayerBackingStoreTile>::iterator it = m_tiles.find(id); 82 82 ASSERT(it != m_tiles.end()); 83 it->second.incrementRepaintCount(); 83 84 it->second.setBackBuffer(targetRect, sourceRect, backBuffer, offset); 84 85 } … … 94 95 95 96 return PassRefPtr<BitmapTexture>(); 97 } 98 99 static bool shouldShowTileDebugVisuals() 100 { 101 #if PLATFORM(QT) 102 return (qgetenv("QT_WEBKIT_SHOW_COMPOSITING_DEBUG_VISUALS") == "1"); 103 #endif 104 return false; 96 105 } 97 106 … … 127 136 // the total tiled surface rect at the moment. 128 137 unsigned edgesExposed = m_tiles.size() > 1 ? TextureMapper::NoEdges : TextureMapper::AllEdges; 129 for (size_t i = 0; i < tilesToPaint.size(); ++i) 130 tilesToPaint[i]->paint(textureMapper, transform, opacity, mask, edgesExposed); 138 for (size_t i = 0; i < tilesToPaint.size(); ++i) { 139 TextureMapperTile* tile = tilesToPaint[i]; 140 tile->paint(textureMapper, transform, opacity, mask, edgesExposed); 141 static bool shouldDebug = shouldShowTileDebugVisuals(); 142 if (!shouldDebug) 143 continue; 144 textureMapper->drawBorder(QColor(Qt::red), 2, tile->rect(), transform); 145 textureMapper->drawRepaintCounter(static_cast<LayerBackingStoreTile*>(tile)->repaintCount(), 8, tilesToPaint[i]->rect().location(), transform); 146 } 131 147 } 132 148 -
trunk/Source/WebKit2/UIProcess/texmap/LayerBackingStore.h
r121151 r122275 36 36 : TextureMapperTile(WebCore::FloatRect()) 37 37 , m_scale(scale) 38 , m_repaintCount(0) 38 39 { 39 40 } 40 41 41 42 inline float scale() const { return m_scale; } 43 inline void incrementRepaintCount() { ++m_repaintCount; } 44 inline int repaintCount() const { return m_repaintCount; } 42 45 void swapBuffers(WebCore::TextureMapper*); 43 46 void setBackBuffer(const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<ShareableSurface> buffer, const WebCore::IntPoint&); … … 49 52 WebCore::IntPoint m_surfaceOffset; 50 53 float m_scale; 54 int m_repaintCount; 51 55 }; 52 56
Note: See TracChangeset
for help on using the changeset viewer.