OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CCRenderer_h | 5 // Temporary forwarding header |
6 #define CCRenderer_h | 6 #include "cc/renderer.h" |
7 | |
8 #include "base/basictypes.h" | |
9 #include "CCLayerTreeHost.h" | |
10 #include "CCRenderPass.h" | |
11 #include "FloatQuad.h" | |
12 #include "IntRect.h" | |
13 #include <wtf/PassRefPtr.h> | |
14 | |
15 namespace cc { | |
16 | |
17 class CCScopedTexture; | |
18 | |
19 class CCRendererClient { | |
20 public: | |
21 virtual const IntSize& deviceViewportSize() const = 0; | |
22 virtual const CCLayerTreeSettings& settings() const = 0; | |
23 virtual void didLoseContext() = 0; | |
24 virtual void onSwapBuffersComplete() = 0; | |
25 virtual void releaseContentsTextures() = 0; | |
26 virtual void setFullRootLayerDamage() = 0; | |
27 virtual void setMemoryAllocationLimitBytes(size_t) = 0; | |
28 protected: | |
29 virtual ~CCRendererClient() { } | |
30 }; | |
31 | |
32 class CCRenderer { | |
33 public: | |
34 // This enum defines the various resource pools for the CCResourceProvider | |
35 // where textures get allocated. | |
36 enum ResourcePool { | |
37 ImplPool = 1, // This pool is for textures that get allocated on the impl
thread (e.g. RenderSurfaces). | |
38 ContentPool // This pool is for textures that get allocated on the main th
read (e.g. tiles). | |
39 }; | |
40 | |
41 virtual ~CCRenderer() { } | |
42 | |
43 virtual const RendererCapabilities& capabilities() const = 0; | |
44 | |
45 const CCLayerTreeSettings& settings() const { return m_client->settings(); } | |
46 | |
47 const IntSize& viewportSize() { return m_client->deviceViewportSize(); } | |
48 int viewportWidth() { return viewportSize().width(); } | |
49 int viewportHeight() { return viewportSize().height(); } | |
50 | |
51 virtual void viewportChanged() { } | |
52 | |
53 virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) {
} | |
54 virtual bool haveCachedResourcesForRenderPassId(CCRenderPass::Id) const; | |
55 | |
56 virtual void drawFrame(const CCRenderPassList&, const CCRenderPassIdHashMap&
) = 0; | |
57 | |
58 // waits for rendering to finish | |
59 virtual void finish() = 0; | |
60 | |
61 virtual void doNoOp() { } | |
62 // puts backbuffer onscreen | |
63 virtual bool swapBuffers() = 0; | |
64 | |
65 virtual void getFramebufferPixels(void *pixels, const IntRect&) = 0; | |
66 | |
67 virtual bool isContextLost(); | |
68 | |
69 virtual void setVisible(bool) = 0; | |
70 | |
71 protected: | |
72 explicit CCRenderer(CCRendererClient* client) | |
73 : m_client(client) | |
74 { | |
75 } | |
76 | |
77 CCRendererClient* m_client; | |
78 | |
79 DISALLOW_COPY_AND_ASSIGN(CCRenderer); | |
80 }; | |
81 | |
82 } | |
83 | |
84 #endif // CCRenderer_h | |
OLD | NEW |