GrDrawableOp.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright 2018 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 GrDrawableOp_DEFINED
  8. #define GrDrawableOp_DEFINED
  9. #include "src/gpu/ops/GrOp.h"
  10. #include "include/core/SkDrawable.h"
  11. #include "include/core/SkMatrix.h"
  12. #include "src/gpu/GrSemaphore.h"
  13. class GrRecordingContext;
  14. class GrDrawableOp final : public GrOp {
  15. public:
  16. DEFINE_OP_CLASS_ID
  17. static std::unique_ptr<GrDrawableOp> Make(GrRecordingContext*,
  18. std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
  19. const SkRect& bounds);
  20. const char* name() const override { return "Drawable"; }
  21. #ifdef SK_DEBUG
  22. SkString dumpInfo() const override {
  23. return INHERITED::dumpInfo();
  24. }
  25. #endif
  26. private:
  27. friend class GrOpMemoryPool; // for ctor
  28. GrDrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler>, const SkRect& bounds);
  29. CombineResult onCombineIfPossible(GrOp* that, const GrCaps& caps) override {
  30. return CombineResult::kCannotCombine;
  31. }
  32. void onPrepare(GrOpFlushState*) override {}
  33. void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
  34. std::unique_ptr<SkDrawable::GpuDrawHandler> fDrawable;
  35. typedef GrOp INHERITED;
  36. };
  37. #endif