GrCustomXfermodePriv.h revision 0063a9b69a6a5d377f207c2aa1ea1e7220c19ba9
1/* 2 * Copyright 2015 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8#ifndef GrCustomXfermodePriv_DEFINED 9#define GrCustomXfermodePriv_DEFINED 10 11#include "GrCoordTransform.h" 12#include "GrFragmentProcessor.h" 13#include "GrTextureAccess.h" 14#include "SkXfermode.h" 15 16class GrGLCaps; 17class GrGLFragmentProcessor; 18class GrInvariantOutput; 19class GrProcessorKeyBuilder; 20class GrTexture; 21 22/////////////////////////////////////////////////////////////////////////////// 23// Fragment Processor 24/////////////////////////////////////////////////////////////////////////////// 25 26class GrCustomXferFP : public GrFragmentProcessor { 27public: 28 GrCustomXferFP(SkXfermode::Mode mode, GrTexture* background); 29 30 void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE; 31 32 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; 33 34 const char* name() const SK_OVERRIDE { return "Custom Xfermode"; } 35 36 SkXfermode::Mode mode() const { return fMode; } 37 const GrTextureAccess& backgroundAccess() const { return fBackgroundAccess; } 38 39private: 40 bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE; 41 42 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE; 43 44 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 45 46 SkXfermode::Mode fMode; 47 GrCoordTransform fBackgroundTransform; 48 GrTextureAccess fBackgroundAccess; 49 50 typedef GrFragmentProcessor INHERITED; 51}; 52 53#endif 54 55