Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrOp.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
9
10std::atomic<uint32_t> GrOp::gCurrOpClassID {GrOp::kIllegalOpID + 1};
11std::atomic<uint32_t> GrOp::gCurrOpUniqueID{GrOp::kIllegalOpID + 1};
12
13GrOp::GrOp(uint32_t classID) : fClassID(classID) {
14 SkASSERT(classID == SkToU32(fClassID));
15 SkASSERT(classID);
16 SkDEBUGCODE(fBoundsFlags = kUninitialized_BoundsFlag);
17}
18
20 SkASSERT(this != that);
21 if (this->classID() != that->classID()) {
23 }
24 auto result = this->onCombineIfPossible(that, alloc, caps);
26 this->joinBounds(*that);
27 }
28 return result;
29}
30
33 SkASSERT(this->classID() == next->classID());
34 SkASSERT(this->isChainTail());
35 SkASSERT(next->isChainHead());
36 fNextInChain = std::move(next);
37 fNextInChain->fPrevInChain = this;
38}
39
41 if (fNextInChain) {
42 fNextInChain->fPrevInChain = nullptr;
43 return std::move(fNextInChain);
44 }
45 return nullptr;
46}
47
48#ifdef SK_DEBUG
49void GrOp::validateChain(GrOp* expectedTail) const {
50 SkASSERT(this->isChainHead());
51 uint32_t classID = this->classID();
52 const GrOp* op = this;
53 while (op) {
54 SkASSERT(op == this || (op->prevInChain() && op->prevInChain()->nextInChain() == op));
55 SkASSERT(classID == op->classID());
56 if (op->nextInChain()) {
57 SkASSERT(op->nextInChain()->prevInChain() == op);
58 SkASSERT(op != expectedTail);
59 } else {
60 SkASSERT(!expectedTail || op == expectedTail);
61 }
62 op = op->nextInChain();
63 }
64}
65#endif
static float next(float f)
#define SkASSERT(cond)
Definition SkAssert.h:116
#define SkDEBUGCODE(...)
Definition SkDebug.h:23
constexpr uint32_t SkToU32(S x)
Definition SkTo.h:26
Definition GrOp.h:70
CombineResult
Definition GrOp.h:99
CombineResult combineIfPossible(GrOp *that, SkArenaAlloc *alloc, const GrCaps &caps)
Definition GrOp.cpp:19
GrOp * prevInChain() const
Definition GrOp.h:246
std::unique_ptr< GrOp > Owner
Definition GrOp.h:72
GrOp * nextInChain() const
Definition GrOp.h:244
GrOp::Owner cutChain()
Definition GrOp.cpp:40
bool isChainTail() const
Definition GrOp.h:242
uint32_t classID() const
Definition GrOp.h:158
void chainConcat(GrOp::Owner)
Definition GrOp.cpp:31
bool isChainHead() const
Definition GrOp.h:240
virtual CombineResult onCombineIfPossible(GrOp *, SkArenaAlloc *, const GrCaps &)
Definition GrOp.h:305
GAsyncResult * result