GrPathProcessor.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright 2013 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 GrPathProcessor_DEFINED
  8. #define GrPathProcessor_DEFINED
  9. #include "src/gpu/GrPrimitiveProcessor.h"
  10. /*
  11. * The path equivalent of the GP. For now this just manages color. In the long term we plan on
  12. * extending this class to handle all nvpr uniform / varying / program work.
  13. */
  14. class GrPathProcessor : public GrPrimitiveProcessor {
  15. public:
  16. static GrPathProcessor* Create(const SkPMColor4f& color,
  17. const SkMatrix& viewMatrix = SkMatrix::I(),
  18. const SkMatrix& localMatrix = SkMatrix::I()) {
  19. return new GrPathProcessor(color, viewMatrix, localMatrix);
  20. }
  21. const char* name() const override { return "PathProcessor"; }
  22. const SkPMColor4f& color() const { return fColor; }
  23. const SkMatrix& viewMatrix() const { return fViewMatrix; }
  24. const SkMatrix& localMatrix() const { return fLocalMatrix; }
  25. bool willUseGeoShader() const override { return false; }
  26. virtual void getGLSLProcessorKey(const GrShaderCaps& caps,
  27. GrProcessorKeyBuilder* b) const override;
  28. virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override;
  29. virtual bool isPathRendering() const override { return true; }
  30. private:
  31. GrPathProcessor(const SkPMColor4f&, const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
  32. SkPMColor4f fColor;
  33. const SkMatrix fViewMatrix;
  34. const SkMatrix fLocalMatrix;
  35. typedef GrPrimitiveProcessor INHERITED;
  36. };
  37. #endif