Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: src/gpu/effects/GrExtractAlphaFragmentProcessor.cpp

Issue 1313573005: Revert of Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor* (Closed) Base URL: https://skia.googlesource.com/skia.git@things
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/effects/GrDitherEffect.cpp ('k') | src/gpu/effects/GrMatrixConvolutionEffect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 "effects/GrExtractAlphaFragmentProcessor.h"
9 #include "gl/GrGLFragmentProcessor.h"
10 #include "gl/builders/GrGLProgramBuilder.h"
11
12 class GLExtractAlphaFragmentProcessor : public GrGLFragmentProcessor {
13 public:
14 GLExtractAlphaFragmentProcessor() {}
15
16 void emitCode(EmitArgs& args) override {
17 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder ();
18 fsBuilder->codeAppendf("vec4 alpha4 = %s.aaaa;", args.fInputColor);
19 SkString output;
20 this->emitChild(0, "alpha4", &output, args);
21 fsBuilder->codeAppendf("%s = %s;", args.fOutputColor, output.c_str());
22 }
23
24 private:
25 typedef GrGLFragmentProcessor INHERITED;
26 };
27
28 GrGLFragmentProcessor* GrExtractAlphaFragmentProcessor::onCreateGLInstance() con st {
29 return SkNEW(GLExtractAlphaFragmentProcessor);
30 }
31
32 void GrExtractAlphaFragmentProcessor::onGetGLProcessorKey(const GrGLSLCaps&,
33 GrProcessorKeyBuilder* ) const {
34 }
35
36 bool GrExtractAlphaFragmentProcessor::onIsEqual(const GrFragmentProcessor&) cons t { return true; }
37
38 void GrExtractAlphaFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput * inout) const {
39 if (inout->validFlags() & kA_GrColorComponentFlag) {
40 GrColor color = GrColorPackA4(GrColorUnpackA(inout->color()));
41 inout->setToOther(kRGBA_GrColorComponentFlags, color,
42 GrInvariantOutput::kWill_ReadInput);
43 } else {
44 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
45 }
46 this->childProcessor(0).computeInvariantOutput(inout);
47 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDitherEffect.cpp ('k') | src/gpu/effects/GrMatrixConvolutionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698