blob: e331a7798abe3c0c868d222a911bfb39fb85f708 [file] [log] [blame]
[email protected]c1ae82942014-01-17 23:17:041// 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.
4
5#ifndef CC_LAYERS_SURFACE_LAYER_IMPL_H_
6#define CC_LAYERS_SURFACE_LAYER_IMPL_H_
7
danakj60bc3bc2016-04-09 00:24:488#include <memory>
9
avi02a4d172015-12-21 06:14:3610#include "base/macros.h"
danakj60bc3bc2016-04-09 00:24:4811#include "base/memory/ptr_util.h"
chrishtrac41ff92017-03-17 05:07:3012#include "cc/cc_export.h"
[email protected]c1ae82942014-01-17 23:17:0413#include "cc/layers/layer_impl.h"
fsamuel1d3252c2017-02-15 20:56:3714#include "cc/quads/surface_draw_quad.h"
samans72b2a282016-12-17 02:44:1515#include "cc/surfaces/surface_info.h"
Fady Samuel644df1d2017-07-13 01:13:0216#include "components/viz/common/surfaces/surface_id.h"
[email protected]c1ae82942014-01-17 23:17:0417
18namespace cc {
19
20class CC_EXPORT SurfaceLayerImpl : public LayerImpl {
21 public:
danakj60bc3bc2016-04-09 00:24:4822 static std::unique_ptr<SurfaceLayerImpl> Create(LayerTreeImpl* tree_impl,
23 int id) {
24 return base::WrapUnique(new SurfaceLayerImpl(tree_impl, id));
[email protected]c1ae82942014-01-17 23:17:0425 }
dcheng716bedf2014-10-21 09:51:0826 ~SurfaceLayerImpl() override;
[email protected]c1ae82942014-01-17 23:17:0427
fsamuel1d3252c2017-02-15 20:56:3728 void SetPrimarySurfaceInfo(const SurfaceInfo& surface_info);
29 const SurfaceInfo& primary_surface_info() const {
30 return primary_surface_info_;
31 }
32
fsamuel3ca78632017-05-04 21:48:5333 // A fallback Surface is a Surface that is already known to exist in the
34 // display compositor. If surface synchronization is enabled, the display
35 // compositor will use the fallback if the primary surface is unavailable
36 // at the time of surface aggregation. If surface synchronization is not
37 // enabled, then a fallback surface will not be specified.
fsamuel1d3252c2017-02-15 20:56:3738 void SetFallbackSurfaceInfo(const SurfaceInfo& surface_info);
39 const SurfaceInfo& fallback_surface_info() const {
40 return fallback_surface_info_;
41 }
42
xlai5e87e712016-12-16 02:10:2543 void SetStretchContentToFillBounds(bool stretch_content);
[email protected]c1ae82942014-01-17 23:17:0444
45 // LayerImpl overrides.
danakj60bc3bc2016-04-09 00:24:4846 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
dcheng716bedf2014-10-21 09:51:0847 void PushPropertiesTo(LayerImpl* layer) override;
48 void AppendQuads(RenderPass* render_pass,
dcheng716bedf2014-10-21 09:51:0849 AppendQuadsData* append_quads_data) override;
[email protected]c1ae82942014-01-17 23:17:0450
51 protected:
52 SurfaceLayerImpl(LayerTreeImpl* tree_impl, int id);
53
54 private:
fsamuel1d3252c2017-02-15 20:56:3755 SurfaceDrawQuad* CreateSurfaceDrawQuad(
56 RenderPass* render_pass,
57 SurfaceDrawQuadType surface_draw_quad_type,
fsamuela4f81d1f2017-04-07 18:32:3858 const SurfaceInfo& surface_info,
fsamuel9499e182017-05-04 15:12:2959 SharedQuadState** common_shared_quad_state);
fsamuel1d3252c2017-02-15 20:56:3760
dcheng716bedf2014-10-21 09:51:0861 void GetDebugBorderProperties(SkColor* color, float* width) const override;
danakjddf41262015-08-26 01:09:0762 void AppendRainbowDebugBorder(RenderPass* render_pass);
ssid911e40e2015-02-09 17:55:2063 void AsValueInto(base::trace_event::TracedValue* dict) const override;
dcheng716bedf2014-10-21 09:51:0864 const char* LayerTypeAsString() const override;
[email protected]c1ae82942014-01-17 23:17:0465
fsamuel1d3252c2017-02-15 20:56:3766 SurfaceInfo primary_surface_info_;
67 SurfaceInfo fallback_surface_info_;
68
xlai5e87e712016-12-16 02:10:2569 bool stretch_content_to_fill_bounds_ = false;
[email protected]c1ae82942014-01-17 23:17:0470
71 DISALLOW_COPY_AND_ASSIGN(SurfaceLayerImpl);
72};
73
74} // namespace cc
75
76#endif // CC_LAYERS_SURFACE_LAYER_IMPL_H_