Changeset 140821 in webkit


Ignore:
Timestamp:
Jan 25, 2013 5:50:58 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[Texmap] Refactor code related to debug border and repaint count.
https://bugs.webkit.org/show_bug.cgi?id=105787

Patch by Huang Dongsung <luxtella@company100.net> on 2013-01-25
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.

  1. We use the same color and width to Mac port because we get that info using

GraphicsLayer::updateDebugIndicators().

  1. 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):

Location:
trunk/Source/WebCore
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r140820 r140821  
     12013-01-25  Huang Dongsung  <luxtella@company100.net>
     2
     3        [Texmap] Refactor code related to debug border and repaint count.
     4        https://bugs.webkit.org/show_bug.cgi?id=105787
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        Currently, TextureMapperBackingStore, CoordinatedBackingStore and
     9        GraphicsLayerTextureMapper have duplicated code to draw debug border or
     10        repaint count. This patch refactors that all platform layers draw debug
     11        border and repaint count in the consistent way:
     12        TextureMapper::drawBorder() and TextureMapper::drawRepaintCounter().
     13
     14        There are three big changes:
     15        1. TextureMapperLayer has the debug visuals like GraphicsLayer.
     16        Both debug border and repaint count are called as the debug visuals.
     17        2. We use the same color and width to Mac port because we get that info using
     18        GraphicsLayer::updateDebugIndicators().
     19        3. Draw borders for background color, backing store and contents layer,
     20        while drawing repaint count only for backing store.
     21
     22        No new tests. This functionality is for debugging, so we cannot test using DRT.
     23
     24        * platform/graphics/cairo/GraphicsContext3DPrivate.h:
     25        * platform/graphics/qt/GraphicsContext3DQt.cpp:
     26        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
     27        (WebCore::GraphicsLayerTextureMapper::setShowDebugBorder):
     28        (WebCore):
     29        (WebCore::GraphicsLayerTextureMapper::setShowRepaintCounter):
     30        (WebCore::GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly):
     31        (WebCore::GraphicsLayerTextureMapper::updateDebugBorderAndRepaintCountIfNeeded):
     32        (WebCore::GraphicsLayerTextureMapper::setDebugBorder):
     33        (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
     34        (WebCore::GraphicsLayerTextureMapper::prepareBackingStore):
     35        (WebCore::GraphicsLayerTextureMapper::setRepaintCount):
     36        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
     37        (GraphicsLayerTextureMapper):
     38        (WebCore::GraphicsLayerTextureMapper::debugBorderColor):
     39        (WebCore::GraphicsLayerTextureMapper::debugBorderWidth):
     40        * platform/graphics/texmap/TextureMapper.h:
     41        * platform/graphics/texmap/TextureMapperBackingStore.cpp:
     42        (WebCore::TextureMapperTiledBackingStore::adjustedTransformForRect):
     43        (WebCore):
     44        (WebCore::TextureMapperTiledBackingStore::paintToTextureMapper):
     45        (WebCore::TextureMapperTiledBackingStore::drawBorder):
     46            Override TextureMapperPlatformLayer::drawBorder() to draw the border
     47            for each tile.
     48        (WebCore::TextureMapperTiledBackingStore::drawRepaintCounter):
     49        * platform/graphics/texmap/TextureMapperBackingStore.h:
     50        (WebCore::TextureMapperBackingStore::drawRepaintCounter):
     51        (TextureMapperBackingStore):
     52        (TextureMapperTiledBackingStore):
     53        * platform/graphics/texmap/TextureMapperGL.cpp:
     54        (WebCore::TextureMapperGL::drawRepaintCounter):
     55        * platform/graphics/texmap/TextureMapperGL.h:
     56        * platform/graphics/texmap/TextureMapperImageBuffer.cpp:
     57        (WebCore::TextureMapperImageBuffer::drawBorder):
     58        (WebCore):
     59        (WebCore::TextureMapperImageBuffer::drawRepaintCounter):
     60        * platform/graphics/texmap/TextureMapperImageBuffer.h:
     61        (TextureMapperImageBuffer):
     62        * platform/graphics/texmap/TextureMapperLayer.cpp:
     63        (WebCore::TextureMapperLayer::paintSelf):
     64        (WebCore::TextureMapperLayer::flushCompositingStateForThisLayerOnly):
     65        * platform/graphics/texmap/TextureMapperLayer.h:
     66        (State):
     67        (WebCore::TextureMapperLayer::State::State):
     68        * platform/graphics/texmap/TextureMapperPlatformLayer.h:
     69        (WebCore::TextureMapperPlatformLayer::drawBorder):
     70
    1712013-01-24  Patrick Gansterer  <paroga@webkit.org>
    272
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DPrivate.h

    r127044 r140821  
    2626
    2727#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
    28 #include "TextureMapper.h"
     28#include "TextureMapperPlatformLayer.h"
    2929#endif
    3030
  • trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp

    r140497 r140821  
    3535#include "QWebPageClient.h"
    3636#include "SharedBuffer.h"
     37#include "TextureMapperPlatformLayer.h"
    3738#include <QWindow>
    3839#include <qpa/qplatformpixmap.h>
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp

    r140519 r140821  
    2525#include "GraphicsLayerFactory.h"
    2626#include "ImageBuffer.h"
    27 #include "NotImplemented.h"
    2827#include <wtf/CurrentTime.h>
    29 
    30 #if USE(CAIRO)
    31 #include "CairoUtilities.h"
    32 #include <wtf/text/CString.h>
    33 #endif
    3428
    3529namespace WebCore {
     
    387381}
    388382
     383void GraphicsLayerTextureMapper::setShowDebugBorder(bool show)
     384{
     385    if (isShowingDebugBorder() == show)
     386        return;
     387
     388    GraphicsLayer::setShowDebugBorder(show);
     389    notifyChange(TextureMapperLayer::DebugVisualsChange);
     390}
     391
     392void GraphicsLayerTextureMapper::setShowRepaintCounter(bool show)
     393{
     394    if (isShowingRepaintCounter() == show)
     395        return;
     396
     397    GraphicsLayer::setShowRepaintCounter(show);
     398    notifyChange(TextureMapperLayer::DebugVisualsChange);
     399}
     400
    389401/* \reimp (GraphicsLayer.h)
    390402*/
    391403void GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly()
    392404{
     405    updateDebugBorderAndRepaintCountIfNeeded();
    393406    m_layer->flushCompositingStateForThisLayerOnly(this);
    394     updateBackingStore();
     407    updateBackingStoreIfNeeded();
    395408    didFlushCompositingState();
     409}
     410
     411void GraphicsLayerTextureMapper::updateDebugBorderAndRepaintCountIfNeeded()
     412{
     413    if (!m_hasOwnBackingStore)
     414        return;
     415
     416    m_usingTiledLayer = shouldHaveBackingStore();
     417    updateDebugIndicators();
     418
     419    // When this has its own backing store (e.g. Qt WK1), update the repaint count before calling TextureMapperLayer::flushCompositingStateForThisLayerOnly().
     420    bool needsToRepaint = shouldHaveBackingStore() && (m_needsDisplay || !m_needsDisplayRect.isEmpty());
     421    if (isShowingRepaintCounter() && needsToRepaint) {
     422        incrementRepaintCount();
     423        m_changeMask |= TextureMapperLayer::RepaintCountChange;
     424    }
     425}
     426
     427void GraphicsLayerTextureMapper::setDebugBorder(const Color& color, float width)
     428{
     429    m_debugBorderColor = color;
     430    m_debugBorderWidth = width;
     431    m_changeMask |= TextureMapperLayer::DebugVisualsChange;
    396432}
    397433
     
    418454}
    419455
    420 void GraphicsLayerTextureMapper::updateBackingStore()
     456void GraphicsLayerTextureMapper::updateBackingStoreIfNeeded()
    421457{
    422458    if (!m_hasOwnBackingStore)
    423459        return;
    424 
    425460    prepareBackingStore();
    426461    m_layer->setBackingStore(m_backingStore);
     
    452487    TextureMapperTiledBackingStore* backingStore = static_cast<TextureMapperTiledBackingStore*>(m_backingStore.get());
    453488
    454     if (isShowingRepaintCounter())
    455         incrementRepaintCount();
    456 
    457     // Paint into an intermediate buffer to avoid painting content more than once.
    458     bool paintOnce = true;
    459     const IntSize maxTextureSize = textureMapper->maxTextureSize();
    460     // We need to paint directly if the dirty rect exceeds one of the maximum dimensions.
    461     if (dirtyRect.width() > maxTextureSize.width() || dirtyRect.height() > maxTextureSize.height())
    462         paintOnce = false;
    463 
    464     if (paintOnce) {
    465         OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(dirtyRect.size());
    466         GraphicsContext* context = imageBuffer->context();
    467         context->setImageInterpolationQuality(textureMapper->imageInterpolationQuality());
    468         context->setTextDrawingMode(textureMapper->textDrawingMode());
    469         context->translate(-dirtyRect.x(), -dirtyRect.y());
    470         paintGraphicsLayerContents(*context, dirtyRect);
    471 
    472         if (isShowingRepaintCounter())
    473             drawRepaintCounter(context);
    474 
    475         RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore);
    476         backingStore->updateContents(textureMapper, image.get(), m_size, dirtyRect, BitmapTexture::UpdateCanModifyOriginalImageData);
    477     } else
    478         backingStore->updateContents(textureMapper, this, m_size, dirtyRect, BitmapTexture::UpdateCanModifyOriginalImageData);
    479 
    480     backingStore->setShowDebugBorders(isShowingDebugBorder());
    481     backingStore->setDebugBorder(m_debugBorderColor, m_debugBorderWidth);
     489    backingStore->updateContents(textureMapper, this, m_size, dirtyRect, BitmapTexture::UpdateCanModifyOriginalImageData);
    482490
    483491    m_needsDisplay = false;
     
    489497    return drawsContent() && contentsAreVisible() && !m_size.isEmpty();
    490498}
    491 
    492 #if USE(CAIRO)
    493 void GraphicsLayerTextureMapper::drawRepaintCounter(GraphicsContext* context)
    494 {
    495     cairo_t* cr = context->platformContext()->cr();
    496     cairo_save(cr);
    497 
    498     CString repaintCount = String::format("%i", this->repaintCount()).utf8();
    499     cairo_select_font_face(cr, "sans-serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    500     cairo_set_font_size(cr, 18);
    501 
    502     cairo_text_extents_t repaintTextExtents;
    503     cairo_text_extents(cr, repaintCount.data(), &repaintTextExtents);
    504 
    505     static const int repaintCountBorderWidth = 10;
    506     setSourceRGBAFromColor(cr, isShowingDebugBorder() ? m_debugBorderColor : Color(0, 255, 0, 127));
    507     cairo_rectangle(cr, 0, 0,
    508         repaintTextExtents.width + (repaintCountBorderWidth * 2),
    509         repaintTextExtents.height + (repaintCountBorderWidth * 2));
    510     cairo_fill(cr);
    511 
    512     cairo_set_source_rgb(cr, 1, 1, 1);
    513     cairo_move_to(cr, repaintCountBorderWidth, repaintTextExtents.height + repaintCountBorderWidth);
    514     cairo_show_text(cr, repaintCount.data());
    515 
    516     cairo_restore(cr);
    517 }
    518 #else
    519 void GraphicsLayerTextureMapper::drawRepaintCounter(GraphicsContext* context)
    520 {
    521     notImplemented();
    522 }
    523 
    524 #endif
    525499
    526500bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double timeOffset)
     
    565539}
    566540
    567 void GraphicsLayerTextureMapper::setDebugBorder(const Color& color, float width)
    568 {
    569     // The default values for GraphicsLayer debug borders are a little
    570     // hard to see (some less than one pixel wide), so we double their size here.
    571     m_debugBorderColor = color;
    572     m_debugBorderWidth = width * 2;
    573 }
    574 
    575541#if ENABLE(CSS_FILTERS)
    576542bool GraphicsLayerTextureMapper::setFilters(const FilterOperations& filters)
     
    581547#endif
    582548
    583 }
     549void GraphicsLayerTextureMapper::setRepaintCount(int repaintCount)
     550{
     551    m_repaintCount = repaintCount;
     552    notifyChange(TextureMapperLayer::RepaintCountChange);
     553}
     554
     555}
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h

    r138291 r140821  
    2121#define GraphicsLayerTextureMapper_h
    2222
    23 #include "GraphicsContext.h"
    2423#include "GraphicsLayer.h"
    2524#include "GraphicsLayerClient.h"
     
    6766    virtual void setContentsToMedia(PlatformLayer*);
    6867    virtual void setContentsToCanvas(PlatformLayer* canvas) { setContentsToMedia(canvas); }
     68    virtual void setShowDebugBorder(bool) OVERRIDE;
     69    virtual void setDebugBorder(const Color&, float width) OVERRIDE;
     70    virtual void setShowRepaintCounter(bool) OVERRIDE;
    6971    virtual void flushCompositingState(const FloatRect&);
    7072    virtual void flushCompositingStateForThisLayerOnly();
     
    8284    TextureMapperLayer* layer() const { return m_layer.get(); }
    8385
    84     virtual void setDebugBorder(const Color&, float width);
    85 
    8686#if ENABLE(CSS_FILTERS)
    8787    virtual bool setFilters(const FilterOperations&);
     
    9494    bool fixedToViewport() const { return m_fixedToViewport; }
    9595
    96     void drawRepaintCounter(GraphicsContext*);
     96    Color debugBorderColor() const { return m_debugBorderColor; }
     97    float debugBorderWidth() const { return m_debugBorderWidth; }
     98    void setRepaintCount(int);
     99
    97100private:
    98101    virtual void willBeDestroyed();
    99102    void didFlushCompositingState();
    100     void updateBackingStore();
     103    void updateDebugBorderAndRepaintCountIfNeeded();
     104    void updateBackingStoreIfNeeded();
    101105    void prepareBackingStore();
    102106    bool shouldHaveBackingStore() const;
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h

    r137982 r140821  
    3737#include "IntRect.h"
    3838#include "IntSize.h"
    39 #include "TextureMapperPlatformLayer.h"
    4039#include "TransformationMatrix.h"
    4140#include <wtf/UnusedParam.h>
     
    131130    };
    132131
    133     virtual void drawBorder(const Color&, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) = 0;
    134     virtual void drawRepaintCounter(int value, int pointSize, const FloatPoint&, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) = 0;
     132    virtual void drawBorder(const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) = 0;
     133    virtual void drawRepaintCounter(int repaintCount, const Color&, const FloatPoint&, const TransformationMatrix&) = 0;
     134
    135135    virtual void drawTexture(const BitmapTexture&, const FloatRect& target, const TransformationMatrix& modelViewMatrix = TransformationMatrix(), float opacity = 1.0f, const BitmapTexture* maskTexture = 0, unsigned exposedEdges = AllEdges) = 0;
    136136    virtual void drawSolidColor(const FloatRect&, const TransformationMatrix&, const Color&) = 0;
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp

    r138327 r140821  
    107107
    108108TextureMapperTiledBackingStore::TextureMapperTiledBackingStore()
    109     : m_drawsDebugBorders(false)
    110109{
    111110}
     
    134133}
    135134
     135TransformationMatrix TextureMapperTiledBackingStore::adjustedTransformForRect(const FloatRect& targetRect)
     136{
     137    return TransformationMatrix::rectToRect(rect(), targetRect);
     138}
     139
    136140void TextureMapperTiledBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask)
    137141{
    138142    updateContentsFromImageIfNeeded(textureMapper);
    139     TransformationMatrix adjustedTransform = transform;
    140     adjustedTransform.multiply(TransformationMatrix::rectToRect(rect(), targetRect));
    141     for (size_t i = 0; i < m_tiles.size(); ++i) {
     143    TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
     144    for (size_t i = 0; i < m_tiles.size(); ++i)
    142145        m_tiles[i].paint(textureMapper, adjustedTransform, opacity, mask, calculateExposedTileEdges(rect(), m_tiles[i].rect()));
    143         if (m_drawsDebugBorders)
    144             textureMapper->drawBorder(m_debugBorderColor, m_debugBorderWidth, m_tiles[i].rect(), adjustedTransform);
    145     }
     146}
     147
     148void TextureMapperTiledBackingStore::drawBorder(TextureMapper* textureMapper, const Color& borderColor, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& transform)
     149{
     150    TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
     151    for (size_t i = 0; i < m_tiles.size(); ++i)
     152        textureMapper->drawBorder(borderColor, borderWidth, m_tiles[i].rect(), adjustedTransform);
     153}
     154
     155void TextureMapperTiledBackingStore::drawRepaintCounter(TextureMapper* textureMapper, int repaintCount, const Color& borderColor, const FloatRect& targetRect, const TransformationMatrix& transform)
     156{
     157    TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
     158    for (size_t i = 0; i < m_tiles.size(); ++i)
     159        textureMapper->drawRepaintCounter(repaintCount, borderColor, m_tiles[i].rect().location(), adjustedTransform);
    146160}
    147161
     
    235249}
    236250
    237 void TextureMapperTiledBackingStore::setDebugBorder(const Color& color, float width)
    238 {
    239     m_debugBorderColor = color;
    240     m_debugBorderWidth = width;
    241 }
    242 
    243251}
    244252#endif
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h

    r137481 r140821  
    4141    virtual PassRefPtr<BitmapTexture> texture() const = 0;
    4242    virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float, BitmapTexture*) = 0;
     43    virtual void drawRepaintCounter(TextureMapper*, int /* repaintCount */, const Color&, const FloatRect&, const TransformationMatrix&) { }
    4344    virtual ~TextureMapperBackingStore() { }
     45
    4446
    4547protected:
     
    9597    virtual PassRefPtr<BitmapTexture> texture() const OVERRIDE;
    9698    virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float, BitmapTexture*) OVERRIDE;
     99    virtual void drawBorder(TextureMapper*, const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) OVERRIDE;
     100    virtual void drawRepaintCounter(TextureMapper*, int repaintCount, const Color&, const FloatRect&, const TransformationMatrix&) OVERRIDE;
    97101    void updateContents(TextureMapper*, Image*, const FloatSize&, const IntRect&, BitmapTexture::UpdateContentsFlag);
    98102    void updateContents(TextureMapper*, GraphicsLayer*, const FloatSize&, const IntRect&, BitmapTexture::UpdateContentsFlag);
    99103
    100104    void setContentsToImage(Image* image) { m_image = image; }
    101     void setShowDebugBorders(bool drawsDebugBorders) { m_drawsDebugBorders = drawsDebugBorders; }
    102     void setDebugBorder(const Color&, float width);
    103105
    104106private:
     
    106108    void createOrDestroyTilesIfNeeded(const FloatSize& backingStoreSize, const IntSize& tileSize, bool hasAlpha);
    107109    void updateContentsFromImageIfNeeded(TextureMapper*);
     110    TransformationMatrix adjustedTransformForRect(const FloatRect&);
    108111    inline FloatRect rect() const { return FloatRect(FloatPoint::zero(), m_size); }
    109112
     
    111114    FloatSize m_size;
    112115    RefPtr<Image> m_image;
    113 
    114     bool m_drawsDebugBorders;
    115     Color m_debugBorderColor;
    116     float m_debugBorderWidth;
    117116};
    118117
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp

    r140518 r140821  
    322322}
    323323
    324 void TextureMapperGL::drawRepaintCounter(int value, int pointSize, const FloatPoint& targetPoint, const TransformationMatrix& modelViewMatrix)
    325 {
     324void TextureMapperGL::drawRepaintCounter(int repaintCount, const Color& color, const FloatPoint& targetPoint, const TransformationMatrix& modelViewMatrix)
     325{
     326    int pointSize = 8;
    326327#if PLATFORM(QT)
    327     QString counterString = QString::number(value);
     328    QString counterString = QString::number(repaintCount);
    328329
    329330    QFont font(QString::fromLatin1("Monospace"), pointSize, QFont::Bold);
     
    340341    QImage image(size, NativeImageQt::defaultFormatForAlphaEnabledImages());
    341342    QPainter painter(&image);
    342     painter.fillRect(sourceRect, Qt::blue); // Since we won't swap R+B for speed, this will paint red.
     343    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.
    343344    painter.setFont(font);
    344345    painter.setPen(Qt::white);
     
    351352
    352353#elif USE(CAIRO)
    353     CString counterString = String::number(value).ascii();
     354    CString counterString = String::number(repaintCount).ascii();
    354355    // cairo_text_extents() requires a cairo_t, so dimensions need to be guesstimated.
    355356    int width = counterString.length() * pointSize * 1.2;
     
    359360    cairo_t* cr = cairo_create(surface);
    360361
    361     cairo_set_source_rgb(cr, 0, 0, 1); // Since we won't swap R+B for speed, this will paint red.
     362    float r, g, b, a;
     363    color.getRGBA(r, g, b, a);
     364    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.
    362365    cairo_rectangle(cr, 0, 0, width, height);
    363366    cairo_fill(cr);
     
    383386
    384387#else
    385     UNUSED_PARAM(value);
     388    UNUSED_PARAM(repaintCount);
    386389    UNUSED_PARAM(pointSize);
    387390    UNUSED_PARAM(targetPoint);
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h

    r139731 r140821  
    5353
    5454    // TextureMapper implementation
    55     virtual void drawBorder(const Color&, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) OVERRIDE;
    56     virtual void drawRepaintCounter(int value, int pointSize, const FloatPoint&, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) OVERRIDE;
     55    virtual void drawBorder(const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) OVERRIDE;
     56    virtual void drawRepaintCounter(int repaintCount, const Color&, const FloatPoint&, const TransformationMatrix&) OVERRIDE;
    5757    virtual void drawTexture(const BitmapTexture&, const FloatRect&, const TransformationMatrix&, float opacity, const BitmapTexture* maskTexture, unsigned exposedEdges) OVERRIDE;
    5858    virtual void drawTexture(Platform3DObject 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.cpp

    r139864 r140821  
    2626#include "NativeImageQt.h"
    2727#endif
     28#include "NotImplemented.h"
    2829
    2930
     
    165166}
    166167
     168void TextureMapperImageBuffer::drawBorder(const Color&, float /* borderWidth */, const FloatRect&, const TransformationMatrix&)
     169{
     170    notImplemented();
     171}
     172
     173void TextureMapperImageBuffer::drawRepaintCounter(int /* repaintCount */, const Color&, const FloatPoint&, const TransformationMatrix&)
     174{
     175    notImplemented();
     176}
     177
    167178#if ENABLE(CSS_FILTERS)
    168179PassRefPtr<BitmapTexture> BitmapTextureImageBuffer::applyFilters(TextureMapper*, const BitmapTexture& contentTexture, const FilterOperations& filters)
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h

    r137481 r140821  
    5454
    5555    // TextureMapper implementation
    56     virtual void drawBorder(const Color&, float /* borderWidth */, const FloatRect& /* targetRect */, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) OVERRIDE
    57     {
    58         UNUSED_PARAM(modelViewMatrix);
    59     };
    60     virtual void drawRepaintCounter(int /* value */, int /* pointSize */, const FloatPoint&, const TransformationMatrix& modelViewMatrix = TransformationMatrix()) OVERRIDE
    61     {
    62         UNUSED_PARAM(modelViewMatrix);
    63     };
     56    virtual void drawBorder(const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) OVERRIDE;
     57    virtual void drawRepaintCounter(int repaintCount, const Color&, const FloatPoint&, const TransformationMatrix&) OVERRIDE;
    6458    virtual void drawTexture(const BitmapTexture&, const FloatRect& targetRect, const TransformationMatrix&, float opacity, const BitmapTexture* maskTexture, unsigned exposedEdges) OVERRIDE;
    6559    virtual void drawSolidColor(const FloatRect&, const TransformationMatrix&, const Color&) OVERRIDE;
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp

    r140519 r140821  
    130130    if (m_state.solidColor.isValid() && !m_state.contentsRect.isEmpty()) {
    131131        options.textureMapper->drawSolidColor(m_state.contentsRect, transform, blendWithOpacity(m_state.solidColor, opacity));
     132        if (m_state.showDebugBorders)
     133            options.textureMapper->drawBorder(m_state.debugBorderColor, m_state.debugBorderWidth, layerRect(), transform);
    132134        return;
    133135    }
     
    137139        ASSERT(!layerRect().isEmpty());
    138140        m_backingStore->paintToTextureMapper(options.textureMapper, layerRect(), transform, opacity, mask.get());
     141        if (m_state.showDebugBorders)
     142            m_backingStore->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, layerRect(), transform);
     143        // Only draw repaint count for the main backing store.
     144        if (m_state.showRepaintCounter)
     145            m_backingStore->drawRepaintCounter(options.textureMapper, m_state.repaintCount, m_state.debugBorderColor, layerRect(), transform);
    139146    }
    140147
     
    142149        ASSERT(!layerRect().isEmpty());
    143150        m_contentsLayer->paintToTextureMapper(options.textureMapper, m_state.contentsRect, transform, opacity, mask.get());
     151        if (m_state.showDebugBorders)
     152            m_contentsLayer->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, m_state.contentsRect, transform);
    144153    }
    145154}
     
    384393        return;
    385394
    386     graphicsLayer->updateDebugIndicators();
    387 
    388395    if (changeMask & ChildrenChange)
    389396        setChildren(graphicsLayer->children());
     
    401408    if (changeMask & AnimationChange)
    402409        m_animations = graphicsLayer->m_animations;
     410
     411    if (changeMask & RepaintCountChange)
     412        m_state.repaintCount = graphicsLayer->repaintCount();
    403413
    404414    m_state.maskLayer = toTextureMapperLayer(graphicsLayer->maskLayer());
     
    424434    m_fixedToViewport = graphicsLayer->fixedToViewport();
    425435
     436    m_state.showDebugBorders = graphicsLayer->isShowingDebugBorder();
     437    m_state.debugBorderColor = toGraphicsLayerTextureMapper(graphicsLayer)->debugBorderColor();
     438    m_state.debugBorderWidth = toGraphicsLayerTextureMapper(graphicsLayer)->debugBorderWidth();
     439    m_state.showRepaintCounter = graphicsLayer->isShowingRepaintCounter();
     440
    426441    m_contentsLayer = graphicsLayer->platformLayer();
    427442
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h

    r139526 r140821  
    7272        ReplicaLayerChange =        (1L << 21),
    7373        AnimationChange =           (1L << 22),
    74         FilterChange =              (1L << 23)
     74        FilterChange =              (1L << 23),
     75
     76        DebugVisualsChange =        (1L << 24),
     77        RepaintCountChange =        (1L << 25)
    7578    };
    7679
     
    173176        FilterOperations filters;
    174177#endif
     178        Color debugBorderColor;
     179        float debugBorderWidth;
     180        int repaintCount;
    175181
    176182        bool preserves3D : 1;
     
    181187        bool backfaceVisibility : 1;
    182188        bool visible : 1;
     189        bool showDebugBorders : 1;
     190        bool showRepaintCounter : 1;
    183191
    184192        State()
     
    186194            , maskLayer(0)
    187195            , replicaLayer(0)
     196            , debugBorderWidth(0)
     197            , repaintCount(0)
    188198            , preserves3D(false)
    189199            , masksToBounds(false)
     
    193203            , backfaceVisibility(false)
    194204            , visible(true)
     205            , showDebugBorders(false)
     206            , showRepaintCounter(false)
    195207        {
    196208        }
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h

    r135200 r140821  
    2525#endif
    2626
     27#include "TextureMapper.h"
    2728#include "TransformationMatrix.h"
    2829
    2930namespace WebCore {
    30 
    31 class TextureMapper;
    32 class BitmapTexture;
    3331
    3432class TextureMapperPlatformLayer {
     
    3735    virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix& modelViewMatrix = TransformationMatrix(), float opacity = 1.0, BitmapTexture* mask = 0) = 0;
    3836    virtual void swapBuffers() { }
     37    virtual void drawBorder(TextureMapper* textureMapper, const Color& color, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& transform)
     38    {
     39        textureMapper->drawBorder(color, borderWidth, targetRect, transform);
     40    }
    3941#if USE(GRAPHICS_SURFACE)
    4042    virtual IntSize platformLayerSize() const { return IntSize(); }
Note: See TracChangeset for help on using the changeset viewer.