| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_RENDERER_H_ | |
| 6 #define CC_RENDERER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "cc/base/cc_export.h" | |
| 10 #include "cc/layer_tree_host.h" | |
| 11 #include "cc/managed_memory_policy.h" | |
| 12 #include "cc/render_pass.h" | |
| 13 | |
| 14 namespace cc { | |
| 15 | |
| 16 class CompositorFrameAck; | |
| 17 class CompositorFrameMetadata; | |
| 18 class ScopedResource; | |
| 19 | |
| 20 class CC_EXPORT RendererClient { | |
| 21 public: | |
| 22 virtual gfx::Size DeviceViewportSize() const = 0; | |
| 23 virtual const LayerTreeSettings& Settings() const = 0; | |
| 24 virtual void DidLoseOutputSurface() = 0; | |
| 25 virtual void OnSwapBuffersComplete() = 0; | |
| 26 virtual void SetFullRootLayerDamage() = 0; | |
| 27 virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy) = 0; | |
| 28 virtual void EnforceManagedMemoryPolicy( | |
| 29 const ManagedMemoryPolicy& policy) = 0; | |
| 30 virtual bool HasImplThread() const = 0; | |
| 31 virtual bool ShouldClearRootRenderPass() const = 0; | |
| 32 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const = 0; | |
| 33 | |
| 34 protected: | |
| 35 virtual ~RendererClient() {} | |
| 36 }; | |
| 37 | |
| 38 class CC_EXPORT Renderer { | |
| 39 public: | |
| 40 virtual ~Renderer() {} | |
| 41 | |
| 42 virtual const RendererCapabilities& Capabilities() const = 0; | |
| 43 | |
| 44 const LayerTreeSettings& Settings() const { return client_->Settings(); } | |
| 45 | |
| 46 gfx::Size ViewportSize() const { return client_->DeviceViewportSize(); } | |
| 47 int ViewportWidth() const { return ViewportSize().width(); } | |
| 48 int ViewportHeight() const { return ViewportSize().height(); } | |
| 49 | |
| 50 virtual void ViewportChanged() {} | |
| 51 virtual void ReceiveCompositorFrameAck(const CompositorFrameAck& ack) {} | |
| 52 | |
| 53 virtual void DecideRenderPassAllocationsForFrame( | |
| 54 const RenderPassList& render_passes_in_draw_order) {} | |
| 55 virtual bool HaveCachedResourcesForRenderPassId(RenderPass::Id id) const; | |
| 56 | |
| 57 // This passes ownership of the render passes to the renderer. It should | |
| 58 // consume them, and empty the list. | |
| 59 virtual void DrawFrame(RenderPassList& render_passes_in_draw_order) = 0; | |
| 60 | |
| 61 // Waits for rendering to finish. | |
| 62 virtual void Finish() = 0; | |
| 63 | |
| 64 virtual void DoNoOp() {} | |
| 65 | |
| 66 // Puts backbuffer onscreen. | |
| 67 virtual bool SwapBuffers() = 0; | |
| 68 | |
| 69 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) = 0; | |
| 70 | |
| 71 virtual bool IsContextLost(); | |
| 72 | |
| 73 virtual void SetVisible(bool visible) = 0; | |
| 74 | |
| 75 virtual void SendManagedMemoryStats(size_t bytes_visible, | |
| 76 size_t bytes_visible_and_nearby, | |
| 77 size_t bytes_allocated) = 0; | |
| 78 | |
| 79 protected: | |
| 80 explicit Renderer(RendererClient* client) | |
| 81 : client_(client) {} | |
| 82 | |
| 83 RendererClient* client_; | |
| 84 | |
| 85 DISALLOW_COPY_AND_ASSIGN(Renderer); | |
| 86 }; | |
| 87 | |
| 88 } | |
| 89 | |
| 90 #endif // CC_RENDERER_H_ | |
| OLD | NEW |