blob: 8af18b5799a7f2e73eae5ec138d7fbb1d3c60c36 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_SURFACES_DISPLAY_H_
#define CC_SURFACES_DISPLAY_H_
#include "base/memory/scoped_ptr.h"
#include "cc/output/output_surface_client.h"
#include "cc/output/renderer.h"
#include "cc/resources/returned_resource.h"
#include "cc/surfaces/surface_aggregator.h"
#include "cc/surfaces/surface_id.h"
#include "cc/surfaces/surface_manager.h"
#include "cc/surfaces/surfaces_export.h"
namespace gfx {
class Size;
}
namespace cc {
class DirectRenderer;
class DisplayClient;
class OutputSurface;
class ResourceProvider;
class SharedBitmapManager;
class Surface;
class SurfaceAggregator;
class SurfaceIdAllocator;
class SurfaceFactory;
// A Display produces a surface that can be used to draw to a physical display
// (OutputSurface). The client is responsible for creating and sizing the
// surface IDs used to draw into the display and deciding when to draw.
class CC_SURFACES_EXPORT Display : public OutputSurfaceClient,
public RendererClient,
public SurfaceDamageObserver {
public:
Display(DisplayClient* client,
SurfaceManager* manager,
SharedBitmapManager* bitmap_manager);
virtual ~Display();
void Resize(SurfaceId id, const gfx::Size& new_size);
bool Draw();
SurfaceId CurrentSurfaceId();
// OutputSurfaceClient implementation.
virtual void DeferredInitialize() OVERRIDE {}
virtual void ReleaseGL() OVERRIDE {}
virtual void CommitVSyncParameters(base::TimeTicks timebase,
base::TimeDelta interval) OVERRIDE {}
virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) OVERRIDE {}
virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE {}
virtual void DidSwapBuffers() OVERRIDE {}
virtual void DidSwapBuffersComplete() OVERRIDE {}
virtual void ReclaimResources(const CompositorFrameAck* ack) OVERRIDE {}
virtual void DidLoseOutputSurface() OVERRIDE {}
virtual void SetExternalDrawConstraints(
const gfx::Transform& transform,
const gfx::Rect& viewport,
const gfx::Rect& clip,
const gfx::Rect& viewport_rect_for_tile_priority,
const gfx::Transform& transform_for_tile_priority,
bool resourceless_software_draw) OVERRIDE {}
virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE {}
virtual void SetTreeActivationCallback(
const base::Closure& callback) OVERRIDE {}
// RendererClient implementation.
virtual void SetFullRootLayerDamage() OVERRIDE {}
virtual void RunOnDemandRasterTask(Task* on_demand_raster_task) OVERRIDE {}
// SurfaceDamageObserver implementation.
virtual void OnSurfaceDamaged(SurfaceId surface) OVERRIDE;
private:
void InitializeOutputSurface();
DisplayClient* client_;
SurfaceManager* manager_;
SharedBitmapManager* bitmap_manager_;
SurfaceId current_surface_id_;
gfx::Size current_surface_size_;
LayerTreeSettings settings_;
scoped_ptr<OutputSurface> output_surface_;
scoped_ptr<ResourceProvider> resource_provider_;
scoped_ptr<SurfaceAggregator> aggregator_;
scoped_ptr<DirectRenderer> renderer_;
std::set<SurfaceId> contained_surfaces_;
DISALLOW_COPY_AND_ASSIGN(Display);
};
} // namespace cc
#endif // CC_SURFACES_DISPLAY_H_
|