Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
core
SkRecord.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2015 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#include "
src/core/SkRecord.h
"
9
10
#include <algorithm>
11
12
SkRecord::~SkRecord
() {
13
Destroyer destroyer;
14
for
(
int
i = 0; i < this->
count
(); i++) {
15
this->
mutate
(i, destroyer);
16
}
17
}
18
19
void
SkRecord::grow() {
20
SkASSERT
(fCount == fReserved);
21
fReserved = fReserved ? fReserved * 2 : 4;
22
fRecords.
realloc
(fReserved);
23
}
24
25
size_t
SkRecord::bytesUsed
()
const
{
26
size_t
bytes = fApproxBytesAllocated +
sizeof
(
SkRecord
);
27
return
bytes;
28
}
29
30
void
SkRecord::defrag
() {
31
// Remove all the NoOps, preserving the order of other ops, e.g.
32
// Save, ClipRect, NoOp, DrawRect, NoOp, NoOp, Restore
33
// -> Save, ClipRect, DrawRect, Restore
34
Record* noops = std::remove_if(fRecords.
get
(), fRecords.
get
() + fCount,
35
[](Record op) { return op.type() == SkRecords::NoOp_Type; });
36
fCount = noops - fRecords.
get
();
37
}
SkASSERT
#define SkASSERT(cond)
Definition
SkAssert.h:116
SkRecord.h
SkRecord::bytesUsed
size_t bytesUsed() const
Definition
SkRecord.cpp:25
SkRecord::mutate
auto mutate(int i, F &&f) -> decltype(f((SkRecords::NoOp *) nullptr))
Definition
SkRecord.h:54
SkRecord::count
int count() const
Definition
SkRecord.h:38
SkRecord::defrag
void defrag()
Definition
SkRecord.cpp:30
SkRecord::SkRecord
SkRecord()=default
SkRecord::~SkRecord
~SkRecord() override
Definition
SkRecord.cpp:12
skia_private::AutoTMalloc::realloc
void realloc(size_t count)
Definition
SkTemplates.h:291
skia_private::AutoTMalloc::get
T * get() const
Definition
SkTemplates.h:301
Generated on Fri Apr 26 2024 06:16:47 for Flutter Engine by
1.9.8