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

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

Issue 778453002: Remove backend factories (Closed) Base URL: https://skia.googlesource.com/skia.git@unichoice
Patch Set: more clang warnings Created 6 years 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/GrSimpleTextureEffect.h ('k') | src/gpu/effects/GrTextureDomain.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrSimpleTextureEffect.h" 8 #include "GrSimpleTextureEffect.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrTBackendProcessorFactory.h"
11 #include "GrTexture.h" 10 #include "GrTexture.h"
11 #include "gl/GrGLCaps.h"
12 #include "gl/GrGLProcessor.h" 12 #include "gl/GrGLProcessor.h"
13 #include "gl/GrGLSL.h" 13 #include "gl/GrGLSL.h"
14 #include "gl/GrGLTexture.h" 14 #include "gl/GrGLTexture.h"
15 #include "gl/builders/GrGLProgramBuilder.h" 15 #include "gl/builders/GrGLProgramBuilder.h"
16 16
17 class GrGLSimpleTextureEffect : public GrGLFragmentProcessor { 17 class GrGLSimpleTextureEffect : public GrGLFragmentProcessor {
18 public: 18 public:
19 GrGLSimpleTextureEffect(const GrBackendProcessorFactory& factory, const GrPr ocessor&) 19 GrGLSimpleTextureEffect(const GrProcessor&) {}
20 : INHERITED (factory) {
21 }
22 20
23 virtual void emitCode(GrGLFPBuilder* builder, 21 virtual void emitCode(GrGLFPBuilder* builder,
24 const GrFragmentProcessor& fp, 22 const GrFragmentProcessor& fp,
25 const char* outputColor, 23 const char* outputColor,
26 const char* inputColor, 24 const char* inputColor,
27 const TransformedCoordsArray& coords, 25 const TransformedCoordsArray& coords,
28 const TextureSamplerArray& samplers) SK_OVERRIDE { 26 const TextureSamplerArray& samplers) SK_OVERRIDE {
29 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 27 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
30 fsBuilder->codeAppendf("\t%s = ", outputColor); 28 fsBuilder->codeAppendf("\t%s = ", outputColor);
31 fsBuilder->appendTextureLookupAndModulate(inputColor, 29 fsBuilder->appendTextureLookupAndModulate(inputColor,
32 samplers[0], 30 samplers[0],
33 coords[0].c_str(), 31 coords[0].c_str(),
34 coords[0].getType()); 32 coords[0].getType());
35 fsBuilder->codeAppend(";\n"); 33 fsBuilder->codeAppend(";\n");
36 } 34 }
37 35
38 private: 36 private:
39 typedef GrGLFragmentProcessor INHERITED; 37 typedef GrGLFragmentProcessor INHERITED;
40 }; 38 };
41 39
42 /////////////////////////////////////////////////////////////////////////////// 40 ///////////////////////////////////////////////////////////////////////////////
43 41
44 void GrSimpleTextureEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c onst { 42 void GrSimpleTextureEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c onst {
45 this->updateInvariantOutputForModulation(inout); 43 this->updateInvariantOutputForModulation(inout);
46 } 44 }
47 45
48 const GrBackendFragmentProcessorFactory& GrSimpleTextureEffect::getFactory() con st { 46 void GrSimpleTextureEffect::getGLProcessorKey(const GrGLCaps& caps,
49 return GrTBackendFragmentProcessorFactory<GrSimpleTextureEffect>::getInstanc e(); 47 GrProcessorKeyBuilder* b) const {
48 GrGLSimpleTextureEffect::GenKey(*this, caps, b);
49 }
50
51 GrGLFragmentProcessor* GrSimpleTextureEffect::createGLInstance() const {
52 return SkNEW_ARGS(GrGLSimpleTextureEffect, (*this));
50 } 53 }
51 54
52 /////////////////////////////////////////////////////////////////////////////// 55 ///////////////////////////////////////////////////////////////////////////////
53 56
54 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSimpleTextureEffect); 57 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSimpleTextureEffect);
55 58
56 GrFragmentProcessor* GrSimpleTextureEffect::TestCreate(SkRandom* random, 59 GrFragmentProcessor* GrSimpleTextureEffect::TestCreate(SkRandom* random,
57 GrContext*, 60 GrContext*,
58 const GrDrawTargetCaps&, 61 const GrDrawTargetCaps&,
59 GrTexture* textures[]) { 62 GrTexture* textures[]) {
(...skipping 13 matching lines...) Expand all
73 76
74 static const GrCoordSet kCoordSets[] = { 77 static const GrCoordSet kCoordSets[] = {
75 kLocal_GrCoordSet, 78 kLocal_GrCoordSet,
76 kPosition_GrCoordSet 79 kPosition_GrCoordSet
77 }; 80 };
78 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord Sets))]; 81 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord Sets))];
79 82
80 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); 83 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random);
81 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); 84 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet);
82 } 85 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrSimpleTextureEffect.h ('k') | src/gpu/effects/GrTextureDomain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698