blob: 684fb26a84c6eeb085f349310aab49757799d61d (
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
|
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrProcessorSet_DEFINED
#define GrProcessorSet_DEFINED
#include "GrFragmentProcessor.h"
#include "GrPaint.h"
#include "GrPipeline.h"
#include "SkTemplates.h"
class GrXPFactory;
class GrProcessorSet : private SkNoncopyable {
public:
GrProcessorSet(GrPaint&& paint);
~GrProcessorSet() {
// We are deliberately not using sk_sp here because this will be updated to work with
// "pending execution" refs.
for (auto fp : fFragmentProcessors) {
fp->unref();
}
}
int numColorFragmentProcessors() const { return fColorFragmentProcessorCnt; }
int numCoverageFragmentProcessors() const {
return fFragmentProcessors.count() - fColorFragmentProcessorCnt;
}
int numFragmentProcessors() const { return fFragmentProcessors.count(); }
const GrFragmentProcessor* colorFragmentProcessor(int idx) const {
SkASSERT(idx < fColorFragmentProcessorCnt);
return fFragmentProcessors[idx];
}
const GrFragmentProcessor* coverageFragmentProcessor(int idx) const {
return fFragmentProcessors[idx + fColorFragmentProcessorCnt];
}
const GrXPFactory* xpFactory() const { return fXPFactory; }
void analyzeFragmentProcessors(GrPipelineAnalysis* analysis) const {
const GrFragmentProcessor* const* fps = fFragmentProcessors.get();
analysis->fColorPOI.addProcessors(fps, fColorFragmentProcessorCnt);
fps += fColorFragmentProcessorCnt;
analysis->fCoveragePOI.addProcessors(fps, this->numCoverageFragmentProcessors());
}
private:
const GrXPFactory* fXPFactory = nullptr;
SkAutoSTArray<4, const GrFragmentProcessor*> fFragmentProcessors;
int fColorFragmentProcessorCnt;
};
#endif
|