• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 #include "src/gpu/ganesh/ops/DrawableOp.h"
9 
10 #include "include/core/SkDrawable.h"
11 #include "include/gpu/GrRecordingContext.h"
12 #include "src/gpu/ganesh/GrMemoryPool.h"
13 #include "src/gpu/ganesh/GrOpFlushState.h"
14 #include "src/gpu/ganesh/GrOpsRenderPass.h"
15 #include "src/gpu/ganesh/GrRecordingContextPriv.h"
16 
17 namespace skgpu::v1 {
18 
Make(GrRecordingContext * context,std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,const SkRect & bounds)19 GrOp::Owner DrawableOp::Make(GrRecordingContext* context,
20                              std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
21                              const SkRect& bounds) {
22     return GrOp::Make<DrawableOp>(context, std::move(drawable), bounds);
23 }
24 
DrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,const SkRect & bounds)25 DrawableOp::DrawableOp(std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
26                        const SkRect& bounds)
27         : GrOp(ClassID())
28         , fDrawable(std::move(drawable)) {
29     this->setBounds(bounds, HasAABloat::kNo, IsHairline::kNo);
30 }
31 
onExecute(GrOpFlushState * state,const SkRect & chainBounds)32 void DrawableOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) {
33     SkASSERT(state->opsRenderPass());
34     state->opsRenderPass()->executeDrawable(std::move(fDrawable));
35 }
36 
37 } // namespace skgpu::v1
38