blob: 6c0debeb42ae9ccb452a9678f6b36e2c75c37ae5 [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
Robert Phillipsb97da532019-02-12 15:24:12 -050023 static std::unique_ptr<GrDrawableOp> Make(GrRecordingContext*,
Greg Daniel64cc9aa2018-10-19 13:54:56 -040024 std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
25 const SkRect& bounds);
26
27 const char* name() const override { return "Drawable"; }
28
Brian Osman9a390ac2018-11-12 09:47:48 -050029#ifdef SK_DEBUG
Greg Daniel64cc9aa2018-10-19 13:54:56 -040030 SkString dumpInfo() const override {
31 return INHERITED::dumpInfo();
32 }
Brian Osman9a390ac2018-11-12 09:47:48 -050033#endif
Greg Daniel64cc9aa2018-10-19 13:54:56 -040034
35private:
36 friend class GrOpMemoryPool; // for ctor
37
38 GrDrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler>, const SkRect& bounds);
39
Michael Ludwig28b0c5d2019-12-19 14:51:00 -050040 CombineResult onCombineIfPossible(GrOp* that, GrRecordingContext::Arenas*,
41 const GrCaps& caps) override {
Greg Daniel64cc9aa2018-10-19 13:54:56 -040042 return CombineResult::kCannotCombine;
43 }
Robert Phillipsc655c3a2020-03-18 13:23:45 -040044
45 void onPrePrepare(GrRecordingContext*,
Brian Salomon8afde5f2020-04-01 16:22:00 -040046 const GrSurfaceProxyView* writeView,
Robert Phillipsc655c3a2020-03-18 13:23:45 -040047 GrAppliedClip*,
48 const GrXferProcessor::DstProxyView&) override {}
49
Greg Daniel64cc9aa2018-10-19 13:54:56 -040050 void onPrepare(GrOpFlushState*) override {}
51
Brian Salomon588cec72018-11-14 13:56:37 -050052 void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
Greg Daniel64cc9aa2018-10-19 13:54:56 -040053
54 std::unique_ptr<SkDrawable::GpuDrawHandler> fDrawable;
55
56 typedef GrOp INHERITED;
57};
58
59#endif
60