Changeset 95939 in webkit


Ignore:
Timestamp:
Sep 26, 2011 3:51:59 AM (13 years ago)
Author:
noam.rosenthal@nokia.com
Message:

[Texmap][Qt] Enable TextureMapperGL in platforms where BGRA is not present
https://bugs.webkit.org/show_bug.cgi?id=65473

Reviewed by Andreas Kling.

For now, swap RGBA->BGRA in software if we're in OpenGL ES 2.
We do that by iterating on the pixels and manually swapping each pixel's red and blue
values. This can be done faster with shaders, but for now this is a working solution
for platforms without BGRA support.

No new tests. Existing layout tests cover this.

  • platform/graphics/opengl/TextureMapperGL.cpp:

(WebCore::BitmapTextureGL::endPaint):

  • platform/graphics/opengl/TextureMapperGL.h:
  • platform/graphics/qt/TextureMapperQt.cpp:

(WebCore::RGBA32PremultimpliedBufferQt::swapRGB):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r95938 r95939  
     12011-09-26  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        [Texmap][Qt] Enable TextureMapperGL in platforms where BGRA is not present
     4        https://bugs.webkit.org/show_bug.cgi?id=65473
     5
     6        Reviewed by Andreas Kling.
     7
     8        For now, swap RGBA->BGRA in software if we're in OpenGL ES 2.
     9        We do that by iterating on the pixels and manually swapping each pixel's red and blue
     10        values. This can be done faster with shaders, but for now this is a working solution
     11        for platforms without BGRA support.
     12
     13        No new tests. Existing layout tests cover this.
     14
     15        * platform/graphics/opengl/TextureMapperGL.cpp:
     16        (WebCore::BitmapTextureGL::endPaint):
     17        * platform/graphics/opengl/TextureMapperGL.h:
     18        * platform/graphics/qt/TextureMapperQt.cpp:
     19        (WebCore::RGBA32PremultimpliedBufferQt::swapRGB):
     20
    1212011-09-26  Sergio Villar Senin  <svillar@igalia.com>
    222
  • trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp

    r95901 r95939  
    535535    m_buffer->endPaint();
    536536    GL_CMD(glBindTexture(GL_TEXTURE_2D, m_id))
     537#ifdef TEXMAP_OPENGL_ES_2
     538    // FIXME: use shaders for RGBA->BGRA swap if this becomes a performance issue.
     539    m_buffer->swapRGB();
     540    GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, m_dirtyRect.x(), m_dirtyRect.y(), m_dirtyRect.width(), m_dirtyRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, m_buffer->data()))
     541#else
    537542    GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, m_dirtyRect.x(), m_dirtyRect.y(), m_dirtyRect.width(), m_dirtyRect.height(), GL_BGRA, GL_UNSIGNED_BYTE, m_buffer->data()))
     543#endif
    538544    m_buffer.clear();
    539545}
  • trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h

    r95901 r95939  
    6868    virtual ~RGBA32PremultimpliedBuffer() {}
    6969    virtual PlatformGraphicsContext* beginPaint(const IntRect& dirtyRect, bool opaque) = 0;
     70    virtual void swapRGB() = 0;
    7071    virtual void endPaint() = 0;
    7172    virtual const void* data() const = 0;
  • trunk/Source/WebCore/platform/graphics/qt/TextureMapperQt.cpp

    r95901 r95939  
    229229    }
    230230
     231    void swapRGB()
     232    {
     233        m_image = m_image.rgbSwapped();
     234    }
     235
    231236    virtual void endPaint() { m_painter.end(); }
    232237    virtual const void* data() const { return m_image.constBits(); }
Note: See TracChangeset for help on using the changeset viewer.