blob: b5b71a70d0629813a1e7caaf0b04312092c97556 [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
40 CombineResult onCombineIfPossible(GrOp* that, const GrCaps& caps) override {
41 return CombineResult::kCannotCombine;
42 }
43 void onPrepare(GrOpFlushState*) override {}
44
Brian Salomon588cec72018-11-14 13:56:37 -050045 void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
Greg Daniel64cc9aa2018-10-19 13:54:56 -040046
47 std::unique_ptr<SkDrawable::GpuDrawHandler> fDrawable;
48
49 typedef GrOp INHERITED;
50};
51
52#endif
53