• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/ops/GrOp.h"
13 
14 class GrRecordingContext;
15 
16 namespace skgpu::v1 {
17 
18 class DrawableOp final : public GrOp {
19 public:
20     DEFINE_OP_CLASS_ID
21 
22     static GrOp::Owner Make(GrRecordingContext*,
23                             std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
24                             const SkRect& bounds);
25 
name()26     const char* name() const override { return "Drawable"; }
27 
28 private:
29     friend class GrOp; // for ctor
30 
31     DrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler>, const SkRect& bounds);
32 
onCombineIfPossible(GrOp * that,SkArenaAlloc *,const GrCaps & caps)33     CombineResult onCombineIfPossible(GrOp* that, SkArenaAlloc*, const GrCaps& caps) override {
34         return CombineResult::kCannotCombine;
35     }
36 
onPrePrepare(GrRecordingContext *,const GrSurfaceProxyView & writeView,GrAppliedClip *,const GrDstProxyView &,GrXferBarrierFlags renderPassXferBarriers,GrLoadOp colorLoadOp)37     void onPrePrepare(GrRecordingContext*,
38                       const GrSurfaceProxyView& writeView,
39                       GrAppliedClip*,
40                       const GrDstProxyView&,
41                       GrXferBarrierFlags renderPassXferBarriers,
42                       GrLoadOp colorLoadOp) override {}
43 
onPrepare(GrOpFlushState *)44     void onPrepare(GrOpFlushState*) override {}
45 
46     void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
47 
48     std::unique_ptr<SkDrawable::GpuDrawHandler> fDrawable;
49 };
50 
51 } // namespace skgpu::v1
52 
53 #endif // DrawableOp_DEFINED
54