OLD | NEW |
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 GrConfigConversionEffect_DEFINED | 8 #ifndef GrConfigConversionEffect_DEFINED |
9 #define GrConfigConversionEffect_DEFINED | 9 #define GrConfigConversionEffect_DEFINED |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 kMulByAlpha_RoundDown_PMConversion, | 29 kMulByAlpha_RoundDown_PMConversion, |
30 kDivByAlpha_RoundUp_PMConversion, | 30 kDivByAlpha_RoundUp_PMConversion, |
31 kDivByAlpha_RoundDown_PMConversion, | 31 kDivByAlpha_RoundDown_PMConversion, |
32 | 32 |
33 kPMConversionCnt | 33 kPMConversionCnt |
34 }; | 34 }; |
35 | 35 |
36 static sk_sp<GrFragmentProcessor> Make(GrTexture*, const GrSwizzle&, PMConve
rsion, | 36 static sk_sp<GrFragmentProcessor> Make(GrTexture*, const GrSwizzle&, PMConve
rsion, |
37 const SkMatrix&); | 37 const SkMatrix&); |
38 | 38 |
| 39 static sk_sp<GrFragmentProcessor> Make(GrTextureProxy*, const GrSwizzle&, PM
Conversion, |
| 40 const SkMatrix&); |
| 41 |
39 const char* name() const override { return "Config Conversion"; } | 42 const char* name() const override { return "Config Conversion"; } |
40 | 43 |
41 const GrSwizzle& swizzle() const { return fSwizzle; } | 44 const GrSwizzle& swizzle() const { return fSwizzle; } |
42 PMConversion pmConversion() const { return fPMConversion; } | 45 PMConversion pmConversion() const { return fPMConversion; } |
43 | 46 |
44 // This function determines whether it is possible to choose PM->UPM and UPM
->PM conversions | 47 // This function determines whether it is possible to choose PM->UPM and UPM
->PM conversions |
45 // for which in any PM->UPM->PM->UPM sequence the two UPM values are the sam
e. This means that | 48 // for which in any PM->UPM->PM->UPM sequence the two UPM values are the sam
e. This means that |
46 // if pixels are read back to a UPM buffer, written back to PM to the GPU, a
nd read back again | 49 // if pixels are read back to a UPM buffer, written back to PM to the GPU, a
nd read back again |
47 // both reads will produce the same result. This test is quite expensive and
should not be run | 50 // both reads will produce the same result. This test is quite expensive and
should not be run |
48 // multiple times for a given context. | 51 // multiple times for a given context. |
49 static void TestForPreservingPMConversions(GrContext* context, | 52 static void TestForPreservingPMConversions(GrContext* context, |
50 PMConversion* PMToUPMRule, | 53 PMConversion* PMToUPMRule, |
51 PMConversion* UPMToPMRule); | 54 PMConversion* UPMToPMRule); |
52 | 55 |
53 private: | 56 private: |
54 GrConfigConversionEffect(GrTexture*, | 57 GrConfigConversionEffect(GrTexture*, |
55 const GrSwizzle&, | 58 const GrSwizzle&, |
56 PMConversion pmConversion, | 59 PMConversion pmConversion, |
57 const SkMatrix& matrix); | 60 const SkMatrix& matrix); |
58 | 61 |
| 62 GrConfigConversionEffect(GrTextureProxy*, |
| 63 const GrSwizzle&, |
| 64 PMConversion pmConversion, |
| 65 const SkMatrix& matrix); |
| 66 |
59 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; | 67 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
60 | 68 |
61 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const
override; | 69 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const
override; |
62 | 70 |
63 bool onIsEqual(const GrFragmentProcessor&) const override; | 71 bool onIsEqual(const GrFragmentProcessor&) const override; |
64 | 72 |
65 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 73 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
66 | 74 |
67 GrSwizzle fSwizzle; | 75 GrSwizzle fSwizzle; |
68 PMConversion fPMConversion; | 76 PMConversion fPMConversion; |
69 | 77 |
70 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 78 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
71 | 79 |
72 typedef GrSingleTextureEffect INHERITED; | 80 typedef GrSingleTextureEffect INHERITED; |
73 }; | 81 }; |
74 | 82 |
75 #endif | 83 #endif |
OLD | NEW |