Robert Phillips | d2f53f9 | 2021-08-31 17:51:18 -0400 | [diff] [blame] | 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/ops/DrawableOp.h" |
| 9 | |
| 10 | #include "include/core/SkDrawable.h" |
| 11 | #include "include/gpu/GrRecordingContext.h" |
| 12 | #include "src/gpu/GrMemoryPool.h" |
| 13 | #include "src/gpu/GrOpFlushState.h" |
| 14 | #include "src/gpu/GrOpsRenderPass.h" |
| 15 | #include "src/gpu/GrRecordingContextPriv.h" |
| 16 | |
| 17 | namespace skgpu::v1 { |
| 18 | |
| 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 | |
| 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 | |
| 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 |