Changeset 148129 in webkit


Ignore:
Timestamp:
Apr 10, 2013 12:56:23 PM (11 years ago)
Author:
anilsson@rim.com
Message:

[BlackBerry] Rename BlackBerry specific Texture class
https://bugs.webkit.org/show_bug.cgi?id=95781

Reviewed by Rob Buis.

Texture was a bit too generic and prone to name conflicts. Renamed it
to LayerTexture.

Source/WebCore:

No change in behavior, no new tests.

PR 322882

  • PlatformBlackBerry.cmake:
  • platform/graphics/blackberry/LayerCompositingThread.cpp:

(WebCore::LayerCompositingThread::drawSurface):
(WebCore::LayerCompositingThread::contentsTexture):

  • platform/graphics/blackberry/LayerCompositingThread.h:

(LayerCompositingThread):

  • platform/graphics/blackberry/LayerCompositingThreadClient.h:

(WebCore):
(WebCore::LayerCompositingThreadClient::contentsTexture):

  • platform/graphics/blackberry/LayerFilterRenderer.cpp:

(WebCore::LayerFilterRenderer::applyActions):

  • platform/graphics/blackberry/LayerFilterRenderer.h:

(LayerFilterRenderer):

  • platform/graphics/blackberry/LayerRendererSurface.h:

(WebCore::LayerRendererSurface::texture):
(LayerRendererSurface):

  • platform/graphics/blackberry/LayerTexture.cpp: Renamed from Source/WebCore/platform/graphics/blackberry/Texture.cpp.

(WebCore):
(WebCore::LayerTexture::LayerTexture):
(WebCore::LayerTexture::~LayerTexture):
(WebCore::LayerTexture::updateContents):
(WebCore::LayerTexture::setContentsToColor):
(WebCore::LayerTexture::protect):

  • platform/graphics/blackberry/LayerTexture.h: Renamed from Source/WebCore/platform/graphics/blackberry/Texture.h.

(WebCore):
(LayerTexture):
(WebCore::LayerTexture::create):
(WebCore::LayerTexture::textureId):
(WebCore::LayerTexture::isDirty):
(WebCore::LayerTexture::hasTexture):
(WebCore::LayerTexture::isColor):
(WebCore::LayerTexture::isOpaque):
(WebCore::LayerTexture::isProtected):
(WebCore::LayerTexture::protect):
(WebCore::LayerTexture::unprotect):
(WebCore::LayerTexture::size):
(WebCore::LayerTexture::width):
(WebCore::LayerTexture::height):
(WebCore::LayerTexture::bytesPerPixel):
(WebCore::LayerTexture::sizeInBytes):
(WebCore::LayerTexture::setTextureId):
(WebCore::LayerTexture::setSize):

  • platform/graphics/blackberry/LayerTile.cpp:

(WebCore::LayerTile::setContents):
(WebCore::LayerTile::updateContents):
(WebCore::LayerTile::setTexture):

  • platform/graphics/blackberry/LayerTile.h:

(WebCore::LayerTile::texture):
(LayerTile):

  • platform/graphics/blackberry/LayerTiler.cpp:

(WebCore::LayerTiler::drawTile):
(WebCore::LayerTiler::contentsTexture):

  • platform/graphics/blackberry/LayerTiler.h:

(LayerTiler):
(WebCore::LayerTiler::TextureJob::TextureJob):
(WebCore::LayerTiler::TextureJob::setContents):
(WebCore::LayerTiler::TextureJob::updateContents):
(TextureJob):

  • platform/graphics/blackberry/TextureCacheCompositingThread.cpp:

(WebCore::TextureProtector::TextureProtector):
(TextureProtector):
(WebCore::TextureCacheCompositingThread::allocateTextureId):
(WebCore::freeTextureId):
(WebCore::TextureCacheCompositingThread::textureResized):
(WebCore::TextureCacheCompositingThread::textureSizeInBytesChanged):
(WebCore::TextureCacheCompositingThread::textureDestroyed):
(WebCore::TextureCacheCompositingThread::install):
(WebCore::TextureCacheCompositingThread::resizeTexture):
(WebCore::TextureCacheCompositingThread::evict):
(WebCore::TextureCacheCompositingThread::textureAccessed):
(WebCore::TextureCacheCompositingThread::prune):
(WebCore::TextureCacheCompositingThread::textureForTiledContents):
(WebCore::TextureCacheCompositingThread::textureForColor):
(WebCore::TextureCacheCompositingThread::updateContents):

  • platform/graphics/blackberry/TextureCacheCompositingThread.h:

(WebCore::TextureCacheCompositingThread::createTexture):
(TextureCacheCompositingThread):
(WebCore::TextureCacheCompositingThread::ZombieTexture::ZombieTexture):
(ZombieTexture):

Source/WebKit/blackberry:

PR 322882

  • Api/WebOverlay.cpp:

(BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded):

  • Api/WebOverlay_p.h:

(WebOverlayLayerCompositingThreadClient):

Location:
trunk/Source
Files:
17 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r148128 r148129  
     12013-04-10  Arvid Nilsson  <anilsson@rim.com>
     2
     3        [BlackBerry] Rename BlackBerry specific Texture class
     4        https://bugs.webkit.org/show_bug.cgi?id=95781
     5
     6        Reviewed by Rob Buis.
     7
     8        Texture was a bit too generic and prone to name conflicts. Renamed it
     9        to LayerTexture.
     10
     11        No change in behavior, no new tests.
     12
     13        PR 322882
     14
     15        * PlatformBlackBerry.cmake:
     16        * platform/graphics/blackberry/LayerCompositingThread.cpp:
     17        (WebCore::LayerCompositingThread::drawSurface):
     18        (WebCore::LayerCompositingThread::contentsTexture):
     19        * platform/graphics/blackberry/LayerCompositingThread.h:
     20        (LayerCompositingThread):
     21        * platform/graphics/blackberry/LayerCompositingThreadClient.h:
     22        (WebCore):
     23        (WebCore::LayerCompositingThreadClient::contentsTexture):
     24        * platform/graphics/blackberry/LayerFilterRenderer.cpp:
     25        (WebCore::LayerFilterRenderer::applyActions):
     26        * platform/graphics/blackberry/LayerFilterRenderer.h:
     27        (LayerFilterRenderer):
     28        * platform/graphics/blackberry/LayerRendererSurface.h:
     29        (WebCore::LayerRendererSurface::texture):
     30        (LayerRendererSurface):
     31        * platform/graphics/blackberry/LayerTexture.cpp: Renamed from Source/WebCore/platform/graphics/blackberry/Texture.cpp.
     32        (WebCore):
     33        (WebCore::LayerTexture::LayerTexture):
     34        (WebCore::LayerTexture::~LayerTexture):
     35        (WebCore::LayerTexture::updateContents):
     36        (WebCore::LayerTexture::setContentsToColor):
     37        (WebCore::LayerTexture::protect):
     38        * platform/graphics/blackberry/LayerTexture.h: Renamed from Source/WebCore/platform/graphics/blackberry/Texture.h.
     39        (WebCore):
     40        (LayerTexture):
     41        (WebCore::LayerTexture::create):
     42        (WebCore::LayerTexture::textureId):
     43        (WebCore::LayerTexture::isDirty):
     44        (WebCore::LayerTexture::hasTexture):
     45        (WebCore::LayerTexture::isColor):
     46        (WebCore::LayerTexture::isOpaque):
     47        (WebCore::LayerTexture::isProtected):
     48        (WebCore::LayerTexture::protect):
     49        (WebCore::LayerTexture::unprotect):
     50        (WebCore::LayerTexture::size):
     51        (WebCore::LayerTexture::width):
     52        (WebCore::LayerTexture::height):
     53        (WebCore::LayerTexture::bytesPerPixel):
     54        (WebCore::LayerTexture::sizeInBytes):
     55        (WebCore::LayerTexture::setTextureId):
     56        (WebCore::LayerTexture::setSize):
     57        * platform/graphics/blackberry/LayerTile.cpp:
     58        (WebCore::LayerTile::setContents):
     59        (WebCore::LayerTile::updateContents):
     60        (WebCore::LayerTile::setTexture):
     61        * platform/graphics/blackberry/LayerTile.h:
     62        (WebCore::LayerTile::texture):
     63        (LayerTile):
     64        * platform/graphics/blackberry/LayerTiler.cpp:
     65        (WebCore::LayerTiler::drawTile):
     66        (WebCore::LayerTiler::contentsTexture):
     67        * platform/graphics/blackberry/LayerTiler.h:
     68        (LayerTiler):
     69        (WebCore::LayerTiler::TextureJob::TextureJob):
     70        (WebCore::LayerTiler::TextureJob::setContents):
     71        (WebCore::LayerTiler::TextureJob::updateContents):
     72        (TextureJob):
     73        * platform/graphics/blackberry/TextureCacheCompositingThread.cpp:
     74        (WebCore::TextureProtector::TextureProtector):
     75        (TextureProtector):
     76        (WebCore::TextureCacheCompositingThread::allocateTextureId):
     77        (WebCore::freeTextureId):
     78        (WebCore::TextureCacheCompositingThread::textureResized):
     79        (WebCore::TextureCacheCompositingThread::textureSizeInBytesChanged):
     80        (WebCore::TextureCacheCompositingThread::textureDestroyed):
     81        (WebCore::TextureCacheCompositingThread::install):
     82        (WebCore::TextureCacheCompositingThread::resizeTexture):
     83        (WebCore::TextureCacheCompositingThread::evict):
     84        (WebCore::TextureCacheCompositingThread::textureAccessed):
     85        (WebCore::TextureCacheCompositingThread::prune):
     86        (WebCore::TextureCacheCompositingThread::textureForTiledContents):
     87        (WebCore::TextureCacheCompositingThread::textureForColor):
     88        (WebCore::TextureCacheCompositingThread::updateContents):
     89        * platform/graphics/blackberry/TextureCacheCompositingThread.h:
     90        (WebCore::TextureCacheCompositingThread::createTexture):
     91        (TextureCacheCompositingThread):
     92        (WebCore::TextureCacheCompositingThread::ZombieTexture::ZombieTexture):
     93        (ZombieTexture):
     94
    1952013-04-10  Andreas Kling  <akling@apple.com>
    296
  • trunk/Source/WebCore/PlatformBlackBerry.cmake

    r147883 r148129  
    243243        ${WEBCORE_DIR}/platform/graphics/blackberry/LayerRenderer.cpp
    244244        ${WEBCORE_DIR}/platform/graphics/blackberry/LayerRendererSurface.cpp
     245        ${WEBCORE_DIR}/platform/graphics/blackberry/LayerTexture.cpp
    245246        ${WEBCORE_DIR}/platform/graphics/blackberry/LayerTile.cpp
    246247        ${WEBCORE_DIR}/platform/graphics/blackberry/LayerTiler.cpp
    247248        ${WEBCORE_DIR}/platform/graphics/blackberry/LayerWebKitThread.cpp
    248249        ${WEBCORE_DIR}/platform/graphics/blackberry/PluginLayerWebKitThread.cpp
    249         ${WEBCORE_DIR}/platform/graphics/blackberry/Texture.cpp
    250250        ${WEBCORE_DIR}/platform/graphics/blackberry/TextureCacheCompositingThread.cpp
    251251        ${WEBCORE_DIR}/platform/graphics/blackberry/WebGLLayerWebKitThread.cpp
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.cpp

    r146906 r148129  
    273273
    274274    if (m_layerRenderer->layerAlreadyOnSurface(this)) {
    275         Texture* surfaceTexture = layerRendererSurface()->texture();
     275        LayerTexture* surfaceTexture = layerRendererSurface()->texture();
    276276        if (!surfaceTexture) {
    277277            ASSERT_NOT_REACHED();
     
    287287
    288288        if (mask) {
    289             Texture* maskTexture = mask->contentsTexture();
     289            LayerTexture* maskTexture = mask->contentsTexture();
    290290            if (maskTexture) {
    291291                GLuint maskTexID = reinterpret_cast<GLuint>(platformBufferHandle(maskTexture->textureId()));
     
    426426}
    427427
    428 Texture* LayerCompositingThread::contentsTexture()
     428LayerTexture* LayerCompositingThread::contentsTexture()
    429429{
    430430    if (m_client)
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.h

    r146058 r148129  
    150150    bool updateAnimations(double currentTime);
    151151    void updateTextureContentsIfNeeded();
    152     Texture* contentsTexture();
     152    LayerTexture* contentsTexture();
    153153
    154154    const LayerCompositingThread* rootLayer() const;
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerCompositingThreadClient.h

    r144465 r148129  
    3232
    3333class LayerCompositingThread;
    34 class Texture;
     34class LayerTexture;
    3535
    3636class LayerCompositingThreadClient {
     
    4747
    4848    // Optional. Allows layers to serve as a mask for other layers
    49     virtual Texture* contentsTexture(LayerCompositingThread*) { return 0; }
     49    virtual LayerTexture* contentsTexture(LayerCompositingThread*) { return 0; }
    5050
    5151    // Optional. Allow the layer to commit thread sensitive content during a sync point
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerFilterRenderer.cpp

    r144465 r148129  
    720720
    721721        if (actions[i]->shouldPushSnapshot()) {
    722             RefPtr<Texture> currentTexture = (!(i % 2) ? surface->texture() : m_texture);
     722            RefPtr<LayerTexture> currentTexture = (!(i % 2) ? surface->texture() : m_texture);
    723723            GLuint texid = reinterpret_cast<GLuint>(platformBufferHandle(currentTexture->textureId()));
    724724            if (!texid) {
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerFilterRenderer.h

    r127040 r148129  
    2424#include "IntRect.h"
    2525#include "LayerData.h"
    26 #include "Texture.h"
     26#include "LayerTexture.h"
    2727#include "TransformationMatrix.h"
    2828
     
    257257
    258258    // Textures for playing ping-pong - see note in applyActions()
    259     RefPtr<Texture> m_texture;
    260     RefPtr<Texture> m_snapshotTexture;
     259    RefPtr<LayerTexture> m_texture;
     260    RefPtr<LayerTexture> m_snapshotTexture;
    261261
    262262    friend class LayerFilterRendererAction;
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerRendererSurface.h

    r109809 r148129  
    2525#include "IntRect.h"
    2626#include "IntSize.h"
    27 #include "Texture.h"
     27#include "LayerTexture.h"
    2828#include "TransformationMatrix.h"
    2929
     
    5555    bool ensureTexture();
    5656    void releaseTexture();
    57     Texture* texture() const { return m_texture.get(); }
     57    LayerTexture* texture() const { return m_texture.get(); }
    5858
    5959    float drawOpacity() { return m_opacity; }
     
    6161
    6262private:
    63     RefPtr<Texture> m_texture;
     63    RefPtr<LayerTexture> m_texture;
    6464
    6565    FloatRect m_contentRect;
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerTexture.cpp

    r148128 r148129  
    1818
    1919#include "config.h"
    20 #include "Texture.h"
     20#include "LayerTexture.h"
    2121
    2222#if USE(ACCELERATED_COMPOSITING)
     
    3333namespace WebCore {
    3434
    35 Texture::Texture(bool isColor)
     35LayerTexture::LayerTexture(bool isColor)
    3636    : m_protectionCount(0)
    3737    , m_handle(0)
     
    4343}
    4444
    45 Texture::~Texture()
     45LayerTexture::~LayerTexture()
    4646{
    4747    textureCacheCompositingThread()->textureDestroyed(this);
    4848}
    4949
    50 void Texture::updateContents(const Texture::HostType& contents, const IntRect& dirtyRect, const IntRect& tile, bool isOpaque)
     50void LayerTexture::updateContents(const LayerTexture::HostType& contents, const IntRect& dirtyRect, const IntRect& tile, bool isOpaque)
    5151{
    5252    if (m_handle)
     
    5858}
    5959
    60 void Texture::setContentsToColor(const Color& color)
     60void LayerTexture::setContentsToColor(const Color& color)
    6161{
    6262    m_isOpaque = !color.hasAlpha();
     
    7878}
    7979
    80 bool Texture::protect(const IntSize& size, BlackBerry::Platform::Graphics::BufferType type)
     80bool LayerTexture::protect(const IntSize& size, BlackBerry::Platform::Graphics::BufferType type)
    8181{
    8282    if (!hasTexture()) {
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerTexture.h

    r148128 r148129  
    1717 */
    1818
    19 #ifndef Texture_h
    20 #define Texture_h
     19#ifndef LayerTexture_h
     20#define LayerTexture_h
    2121
    2222#if USE(ACCELERATED_COMPOSITING)
     
    3434class TextureCacheCompositingThread;
    3535
    36 // Texture encapsulates a volatile texture - at any time, the underlying OpenGL
     36// LayerTexture encapsulates a volatile texture - at any time, the underlying OpenGL
    3737// texture may be deleted by the TextureCacheCompositingThread. The user must
    38 // check using Texture::isDirty() immediately before using it, every time.
    39 // The only way to prevent eviction this is to call Texture::protect().
     38// check using LayerTexture::isDirty() immediately before using it, every time.
     39// The only way to prevent eviction this is to call LayerTexture::protect().
    4040// If the texture isDirty(), you must updateContents() before you can use it.
    41 class Texture : public RefCounted<Texture> {
     41class LayerTexture : public RefCounted<LayerTexture> {
    4242public:
    43     static PassRefPtr<Texture> create(bool isColor = false)
     43    static PassRefPtr<LayerTexture> create(bool isColor = false)
    4444    {
    45         return adoptRef(new Texture(isColor));
     45        return adoptRef(new LayerTexture(isColor));
    4646    }
    4747
    48     ~Texture();
     48    ~LayerTexture();
    4949
    5050    typedef BlackBerry::Platform::Graphics::Buffer* GpuHandle;
     
    7878    friend class TextureCacheCompositingThread;
    7979
    80     Texture(bool isColor = false);
     80    LayerTexture(bool isColor = false);
    8181    void setTextureId(GpuHandle id)
    8282    {
     
    104104#endif // USE(ACCELERATED_COMPOSITING)
    105105
    106 #endif // Texture_h
     106#endif // LayerTexture_h
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerTile.cpp

    r144465 r148129  
    4040}
    4141
    42 void LayerTile::setContents(const Texture::HostType& contents, const IntRect& tileRect, const TileIndex& index, bool isOpaque)
     42void LayerTile::setContents(const LayerTexture::HostType& contents, const IntRect& tileRect, const TileIndex& index, bool isOpaque)
    4343{
    4444    setTexture(textureCacheCompositingThread()->textureForTiledContents(contents, tileRect, index, isOpaque));
     
    5050}
    5151
    52 void LayerTile::updateContents(const Texture::HostType& contents, const IntRect& dirtyRect, const IntRect& tileRect, bool isOpaque)
     52void LayerTile::updateContents(const LayerTexture::HostType& contents, const IntRect& dirtyRect, const IntRect& tileRect, bool isOpaque)
    5353{
    5454    setTexture(textureCacheCompositingThread()->updateContents(m_texture, contents, dirtyRect, tileRect, isOpaque));
     
    7878}
    7979
    80 void LayerTile::setTexture(PassRefPtr<Texture> texture)
     80void LayerTile::setTexture(PassRefPtr<LayerTexture> texture)
    8181{
    8282    // Clear this flag regardless of the value of the texture parameter.
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerTile.h

    r144465 r148129  
    2222#if USE(ACCELERATED_COMPOSITING)
    2323
    24 #include "Texture.h"
     24#include "LayerTexture.h"
    2525
    2626#include <wtf/RefPtr.h>
     
    3838    ~LayerTile();
    3939
    40     Texture* texture() const { return m_texture.get(); }
     40    LayerTexture* texture() const { return m_texture.get(); }
    4141
    4242    bool isVisible() const { return m_visible; }
     
    4747    bool hasTexture() const { return m_texture && m_texture->hasTexture(); }
    4848
    49     void setContents(const Texture::HostType& contents, const IntRect& tileRect, const TileIndex&, bool isOpaque);
     49    void setContents(const LayerTexture::HostType& contents, const IntRect& tileRect, const TileIndex&, bool isOpaque);
    5050    void setContentsToColor(const Color&);
    51     void updateContents(const Texture::HostType& contents, const IntRect& dirtyRect, const IntRect& tileRect, bool isOpaque);
     51    void updateContents(const LayerTexture::HostType& contents, const IntRect& dirtyRect, const IntRect& tileRect, bool isOpaque);
    5252    void discardContents();
    5353
     
    6565
    6666private:
    67     void setTexture(PassRefPtr<Texture>);
     67    void setTexture(PassRefPtr<LayerTexture>);
    6868
    6969    // Never assign to m_texture directly, use setTexture() above.
    70     RefPtr<Texture> m_texture;
     70    RefPtr<LayerTexture> m_texture;
    7171    bool m_contentsDirty : 1;
    7272    bool m_visible : 1;
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerTiler.cpp

    r145193 r148129  
    230230                // FIXME: the zoom preview only works if we don't re-tile the
    231231                // layer. We need to store texture coordinates in
    232                 // WebCore::Texture to be able to fix that.
     232                // WebCore::LayerTexture to be able to fix that.
    233233                if (didResize && !(isZoomJob && wasOneTile && isOneTile))
    234234                    addTextureJob(TextureJob::discardContents(tileRect));
     
    493493    if (visible) {
    494494        if (tile->hasTexture()) {
    495             Texture* texture = tile->texture();
     495            LayerTexture* texture = tile->texture();
    496496            textureCacheCompositingThread()->textureAccessed(texture);
    497497
     
    672672}
    673673
    674 Texture* LayerTiler::contentsTexture(LayerCompositingThread*)
     674LayerTexture* LayerTiler::contentsTexture(LayerCompositingThread*)
    675675{
    676676    ASSERT(m_tiles.size() == 1);
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerTiler.h

    r144465 r148129  
    6868    virtual void layerVisibilityChanged(LayerCompositingThread*, bool visible);
    6969    virtual void uploadTexturesIfNeeded(LayerCompositingThread*);
    70     virtual Texture* contentsTexture(LayerCompositingThread*);
     70    virtual LayerTexture* contentsTexture(LayerCompositingThread*);
    7171    virtual void drawTextures(LayerCompositingThread*, double scale, const BlackBerry::Platform::Graphics::GLES2Program&);
    7272    virtual void deleteTextures(LayerCompositingThread*);
     
    102102        }
    103103
    104         TextureJob(Type type, const Texture::HostType& contents, const IntRect& dirtyRect, bool isOpaque)
     104        TextureJob(Type type, const LayerTexture::HostType& contents, const IntRect& dirtyRect, bool isOpaque)
    105105            : m_type(type)
    106106            , m_contents(contents)
     
    122122        }
    123123
    124         static TextureJob setContents(const Texture::HostType& contents, const IntRect& contentsRect, bool isOpaque)
     124        static TextureJob setContents(const LayerTexture::HostType& contents, const IntRect& contentsRect, bool isOpaque)
    125125        {
    126126            return TextureJob(SetContents, contents, contentsRect, isOpaque);
    127127        }
    128128        static TextureJob setContentsToColor(const Color& color, const TileIndex& index) { return TextureJob(SetContentsToColor, color, index); }
    129         static TextureJob updateContents(const Texture::HostType& contents, const IntRect& dirtyRect, bool isOpaque) { return TextureJob(UpdateContents, contents, dirtyRect, isOpaque); }
     129        static TextureJob updateContents(const LayerTexture::HostType& contents, const IntRect& dirtyRect, bool isOpaque) { return TextureJob(UpdateContents, contents, dirtyRect, isOpaque); }
    130130        static TextureJob discardContents(const IntRect& dirtyRect) { return TextureJob(DiscardContents, dirtyRect); }
    131131        static TextureJob resizeContents(const IntSize& newSize) { return TextureJob(ResizeContents, newSize); }
     
    135135
    136136        Type m_type;
    137         Texture::HostType m_contents;
     137        LayerTexture::HostType m_contents;
    138138        bool m_isOpaque;
    139139        IntRect m_dirtyRect;
  • trunk/Source/WebCore/platform/graphics/blackberry/TextureCacheCompositingThread.cpp

    r144465 r148129  
    3838class TextureProtector {
    3939public:
    40     TextureProtector(Texture* texture)
     40    TextureProtector(LayerTexture* texture)
    4141        : m_texture(texture)
    4242    {
     
    5050
    5151private:
    52     Texture* m_texture;
     52    LayerTexture* m_texture;
    5353};
    5454
     
    5959}
    6060
    61 Texture::GpuHandle TextureCacheCompositingThread::allocateTextureId(const IntSize& size, BlackBerry::Platform::Graphics::BufferType type)
     61LayerTexture::GpuHandle TextureCacheCompositingThread::allocateTextureId(const IntSize& size, BlackBerry::Platform::Graphics::BufferType type)
    6262{
    6363    return BlackBerry::Platform::Graphics::createBuffer(size, type);
    6464}
    6565
    66 static void freeTextureId(Texture::GpuHandle id)
     66static void freeTextureId(LayerTexture::GpuHandle id)
    6767{
    6868    BlackBerry::Platform::Graphics::destroyBuffer(id);
     
    7878}
    7979
    80 void TextureCacheCompositingThread::textureResized(Texture* texture, const IntSize& oldSize)
    81 {
    82     int delta = (texture->width() * texture->height() - oldSize.width() * oldSize.height()) * Texture::bytesPerPixel();
     80void TextureCacheCompositingThread::textureResized(LayerTexture* texture, const IntSize& oldSize)
     81{
     82    int delta = (texture->width() * texture->height() - oldSize.width() * oldSize.height()) * LayerTexture::bytesPerPixel();
    8383    incMemoryUsage(delta);
    8484    if (delta > 0)
     
    8686}
    8787
    88 void TextureCacheCompositingThread::textureSizeInBytesChanged(Texture*, int delta)
     88void TextureCacheCompositingThread::textureSizeInBytesChanged(LayerTexture*, int delta)
    8989{
    9090    incMemoryUsage(delta);
     
    9393}
    9494
    95 void TextureCacheCompositingThread::textureDestroyed(Texture* texture)
     95void TextureCacheCompositingThread::textureDestroyed(LayerTexture* texture)
    9696{
    9797    if (texture->isColor()) {
     
    105105}
    106106
    107 bool TextureCacheCompositingThread::install(Texture* texture, const IntSize& size, BlackBerry::Platform::Graphics::BufferType type)
     107bool TextureCacheCompositingThread::install(LayerTexture* texture, const IntSize& size, BlackBerry::Platform::Graphics::BufferType type)
    108108{
    109109    if (!texture)
     
    111111
    112112    if (!texture->hasTexture() && !size.isEmpty()) {
    113         Texture::GpuHandle textureId = allocateTextureId(size, type);
     113        LayerTexture::GpuHandle textureId = allocateTextureId(size, type);
    114114        if (!textureId)
    115115            return false;
     
    126126}
    127127
    128 bool TextureCacheCompositingThread::resizeTexture(Texture* texture, const IntSize& size, BlackBerry::Platform::Graphics::BufferType type)
     128bool TextureCacheCompositingThread::resizeTexture(LayerTexture* texture, const IntSize& size, BlackBerry::Platform::Graphics::BufferType type)
    129129{
    130130    IntSize oldSize = texture->size();
    131131
    132132    // Reallocate the buffer
    133     Texture::GpuHandle textureId = allocateTextureId(size, type);
     133    LayerTexture::GpuHandle textureId = allocateTextureId(size, type);
    134134    if (!textureId)
    135135        return false;
     
    147147        return;
    148148
    149     Texture* texture = *it;
     149    LayerTexture* texture = *it;
    150150    if (texture->hasTexture()) {
    151151        int delta = 0;
    152         delta += texture->width() * texture->height() * Texture::bytesPerPixel();
     152        delta += texture->width() * texture->height() * LayerTexture::bytesPerPixel();
    153153        delta += texture->sizeInBytes();
    154154        if (delta)
     
    160160}
    161161
    162 void TextureCacheCompositingThread::textureAccessed(Texture* texture)
     162void TextureCacheCompositingThread::textureAccessed(LayerTexture* texture)
    163163{
    164164    if (texture->isColor())
     
    184184        bool found = false;
    185185        for (TextureSet::iterator it = m_textures.begin(); it != m_textures.end(); ++it) {
    186             Texture* texture = *it;
     186            LayerTexture* texture = *it;
    187187            if (texture->isProtected() || (texture->size().isEmpty() && !texture->sizeInBytes()))
    188188                continue;
     
    210210}
    211211
    212 PassRefPtr<Texture> TextureCacheCompositingThread::textureForTiledContents(const Texture::HostType& contents, const IntRect& tileRect, const TileIndex& index, bool isOpaque)
    213 {
    214     RefPtr<Texture> texture = createTexture();
     212PassRefPtr<LayerTexture> TextureCacheCompositingThread::textureForTiledContents(const LayerTexture::HostType& contents, const IntRect& tileRect, const TileIndex& index, bool isOpaque)
     213{
     214    RefPtr<LayerTexture> texture = createTexture();
    215215
    216216    // Protect newly created texture from being evicted.
     
    222222}
    223223
    224 PassRefPtr<Texture> TextureCacheCompositingThread::textureForColor(const Color& color)
     224PassRefPtr<LayerTexture> TextureCacheCompositingThread::textureForColor(const Color& color)
    225225{
    226226    // Just to make sure we don't get fooled by some malicious web page
     
    230230
    231231    ColorTextureMap::iterator it = m_colors.find(color);
    232     RefPtr<Texture> texture;
     232    RefPtr<LayerTexture> texture;
    233233    if (it == m_colors.end()) {
    234         texture = Texture::create(true /* isColor */);
     234        texture = LayerTexture::create(true /* isColor */);
    235235#if DEBUG_TEXTURE_MEMORY_USAGE
    236236        fprintf(stderr, "Creating texture 0x%x for color 0x%x\n", texture.get(), color.rgb());
     
    248248}
    249249
    250 PassRefPtr<Texture> TextureCacheCompositingThread::updateContents(const RefPtr<Texture>& textureIn, const Texture::HostType& contents, const IntRect& dirtyRect, const IntRect& tileRect, bool isOpaque)
    251 {
    252     RefPtr<Texture> texture(textureIn);
     250PassRefPtr<LayerTexture> TextureCacheCompositingThread::updateContents(const RefPtr<LayerTexture>& textureIn, const LayerTexture::HostType& contents, const IntRect& dirtyRect, const IntRect& tileRect, bool isOpaque)
     251{
     252    RefPtr<LayerTexture> texture(textureIn);
    253253
    254254    // If the texture was 0, or needs to transition from a solid color texture to a contents texture,
  • trunk/Source/WebCore/platform/graphics/blackberry/TextureCacheCompositingThread.h

    r144465 r148129  
    2323
    2424#include "Color.h"
     25#include "LayerTexture.h"
    2526#include "LayerTileIndex.h"
    26 #include "Texture.h"
    2727
    2828#include <BlackBerryPlatformGraphics.h>
     
    4646
    4747    // Creates a new texture managed by this cache.
    48     PassRefPtr<Texture> createTexture()
     48    PassRefPtr<LayerTexture> createTexture()
    4949    {
    50         return Texture::create();
     50        return LayerTexture::create();
    5151    }
    5252
    5353    // Retrieve a texture from the cache.
    54     PassRefPtr<Texture> textureForTiledContents(const Texture::HostType& contents, const IntRect& tileRect, const TileIndex&, bool isOpaque);
    55     PassRefPtr<Texture> textureForColor(const Color&);
     54    PassRefPtr<LayerTexture> textureForTiledContents(const LayerTexture::HostType& contents, const IntRect& tileRect, const TileIndex&, bool isOpaque);
     55    PassRefPtr<LayerTexture> textureForColor(const Color&);
    5656
    5757    // Update contents of an existing texture, or create a new one if texture is 0.
    58     PassRefPtr<Texture> updateContents(const RefPtr<Texture>&, const Texture::HostType& contents, const IntRect& dirtyRect, const IntRect& tileRect, bool isOpaque);
     58    PassRefPtr<LayerTexture> updateContents(const RefPtr<LayerTexture>&, const LayerTexture::HostType& contents, const IntRect& dirtyRect, const IntRect& tileRect, bool isOpaque);
    5959
    6060    size_t memoryUsage() const { return m_memoryUsage; }
     
    7070
    7171    // Update the LRU list.
    72     void textureAccessed(Texture*);
     72    void textureAccessed(LayerTexture*);
    7373
    7474    // Deleting destroyed textures is provided as a separate method, because
     
    7777    void collectGarbage();
    7878
    79     void textureDestroyed(Texture*);
    80     void textureResized(Texture*, const IntSize& oldSize);
    81     void textureSizeInBytesChanged(Texture*, int delta);
     79    void textureDestroyed(LayerTexture*);
     80    void textureResized(LayerTexture*, const IntSize& oldSize);
     81    void textureSizeInBytesChanged(LayerTexture*, int delta);
    8282
    8383    // Undo the effects of eviction, if possible.
    84     bool install(Texture*, const IntSize& textureSize = IntSize(0, 0), BlackBerry::Platform::Graphics::BufferType = BlackBerry::Platform::Graphics::BackedWhenNecessary);
    85     bool resizeTexture(Texture*, const IntSize& newSize, BlackBerry::Platform::Graphics::BufferType = BlackBerry::Platform::Graphics::BackedWhenNecessary);
     84    bool install(LayerTexture*, const IntSize& textureSize = IntSize(0, 0), BlackBerry::Platform::Graphics::BufferType = BlackBerry::Platform::Graphics::BackedWhenNecessary);
     85    bool resizeTexture(LayerTexture*, const IntSize& newSize, BlackBerry::Platform::Graphics::BufferType = BlackBerry::Platform::Graphics::BackedWhenNecessary);
    8686
    8787private:
    8888    struct ZombieTexture {
    89         explicit ZombieTexture(Texture* texture)
     89        explicit ZombieTexture(LayerTexture* texture)
    9090            : id(texture->textureId())
    9191            , size(texture->size())
     
    9494        }
    9595
    96         Texture::GpuHandle id;
     96        LayerTexture::GpuHandle id;
    9797        IntSize size;
    9898        size_t sizeInBytes;
    9999    };
    100     typedef ListHashSet<Texture* > TextureSet;
    101     typedef HashMap<TileIndex, RefPtr<Texture> > TextureMap;
     100    typedef ListHashSet<LayerTexture* > TextureSet;
     101    typedef HashMap<TileIndex, RefPtr<LayerTexture> > TextureMap;
    102102    typedef Vector<ZombieTexture> Garbage;
    103103
     
    105105    ~TextureCacheCompositingThread();
    106106
    107     Texture::GpuHandle allocateTextureId(const IntSize& textureSize, BlackBerry::Platform::Graphics::BufferType);
     107    LayerTexture::GpuHandle allocateTextureId(const IntSize& textureSize, BlackBerry::Platform::Graphics::BufferType);
    108108
    109109    void incMemoryUsage(int delta) { setMemoryUsage(memoryUsage() + delta); }
     
    131131        static bool isDeletedValue(const Color& value) { return !value.isValid() && value.rgb() == Color::white; }
    132132    };
    133     typedef HashMap<Color, RefPtr<Texture>, ColorHash, ColorHashTraits> ColorTextureMap;
     133    typedef HashMap<Color, RefPtr<LayerTexture>, ColorHash, ColorHashTraits> ColorTextureMap;
    134134    ColorTextureMap m_colors;
    135135    Garbage m_garbage;
  • trunk/Source/WebKit/blackberry/Api/WebOverlay.cpp

    r147738 r148129  
    447447    }
    448448
    449     Texture::HostType textureContents = Texture::HostType();
     449    LayerTexture::HostType textureContents = LayerTexture::HostType();
    450450    IntSize textureSize;
    451451
     
    497497    }
    498498
    499     m_texture = Texture::create();
     499    m_texture = LayerTexture::create();
    500500    m_texture->protect(IntSize(), BlackBerry::Platform::Graphics::BackedWhenNecessary);
    501501    IntRect bitmapRect(0, 0, textureSize.width(), textureSize.height());
  • trunk/Source/WebKit/blackberry/Api/WebOverlay_p.h

    r147740 r148129  
    2424#include "GraphicsLayer.h"
    2525#include "LayerCompositingThread.h"
    26 #include "Texture.h"
     26#include "LayerTexture.h"
    2727#include "WebOverlay.h"
    2828#include "WebOverlayOverride.h"
     
    206206private:
    207207    bool m_drawsContent;
    208     RefPtr<WebCore::Texture> m_texture;
     208    RefPtr<WebCore::LayerTexture> m_texture;
    209209    BlackBerry::Platform::Graphics::TiledImage m_image;
    210210    BlackBerry::Platform::Graphics::TiledImage m_uploadedImage;
  • trunk/Source/WebKit/blackberry/ChangeLog

    r148123 r148129  
     12013-04-10  Arvid Nilsson  <anilsson@rim.com>
     2
     3        [BlackBerry] Rename BlackBerry specific Texture class
     4        https://bugs.webkit.org/show_bug.cgi?id=95781
     5
     6        Reviewed by Rob Buis.
     7
     8        Texture was a bit too generic and prone to name conflicts. Renamed it
     9        to LayerTexture.
     10
     11        PR 322882
     12
     13        * Api/WebOverlay.cpp:
     14        (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded):
     15        * Api/WebOverlay_p.h:
     16        (WebOverlayLayerCompositingThreadClient):
     17
    1182013-04-08  Anders Carlsson  <andersca@apple.com>
    219
Note: See TracChangeset for help on using the changeset viewer.