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 GrDrawableOp_DEFINED
9 #define GrDrawableOp_DEFINED
10 
11 #include "GrOp.h"
12 
13 #include "GrSemaphore.h"
14 #include "SkDrawable.h"
15 #include "SkMatrix.h"
16 
17 class GrDrawableOp final : public GrOp {
18 public:
19     DEFINE_OP_CLASS_ID
20 
21     static std::unique_ptr<GrDrawableOp> Make(GrContext*,
22                                               std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
23                                               const SkRect& bounds);
24 
name()25     const char* name() const override { return "Drawable"; }
26 
27 #ifdef SK_DEBUG
dumpInfo()28     SkString dumpInfo() const override {
29         return INHERITED::dumpInfo();
30     }
31 #endif
32 
33 private:
34     friend class GrOpMemoryPool; // for ctor
35 
36     GrDrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler>, const SkRect& bounds);
37 
onCombineIfPossible(GrOp * that,const GrCaps & caps)38     CombineResult onCombineIfPossible(GrOp* that, const GrCaps& caps) override {
39         return CombineResult::kCannotCombine;
40     }
onPrepare(GrOpFlushState *)41     void onPrepare(GrOpFlushState*) override {}
42 
43     void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
44 
45     std::unique_ptr<SkDrawable::GpuDrawHandler> fDrawable;
46 
47     typedef GrOp INHERITED;
48 };
49 
50 #endif
51 
52