Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
flow
layers
layer.cc
Go to the documentation of this file.
1
// Copyright 2013 The Flutter 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
#include "flutter/flow/layers/layer.h"
6
7
#include "flutter/flow/paint_utils.h"
8
9
namespace
flutter
{
10
11
Layer::Layer
()
12
: paint_bounds_(
SkRect
::MakeEmpty()),
13
unique_id_(NextUniqueID()),
14
original_layer_id_(unique_id_) {}
15
16
Layer::~Layer
() =
default
;
17
18
uint64_t Layer::NextUniqueID() {
19
static
std::atomic<uint64_t>
next_id
(1);
20
uint64_t
id
;
21
do
{
22
id
=
next_id
.fetch_add(1);
23
}
while
(
id
== 0);
// 0 is reserved for an invalid id.
24
return
id
;
25
}
26
27
Layer::AutoPrerollSaveLayerState::AutoPrerollSaveLayerState(
28
PrerollContext* preroll_context,
29
bool
save_layer_is_active,
30
bool
layer_itself_performs_readback)
31
: preroll_context_(preroll_context),
32
save_layer_is_active_(save_layer_is_active),
33
layer_itself_performs_readback_(layer_itself_performs_readback) {
34
if
(save_layer_is_active_) {
35
prev_surface_needs_readback_ = preroll_context_->surface_needs_readback;
36
preroll_context_->surface_needs_readback =
false
;
37
}
38
}
39
40
Layer::AutoPrerollSaveLayerState
Layer::AutoPrerollSaveLayerState::Create
(
41
PrerollContext
* preroll_context,
42
bool
save_layer_is_active,
43
bool
layer_itself_performs_readback) {
44
return
Layer::AutoPrerollSaveLayerState
(preroll_context, save_layer_is_active,
45
layer_itself_performs_readback);
46
}
47
48
Layer::AutoPrerollSaveLayerState::~AutoPrerollSaveLayerState
() {
49
if
(save_layer_is_active_) {
50
preroll_context_->surface_needs_readback =
51
(prev_surface_needs_readback_ || layer_itself_performs_readback_);
52
}
53
}
54
55
}
// namespace flutter
next_id
static uint32_t next_id()
Definition
SkTextBlob.cpp:146
flutter::Layer::AutoPrerollSaveLayerState
Definition
layer.h:175
flutter::Layer::AutoPrerollSaveLayerState::Create
static AutoPrerollSaveLayerState Create(PrerollContext *preroll_context, bool save_layer_is_active=true, bool layer_itself_performs_readback=false)
Definition
layer.cc:40
flutter::Layer::AutoPrerollSaveLayerState::~AutoPrerollSaveLayerState
~AutoPrerollSaveLayerState()
Definition
layer.cc:48
flutter::Layer::~Layer
virtual ~Layer()
flutter::Layer::Layer
Layer()
Definition
layer.cc:11
flutter
Definition
asset_manager.cc:10
SkRect
Definition
extension.cpp:13
flutter::PrerollContext
Definition
layer.h:54
id
const uintptr_t id
Definition
texture_unittests.cc:27
Generated on Fri Apr 26 2024 06:14:03 for Flutter Engine by
1.9.8