blob: ff2e51f09d3888a816adc40967602895dc380d4a [file] [log] [blame]
Greg Daniel64cc9aa2018-10-19 13:54:56 -04001/*
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 Kleinc0bd9f92019-04-23 12:05:21 -050011#include "src/gpu/ops/GrOp.h"
Greg Daniel64cc9aa2018-10-19 13:54:56 -040012
Mike Kleinc0bd9f92019-04-23 12:05:21 -050013#include "include/core/SkDrawable.h"
14#include "include/core/SkMatrix.h"
15#include "src/gpu/GrSemaphore.h"
Greg Daniel64cc9aa2018-10-19 13:54:56 -040016
Robert Phillipsb97da532019-02-12 15:24:12 -050017class GrRecordingContext;
18
Greg Daniel64cc9aa2018-10-19 13:54:56 -040019class GrDrawableOp final : public GrOp {
20public:
21 DEFINE_OP_CLASS_ID
22
Herb Derbyc76d4092020-10-07 16:46:15 -040023 static GrOp::Owner Make(GrRecordingContext*,
24 std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
25 const SkRect& bounds);
Greg Daniel64cc9aa2018-10-19 13:54:56 -040026
27 const char* name() const override { return "Drawable"; }
28
Greg Daniel64cc9aa2018-10-19 13:54:56 -040029private:
Herb Derbyc76d4092020-10-07 16:46:15 -040030 friend class GrOp; // for ctor
Greg Daniel64cc9aa2018-10-19 13:54:56 -040031
32 GrDrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler>, const SkRect& bounds);
33
Michael Ludwig28b0c5d2019-12-19 14:51:00 -050034 CombineResult onCombineIfPossible(GrOp* that, GrRecordingContext::Arenas*,
35 const GrCaps& caps) override {
Greg Daniel64cc9aa2018-10-19 13:54:56 -040036 return CombineResult::kCannotCombine;
37 }
Robert Phillipsc655c3a2020-03-18 13:23:45 -040038
39 void onPrePrepare(GrRecordingContext*,
Brian Salomon8afde5f2020-04-01 16:22:00 -040040 const GrSurfaceProxyView* writeView,
Robert Phillipsc655c3a2020-03-18 13:23:45 -040041 GrAppliedClip*,
Greg Danield358cbe2020-09-11 09:33:54 -040042 const GrXferProcessor::DstProxyView&,
43 GrXferBarrierFlags renderPassXferBarriers) override {}
Robert Phillipsc655c3a2020-03-18 13:23:45 -040044
Greg Daniel64cc9aa2018-10-19 13:54:56 -040045 void onPrepare(GrOpFlushState*) override {}
46
Brian Salomon588cec72018-11-14 13:56:37 -050047 void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
Greg Daniel64cc9aa2018-10-19 13:54:56 -040048
49 std::unique_ptr<SkDrawable::GpuDrawHandler> fDrawable;
50
John Stiles7571f9e2020-09-02 22:42:33 -040051 using INHERITED = GrOp;
Greg Daniel64cc9aa2018-10-19 13:54:56 -040052};
53
54#endif
55