blob: 3dd1d941cdab7aff8540f13fdf69bc667333bfdd [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
Robert Phillipsd2f53f92021-08-31 17:51:18 -04008#ifndef DrawableOp_DEFINED
9#define DrawableOp_DEFINED
Greg Daniel64cc9aa2018-10-19 13:54:56 -040010
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/core/SkDrawable.h"
Robert Phillipsd2f53f92021-08-31 17:51:18 -040012#include "src/gpu/ops/GrOp.h"
Greg Daniel64cc9aa2018-10-19 13:54:56 -040013
Robert Phillipsb97da532019-02-12 15:24:12 -050014class GrRecordingContext;
15
Robert Phillipsd2f53f92021-08-31 17:51:18 -040016namespace skgpu::v1 {
17
18class DrawableOp final : public GrOp {
Greg Daniel64cc9aa2018-10-19 13:54:56 -040019public:
20 DEFINE_OP_CLASS_ID
21
Herb Derbyc76d4092020-10-07 16:46:15 -040022 static GrOp::Owner Make(GrRecordingContext*,
23 std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
24 const SkRect& bounds);
Greg Daniel64cc9aa2018-10-19 13:54:56 -040025
26 const char* name() const override { return "Drawable"; }
27
Greg Daniel64cc9aa2018-10-19 13:54:56 -040028private:
Herb Derbyc76d4092020-10-07 16:46:15 -040029 friend class GrOp; // for ctor
Greg Daniel64cc9aa2018-10-19 13:54:56 -040030
Robert Phillipsd2f53f92021-08-31 17:51:18 -040031 DrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler>, const SkRect& bounds);
Greg Daniel64cc9aa2018-10-19 13:54:56 -040032
Herb Derbye25c3002020-10-27 15:57:27 -040033 CombineResult onCombineIfPossible(GrOp* that, SkArenaAlloc*, const GrCaps& caps) override {
Greg Daniel64cc9aa2018-10-19 13:54:56 -040034 return CombineResult::kCannotCombine;
35 }
Robert Phillipsc655c3a2020-03-18 13:23:45 -040036
37 void onPrePrepare(GrRecordingContext*,
Adlai Hollere2296f72020-11-19 13:41:26 -050038 const GrSurfaceProxyView& writeView,
Robert Phillipsc655c3a2020-03-18 13:23:45 -040039 GrAppliedClip*,
John Stiles52cb1d02021-06-02 11:58:05 -040040 const GrDstProxyView&,
Greg Daniel42dbca52020-11-20 10:22:43 -050041 GrXferBarrierFlags renderPassXferBarriers,
42 GrLoadOp colorLoadOp) override {}
Robert Phillipsc655c3a2020-03-18 13:23:45 -040043
Greg Daniel64cc9aa2018-10-19 13:54:56 -040044 void onPrepare(GrOpFlushState*) override {}
45
Brian Salomon588cec72018-11-14 13:56:37 -050046 void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
Greg Daniel64cc9aa2018-10-19 13:54:56 -040047
48 std::unique_ptr<SkDrawable::GpuDrawHandler> fDrawable;
Greg Daniel64cc9aa2018-10-19 13:54:56 -040049};
50
Robert Phillipsd2f53f92021-08-31 17:51:18 -040051} // namespace skgpu::v1
Greg Daniel64cc9aa2018-10-19 13:54:56 -040052
Robert Phillipsd2f53f92021-08-31 17:51:18 -040053#endif // DrawableOp_DEFINED