LayerWebKitThread.h [plain text]
#ifndef LayerWebKitThread_h
#define LayerWebKitThread_h
#if USE(ACCELERATED_COMPOSITING)
#include "GraphicsLayerBlackBerry.h"
#include "LayerData.h"
#include "LayerTiler.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
class SkBitmap;
namespace WebCore {
class LayerCompositingThread;
class LayerWebKitThread : public RefCounted<LayerWebKitThread>, public LayerData {
public:
static PassRefPtr<LayerWebKitThread> create(LayerType, GraphicsLayerBlackBerry* owner = 0);
virtual ~LayerWebKitThread();
void addSublayer(PassRefPtr<LayerWebKitThread>);
void insertSublayer(PassRefPtr<LayerWebKitThread>, size_t index);
void replaceSublayer(LayerWebKitThread* reference, PassRefPtr<LayerWebKitThread> newLayer);
void removeFromSuperlayer();
void setAnchorPoint(const FloatPoint& anchorPoint) { m_anchorPoint = anchorPoint; setNeedsCommit(); }
void setAnchorPointZ(float anchorPointZ) { m_anchorPointZ = anchorPointZ; setNeedsCommit(); }
void setBackgroundColor(const Color& color) { m_backgroundColor = color; setNeedsCommit(); }
void setBorderColor(const Color& color) { m_borderColor = color; setNeedsCommit(); }
void setBorderWidth(float width) { m_borderWidth = width; setNeedsCommit(); }
void setBounds(const IntSize&);
void setDoubleSided(bool doubleSided) { m_doubleSided = doubleSided; setNeedsCommit(); }
void setFrame(const FloatRect&);
void setMasksToBounds(bool masksToBounds) { m_masksToBounds = masksToBounds; }
void setMaskLayer(LayerWebKitThread* maskLayer) { m_maskLayer = maskLayer; }
LayerWebKitThread* maskLayer() const { return m_maskLayer.get(); }
void setIsMask(bool);
void setReplicaLayer(LayerWebKitThread* layer) { m_replicaLayer = layer; }
LayerWebKitThread* replicaLayer() { return m_replicaLayer.get(); }
void setNeedsDisplayInRect(const FloatRect& dirtyRect);
virtual void setNeedsDisplay();
void setNeedsDisplayOnBoundsChange(bool needsDisplay) { m_needsDisplayOnBoundsChange = needsDisplay; }
void setOpacity(float opacity) { m_opacity = opacity; setNeedsCommit(); }
void setOpaque(bool isOpaque) { m_isOpaque = isOpaque; setNeedsCommit(); }
void setPosition(const FloatPoint& position) { m_position = position; setNeedsCommit(); }
const LayerWebKitThread* rootLayer() const;
void removeAllSublayers();
void setSublayers(const Vector<RefPtr<LayerWebKitThread> >&);
const Vector<RefPtr<LayerWebKitThread> >& getSublayers() const { return m_sublayers; }
void setSublayerTransform(const TransformationMatrix& transform) { m_sublayerTransform = transform; setNeedsCommit(); }
LayerWebKitThread* superlayer() const { return m_superlayer; }
void setTransform(const TransformationMatrix& transform) { m_transform = transform; setNeedsCommit(); }
void setPreserves3D(bool preserves3D) { m_preserves3D = preserves3D; setNeedsCommit(); }
void setFixedPosition(bool fixed) { m_isFixedPosition = fixed; setNeedsCommit(); }
void setHasFixedContainer(bool fixed) { m_hasFixedContainer = fixed; setNeedsCommit(); }
void setHasFixedAncestorInDOMTree(bool fixed) { m_hasFixedAncestorInDOMTree = fixed; setNeedsCommit(); }
void setContents(Image*);
Image* contents() const { return m_contents.get(); }
void setOwner(GraphicsLayerBlackBerry* owner) { m_owner = owner; }
bool drawsContent() const { return m_owner && m_owner->drawsContent(); }
void setDrawable(bool);
void commitOnWebKitThread(double scale);
void commitOnCompositingThread();
LayerCompositingThread* layerCompositingThread() const { return m_layerCompositingThread.get(); }
void setAbsoluteOffset(const FloatSize& offset) { m_absoluteOffset = offset; }
double contentsScale() const { return m_scale; }
SkBitmap paintContents(const IntRect& transformedContentsRect, double scale, bool* isSolidColor = 0, Color* = 0);
bool contentsVisible(const IntRect& contentsRect) const;
void setNeedsCommit();
void notifyAnimationStarted(double time);
void setRunningAnimations(const Vector<RefPtr<LayerAnimation> >& animations) { m_runningAnimations = animations; setNeedsCommit(); }
void setSuspendedAnimations(const Vector<RefPtr<LayerAnimation> >& animations) { m_suspendedAnimations = animations; setNeedsCommit(); }
protected:
LayerWebKitThread(LayerType, GraphicsLayerBlackBerry* owner);
void setNeedsTexture(bool needsTexture) { m_needsTexture = needsTexture; }
void setLayerProgramShader(LayerData::LayerProgramShader shader) { m_layerProgramShader = shader; }
void createFrontBufferLock();
bool isDrawable() const { return m_isDrawable; }
void startAnimations(double time);
void updateVisibility();
void updateTextureContents(double scale);
virtual void boundsChanged() { }
virtual void updateTextureContentsIfNeeded();
private:
void updateLayerHierarchy();
void setSuperlayer(LayerWebKitThread* superlayer) { m_superlayer = superlayer; }
size_t numSublayers() const
{
return m_sublayers.size();
}
int indexOfSublayer(const LayerWebKitThread*);
void removeSublayer(LayerWebKitThread*);
GraphicsLayerBlackBerry* m_owner;
Vector<RefPtr<LayerWebKitThread> > m_sublayers;
LayerWebKitThread* m_superlayer;
RefPtr<LayerWebKitThread> m_maskLayer;
RefPtr<LayerWebKitThread> m_replicaLayer;
RefPtr<Image> m_contents;
RefPtr<LayerCompositingThread> m_layerCompositingThread;
RefPtr<LayerTiler> m_tiler;
FloatSize m_absoluteOffset;
double m_scale; bool m_isDrawable;
bool m_isMask;
};
}
#endif // USE(ACCELERATED_COMPOSITING)
#endif