1 // Copyright 2014 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_SURFACES_DISPLAY_H_
6 #define CC_SURFACES_DISPLAY_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/output/output_surface_client.h"
10 #include "cc/output/renderer.h"
11 #include "cc/resources/returned_resource.h"
12 #include "cc/surfaces/surface_aggregator.h"
13 #include "cc/surfaces/surface_id.h"
14 #include "cc/surfaces/surface_manager.h"
15 #include "cc/surfaces/surfaces_export.h"
23 class BlockingTaskRunner
;
27 class ResourceProvider
;
28 class SharedBitmapManager
;
30 class SurfaceAggregator
;
31 class SurfaceIdAllocator
;
34 // A Display produces a surface that can be used to draw to a physical display
35 // (OutputSurface). The client is responsible for creating and sizing the
36 // surface IDs used to draw into the display and deciding when to draw.
37 class CC_SURFACES_EXPORT Display
: public OutputSurfaceClient
,
38 public RendererClient
,
39 public SurfaceDamageObserver
{
41 Display(DisplayClient
* client
,
42 SurfaceManager
* manager
,
43 SharedBitmapManager
* bitmap_manager
);
46 void Resize(SurfaceId id
, const gfx::Size
& new_size
);
49 SurfaceId
CurrentSurfaceId();
51 // OutputSurfaceClient implementation.
52 virtual void DeferredInitialize() OVERRIDE
{}
53 virtual void ReleaseGL() OVERRIDE
{}
54 virtual void CommitVSyncParameters(base::TimeTicks timebase
,
55 base::TimeDelta interval
) OVERRIDE
{}
56 virtual void SetNeedsRedrawRect(const gfx::Rect
& damage_rect
) OVERRIDE
{}
57 virtual void BeginFrame(const BeginFrameArgs
& args
) OVERRIDE
{}
58 virtual void DidSwapBuffers() OVERRIDE
{}
59 virtual void DidSwapBuffersComplete() OVERRIDE
{}
60 virtual void ReclaimResources(const CompositorFrameAck
* ack
) OVERRIDE
{}
61 virtual void DidLoseOutputSurface() OVERRIDE
{}
62 virtual void SetExternalDrawConstraints(
63 const gfx::Transform
& transform
,
64 const gfx::Rect
& viewport
,
65 const gfx::Rect
& clip
,
66 const gfx::Rect
& viewport_rect_for_tile_priority
,
67 const gfx::Transform
& transform_for_tile_priority
,
68 bool resourceless_software_draw
) OVERRIDE
{}
69 virtual void SetMemoryPolicy(const ManagedMemoryPolicy
& policy
) OVERRIDE
{}
70 virtual void SetTreeActivationCallback(
71 const base::Closure
& callback
) OVERRIDE
{}
73 // RendererClient implementation.
74 virtual void SetFullRootLayerDamage() OVERRIDE
{}
76 // SurfaceDamageObserver implementation.
77 virtual void OnSurfaceDamaged(SurfaceId surface
) OVERRIDE
;
80 void InitializeOutputSurface();
82 DisplayClient
* client_
;
83 SurfaceManager
* manager_
;
84 SharedBitmapManager
* bitmap_manager_
;
85 SurfaceId current_surface_id_
;
86 gfx::Size current_surface_size_
;
87 LayerTreeSettings settings_
;
88 scoped_ptr
<OutputSurface
> output_surface_
;
89 scoped_ptr
<ResourceProvider
> resource_provider_
;
90 scoped_ptr
<SurfaceAggregator
> aggregator_
;
91 scoped_ptr
<DirectRenderer
> renderer_
;
92 scoped_ptr
<BlockingTaskRunner
> blocking_main_thread_task_runner_
;
94 DISALLOW_COPY_AND_ASSIGN(Display
);
99 #endif // CC_SURFACES_DISPLAY_H_