Changeset 86265 in webkit


Ignore:
Timestamp:
May 11, 2011 2:06:04 PM (13 years ago)
Author:
noam.rosenthal@nokia.com
Message:

2011-05-11 Noam Rosenthal <noam.rosenthal@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Texmap][Qt] Upstream texture-mapper changes from Qt's WebKit2 branch
https://bugs.webkit.org/show_bug.cgi?id=60439

Patch 2/12: Add a few functions to the TextureMapper API, allowing:

  1. an entry/exit point for painting (beginPaint/endPaint)
  2. Clipping with a matrix, since we use stencil instead of scissors
  3. Draw a texture directly with an ID
  4. Remove offset, since we're using real tiling
  5. numberOfBytes calculation for textures, for memory management

No new tests. Tests in LayoutTests/compositing test this.

  • platform/graphics/texmap/TextureMapper.h: (WebCore::BitmapTexture::destroy): (WebCore::BitmapTexture::allowOfflineTextureUpload): (WebCore::BitmapTexture::bpp): (WebCore::BitmapTexture::numberOfBytes): (WebCore::TextureMapper::viewportSize): (WebCore::TextureMapper::setViewportSize): (WebCore::TextureMapper::allowPartialUpdates): (WebCore::TextureMapper::isOpenGLBacked): (WebCore::TextureMapper::setTransform): (WebCore::TextureMapper::transform): (WebCore::TextureMapper::beginPainting): (WebCore::TextureMapper::endPainting):
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86264 r86265  
     12011-05-11  Noam Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Texmap][Qt] Upstream texture-mapper changes from Qt's WebKit2 branch
     6        https://bugs.webkit.org/show_bug.cgi?id=60439
     7
     8        Patch 2/12: Add a few functions to the TextureMapper API, allowing:
     9        1. an entry/exit point for painting (beginPaint/endPaint)
     10        2. Clipping with a matrix, since we use stencil instead of scissors
     11        3. Draw a texture directly with an ID
     12        4. Remove offset, since we're using real tiling
     13        5. numberOfBytes calculation for textures, for memory management
     14
     15        No new tests. Tests in LayoutTests/compositing test this.
     16
     17        * platform/graphics/texmap/TextureMapper.h:
     18        (WebCore::BitmapTexture::destroy):
     19        (WebCore::BitmapTexture::allowOfflineTextureUpload):
     20        (WebCore::BitmapTexture::bpp):
     21        (WebCore::BitmapTexture::numberOfBytes):
     22        (WebCore::TextureMapper::viewportSize):
     23        (WebCore::TextureMapper::setViewportSize):
     24        (WebCore::TextureMapper::allowPartialUpdates):
     25        (WebCore::TextureMapper::isOpenGLBacked):
     26        (WebCore::TextureMapper::setTransform):
     27        (WebCore::TextureMapper::transform):
     28        (WebCore::TextureMapper::beginPainting):
     29        (WebCore::TextureMapper::endPainting):
     30
    1312011-05-11  Noam Rosenthal  <noam.rosenthal@nokia.com>
    232
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h

    r81230 r86265  
    3131#include "IntRect.h"
    3232#include "IntSize.h"
     33#include "TextureMapperPlatformLayer.h"
    3334#include "TransformationMatrix.h"
    3435#include <wtf/UnusedParam.h>
     
    4849    BitmapTexture() : m_lockCount(0) {}
    4950    virtual ~BitmapTexture() { }
     51    virtual void destroy() { }
    5052
    5153    virtual bool allowOfflineTextureUpload() const { return false; }
    52     virtual void destroy() = 0;
    5354    virtual IntSize size() const = 0;
     55    virtual int bpp() const { return 32; }
    5456    virtual bool isValid() const = 0;
    5557    virtual void reset(const IntSize& size, bool opaque = false)
     
    7678    inline bool isLocked() { return m_lockCount; }
    7779    inline IntSize contentSize() const { return m_contentSize; }
    78     inline void setOffset(const IntPoint& o) { m_offset = o; }
    79     inline IntPoint offset() const { return m_offset; }
     80    inline int numberOfBytes() const { return size().width() * size().height() * bpp() >> 3; }
    8081
    8182protected:
    82 
    83 private:
    8483    int m_lockCount;
    8584    IntSize m_contentSize;
    8685    bool m_isOpaque;
    87     IntPoint m_offset;
    8886};
    8987
     
    9795    virtual ~TextureMapper() { }
    9896
    99     virtual void drawTexture(const BitmapTexture& texture, const IntRect& target, const TransformationMatrix& matrix = TransformationMatrix(), float opacity = 1.0f, const BitmapTexture* maskTexture = 0) = 0;
     97    virtual void drawTexture(const BitmapTexture&, const FloatRect& target, const TransformationMatrix& modelViewMatrix = TransformationMatrix(), float opacity = 1.0f, const BitmapTexture* maskTexture = 0) = 0;
    10098
    10199    // makes a surface the target for the following drawTexture calls.
    102100    virtual void bindSurface(BitmapTexture* surface) = 0;
    103     virtual void paintToTarget(const BitmapTexture& texture, const IntSize&, const TransformationMatrix& matrix, float opacity, const IntRect& visibleRect)
    104     {
    105         UNUSED_PARAM(visibleRect);
    106         drawTexture(texture, IntRect(0, 0, texture.contentSize().width(), texture.contentSize().height()), matrix, opacity, 0);
    107     }
    108 
    109     virtual void setGraphicsContext(GraphicsContext*) { }
    110     virtual void setClip(const IntRect&) = 0;
     101    virtual void setGraphicsContext(GraphicsContext*) = 0;
     102    virtual GraphicsContext* graphicsContext() = 0;
     103    virtual void beginClip(const TransformationMatrix&, const FloatRect&) = 0;
     104    virtual void endClip() = 0;
    111105    virtual bool allowSurfaceForRoot() const = 0;
    112106    virtual PassRefPtr<BitmapTexture> createTexture() = 0;
     107    IntSize viewportSize() const { return m_viewportSize; }
     108    void setViewportSize(const IntSize& s) { m_viewportSize = s; }
    113109
    114110    void setImageInterpolationQuality(InterpolationQuality quality) { m_interpolationQuality = quality; }
     
    117113    InterpolationQuality imageInterpolationQuality() const { return m_interpolationQuality; }
    118114    TextDrawingModeFlags textDrawingMode() const { return m_textDrawingMode; }
     115    virtual bool allowPartialUpdates() const { return false; }
     116    virtual bool isOpenGLBacked() const { return false; }
    119117
    120     void setViewportSize(const IntSize&);
     118    void setTransform(const TransformationMatrix& matrix) { m_transform = matrix; }
     119    TransformationMatrix transform() const { return m_transform; }
     120
     121    virtual void beginPainting() { }
     122    virtual void endPainting() { }
     123
    121124
    122125protected:
     
    129132    InterpolationQuality m_interpolationQuality;
    130133    TextDrawingModeFlags m_textDrawingMode;
     134    TransformationMatrix m_transform;
     135    IntSize m_viewportSize;
    131136};
    132137
Note: See TracChangeset for help on using the changeset viewer.