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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 // Installs an effect in the GrProcessorStage to perform a config conversion
. | 37 // Installs an effect in the GrProcessorStage to perform a config conversion
. |
38 static const GrFragmentProcessor* Create(GrTexture*, bool swapRedAndBlue, PM
Conversion, | 38 static const GrFragmentProcessor* Create(GrTexture*, bool swapRedAndBlue, PM
Conversion, |
39 const SkMatrix&); | 39 const SkMatrix&); |
40 | 40 |
41 static const char* Name() { return "Config Conversion"; } | 41 static const char* Name() { return "Config Conversion"; } |
42 typedef GrGLConfigConversionEffect GLProcessor; | 42 typedef GrGLConfigConversionEffect GLProcessor; |
43 | 43 |
44 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 44 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; |
45 | 45 |
| 46 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; |
| 47 |
46 bool swapsRedAndBlue() const { return fSwapRedAndBlue; } | 48 bool swapsRedAndBlue() const { return fSwapRedAndBlue; } |
47 PMConversion pmConversion() const { return fPMConversion; } | 49 PMConversion pmConversion() const { return fPMConversion; } |
48 | 50 |
49 // This function determines whether it is possible to choose PM->UPM and UPM
->PM conversions | 51 // This function determines whether it is possible to choose PM->UPM and UPM
->PM conversions |
50 // for which in any PM->UPM->PM->UPM sequence the two UPM values are the sam
e. This means that | 52 // for which in any PM->UPM->PM->UPM sequence the two UPM values are the sam
e. This means that |
51 // if pixels are read back to a UPM buffer, written back to PM to the GPU, a
nd read back again | 53 // if pixels are read back to a UPM buffer, written back to PM to the GPU, a
nd read back again |
52 // both reads will produce the same result. This test is quite expensive and
should not be run | 54 // both reads will produce the same result. This test is quite expensive and
should not be run |
53 // multiple times for a given context. | 55 // multiple times for a given context. |
54 static void TestForPreservingPMConversions(GrContext* context, | 56 static void TestForPreservingPMConversions(GrContext* context, |
55 PMConversion* PMToUPMRule, | 57 PMConversion* PMToUPMRule, |
56 PMConversion* UPMToPMRule); | 58 PMConversion* UPMToPMRule); |
57 | 59 |
58 private: | 60 private: |
59 GrConfigConversionEffect(GrTexture*, | 61 GrConfigConversionEffect(GrTexture*, |
60 bool swapRedAndBlue, | 62 bool swapRedAndBlue, |
61 PMConversion pmConversion, | 63 PMConversion pmConversion, |
62 const SkMatrix& matrix); | 64 const SkMatrix& matrix); |
63 | 65 |
64 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; | 66 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; |
65 | 67 |
66 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | |
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 |