WebKit merge 128969:128981
[chromium-blink-merge.git] / cc / ContentLayerChromium.h
blob2e824d4217dc1d3ff41efed251416504e435ee87
1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 #ifndef ContentLayerChromium_h
7 #define ContentLayerChromium_h
9 #if USE(ACCELERATED_COMPOSITING)
11 #include "LayerPainterChromium.h"
12 #include "TiledLayerChromium.h"
14 class SkCanvas;
16 namespace cc {
18 class ContentLayerChromiumClient;
19 class FloatRect;
20 class IntRect;
21 class LayerTextureUpdater;
23 class ContentLayerPainter : public LayerPainterChromium {
24 WTF_MAKE_NONCOPYABLE(ContentLayerPainter);
25 public:
26 static PassOwnPtr<ContentLayerPainter> create(ContentLayerChromiumClient*);
28 virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect& opaque) OVERRIDE;
30 private:
31 explicit ContentLayerPainter(ContentLayerChromiumClient*);
33 ContentLayerChromiumClient* m_client;
36 // A layer that renders its contents into an SkCanvas.
37 class ContentLayerChromium : public TiledLayerChromium {
38 public:
39 static PassRefPtr<ContentLayerChromium> create(ContentLayerChromiumClient*);
41 virtual ~ContentLayerChromium();
43 void clearClient() { m_client = 0; }
45 virtual bool drawsContent() const OVERRIDE;
46 virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
47 virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
48 virtual bool needMoreUpdates() OVERRIDE;
50 virtual void setOpaque(bool) OVERRIDE;
52 protected:
53 explicit ContentLayerChromium(ContentLayerChromiumClient*);
56 private:
57 virtual LayerTextureUpdater* textureUpdater() const OVERRIDE { return m_textureUpdater.get(); }
58 virtual void createTextureUpdaterIfNeeded() OVERRIDE;
60 ContentLayerChromiumClient* m_client;
61 RefPtr<LayerTextureUpdater> m_textureUpdater;
65 #endif // USE(ACCELERATED_COMPOSITING)
67 #endif