Diff
Modified: trunk/Source/WebCore/ChangeLog (140820 => 140821)
--- trunk/Source/WebCore/ChangeLog 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/ChangeLog 2013-01-25 13:50:58 UTC (rev 140821)
@@ -1,3 +1,73 @@
+2013-01-25 Huang Dongsung <[email protected]>
+
+ [Texmap] Refactor code related to debug border and repaint count.
+ https://bugs.webkit.org/show_bug.cgi?id=105787
+
+ Reviewed by Noam Rosenthal.
+
+ Currently, TextureMapperBackingStore, CoordinatedBackingStore and
+ GraphicsLayerTextureMapper have duplicated code to draw debug border or
+ repaint count. This patch refactors that all platform layers draw debug
+ border and repaint count in the consistent way:
+ TextureMapper::drawBorder() and TextureMapper::drawRepaintCounter().
+
+ There are three big changes:
+ 1. TextureMapperLayer has the debug visuals like GraphicsLayer.
+ Both debug border and repaint count are called as the debug visuals.
+ 2. We use the same color and width to Mac port because we get that info using
+ GraphicsLayer::updateDebugIndicators().
+ 3. Draw borders for background color, backing store and contents layer,
+ while drawing repaint count only for backing store.
+
+ No new tests. This functionality is for debugging, so we cannot test using DRT.
+
+ * platform/graphics/cairo/GraphicsContext3DPrivate.h:
+ * platform/graphics/qt/GraphicsContext3DQt.cpp:
+ * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
+ (WebCore::GraphicsLayerTextureMapper::setShowDebugBorder):
+ (WebCore):
+ (WebCore::GraphicsLayerTextureMapper::setShowRepaintCounter):
+ (WebCore::GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly):
+ (WebCore::GraphicsLayerTextureMapper::updateDebugBorderAndRepaintCountIfNeeded):
+ (WebCore::GraphicsLayerTextureMapper::setDebugBorder):
+ (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
+ (WebCore::GraphicsLayerTextureMapper::prepareBackingStore):
+ (WebCore::GraphicsLayerTextureMapper::setRepaintCount):
+ * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
+ (GraphicsLayerTextureMapper):
+ (WebCore::GraphicsLayerTextureMapper::debugBorderColor):
+ (WebCore::GraphicsLayerTextureMapper::debugBorderWidth):
+ * platform/graphics/texmap/TextureMapper.h:
+ * platform/graphics/texmap/TextureMapperBackingStore.cpp:
+ (WebCore::TextureMapperTiledBackingStore::adjustedTransformForRect):
+ (WebCore):
+ (WebCore::TextureMapperTiledBackingStore::paintToTextureMapper):
+ (WebCore::TextureMapperTiledBackingStore::drawBorder):
+ Override TextureMapperPlatformLayer::drawBorder() to draw the border
+ for each tile.
+ (WebCore::TextureMapperTiledBackingStore::drawRepaintCounter):
+ * platform/graphics/texmap/TextureMapperBackingStore.h:
+ (WebCore::TextureMapperBackingStore::drawRepaintCounter):
+ (TextureMapperBackingStore):
+ (TextureMapperTiledBackingStore):
+ * platform/graphics/texmap/TextureMapperGL.cpp:
+ (WebCore::TextureMapperGL::drawRepaintCounter):
+ * platform/graphics/texmap/TextureMapperGL.h:
+ * platform/graphics/texmap/TextureMapperImageBuffer.cpp:
+ (WebCore::TextureMapperImageBuffer::drawBorder):
+ (WebCore):
+ (WebCore::TextureMapperImageBuffer::drawRepaintCounter):
+ * platform/graphics/texmap/TextureMapperImageBuffer.h:
+ (TextureMapperImageBuffer):
+ * platform/graphics/texmap/TextureMapperLayer.cpp:
+ (WebCore::TextureMapperLayer::paintSelf):
+ (WebCore::TextureMapperLayer::flushCompositingStateForThisLayerOnly):
+ * platform/graphics/texmap/TextureMapperLayer.h:
+ (State):
+ (WebCore::TextureMapperLayer::State::State):
+ * platform/graphics/texmap/TextureMapperPlatformLayer.h:
+ (WebCore::TextureMapperPlatformLayer::drawBorder):
+
2013-01-24 Patrick Gansterer <[email protected]>
Build fix for !ENABLE(DRAG_SUPPORT) after r140286.
Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.h (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.h 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.h 2013-01-25 13:50:58 UTC (rev 140821)
@@ -25,7 +25,7 @@
#include <wtf/PassOwnPtr.h>
#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
-#include "TextureMapper.h"
+#include "TextureMapperPlatformLayer.h"
#endif
namespace WebCore {
Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp 2013-01-25 13:50:58 UTC (rev 140821)
@@ -34,6 +34,7 @@
#include "OpenGLShims.h"
#include "QWebPageClient.h"
#include "SharedBuffer.h"
+#include "TextureMapperPlatformLayer.h"
#include <QWindow>
#include <qpa/qplatformpixmap.h>
#include <wtf/UnusedParam.h>
Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp 2013-01-25 13:50:58 UTC (rev 140821)
@@ -24,14 +24,8 @@
#include "GraphicsLayerAnimation.h"
#include "GraphicsLayerFactory.h"
#include "ImageBuffer.h"
-#include "NotImplemented.h"
#include <wtf/CurrentTime.h>
-#if USE(CAIRO)
-#include "CairoUtilities.h"
-#include <wtf/text/CString.h>
-#endif
-
namespace WebCore {
PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient* client)
@@ -386,15 +380,57 @@
m_contentsLayer = media;
}
+void GraphicsLayerTextureMapper::setShowDebugBorder(bool show)
+{
+ if (isShowingDebugBorder() == show)
+ return;
+
+ GraphicsLayer::setShowDebugBorder(show);
+ notifyChange(TextureMapperLayer::DebugVisualsChange);
+}
+
+void GraphicsLayerTextureMapper::setShowRepaintCounter(bool show)
+{
+ if (isShowingRepaintCounter() == show)
+ return;
+
+ GraphicsLayer::setShowRepaintCounter(show);
+ notifyChange(TextureMapperLayer::DebugVisualsChange);
+}
+
/* \reimp (GraphicsLayer.h)
*/
void GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly()
{
+ updateDebugBorderAndRepaintCountIfNeeded();
m_layer->flushCompositingStateForThisLayerOnly(this);
- updateBackingStore();
+ updateBackingStoreIfNeeded();
didFlushCompositingState();
}
+void GraphicsLayerTextureMapper::updateDebugBorderAndRepaintCountIfNeeded()
+{
+ if (!m_hasOwnBackingStore)
+ return;
+
+ m_usingTiledLayer = shouldHaveBackingStore();
+ 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 |= TextureMapperLayer::RepaintCountChange;
+ }
+}
+
+void GraphicsLayerTextureMapper::setDebugBorder(const Color& color, float width)
+{
+ m_debugBorderColor = color;
+ m_debugBorderWidth = width;
+ m_changeMask |= TextureMapperLayer::DebugVisualsChange;
+}
+
/* \reimp (GraphicsLayer.h)
*/
void GraphicsLayerTextureMapper::flushCompositingState(const FloatRect& rect)
@@ -417,11 +453,10 @@
m_changeMask = 0;
}
-void GraphicsLayerTextureMapper::updateBackingStore()
+void GraphicsLayerTextureMapper::updateBackingStoreIfNeeded()
{
if (!m_hasOwnBackingStore)
return;
-
prepareBackingStore();
m_layer->setBackingStore(m_backingStore);
}
@@ -451,35 +486,8 @@
#endif
TextureMapperTiledBackingStore* backingStore = static_cast<TextureMapperTiledBackingStore*>(m_backingStore.get());
- if (isShowingRepaintCounter())
- incrementRepaintCount();
+ backingStore->updateContents(textureMapper, this, m_size, dirtyRect, BitmapTexture::UpdateCanModifyOriginalImageData);
- // 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();
}
@@ -489,40 +497,6 @@
return drawsContent() && contentsAreVisible() && !m_size.isEmpty();
}
-#if USE(CAIRO)
-void GraphicsLayerTextureMapper::drawRepaintCounter(GraphicsContext* context)
-{
- cairo_t* cr = context->platformContext()->cr();
- cairo_save(cr);
-
- CString repaintCount = String::format("%i", this->repaintCount()).utf8();
- cairo_select_font_face(cr, "sans-serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
- cairo_set_font_size(cr, 18);
-
- cairo_text_extents_t repaintTextExtents;
- cairo_text_extents(cr, repaintCount.data(), &repaintTextExtents);
-
- static const int repaintCountBorderWidth = 10;
- setSourceRGBAFromColor(cr, isShowingDebugBorder() ? m_debugBorderColor : Color(0, 255, 0, 127));
- cairo_rectangle(cr, 0, 0,
- repaintTextExtents.width + (repaintCountBorderWidth * 2),
- repaintTextExtents.height + (repaintCountBorderWidth * 2));
- cairo_fill(cr);
-
- cairo_set_source_rgb(cr, 1, 1, 1);
- cairo_move_to(cr, repaintCountBorderWidth, repaintTextExtents.height + repaintCountBorderWidth);
- cairo_show_text(cr, repaintCount.data());
-
- cairo_restore(cr);
-}
-#else
-void GraphicsLayerTextureMapper::drawRepaintCounter(GraphicsContext* context)
-{
- notImplemented();
-}
-
-#endif
-
bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double timeOffset)
{
ASSERT(!keyframesName.isEmpty());
@@ -564,14 +538,6 @@
client()->notifyAnimationStarted(this, /* DOM time */ WTF::currentTime());
}
-void GraphicsLayerTextureMapper::setDebugBorder(const Color& color, float width)
-{
- // The default values for GraphicsLayer debug borders are a little
- // hard to see (some less than one pixel wide), so we double their size here.
- m_debugBorderColor = color;
- m_debugBorderWidth = width * 2;
-}
-
#if ENABLE(CSS_FILTERS)
bool GraphicsLayerTextureMapper::setFilters(const FilterOperations& filters)
{
@@ -580,4 +546,10 @@
}
#endif
+void GraphicsLayerTextureMapper::setRepaintCount(int repaintCount)
+{
+ m_repaintCount = repaintCount;
+ notifyChange(TextureMapperLayer::RepaintCountChange);
}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h 2013-01-25 13:50:58 UTC (rev 140821)
@@ -20,7 +20,6 @@
#ifndef GraphicsLayerTextureMapper_h
#define GraphicsLayerTextureMapper_h
-#include "GraphicsContext.h"
#include "GraphicsLayer.h"
#include "GraphicsLayerClient.h"
#include "Image.h"
@@ -66,6 +65,9 @@
Color solidColor() const { return m_solidColor; }
virtual void setContentsToMedia(PlatformLayer*);
virtual void setContentsToCanvas(PlatformLayer* canvas) { setContentsToMedia(canvas); }
+ virtual void setShowDebugBorder(bool) OVERRIDE;
+ virtual void setDebugBorder(const Color&, float width) OVERRIDE;
+ virtual void setShowRepaintCounter(bool) OVERRIDE;
virtual void flushCompositingState(const FloatRect&);
virtual void flushCompositingStateForThisLayerOnly();
virtual void setName(const String& name);
@@ -81,8 +83,6 @@
TextureMapperLayer* layer() const { return m_layer.get(); }
- virtual void setDebugBorder(const Color&, float width);
-
#if ENABLE(CSS_FILTERS)
virtual bool setFilters(const FilterOperations&);
#endif
@@ -93,11 +93,15 @@
void setFixedToViewport(bool fixed) { m_fixedToViewport = fixed; }
bool fixedToViewport() const { return m_fixedToViewport; }
- void drawRepaintCounter(GraphicsContext*);
+ Color debugBorderColor() const { return m_debugBorderColor; }
+ float debugBorderWidth() const { return m_debugBorderWidth; }
+ void setRepaintCount(int);
+
private:
virtual void willBeDestroyed();
void didFlushCompositingState();
- void updateBackingStore();
+ void updateDebugBorderAndRepaintCountIfNeeded();
+ void updateBackingStoreIfNeeded();
void prepareBackingStore();
bool shouldHaveBackingStore() const;
void animationStartedTimerFired(Timer<GraphicsLayerTextureMapper>*);
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h 2013-01-25 13:50:58 UTC (rev 140821)
@@ -36,7 +36,6 @@
#include "GraphicsContext.h"
#include "IntRect.h"
#include "IntSize.h"
-#include "TextureMapperPlatformLayer.h"
#include "TransformationMatrix.h"
#include <wtf/UnusedParam.h>
@@ -130,8 +129,9 @@
AllEdges = LeftEdge | RightEdge | TopEdge | BottomEdge,
};
- virtual void drawBorder(const Color&, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) = 0;
- virtual void drawRepaintCounter(int value, int pointSize, const FloatPoint&, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) = 0;
+ virtual void drawBorder(const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) = 0;
+ virtual void drawRepaintCounter(int repaintCount, const Color&, const FloatPoint&, const TransformationMatrix&) = 0;
+
virtual void drawTexture(const BitmapTexture&, const FloatRect& target, const TransformationMatrix& modelViewMatrix = TransformationMatrix(), float opacity = 1.0f, const BitmapTexture* maskTexture = 0, unsigned exposedEdges = AllEdges) = 0;
virtual void drawSolidColor(const FloatRect&, const TransformationMatrix&, const Color&) = 0;
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp 2013-01-25 13:50:58 UTC (rev 140821)
@@ -106,7 +106,6 @@
}
TextureMapperTiledBackingStore::TextureMapperTiledBackingStore()
- : m_drawsDebugBorders(false)
{
}
@@ -133,18 +132,33 @@
return exposedEdges;
}
+TransformationMatrix TextureMapperTiledBackingStore::adjustedTransformForRect(const FloatRect& targetRect)
+{
+ return TransformationMatrix::rectToRect(rect(), targetRect);
+}
+
void TextureMapperTiledBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask)
{
updateContentsFromImageIfNeeded(textureMapper);
- TransformationMatrix adjustedTransform = transform;
- adjustedTransform.multiply(TransformationMatrix::rectToRect(rect(), targetRect));
- for (size_t i = 0; i < m_tiles.size(); ++i) {
+ TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
+ for (size_t i = 0; i < m_tiles.size(); ++i)
m_tiles[i].paint(textureMapper, adjustedTransform, opacity, mask, calculateExposedTileEdges(rect(), m_tiles[i].rect()));
- if (m_drawsDebugBorders)
- textureMapper->drawBorder(m_debugBorderColor, m_debugBorderWidth, m_tiles[i].rect(), adjustedTransform);
- }
}
+void TextureMapperTiledBackingStore::drawBorder(TextureMapper* textureMapper, const Color& borderColor, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& transform)
+{
+ TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
+ for (size_t i = 0; i < m_tiles.size(); ++i)
+ textureMapper->drawBorder(borderColor, borderWidth, m_tiles[i].rect(), adjustedTransform);
+}
+
+void TextureMapperTiledBackingStore::drawRepaintCounter(TextureMapper* textureMapper, int repaintCount, const Color& borderColor, const FloatRect& targetRect, const TransformationMatrix& transform)
+{
+ TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
+ for (size_t i = 0; i < m_tiles.size(); ++i)
+ textureMapper->drawRepaintCounter(repaintCount, borderColor, m_tiles[i].rect().location(), adjustedTransform);
+}
+
void TextureMapperTiledBackingStore::createOrDestroyTilesIfNeeded(const FloatSize& size, const IntSize& tileSize, bool hasAlpha)
{
if (size == m_size)
@@ -234,11 +248,5 @@
return PassRefPtr<BitmapTexture>();
}
-void TextureMapperTiledBackingStore::setDebugBorder(const Color& color, float width)
-{
- m_debugBorderColor = color;
- m_debugBorderWidth = width;
}
-
-}
#endif
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h 2013-01-25 13:50:58 UTC (rev 140821)
@@ -40,8 +40,10 @@
public:
virtual PassRefPtr<BitmapTexture> texture() const = 0;
virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float, BitmapTexture*) = 0;
+ virtual void drawRepaintCounter(TextureMapper*, int /* repaintCount */, const Color&, const FloatRect&, const TransformationMatrix&) { }
virtual ~TextureMapperBackingStore() { }
+
protected:
static unsigned calculateExposedTileEdges(const FloatRect& totalRect, const FloatRect& tileRect);
};
@@ -94,26 +96,23 @@
virtual PassRefPtr<BitmapTexture> texture() const OVERRIDE;
virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float, BitmapTexture*) OVERRIDE;
+ virtual void drawBorder(TextureMapper*, const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) OVERRIDE;
+ virtual void drawRepaintCounter(TextureMapper*, int repaintCount, const Color&, const FloatRect&, const TransformationMatrix&) OVERRIDE;
void updateContents(TextureMapper*, Image*, const FloatSize&, const IntRect&, BitmapTexture::UpdateContentsFlag);
void updateContents(TextureMapper*, GraphicsLayer*, const FloatSize&, const IntRect&, BitmapTexture::UpdateContentsFlag);
void setContentsToImage(Image* image) { m_image = image; }
- void setShowDebugBorders(bool drawsDebugBorders) { m_drawsDebugBorders = drawsDebugBorders; }
- void setDebugBorder(const Color&, float width);
private:
TextureMapperTiledBackingStore();
void createOrDestroyTilesIfNeeded(const FloatSize& backingStoreSize, const IntSize& tileSize, bool hasAlpha);
void updateContentsFromImageIfNeeded(TextureMapper*);
+ TransformationMatrix adjustedTransformForRect(const FloatRect&);
inline FloatRect rect() const { return FloatRect(FloatPoint::zero(), m_size); }
Vector<TextureMapperTile> m_tiles;
FloatSize m_size;
RefPtr<Image> m_image;
-
- bool m_drawsDebugBorders;
- Color m_debugBorderColor;
- float m_debugBorderWidth;
};
}
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp 2013-01-25 13:50:58 UTC (rev 140821)
@@ -321,10 +321,11 @@
draw(targetRect, modelViewMatrix, program.get(), GraphicsContext3D::LINE_LOOP, color.hasAlpha() ? ShouldBlend : 0);
}
-void TextureMapperGL::drawRepaintCounter(int value, int pointSize, const FloatPoint& targetPoint, const TransformationMatrix& modelViewMatrix)
+void TextureMapperGL::drawRepaintCounter(int repaintCount, const Color& color, const FloatPoint& targetPoint, const TransformationMatrix& modelViewMatrix)
{
+ int pointSize = 8;
#if PLATFORM(QT)
- QString counterString = QString::number(value);
+ QString counterString = QString::number(repaintCount);
QFont font(QString::fromLatin1("Monospace"), pointSize, QFont::Bold);
font.setStyleHint(QFont::TypeWriter);
@@ -339,7 +340,7 @@
QImage image(size, NativeImageQt::defaultFormatForAlphaEnabledImages());
QPainter painter(&image);
- painter.fillRect(sourceRect, Qt::blue); // Since we won't swap R+B for speed, this will paint red.
+ painter.fillRect(sourceRect, Color::createUnchecked(color.blue(), color.green(), color.red())); // Since we won't swap R+B when uploading a texture, paint with the swapped R+B color.
painter.setFont(font);
painter.setPen(Qt::white);
painter.drawText(2, height * 0.85, counterString);
@@ -350,7 +351,7 @@
drawTexture(*texture, targetRect, modelViewMatrix, 1.0f, 0, AllEdges);
#elif USE(CAIRO)
- CString counterString = String::number(value).ascii();
+ CString counterString = String::number(repaintCount).ascii();
// cairo_text_extents() requires a cairo_t, so dimensions need to be guesstimated.
int width = counterString.length() * pointSize * 1.2;
int height = pointSize * 1.5;
@@ -358,7 +359,9 @@
cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
cairo_t* cr = cairo_create(surface);
- cairo_set_source_rgb(cr, 0, 0, 1); // Since we won't swap R+B for speed, this will paint red.
+ float r, g, b, a;
+ color.getRGBA(r, g, b, a);
+ cairo_set_source_rgba(cr, b, g, r, a); // Since we won't swap R+B when uploading a texture, paint with the swapped R+B color.
cairo_rectangle(cr, 0, 0, width, height);
cairo_fill(cr);
@@ -382,7 +385,7 @@
cairo_destroy(cr);
#else
- UNUSED_PARAM(value);
+ UNUSED_PARAM(repaintCount);
UNUSED_PARAM(pointSize);
UNUSED_PARAM(targetPoint);
UNUSED_PARAM(modelViewMatrix);
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h 2013-01-25 13:50:58 UTC (rev 140821)
@@ -52,8 +52,8 @@
typedef int Flags;
// TextureMapper implementation
- virtual void drawBorder(const Color&, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) OVERRIDE;
- virtual void drawRepaintCounter(int value, int pointSize, const FloatPoint&, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) OVERRIDE;
+ virtual void drawBorder(const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) OVERRIDE;
+ virtual void drawRepaintCounter(int repaintCount, const Color&, const FloatPoint&, const TransformationMatrix&) OVERRIDE;
virtual void drawTexture(const BitmapTexture&, const FloatRect&, const TransformationMatrix&, float opacity, const BitmapTexture* maskTexture, unsigned exposedEdges) OVERRIDE;
virtual void drawTexture(Platform3DObject texture, Flags, const IntSize& textureSize, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity, const BitmapTexture* maskTexture, unsigned exposedEdges = AllEdges);
virtual void drawSolidColor(const FloatRect&, const TransformationMatrix&, const Color&) OVERRIDE;
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp 2013-01-25 13:50:58 UTC (rev 140821)
@@ -25,6 +25,7 @@
#if PLATFORM(QT)
#include "NativeImageQt.h"
#endif
+#include "NotImplemented.h"
#if USE(TEXTURE_MAPPER)
@@ -164,6 +165,16 @@
context->restore();
}
+void TextureMapperImageBuffer::drawBorder(const Color&, float /* borderWidth */, const FloatRect&, const TransformationMatrix&)
+{
+ notImplemented();
+}
+
+void TextureMapperImageBuffer::drawRepaintCounter(int /* repaintCount */, const Color&, const FloatPoint&, const TransformationMatrix&)
+{
+ notImplemented();
+}
+
#if ENABLE(CSS_FILTERS)
PassRefPtr<BitmapTexture> BitmapTextureImageBuffer::applyFilters(TextureMapper*, const BitmapTexture& contentTexture, const FilterOperations& filters)
{
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h 2013-01-25 13:50:58 UTC (rev 140821)
@@ -53,14 +53,8 @@
static PassOwnPtr<TextureMapper> create() { return adoptPtr(new TextureMapperImageBuffer); }
// TextureMapper implementation
- virtual void drawBorder(const Color&, float /* borderWidth */, const FloatRect& /* targetRect */, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) OVERRIDE
- {
- UNUSED_PARAM(modelViewMatrix);
- };
- virtual void drawRepaintCounter(int /* value */, int /* pointSize */, const FloatPoint&, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) OVERRIDE
- {
- UNUSED_PARAM(modelViewMatrix);
- };
+ virtual void drawBorder(const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) OVERRIDE;
+ virtual void drawRepaintCounter(int repaintCount, const Color&, const FloatPoint&, const TransformationMatrix&) OVERRIDE;
virtual void drawTexture(const BitmapTexture&, const FloatRect& targetRect, const TransformationMatrix&, float opacity, const BitmapTexture* maskTexture, unsigned exposedEdges) OVERRIDE;
virtual void drawSolidColor(const FloatRect&, const TransformationMatrix&, const Color&) OVERRIDE;
virtual void beginClip(const TransformationMatrix&, const FloatRect&) OVERRIDE;
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2013-01-25 13:50:58 UTC (rev 140821)
@@ -129,6 +129,8 @@
if (m_state.solidColor.isValid() && !m_state.contentsRect.isEmpty()) {
options.textureMapper->drawSolidColor(m_state.contentsRect, transform, blendWithOpacity(m_state.solidColor, opacity));
+ if (m_state.showDebugBorders)
+ options.textureMapper->drawBorder(m_state.debugBorderColor, m_state.debugBorderWidth, layerRect(), transform);
return;
}
@@ -136,11 +138,18 @@
ASSERT(m_state.drawsContent && m_state.contentsVisible && !m_state.size.isEmpty());
ASSERT(!layerRect().isEmpty());
m_backingStore->paintToTextureMapper(options.textureMapper, layerRect(), transform, opacity, mask.get());
+ if (m_state.showDebugBorders)
+ m_backingStore->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, layerRect(), transform);
+ // Only draw repaint count for the main backing store.
+ if (m_state.showRepaintCounter)
+ m_backingStore->drawRepaintCounter(options.textureMapper, m_state.repaintCount, m_state.debugBorderColor, layerRect(), transform);
}
if (m_contentsLayer) {
ASSERT(!layerRect().isEmpty());
m_contentsLayer->paintToTextureMapper(options.textureMapper, m_state.contentsRect, transform, opacity, mask.get());
+ if (m_state.showDebugBorders)
+ m_contentsLayer->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, m_state.contentsRect, transform);
}
}
@@ -383,8 +392,6 @@
if (changeMask == NoChanges && graphicsLayer->m_animations.isEmpty())
return;
- graphicsLayer->updateDebugIndicators();
-
if (changeMask & ChildrenChange)
setChildren(graphicsLayer->children());
@@ -401,6 +408,9 @@
if (changeMask & AnimationChange)
m_animations = graphicsLayer->m_animations;
+ if (changeMask & RepaintCountChange)
+ m_state.repaintCount = graphicsLayer->repaintCount();
+
m_state.maskLayer = toTextureMapperLayer(graphicsLayer->maskLayer());
m_state.replicaLayer = toTextureMapperLayer(graphicsLayer->replicaLayer());
m_state.pos = graphicsLayer->position();
@@ -423,6 +433,11 @@
#endif
m_fixedToViewport = graphicsLayer->fixedToViewport();
+ m_state.showDebugBorders = graphicsLayer->isShowingDebugBorder();
+ m_state.debugBorderColor = toGraphicsLayerTextureMapper(graphicsLayer)->debugBorderColor();
+ m_state.debugBorderWidth = toGraphicsLayerTextureMapper(graphicsLayer)->debugBorderWidth();
+ m_state.showRepaintCounter = graphicsLayer->isShowingRepaintCounter();
+
m_contentsLayer = graphicsLayer->platformLayer();
m_currentTransform.setPosition(adjustedPosition());
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h 2013-01-25 13:50:58 UTC (rev 140821)
@@ -71,7 +71,10 @@
ReplicaLayerChange = (1L << 21),
AnimationChange = (1L << 22),
- FilterChange = (1L << 23)
+ FilterChange = (1L << 23),
+
+ DebugVisualsChange = (1L << 24),
+ RepaintCountChange = (1L << 25)
};
TextureMapperLayer()
@@ -172,6 +175,9 @@
#if ENABLE(CSS_FILTERS)
FilterOperations filters;
#endif
+ Color debugBorderColor;
+ float debugBorderWidth;
+ int repaintCount;
bool preserves3D : 1;
bool masksToBounds : 1;
@@ -180,11 +186,15 @@
bool contentsOpaque : 1;
bool backfaceVisibility : 1;
bool visible : 1;
+ bool showDebugBorders : 1;
+ bool showRepaintCounter : 1;
State()
: opacity(1)
, maskLayer(0)
, replicaLayer(0)
+ , debugBorderWidth(0)
+ , repaintCount(0)
, preserves3D(false)
, masksToBounds(false)
, drawsContent(false)
@@ -192,6 +202,8 @@
, contentsOpaque(false)
, backfaceVisibility(false)
, visible(true)
+ , showDebugBorders(false)
+ , showRepaintCounter(false)
{
}
};
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h (140820 => 140821)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h 2013-01-25 13:40:47 UTC (rev 140820)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h 2013-01-25 13:50:58 UTC (rev 140821)
@@ -24,18 +24,20 @@
#include "GraphicsSurface.h"
#endif
+#include "TextureMapper.h"
#include "TransformationMatrix.h"
namespace WebCore {
-class TextureMapper;
-class BitmapTexture;
-
class TextureMapperPlatformLayer {
public:
virtual ~TextureMapperPlatformLayer() { }
virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix& modelViewMatrix = TransformationMatrix(), float opacity = 1.0, BitmapTexture* mask = 0) = 0;
virtual void swapBuffers() { }
+ virtual void drawBorder(TextureMapper* textureMapper, const Color& color, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& transform)
+ {
+ textureMapper->drawBorder(color, borderWidth, targetRect, transform);
+ }
#if USE(GRAPHICS_SURFACE)
virtual IntSize platformLayerSize() const { return IntSize(); }
virtual uint32_t copyToGraphicsSurface() { return 0; }