| 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/private/base/SkAssert.h" |
| 12 |
#include "src/gpu/ganesh/GrOpFlushState.h" |
| 13 |
#include "src/gpu/ganesh/GrOpsRenderPass.h" |
| 14 |
|
| 15 |
#include <utility> |
| 16 |
|
| 17 |
namespace skgpu::ganesh { |
| 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::ganesh |