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

Side by Side Diff: src/gpu/effects/GrSingleTextureEffect.h

Issue 2215323003: Start using RenderTargetProxy (omnibus) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 1 month 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 #ifndef GrSingleTextureEffect_DEFINED 8 #ifndef GrSingleTextureEffect_DEFINED
9 #define GrSingleTextureEffect_DEFINED 9 #define GrSingleTextureEffect_DEFINED
10 10
11 #include "GrFragmentProcessor.h" 11 #include "GrFragmentProcessor.h"
12 #include "GrColorSpaceXform.h" 12 #include "GrColorSpaceXform.h"
13 #include "GrCoordTransform.h" 13 #include "GrCoordTransform.h"
14 #include "GrInvariantOutput.h" 14 #include "GrInvariantOutput.h"
15 #include "SkMatrix.h" 15 #include "SkMatrix.h"
16 16
17 class GrTexture; 17 class GrTexture;
18 class GrTextureProxy;
18 19
19 /** 20 /**
20 * A base class for effects that draw a single texture with a texture matrix. Th is effect has no 21 * A base class for effects that draw a single texture with a texture matrix. Th is effect has no
21 * backend implementations. One must be provided by the subclass. 22 * backend implementations. One must be provided by the subclass.
22 */ 23 */
23 class GrSingleTextureEffect : public GrFragmentProcessor { 24 class GrSingleTextureEffect : public GrFragmentProcessor {
24 public: 25 public:
25 ~GrSingleTextureEffect() override; 26 ~GrSingleTextureEffect() override;
26 27
27 SkString dumpInfo() const override { 28 SkString dumpInfo() const override {
28 SkString str; 29 SkString str;
29 str.appendf("Texture: %d", fTextureAccess.getTexture()->uniqueID()); 30 str.appendf("Texture: %d", fTextureAccess.getTexture()->uniqueID());
30 return str; 31 return str;
31 } 32 }
32 33
33 GrColorSpaceXform* colorSpaceXform() const { return fColorSpaceXform.get(); } 34 GrColorSpaceXform* colorSpaceXform() const { return fColorSpaceXform.get(); }
34 35
35 protected: 36 protected:
36 /** unfiltered, clamp mode */ 37 /** unfiltered, clamp mode */
37 GrSingleTextureEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkMatrix&) ; 38 GrSingleTextureEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkMatrix&) ;
38 /** clamp mode */ 39 /** clamp mode */
39 GrSingleTextureEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkMatrix&, 40 GrSingleTextureEffect(GrTexture*, sk_sp<GrColorSpaceXform>, const SkMatrix&,
40 GrTextureParams::FilterMode filterMode); 41 GrTextureParams::FilterMode filterMode);
41 GrSingleTextureEffect(GrTexture*, 42 GrSingleTextureEffect(GrTexture*,
42 sk_sp<GrColorSpaceXform>, 43 sk_sp<GrColorSpaceXform>,
43 const SkMatrix&, 44 const SkMatrix&,
44 const GrTextureParams&); 45 const GrTextureParams&);
45 46
47 /** unfiltered, clamp mode */
48 GrSingleTextureEffect(GrTextureProxy*, sk_sp<GrColorSpaceXform>, const SkMat rix&);
49 /** clamp mode */
50 GrSingleTextureEffect(GrTextureProxy*, sk_sp<GrColorSpaceXform>, const SkMat rix&,
51 GrTextureParams::FilterMode filterMode);
52 GrSingleTextureEffect(GrTextureProxy*,
53 sk_sp<GrColorSpaceXform>,
54 const SkMatrix&,
55 const GrTextureParams&);
56
46 /** 57 /**
47 * Can be used as a helper to implement subclass onComputeInvariantOutput(). It assumes that 58 * Can be used as a helper to implement subclass onComputeInvariantOutput(). It assumes that
48 * the subclass output color will be a modulation of the input color with a value read from the 59 * the subclass output color will be a modulation of the input color with a value read from the
49 * texture. 60 * texture.
50 */ 61 */
51 void updateInvariantOutputForModulation(GrInvariantOutput* inout) const { 62 void updateInvariantOutputForModulation(GrInvariantOutput* inout) const {
52 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) { 63 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
53 inout->mulByUnknownSingleComponent(); 64 inout->mulByUnknownSingleComponent();
54 } else if (GrPixelConfigIsOpaque(this->texture(0)->config())) { 65 } else if (GrPixelConfigIsOpaque(this->texture(0)->config())) {
55 inout->mulByUnknownOpaqueFourComponents(); 66 inout->mulByUnknownOpaqueFourComponents();
56 } else { 67 } else {
57 inout->mulByUnknownFourComponents(); 68 inout->mulByUnknownFourComponents();
58 } 69 }
59 } 70 }
60 71
61 private: 72 private:
62 GrCoordTransform fCoordTransform; 73 GrCoordTransform fCoordTransform;
63 GrTextureAccess fTextureAccess; 74 GrTextureAccess fTextureAccess;
64 sk_sp<GrColorSpaceXform> fColorSpaceXform; 75 sk_sp<GrColorSpaceXform> fColorSpaceXform;
65 76
66 typedef GrFragmentProcessor INHERITED; 77 typedef GrFragmentProcessor INHERITED;
67 }; 78 };
68 79
69 #endif 80 #endif
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