| 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 GrXferProcessor_DEFINED | 8 #ifndef GrXferProcessor_DEFINED |
| 9 #define GrXferProcessor_DEFINED | 9 #define GrXferProcessor_DEFINED |
| 10 | 10 |
| 11 #include "GrColor.h" | 11 #include "GrColor.h" |
| 12 #include "GrProcessor.h" | 12 #include "GrProcessor.h" |
| 13 #include "GrTexture.h" | 13 #include "GrTexture.h" |
| 14 #include "GrTypes.h" | 14 #include "GrTypes.h" |
| 15 #include "SkXfermode.h" | 15 #include "SkXfermode.h" |
| 16 | 16 |
| 17 class GrDrawTargetCaps; | 17 class GrDrawTargetCaps; |
| 18 class GrGLCaps; | 18 class GrGLCaps; |
| 19 typedef GrGLCaps GrGLSLCaps; |
| 19 class GrGLXferProcessor; | 20 class GrGLXferProcessor; |
| 20 class GrProcOptInfo; | 21 class GrProcOptInfo; |
| 21 | 22 |
| 22 /** | 23 /** |
| 23 * Coeffecients for alpha-blending. | 24 * Coeffecients for alpha-blending. |
| 24 */ | 25 */ |
| 25 enum GrBlendCoeff { | 26 enum GrBlendCoeff { |
| 26 kInvalid_GrBlendCoeff = -1, | 27 kInvalid_GrBlendCoeff = -1, |
| 27 | 28 |
| 28 kZero_GrBlendCoeff, //<! 0 | 29 kZero_GrBlendCoeff, //<! 0 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 59 * | 60 * |
| 60 * A GrXferProcessor is never installed directly into our draw state, but instea
d is created from a | 61 * A GrXferProcessor is never installed directly into our draw state, but instea
d is created from a |
| 61 * GrXPFactory once we have finalized the state of our draw. | 62 * GrXPFactory once we have finalized the state of our draw. |
| 62 */ | 63 */ |
| 63 class GrXferProcessor : public GrProcessor { | 64 class GrXferProcessor : public GrProcessor { |
| 64 public: | 65 public: |
| 65 /** | 66 /** |
| 66 * Sets a unique key on the GrProcessorKeyBuilder calls onGetGLProcessorKey(
...) to get the | 67 * Sets a unique key on the GrProcessorKeyBuilder calls onGetGLProcessorKey(
...) to get the |
| 67 * specific subclass's key. | 68 * specific subclass's key. |
| 68 */ | 69 */ |
| 69 void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const
; | 70 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con
st; |
| 70 | 71 |
| 71 /** Returns a new instance of the appropriate *GL* implementation class | 72 /** Returns a new instance of the appropriate *GL* implementation class |
| 72 for the given GrXferProcessor; caller is responsible for deleting | 73 for the given GrXferProcessor; caller is responsible for deleting |
| 73 the object. */ | 74 the object. */ |
| 74 virtual GrGLXferProcessor* createGLInstance() const = 0; | 75 virtual GrGLXferProcessor* createGLInstance() const = 0; |
| 75 | 76 |
| 76 /** | 77 /** |
| 77 * Optimizations for blending / coverage that an OptDrawState should apply t
o itself. | 78 * Optimizations for blending / coverage that an OptDrawState should apply t
o itself. |
| 78 */ | 79 */ |
| 79 enum OptFlags { | 80 enum OptFlags { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 193 |
| 193 protected: | 194 protected: |
| 194 GrXferProcessor(); | 195 GrXferProcessor(); |
| 195 GrXferProcessor(const GrDeviceCoordTexture* dstCopy, bool willReadDstColor); | 196 GrXferProcessor(const GrDeviceCoordTexture* dstCopy, bool willReadDstColor); |
| 196 | 197 |
| 197 private: | 198 private: |
| 198 /** | 199 /** |
| 199 * Sets a unique key on the GrProcessorKeyBuilder that is directly associate
d with this xfer | 200 * Sets a unique key on the GrProcessorKeyBuilder that is directly associate
d with this xfer |
| 200 * processor's GL backend implementation. | 201 * processor's GL backend implementation. |
| 201 */ | 202 */ |
| 202 virtual void onGetGLProcessorKey(const GrGLCaps& caps, | 203 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, |
| 203 GrProcessorKeyBuilder* b) const = 0; | 204 GrProcessorKeyBuilder* b) const = 0; |
| 204 | 205 |
| 205 /** | 206 /** |
| 206 * Retrieves the hardware blend state required by this Xfer processor. The B
lendInfo struct | 207 * Retrieves the hardware blend state required by this Xfer processor. The B
lendInfo struct |
| 207 * comes initialized to default values, so the Xfer processor only needs to
set the state it | 208 * comes initialized to default values, so the Xfer processor only needs to
set the state it |
| 208 * needs. It may not even need to override this method at all. | 209 * needs. It may not even need to override this method at all. |
| 209 */ | 210 */ |
| 210 virtual void onGetBlendInfo(BlendInfo*) const {} | 211 virtual void onGetBlendInfo(BlendInfo*) const {} |
| 211 | 212 |
| 212 virtual bool onIsEqual(const GrXferProcessor&) const = 0; | 213 virtual bool onIsEqual(const GrXferProcessor&) const = 0; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 enum { | 326 enum { |
| 326 kIllegalXPFClassID = 0, | 327 kIllegalXPFClassID = 0, |
| 327 }; | 328 }; |
| 328 static int32_t gCurrXPFClassID; | 329 static int32_t gCurrXPFClassID; |
| 329 | 330 |
| 330 typedef GrProgramElement INHERITED; | 331 typedef GrProgramElement INHERITED; |
| 331 }; | 332 }; |
| 332 | 333 |
| 333 #endif | 334 #endif |
| 334 | 335 |
| OLD | NEW |