GrShadowGeoProc.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright 2016 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. #ifndef GrShadowGeoProc_DEFINED
  8. #define GrShadowGeoProc_DEFINED
  9. #include "src/gpu/GrGeometryProcessor.h"
  10. #include "src/gpu/GrProcessor.h"
  11. class GrGLRRectShadowGeoProc;
  12. /**
  13. * The output color of this effect is a coverage mask for a rrect shadow,
  14. * assuming circular corner geometry.
  15. */
  16. class GrRRectShadowGeoProc : public GrGeometryProcessor {
  17. public:
  18. static sk_sp<GrGeometryProcessor> Make() {
  19. return sk_sp<GrGeometryProcessor>(new GrRRectShadowGeoProc());
  20. }
  21. const char* name() const override { return "RRectShadow"; }
  22. const Attribute& inPosition() const { return fInPosition; }
  23. const Attribute& inColor() const { return fInColor; }
  24. const Attribute& inShadowParams() const { return fInShadowParams; }
  25. GrColor color() const { return fColor; }
  26. void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {}
  27. GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override;
  28. private:
  29. GrRRectShadowGeoProc();
  30. GrColor fColor;
  31. Attribute fInPosition;
  32. Attribute fInColor;
  33. Attribute fInShadowParams;
  34. GR_DECLARE_GEOMETRY_PROCESSOR_TEST
  35. typedef GrGeometryProcessor INHERITED;
  36. };
  37. #endif