Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrProcessorAnalysis.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2014 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
12
14 const GrProcessorAnalysisColor& input,
15 std::unique_ptr<GrFragmentProcessor> const fps[],
16 int count) {
17 fCompatibleWithCoverageAsAlpha = true;
18 fIsOpaque = input.isOpaque();
19 fUsesLocalCoords = false;
20 fWillReadDstColor = false;
21 fProcessorsToEliminate = 0;
22 fOutputColorKnown = input.isConstant(&fLastKnownOutputColor);
23 for (int i = 0; i < count; ++i) {
24 const GrFragmentProcessor* fp = fps[i].get();
25 if (fOutputColorKnown && fp->hasConstantOutputForConstantInput(fLastKnownOutputColor,
26 &fLastKnownOutputColor)) {
27 ++fProcessorsToEliminate;
28 fIsOpaque = fLastKnownOutputColor.isOpaque();
29 // We reset these flags since the earlier fragment processors are being eliminated.
30 fCompatibleWithCoverageAsAlpha = true;
31 fUsesLocalCoords = false;
32 fWillReadDstColor = false;
33 continue;
34 }
35
36 fOutputColorKnown = false;
37 if (fIsOpaque && !fp->preservesOpaqueInput()) {
38 fIsOpaque = false;
39 }
40 if (fCompatibleWithCoverageAsAlpha && !fp->compatibleWithCoverageAsAlpha()) {
41 fCompatibleWithCoverageAsAlpha = false;
42 }
43 if (fp->usesSampleCoords()) {
44 fUsesLocalCoords = true;
45 }
46 if (fp->willReadDstColor()) {
47 fWillReadDstColor = true;
48 }
49 }
50}
51
int count
const GrShaderCaps * shaderCaps() const
Definition GrCaps.h:63
bool requiresDstTexture(const GrCaps &caps) const
bool isConstant(SkPMColor4f *color=nullptr) const
bool fDstReadInShaderSupport
bool isOpaque() const
Definition SkColor.h:344