/src/skia/src/core/SkRecord.cpp
Line | Count | Source |
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 "include/core/SkImage.h" |
9 | | #include "src/core/SkRecord.h" |
10 | | #include <algorithm> |
11 | | |
12 | 153k | SkRecord::~SkRecord() { |
13 | 153k | Destroyer destroyer; |
14 | 2.71M | for (int i = 0; i < this->count(); i++) { |
15 | 2.56M | this->mutate(i, destroyer); |
16 | 2.56M | } |
17 | 153k | } |
18 | | |
19 | 125k | void SkRecord::grow() { |
20 | 125k | SkASSERT(fCount == fReserved); |
21 | 63.1k | fReserved = fReserved ? fReserved * 2 : 4; |
22 | 125k | fRecords.realloc(fReserved); |
23 | 125k | } |
24 | | |
25 | 20.1k | size_t SkRecord::bytesUsed() const { |
26 | 20.1k | size_t bytes = fApproxBytesAllocated + sizeof(SkRecord); |
27 | 20.1k | return bytes; |
28 | 20.1k | } |
29 | | |
30 | 63.1k | 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 | 63.1k | Record* noops = std::remove_if(fRecords.get(), fRecords.get() + fCount, |
35 | 2.58M | [](Record op) { return op.type() == SkRecords::NoOp_Type; }); SkRecord.cpp:SkRecord::defrag()::$_0::operator()(SkRecord::Record) const Line | Count | Source | 35 | 2.58M | [](Record op) { return op.type() == SkRecords::NoOp_Type; }); |
Unexecuted instantiation: SkRecord.cpp:SkRecord::defrag()::$_1::operator()(SkRecord::Record) const |
36 | 63.1k | fCount = noops - fRecords.get(); |
37 | 63.1k | } |