Greg Daniel | 64cc9aa | 2018-10-19 13:54:56 -0400 | [diff] [blame] | 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "src/gpu/ops/GrOp.h" |
Greg Daniel | 64cc9aa | 2018-10-19 13:54:56 -0400 | [diff] [blame] | 12 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 13 | #include "include/core/SkDrawable.h" |
| 14 | #include "include/core/SkMatrix.h" |
| 15 | #include "src/gpu/GrSemaphore.h" |
Greg Daniel | 64cc9aa | 2018-10-19 13:54:56 -0400 | [diff] [blame] | 16 | |
Robert Phillips | b97da53 | 2019-02-12 15:24:12 -0500 | [diff] [blame] | 17 | class GrRecordingContext; |
| 18 | |
Greg Daniel | 64cc9aa | 2018-10-19 13:54:56 -0400 | [diff] [blame] | 19 | class GrDrawableOp final : public GrOp { |
| 20 | public: |
| 21 | DEFINE_OP_CLASS_ID |
| 22 | |
Robert Phillips | b97da53 | 2019-02-12 15:24:12 -0500 | [diff] [blame] | 23 | static std::unique_ptr<GrDrawableOp> Make(GrRecordingContext*, |
Greg Daniel | 64cc9aa | 2018-10-19 13:54:56 -0400 | [diff] [blame] | 24 | std::unique_ptr<SkDrawable::GpuDrawHandler> drawable, |
| 25 | const SkRect& bounds); |
| 26 | |
| 27 | const char* name() const override { return "Drawable"; } |
| 28 | |
Brian Osman | 9a390ac | 2018-11-12 09:47:48 -0500 | [diff] [blame] | 29 | #ifdef SK_DEBUG |
Greg Daniel | 64cc9aa | 2018-10-19 13:54:56 -0400 | [diff] [blame] | 30 | SkString dumpInfo() const override { |
| 31 | return INHERITED::dumpInfo(); |
| 32 | } |
Brian Osman | 9a390ac | 2018-11-12 09:47:48 -0500 | [diff] [blame] | 33 | #endif |
Greg Daniel | 64cc9aa | 2018-10-19 13:54:56 -0400 | [diff] [blame] | 34 | |
| 35 | private: |
| 36 | friend class GrOpMemoryPool; // for ctor |
| 37 | |
| 38 | GrDrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler>, const SkRect& bounds); |
| 39 | |
Michael Ludwig | 28b0c5d | 2019-12-19 14:51:00 -0500 | [diff] [blame] | 40 | CombineResult onCombineIfPossible(GrOp* that, GrRecordingContext::Arenas*, |
| 41 | const GrCaps& caps) override { |
Greg Daniel | 64cc9aa | 2018-10-19 13:54:56 -0400 | [diff] [blame] | 42 | return CombineResult::kCannotCombine; |
| 43 | } |
Robert Phillips | c655c3a | 2020-03-18 13:23:45 -0400 | [diff] [blame] | 44 | |
| 45 | void onPrePrepare(GrRecordingContext*, |
| 46 | const GrSurfaceProxyView* outputView, |
| 47 | GrAppliedClip*, |
| 48 | const GrXferProcessor::DstProxyView&) override {} |
| 49 | |
Greg Daniel | 64cc9aa | 2018-10-19 13:54:56 -0400 | [diff] [blame] | 50 | void onPrepare(GrOpFlushState*) override {} |
| 51 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 52 | void onExecute(GrOpFlushState*, const SkRect& chainBounds) override; |
Greg Daniel | 64cc9aa | 2018-10-19 13:54:56 -0400 | [diff] [blame] | 53 | |
| 54 | std::unique_ptr<SkDrawable::GpuDrawHandler> fDrawable; |
| 55 | |
| 56 | typedef GrOp INHERITED; |
| 57 | }; |
| 58 | |
| 59 | #endif |
| 60 | |