blob: 31d8a2b5ee8c4a546d0126ca47c434c1ff0af93d [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
Herb Derbye25c3002020-10-27 15:57:27 -040034 CombineResult onCombineIfPossible(GrOp* that, SkArenaAlloc*, const GrCaps& caps) override {
Greg Daniel64cc9aa2018-10-19 13:54:56 -040035 return CombineResult::kCannotCombine;
36 }
Robert Phillipsc655c3a2020-03-18 13:23:45 -040037
38 void onPrePrepare(GrRecordingContext*,
Adlai Hollere2296f72020-11-19 13:41:26 -050039 const GrSurfaceProxyView& writeView,
Robert Phillipsc655c3a2020-03-18 13:23:45 -040040 GrAppliedClip*,
Greg Danield358cbe2020-09-11 09:33:54 -040041 const GrXferProcessor::DstProxyView&,
Greg Daniel42dbca52020-11-20 10:22:43 -050042 GrXferBarrierFlags renderPassXferBarriers,
43 GrLoadOp colorLoadOp) 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