Move a MediaCodecBridge log
[chromium-blink-merge.git] / cc / output / renderer.h
blob8143e2a04108842aabe2fa9a544ee5a750e943b1
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.
5 #ifndef CC_OUTPUT_RENDERER_H_
6 #define CC_OUTPUT_RENDERER_H_
8 #include "base/basictypes.h"
9 #include "cc/base/cc_export.h"
10 #include "cc/base/scoped_ptr_vector.h"
11 #include "cc/output/renderer_capabilities.h"
12 #include "cc/output/renderer_settings.h"
13 #include "ui/gfx/geometry/rect.h"
15 namespace cc {
17 class CompositorFrameAck;
18 class CompositorFrameMetadata;
19 class RenderPass;
20 class RenderPassId;
21 class ScopedResource;
22 class Task;
24 typedef ScopedPtrVector<RenderPass> RenderPassList;
26 struct RendererCapabilitiesImpl {
27 RendererCapabilitiesImpl();
28 ~RendererCapabilitiesImpl();
30 // Capabilities copied to main thread.
31 ResourceFormat best_texture_format;
32 bool allow_partial_texture_updates;
33 int max_texture_size;
34 bool using_shared_memory_resources;
36 // Capabilities used on compositor thread only.
37 bool using_partial_swap;
38 bool using_egl_image;
39 bool using_image;
40 bool using_discard_framebuffer;
41 bool allow_rasterize_on_demand;
42 int max_msaa_samples;
44 RendererCapabilities MainThreadCapabilities() const;
47 class CC_EXPORT RendererClient {
48 public:
49 virtual void SetFullRootLayerDamage() = 0;
52 class CC_EXPORT Renderer {
53 public:
54 virtual ~Renderer() {}
56 virtual const RendererCapabilitiesImpl& Capabilities() const = 0;
58 virtual void DecideRenderPassAllocationsForFrame(
59 const RenderPassList& render_passes_in_draw_order) {}
60 virtual bool HasAllocatedResourcesForTesting(RenderPassId id) const;
62 // This passes ownership of the render passes to the renderer. It should
63 // consume them, and empty the list. The parameters here may change from frame
64 // to frame and should not be cached.
65 // The |device_viewport_rect| and |device_clip_rect| are in non-y-flipped
66 // window space.
67 virtual void DrawFrame(RenderPassList* render_passes_in_draw_order,
68 float device_scale_factor,
69 const gfx::Rect& device_viewport_rect,
70 const gfx::Rect& device_clip_rect,
71 bool disable_picture_quad_image_filtering) = 0;
73 // Waits for rendering to finish.
74 virtual void Finish() = 0;
76 virtual void DoNoOp() {}
78 // Puts backbuffer onscreen.
79 virtual void SwapBuffers(const CompositorFrameMetadata& metadata) = 0;
80 virtual void ReceiveSwapBuffersAck(const CompositorFrameAck& ack) {}
82 bool visible() const { return visible_; }
83 void SetVisible(bool visible);
85 protected:
86 Renderer(RendererClient* client, const RendererSettings* settings)
87 : client_(client), settings_(settings), visible_(true) {}
89 virtual void DidChangeVisibility() = 0;
91 RendererClient* client_;
92 const RendererSettings* settings_;
93 bool visible_;
95 private:
96 DISALLOW_COPY_AND_ASSIGN(Renderer);
99 } // namespace cc
101 #endif // CC_OUTPUT_RENDERER_H_