OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrDisableColorXP_DEFINED | 8 #ifndef GrDisableColorXP_DEFINED |
9 #define GrDisableColorXP_DEFINED | 9 #define GrDisableColorXP_DEFINED |
10 | 10 |
11 #include "GrTypes.h" | 11 #include "GrTypes.h" |
12 #include "GrXferProcessor.h" | 12 #include "GrXferProcessor.h" |
| 13 #include "SkRefCnt.h" |
13 | 14 |
14 class GrProcOptInfo; | 15 class GrProcOptInfo; |
15 | 16 |
16 class GrDisableColorXPFactory : public GrXPFactory { | 17 class GrDisableColorXPFactory : public GrXPFactory { |
17 public: | 18 public: |
18 static GrXPFactory* Create() { return new GrDisableColorXPFactory; } | 19 static sk_sp<GrXPFactory> Create() { return sk_sp<GrXPFactory>(new GrDisable
ColorXPFactory); } |
19 | 20 |
20 void getInvariantBlendedColor(const GrProcOptInfo& colorPOI, | 21 void getInvariantBlendedColor(const GrProcOptInfo& colorPOI, |
21 GrXPFactory::InvariantBlendedColor* blendedCol
or) const override { | 22 GrXPFactory::InvariantBlendedColor* blendedCol
or) const override { |
22 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; | 23 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; |
23 blendedColor->fWillBlendWithDst = false; | 24 blendedColor->fWillBlendWithDst = false; |
24 } | 25 } |
25 | 26 |
26 private: | 27 private: |
27 GrDisableColorXPFactory(); | 28 GrDisableColorXPFactory(); |
28 | 29 |
29 GrXferProcessor* onCreateXferProcessor(const GrCaps& caps, | 30 GrXferProcessor* onCreateXferProcessor(const GrCaps& caps, |
30 const GrPipelineOptimizations& optimi
zations, | 31 const GrPipelineOptimizations& optimi
zations, |
31 bool hasMixedSamples, | 32 bool hasMixedSamples, |
32 const DstTexture* dstTexture) const o
verride; | 33 const DstTexture* dstTexture) const o
verride; |
33 | 34 |
34 bool onWillReadDstColor(const GrCaps&, const GrPipelineOptimizations&) const
override { | 35 bool onWillReadDstColor(const GrCaps&, const GrPipelineOptimizations&) const
override { |
35 return false; | 36 return false; |
36 } | 37 } |
37 | 38 |
38 bool onIsEqual(const GrXPFactory& xpfBase) const override { | 39 bool onIsEqual(const GrXPFactory& xpfBase) const override { |
39 return true; | 40 return true; |
40 } | 41 } |
41 | 42 |
42 GR_DECLARE_XP_FACTORY_TEST; | 43 GR_DECLARE_XP_FACTORY_TEST; |
43 | 44 |
44 typedef GrXPFactory INHERITED; | 45 typedef GrXPFactory INHERITED; |
45 }; | 46 }; |
46 | 47 |
47 #endif | 48 #endif |
OLD | NEW |