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