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 8 #ifndef DrawableOp_DEFINED 9 #define DrawableOp_DEFINED 10 11 #include "include/core/SkDrawable.h" 12 #include "src/gpu/ganesh/GrCaps.h" 13 #include "src/gpu/ganesh/ops/GrOp.h" 14 15 #include <memory> 16 17 class GrAppliedClip; 18 class GrDstProxyView; 19 class GrOpFlushState; 20 class GrRecordingContext; 21 class GrSurfaceProxyView; 22 class SkArenaAlloc; 23 enum class GrLoadOp; 24 enum class GrXferBarrierFlags; 25 struct SkRect; 26 27 namespace skgpu::ganesh { 28 29 class DrawableOp final : public GrOp { 30 public: 31 DEFINE_OP_CLASS_ID 32 33 static GrOp::Owner Make(GrRecordingContext*, 34 std::unique_ptr<SkDrawable::GpuDrawHandler> drawable, 35 const SkRect& bounds); 36 name()37 const char* name() const override { return "Drawable"; } 38 39 private: 40 friend class GrOp; // for ctor 41 42 DrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler>, const SkRect& bounds); 43 onCombineIfPossible(GrOp * that,SkArenaAlloc *,const GrCaps & caps)44 CombineResult onCombineIfPossible(GrOp* that, SkArenaAlloc*, const GrCaps& caps) override { 45 return CombineResult::kCannotCombine; 46 } 47 onPrePrepare(GrRecordingContext *,const GrSurfaceProxyView & writeView,GrAppliedClip *,const GrDstProxyView &,GrXferBarrierFlags renderPassXferBarriers,GrLoadOp colorLoadOp)48 void onPrePrepare(GrRecordingContext*, 49 const GrSurfaceProxyView& writeView, 50 GrAppliedClip*, 51 const GrDstProxyView&, 52 GrXferBarrierFlags renderPassXferBarriers, 53 GrLoadOp colorLoadOp) override {} 54 onPrepare(GrOpFlushState *)55 void onPrepare(GrOpFlushState*) override {} 56 57 void onExecute(GrOpFlushState*, const SkRect& chainBounds) override; 58 59 std::unique_ptr<SkDrawable::GpuDrawHandler> fDrawable; 60 }; 61 62 } // namespace skgpu::ganesh 63 64 #endif // DrawableOp_DEFINED 65