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 20 matching lines...) Expand all Loading... |
31 kDivByAlpha_RoundDown_PMConversion, | 31 kDivByAlpha_RoundDown_PMConversion, |
32 | 32 |
33 kPMConversionCnt | 33 kPMConversionCnt |
34 }; | 34 }; |
35 | 35 |
36 static const GrFragmentProcessor* Create(GrProcessorDataManager*, GrTexture*
, | 36 static const GrFragmentProcessor* Create(GrProcessorDataManager*, GrTexture*
, |
37 bool swapRedAndBlue, PMConversion,
const SkMatrix&); | 37 bool swapRedAndBlue, PMConversion,
const SkMatrix&); |
38 | 38 |
39 const char* name() const override { return "Config Conversion"; } | 39 const char* name() const override { return "Config Conversion"; } |
40 | 40 |
41 GrGLFragmentProcessor* createGLInstance() const override; | |
42 | |
43 bool swapsRedAndBlue() const { return fSwapRedAndBlue; } | 41 bool swapsRedAndBlue() const { return fSwapRedAndBlue; } |
44 PMConversion pmConversion() const { return fPMConversion; } | 42 PMConversion pmConversion() const { return fPMConversion; } |
45 | 43 |
46 // This function determines whether it is possible to choose PM->UPM and UPM
->PM conversions | 44 // This function determines whether it is possible to choose PM->UPM and UPM
->PM conversions |
47 // for which in any PM->UPM->PM->UPM sequence the two UPM values are the sam
e. This means that | 45 // for which in any PM->UPM->PM->UPM sequence the two UPM values are the sam
e. This means that |
48 // if pixels are read back to a UPM buffer, written back to PM to the GPU, a
nd read back again | 46 // if pixels are read back to a UPM buffer, written back to PM to the GPU, a
nd read back again |
49 // both reads will produce the same result. This test is quite expensive and
should not be run | 47 // both reads will produce the same result. This test is quite expensive and
should not be run |
50 // multiple times for a given context. | 48 // multiple times for a given context. |
51 static void TestForPreservingPMConversions(GrContext* context, | 49 static void TestForPreservingPMConversions(GrContext* context, |
52 PMConversion* PMToUPMRule, | 50 PMConversion* PMToUPMRule, |
53 PMConversion* UPMToPMRule); | 51 PMConversion* UPMToPMRule); |
54 | 52 |
55 private: | 53 private: |
56 GrConfigConversionEffect(GrProcessorDataManager*, | 54 GrConfigConversionEffect(GrProcessorDataManager*, |
57 GrTexture*, | 55 GrTexture*, |
58 bool swapRedAndBlue, | 56 bool swapRedAndBlue, |
59 PMConversion pmConversion, | 57 PMConversion pmConversion, |
60 const SkMatrix& matrix); | 58 const SkMatrix& matrix); |
61 | 59 |
| 60 GrGLFragmentProcessor* onCreateGLInstance() const override; |
| 61 |
62 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov
erride; | 62 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov
erride; |
63 | 63 |
64 bool onIsEqual(const GrFragmentProcessor&) const override; | 64 bool onIsEqual(const GrFragmentProcessor&) const override; |
65 | 65 |
66 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 66 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
67 | 67 |
68 bool fSwapRedAndBlue; | 68 bool fSwapRedAndBlue; |
69 PMConversion fPMConversion; | 69 PMConversion fPMConversion; |
70 | 70 |
71 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 71 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
72 | 72 |
73 typedef GrSingleTextureEffect INHERITED; | 73 typedef GrSingleTextureEffect INHERITED; |
74 }; | 74 }; |
75 | 75 |
76 #endif | 76 #endif |
OLD | NEW |