Changeset 142524 in webkit
- Timestamp:
- Feb 11, 2013, 3:07:43 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r142522 r142524 1 2013-02-11 Bruno de Oliveira Abinader <bruno.abinader@basyskom.com> 2 3 [texmap] Implement frames-per-second debug counter 4 https://bugs.webkit.org/show_bug.cgi?id=107942 5 6 Reviewed by Noam Rosenthal. 7 8 Adds FPS counter via WEBKIT_SHOW_FPS=<interval> environment variable, 9 where <interval> is the period in seconds (i.e. =1.5) between FPS 10 updates on screen. It is measured by counting 11 CoordinatedGraphicsScene::paintTo* calls and is painted using 12 drawRepaintCounter() after TextureMapperLayer has finished painting its 13 contents. 14 15 Visual debugging feature, no need for new tests. 16 17 * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp: 18 (WebCore::CoordinatedGraphicsScene::CoordinatedGraphicsScene): 19 (WebCore::CoordinatedGraphicsScene::paintToCurrentGLContext): 20 (WebCore::CoordinatedGraphicsScene::paintToGraphicsContext): 21 (WebCore::CoordinatedGraphicsScene::updateFPS): 22 * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h: 23 1 24 2013-02-11 Eric Seidel <eric@webkit.org> 2 25 -
TabularUnified trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp ¶
r141543 r142524 33 33 #include <OpenGLShims.h> 34 34 #include <wtf/Atomics.h> 35 #include <wtf/CurrentTime.h> 35 36 #include <wtf/MainThread.h> 36 37 … … 77 78 , m_backgroundColor(Color::white) 78 79 , m_setDrawsBackground(false) 80 , m_isShowingFPS(false) 81 , m_fpsInterval(0) 82 , m_fpsTimestamp(0) 83 , m_lastFPS(0) 84 , m_frameCount(0) 79 85 { 80 86 ASSERT(isMainThread()); 87 88 String showFPSEnvironment = getenv("WEBKIT_SHOW_FPS"); 89 bool ok = false; 90 m_fpsInterval = showFPSEnvironment.toDouble(&ok); 91 if (ok && m_fpsInterval) { 92 m_isShowingFPS = true; 93 m_fpsTimestamp = WTF::currentTime(); 94 } 81 95 } 82 96 … … 125 139 126 140 layer->paint(); 141 if (m_isShowingFPS) 142 updateFPS(clipRect.location(), matrix); 127 143 m_textureMapper->endClip(); 128 144 m_textureMapper->endPainting(); … … 172 188 m_textureMapper->beginPainting(); 173 189 190 IntRect clipRect = graphicsContext.clipBounds(); 174 191 if (m_setDrawsBackground) 175 m_textureMapper->drawSolidColor( graphicsContext.clipBounds(), TransformationMatrix(), m_backgroundColor);192 m_textureMapper->drawSolidColor(clipRect, TransformationMatrix(), m_backgroundColor); 176 193 177 194 layer->paint(); 195 if (m_isShowingFPS) 196 updateFPS(clipRect.location()); 178 197 m_textureMapper->endPainting(); 179 198 m_textureMapper->setGraphicsContext(0); … … 694 713 } 695 714 715 void CoordinatedGraphicsScene::updateFPS(const FloatPoint& location, const TransformationMatrix& matrix) 716 { 717 m_frameCount++; 718 double delta = WTF::currentTime() - m_fpsTimestamp; 719 if (delta >= m_fpsInterval) { 720 m_lastFPS = int(m_frameCount / delta); 721 m_frameCount = 0; 722 m_fpsTimestamp += delta; 723 } 724 725 // FIXME: drawRepaintCounter() should save a texture and re-use whenever possible. 726 m_textureMapper->drawRepaintCounter(m_lastFPS, Color::black, location, matrix); 727 } 728 696 729 } // namespace WebCore 697 730 -
TabularUnified trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h ¶
r142366 r142524 175 175 void resetBackingStoreSizeToLayerSize(GraphicsLayer*); 176 176 177 void updateFPS(const FloatPoint&, const TransformationMatrix& = TransformationMatrix()); 178 177 179 FloatSize m_contentsSize; 178 180 FloatRect m_visibleContentsRect; … … 225 227 CustomFilterProgramMap m_customFilterPrograms; 226 228 #endif 229 230 bool m_isShowingFPS; 231 double m_fpsInterval; 232 double m_fpsTimestamp; 233 int m_lastFPS; 234 int m_frameCount; 227 235 }; 228 236
Note:
See TracChangeset
for help on using the changeset viewer.