blob: 2878b6b1039cdc9bd2b59ba6901848a1bc1a4d84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrTestMeshDrawOp_DEFINED
#define GrTestMeshDrawOp_DEFINED
#include "GrGeometryProcessor.h"
#include "GrOpFlushState.h"
#include "ops/GrMeshDrawOp.h"
/*
* A simple solid color batch only for testing purposes which actually doesn't batch at all. It
* saves having to fill out some boiler plate methods.
*/
class GrTestMeshDrawOp : public GrMeshDrawOp {
public:
virtual const char* name() const override = 0;
protected:
GrTestMeshDrawOp(uint32_t classID, const SkRect& bounds, GrColor color)
: INHERITED(classID), fColor(color) {
// Choose some conservative values for aa bloat and zero area.
this->setBounds(bounds, HasAABloat::kYes, IsZeroArea::kYes);
}
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setKnownFourComponents(fColor);
input->pipelineCoverageInput()->setUnknownSingleComponent();
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
optimizations.getOverrideColorIfSet(&fColor);
fOptimizations.fColorIgnored = !optimizations.readsColor();
fOptimizations.fUsesLocalCoords = optimizations.readsLocalCoords();
fOptimizations.fCoverageIgnored = !optimizations.readsCoverage();
}
struct Optimizations {
bool fColorIgnored = false;
bool fUsesLocalCoords = false;
bool fCoverageIgnored = false;
};
GrColor color() const { return fColor; }
const Optimizations optimizations() const { return fOptimizations; }
private:
bool onCombineIfPossible(GrOp*, const GrCaps&) override { return false; }
GrColor fColor;
Optimizations fOptimizations;
typedef GrMeshDrawOp INHERITED;
};
#endif
|