diff options
author | Nicolas Roard <nicolasroard@google.com> | 2011-06-21 16:21:55 -0700 |
---|---|---|
committer | Nicolas Roard <nicolasroard@google.com> | 2011-07-14 18:16:39 -0700 |
commit | 3c131605fca8e29a88fdc4923d86bdc3f40adb2b (patch) | |
tree | 440bd04fb01b43ed995348f579e70d668fe52a85 /Source/WebCore/platform/graphics/android/LayerAndroid.h | |
parent | 5dcd286d3e3e60f6a090f775a1fdceb40f578b75 (diff) | |
download | external_webkit-3c131605fca8e29a88fdc4923d86bdc3f40adb2b.zip external_webkit-3c131605fca8e29a88fdc4923d86bdc3f40adb2b.tar.gz external_webkit-3c131605fca8e29a88fdc4923d86bdc3f40adb2b.tar.bz2 |
Implements tiled layers. We remove all the existing code in LayerAndroid
related to the old texture management and introduce two new classes:
- PaintedSurface, used as a placeholder ui-side for the regularly
changing LayerAndroid
- TiledTexture, implementing the tiling of PaintedSurface using a set
of BaseTile
bug:4580444 bug:3392331
Change-Id: I0daa079d2acce49f3baa8c312ea0b0dd457ccd5c
Diffstat (limited to 'Source/WebCore/platform/graphics/android/LayerAndroid.h')
-rw-r--r-- | Source/WebCore/platform/graphics/android/LayerAndroid.h | 58 |
1 files changed, 18 insertions, 40 deletions
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.h b/Source/WebCore/platform/graphics/android/LayerAndroid.h index bd6c0ef..15c7e0f 100644 --- a/Source/WebCore/platform/graphics/android/LayerAndroid.h +++ b/Source/WebCore/platform/graphics/android/LayerAndroid.h @@ -24,9 +24,10 @@ #include "FloatRect.h" #include "GraphicsLayerClient.h" #include "Layer.h" -#include "LayerTexture.h" #include "RefPtr.h" +#include "SkBitmap.h" #include "SkColor.h" +#include "SkStream.h" #include "TextureOwner.h" #include "TransformationMatrix.h" @@ -45,10 +46,14 @@ class SkCanvas; class SkMatrix; class SkPicture; +namespace WebCore { +class LayerAndroid; +} + namespace android { class DrawExtra; -void serializeLayer(LayerAndroid* layer, SkWStream* stream); -LayerAndroid* deserializeLayer(SkStream* stream); +void serializeLayer(WebCore::LayerAndroid* layer, SkWStream* stream); +WebCore::LayerAndroid* deserializeLayer(SkStream* stream); } using namespace android; @@ -88,19 +93,15 @@ class BaseTileTexture; class LayerAndroidFindState; class RenderLayer; class TiledPage; +class PaintedSurface; -class LayerAndroid : public Layer, public TextureOwner { - +class LayerAndroid : public Layer { public: LayerAndroid(RenderLayer* owner); LayerAndroid(const LayerAndroid& layer); LayerAndroid(SkPicture*); virtual ~LayerAndroid(); - // TextureOwner methods - virtual bool removeTexture(BaseTileTexture* texture); - - LayerTexture* texture() { return m_reservedTexture; } virtual TiledPage* page() { return 0; } virtual GLWebViewState* state() { return 0; } @@ -111,33 +112,16 @@ public: IntRect clippedRect() const; bool outsideViewport(); - // Debug/info functions - int countTextureSize(); - int nbLayers(); - void showLayers(int indent = 0); - - // Texture size functions - void computeTextureSize(double time); - void collect(Vector<LayerAndroid*>& layers, - int& size); - int clippedTextureSize() const; - int fullTextureSize() const; - - // called on the root layer - void reserveGLTextures(); - void createGLTextures(); - virtual bool needsTexture(); - bool needsScheduleRepaint(LayerTexture* texture); void setScale(float scale); float getScale() { return m_scale; } virtual bool drawGL(GLWebViewState*, SkMatrix&); bool drawChildrenGL(GLWebViewState*, SkMatrix&); - virtual void paintBitmapGL(); void updateGLPositions(const TransformationMatrix& parentMatrix, const FloatRect& clip, float opacity); void setDrawOpacity(float opacity) { m_drawOpacity = opacity; } + float drawOpacity() { return m_drawOpacity; } void setVisible(bool value) { m_visible = value; } bool preserves3D() { return m_preserves3D; } @@ -145,7 +129,7 @@ public: void setAnchorPointZ(float z) { m_anchorPointZ = z; } float anchorPointZ() { return m_anchorPointZ; } void setDrawTransform(const TransformationMatrix& transform) { m_drawTransform = transform; } - const TransformationMatrix& drawTransform() const { return m_drawTransform; } + const TransformationMatrix* drawTransform() const { return &m_drawTransform; } void setChildrenTransform(const TransformationMatrix& t) { m_childrenTransform = t; } void setDrawClip(const FloatRect& rect) { m_clippingRect = rect; } const FloatRect& drawClip() { return m_clippingRect; } @@ -262,9 +246,14 @@ public: friend void android::serializeLayer(LayerAndroid* layer, SkWStream* stream); friend LayerAndroid* android::deserializeLayer(SkStream* stream); + PaintedSurface* texture() { return m_texture; } + void assignTexture(LayerAndroid* oldTree); + protected: virtual void onDraw(SkCanvas*, SkScalar opacity); + TransformationMatrix m_drawTransform; + private: class FindState; #if DUMP_NAV_CACHE @@ -331,23 +320,12 @@ private: float m_zValue; - TransformationMatrix m_drawTransform; FloatRect m_clippingRect; SkPicture* m_extra; int m_uniqueId; - // We have two textures pointers -- one if the texture we are currently - // using to draw (m_drawingTexture), the other one is the one we get - // from trying to reserve a texture from the TilesManager. Usually, they - // are identical, but in some cases they are not (different scaling - // resulting in the need for different geometry, at initilisation, and - // if the texture asked does not fit in memory) - LayerTexture* m_drawingTexture; - LayerTexture* m_reservedTexture; - - // rect used to query TilesManager for the right texture - IntRect m_layerTextureRect; + PaintedSurface* m_texture; // used to signal that the tile is out-of-date and needs to be redrawn bool m_dirty; |