#include <canvas.h>
Classes | |
| struct | SaveLayerState |
Public Types | |
| using | BackdropFilterProc = std::function< std::shared_ptr< FilterContents >(FilterInput::Ref, const Matrix &effect_transform, Entity::RenderingMode rendering_mode)> |
Public Member Functions | |
| Canvas (ContentContext &renderer, RenderTarget &render_target, bool requires_readback) | |
| Canvas (ContentContext &renderer, RenderTarget &render_target, bool requires_readback, Rect cull_rect) | |
| Canvas (ContentContext &renderer, RenderTarget &render_target, bool requires_readback, IRect cull_rect) | |
| ~Canvas ()=default | |
| std::optional< Rect > | GetLocalCoverageLimit () const |
| Return the culling bounds of the current render target, or nullopt if there is no coverage. More... | |
| void | Save (uint32_t total_content_depth=kMaxDepth) |
| void | SaveLayer (const Paint &paint, std::optional< Rect > bounds=std::nullopt, const flutter::DlImageFilter *backdrop_filter=nullptr, ContentBoundsPromise bounds_promise=ContentBoundsPromise::kUnknown, uint32_t total_content_depth=kMaxDepth, bool can_distribute_opacity=false) |
| bool | Restore () |
| size_t | GetSaveCount () const |
| void | RestoreToCount (size_t count) |
| const Matrix & | GetCurrentTransform () const |
| void | ResetTransform () |
| void | Transform (const Matrix &transform) |
| void | Concat (const Matrix &transform) |
| void | PreConcat (const Matrix &transform) |
| void | Translate (const Vector3 &offset) |
| void | Scale (const Vector2 &scale) |
| void | Scale (const Vector3 &scale) |
| void | Skew (Scalar sx, Scalar sy) |
| void | Rotate (Radians radians) |
| void | DrawPath (const Path &path, const Paint &paint) |
| void | DrawPaint (const Paint &paint) |
| void | DrawLine (const Point &p0, const Point &p1, const Paint &paint) |
| void | DrawRect (const Rect &rect, const Paint &paint) |
| void | DrawOval (const Rect &rect, const Paint &paint) |
| void | DrawRRect (const Rect &rect, const Size &corner_radii, const Paint &paint) |
| void | DrawCircle (const Point ¢er, Scalar radius, const Paint &paint) |
| void | DrawPoints (std::vector< Point > points, Scalar radius, const Paint &paint, PointStyle point_style) |
| void | DrawImage (const std::shared_ptr< Texture > &image, Point offset, const Paint &paint, SamplerDescriptor sampler={}) |
| void | DrawImageRect (const std::shared_ptr< Texture > &image, Rect source, Rect dest, const Paint &paint, SamplerDescriptor sampler={}, SourceRectConstraint src_rect_constraint=SourceRectConstraint::kFast) |
| void | DrawTextFrame (const std::shared_ptr< TextFrame > &text_frame, Point position, const Paint &paint) |
| void | DrawVertices (const std::shared_ptr< VerticesGeometry > &vertices, BlendMode blend_mode, const Paint &paint) |
| void | DrawAtlas (const std::shared_ptr< AtlasContents > &atlas_contents, const Paint &paint) |
| void | ClipGeometry (std::unique_ptr< Geometry > geometry, Entity::ClipOperation clip_op) |
| void | EndReplay () |
| uint64_t | GetOpDepth () const |
| uint64_t | GetMaxOpDepth () const |
Static Public Attributes | |
| static constexpr uint32_t | kMaxDepth = 1 << 24 |
| using impeller::Canvas::BackdropFilterProc = std::function<std::shared_ptr<FilterContents>( FilterInput::Ref, const Matrix& effect_transform, Entity::RenderingMode rendering_mode)> |
| impeller::Canvas::Canvas | ( | ContentContext & | renderer, |
| RenderTarget & | render_target, | ||
| bool | requires_readback | ||
| ) |
|
explicit |
|
explicit |
Definition at line 288 of file canvas.cc.
References impeller::TRect< T >::GetBottom(), impeller::TRect< T >::GetLeft(), impeller::TRect< T >::GetRight(), impeller::TRect< T >::GetTop(), and impeller::TRect< Scalar >::MakeLTRB().
|
default |
| void impeller::Canvas::ClipGeometry | ( | std::unique_ptr< Geometry > | geometry, |
| Entity::ClipOperation | clip_op | ||
| ) |
Definition at line 651 of file canvas.cc.
References GetCurrentTransform(), impeller::Entity::SetContents(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcherBase::clipOval(), impeller::DlDispatcherBase::clipPath(), impeller::DlDispatcherBase::clipRect(), and impeller::DlDispatcherBase::clipRRect().
| void impeller::Canvas::Concat | ( | const Matrix & | transform | ) |
Definition at line 315 of file canvas.cc.
References GetCurrentTransform(), and transform.
Referenced by Rotate(), Scale(), Skew(), Transform(), and Translate().
| void impeller::Canvas::DrawAtlas | ( | const std::shared_ptr< AtlasContents > & | atlas_contents, |
| const Paint & | paint | ||
| ) |
Definition at line 868 of file canvas.cc.
References impeller::Color::alpha, impeller::Paint::blend_mode, impeller::Paint::color, GetCurrentTransform(), impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), and impeller::Paint::WithFilters().
Referenced by impeller::DlDispatcherBase::drawAtlas().
Definition at line 628 of file canvas.cc.
References impeller::Paint::blend_mode, GetCurrentTransform(), impeller::Paint::kStroke, impeller::TRect< Scalar >::MakeOriginSize(), impeller::Entity::SetBlendMode(), impeller::Entity::SetTransform(), impeller::Paint::stroke_width, and impeller::Paint::style.
Referenced by impeller::DlDispatcherBase::drawCircle(), and DrawOval().
| void impeller::Canvas::DrawImage | ( | const std::shared_ptr< Texture > & | image, |
| Point | offset, | ||
| const Paint & | paint, | ||
| SamplerDescriptor | sampler = {} |
||
| ) |
Definition at line 698 of file canvas.cc.
References DrawImageRect(), impeller::TRect< Scalar >::MakeSize(), and offset.
| void impeller::Canvas::DrawImageRect | ( | const std::shared_ptr< Texture > & | image, |
| Rect | source, | ||
| Rect | dest, | ||
| const Paint & | paint, | ||
| SamplerDescriptor | sampler = {}, |
||
| SourceRectConstraint | src_rect_constraint = SourceRectConstraint::kFast |
||
| ) |
Definition at line 712 of file canvas.cc.
References impeller::Color::alpha, impeller::Paint::blend_mode, impeller::Paint::color, GetCurrentTransform(), impeller::Paint::HasColorFilter(), impeller::TRect< T >::IsEmpty(), impeller::kStrict, impeller::TextureContents::MakeRect(), impeller::Paint::mask_blur_descriptor, impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), and impeller::Paint::WithFilters().
Referenced by DrawImage(), impeller::DlDispatcherBase::drawImageRect(), and impeller::NinePatchConverter::DrawNinePatch().
Definition at line 546 of file canvas.cc.
References impeller::Paint::blend_mode, GetCurrentTransform(), impeller::Entity::SetBlendMode(), impeller::Entity::SetTransform(), impeller::Paint::stroke_cap, and impeller::Paint::stroke_width.
Referenced by impeller::DlDispatcherBase::drawLine(), and impeller::DlDispatcherBase::drawPoints().
Definition at line 573 of file canvas.cc.
References impeller::PathBuilder::AddOval(), impeller::Paint::blend_mode, DrawCircle(), DrawPath(), impeller::TRect< T >::GetCenter(), GetCurrentTransform(), impeller::TRect< T >::GetSize(), impeller::TRect< T >::GetWidth(), impeller::TRect< T >::IsSquare(), impeller::Paint::kFill, impeller::Paint::kStroke, impeller::Entity::SetBlendMode(), impeller::Entity::SetTransform(), impeller::Paint::stroke_width, and impeller::Paint::style.
Referenced by impeller::DlDispatcherBase::drawOval(), and impeller::DlDispatcherBase::SimplifyOrDrawPath().
| void impeller::Canvas::DrawPaint | ( | const Paint & | paint | ) |
Definition at line 401 of file canvas.cc.
References impeller::Paint::blend_mode, GetCurrentTransform(), impeller::Entity::SetBlendMode(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcherBase::drawColor(), and impeller::DlDispatcherBase::drawPaint().
Definition at line 386 of file canvas.cc.
References impeller::Paint::blend_mode, GetCurrentTransform(), impeller::Paint::kFill, impeller::Entity::SetBlendMode(), impeller::Entity::SetTransform(), impeller::Paint::stroke_cap, impeller::Paint::stroke_join, impeller::Paint::stroke_miter, impeller::Paint::stroke_width, and impeller::Paint::style.
Referenced by impeller::DlDispatcherBase::drawArc(), impeller::DlDispatcherBase::drawDashedLine(), impeller::DlDispatcherBase::drawDRRect(), DrawOval(), DrawRect(), impeller::DlDispatcherBase::drawRRect(), DrawRRect(), and impeller::DlDispatcherBase::SimplifyOrDrawPath().
| void impeller::Canvas::DrawPoints | ( | std::vector< Point > | points, |
| Scalar | radius, | ||
| const Paint & | paint, | ||
| PointStyle | point_style | ||
| ) |
Definition at line 681 of file canvas.cc.
References impeller::Paint::blend_mode, GetCurrentTransform(), impeller::kRound, impeller::Entity::SetBlendMode(), and impeller::Entity::SetTransform().
Referenced by impeller::DlDispatcherBase::drawPoints().
Definition at line 555 of file canvas.cc.
References impeller::PathBuilder::AddRect(), impeller::Paint::blend_mode, DrawPath(), GetCurrentTransform(), impeller::Paint::kStroke, impeller::Entity::SetBlendMode(), impeller::Entity::SetTransform(), and impeller::Paint::style.
Referenced by impeller::DlDispatcherBase::drawRect(), and impeller::DlDispatcherBase::SimplifyOrDrawPath().
| void impeller::Canvas::DrawRRect | ( | const Rect & | rect, |
| const Size & | corner_radii, | ||
| const Paint & | paint | ||
| ) |
Definition at line 603 of file canvas.cc.
References impeller::PathBuilder::AddRoundedRect(), impeller::Paint::blend_mode, DrawPath(), GetCurrentTransform(), impeller::kConvex, impeller::Paint::kFill, impeller::Entity::SetBlendMode(), impeller::PathBuilder::SetBounds(), impeller::PathBuilder::SetConvexity(), impeller::Entity::SetTransform(), impeller::Paint::style, and impeller::PathBuilder::TakePath().
Referenced by impeller::DlDispatcherBase::drawRRect(), and impeller::DlDispatcherBase::SimplifyOrDrawPath().
| void impeller::Canvas::DrawTextFrame | ( | const std::shared_ptr< TextFrame > & | text_frame, |
| Point | position, | ||
| const Paint & | paint | ||
| ) |
Definition at line 1309 of file canvas.cc.
References impeller::Paint::blend_mode, impeller::Paint::color, GetCurrentTransform(), impeller::Paint::kStroke, impeller::Matrix::MakeTranslation(), impeller::Paint::mask_blur_descriptor, impeller::Entity::SetBlendMode(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), impeller::Paint::stroke_cap, impeller::Paint::stroke_join, impeller::Paint::stroke_miter, impeller::Paint::stroke_width, impeller::Paint::style, impeller::Paint::WithFilters(), and impeller::Paint::WithMaskBlur().
Referenced by impeller::DlDispatcherBase::drawTextFrame().
| void impeller::Canvas::DrawVertices | ( | const std::shared_ptr< VerticesGeometry > & | vertices, |
| BlendMode | blend_mode, | ||
| const Paint & | paint | ||
| ) |
Definition at line 758 of file canvas.cc.
References impeller::Color::alpha, impeller::Paint::blend_mode, impeller::Paint::color, impeller::Paint::color_source, GetCurrentTransform(), impeller::kDestination, impeller::Geometry::MakeRect(), impeller::TRect< Scalar >::MakeXYWH(), impeller::TRect< Scalar >::Round(), impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), impeller::skia_conversions::ToMatrix(), impeller::skia_conversions::ToSamplerDescriptor(), impeller::Color::WithAlpha(), and impeller::Paint::WithFilters().
Referenced by impeller::CanvasDlDispatcher::drawVertices().
| void impeller::Canvas::EndReplay | ( | ) |
Definition at line 1639 of file canvas.cc.
Referenced by impeller::CanvasDlDispatcher::FinishRecording().
| const Matrix & impeller::Canvas::GetCurrentTransform | ( | ) | const |
Definition at line 331 of file canvas.cc.
Referenced by ClipGeometry(), Concat(), DrawAtlas(), DrawCircle(), impeller::DlDispatcherBase::drawDisplayList(), DrawImageRect(), DrawLine(), DrawOval(), DrawPaint(), DrawPath(), DrawPoints(), DrawRect(), DrawRRect(), impeller::DlDispatcherBase::drawShadow(), DrawTextFrame(), DrawVertices(), PreConcat(), and Restore().
| std::optional< Rect > impeller::Canvas::GetLocalCoverageLimit | ( | ) | const |
Return the culling bounds of the current render target, or nullopt if there is no coverage.
Definition at line 951 of file canvas.cc.
References impeller::EntityPassClipStack::CurrentClipCoverage(), impeller::RenderTarget::GetRenderTargetSize(), impeller::EntityPassClipStack::HasCoverage(), impeller::TRect< T >::Intersection(), impeller::TRect< Scalar >::MakeOriginSize(), and impeller::TRect< Scalar >::MakeSize().
Referenced by impeller::DlDispatcherBase::drawDisplayList(), and SaveLayer().
|
inline |
|
inline |
| size_t impeller::Canvas::GetSaveCount | ( | ) | const |
Definition at line 370 of file canvas.cc.
Referenced by impeller::DlDispatcherBase::drawDisplayList(), and RestoreToCount().
| void impeller::Canvas::PreConcat | ( | const Matrix & | transform | ) |
Definition at line 319 of file canvas.cc.
References GetCurrentTransform(), and transform.
Referenced by impeller::DlDispatcherBase::drawShadow().
| void impeller::Canvas::ResetTransform | ( | ) |
Definition at line 323 of file canvas.cc.
Referenced by impeller::DlDispatcherBase::transformReset().
| bool impeller::Canvas::Restore | ( | ) |
Definition at line 1134 of file canvas.cc.
References impeller::EntityPassClipStack::ApplyClipState(), impeller::Paint::blend_mode, impeller::EntityPassClipStack::ClipStateResult::clip_did_change, impeller::Contents::ClipCoverage::coverage, impeller::Canvas::SaveLayerState::coverage, impeller::EntityPassClipStack::CurrentClipCoverage(), impeller::Entity::GetBlendMode(), impeller::Entity::GetClipCoverage(), impeller::Entity::GetContents(), impeller::Entity::GetCoverage(), GetCurrentTransform(), impeller::ContentContext::GetDeviceCapabilities(), impeller::TRect< T >::GetOrigin(), impeller::Entity::GetTransform(), impeller::Matrix::Invert(), impeller::Entity::kLastPipelineBlendMode, impeller::kSource, impeller::Entity::kSubpassAppendSnapshotTransform, impeller::Entity::kSubpassPrependSnapshotTransform, impeller::FilterInput::Make(), impeller::ColorFilterContents::MakeBlend(), impeller::Matrix::MakeTranslation(), impeller::Canvas::SaveLayerState::paint, impeller::EntityPassClipStack::PopSubpass(), impeller::Entity::Render(), impeller::Entity::SetBlendMode(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), impeller::EntityPassClipStack::ClipStateResult::should_render, and impeller::Capabilities::SupportsFramebufferFetch().
Referenced by impeller::DlDispatcherBase::drawShadow(), impeller::DlDispatcherBase::restore(), and RestoreToCount().
| void impeller::Canvas::RestoreToCount | ( | size_t | count | ) |
Definition at line 378 of file canvas.cc.
References GetSaveCount(), and Restore().
Referenced by impeller::DlDispatcherBase::drawDisplayList().
| void impeller::Canvas::Rotate | ( | Radians | radians | ) |
Definition at line 351 of file canvas.cc.
References Concat(), and impeller::Matrix::MakeRotationZ().
Referenced by impeller::DlDispatcherBase::rotate().
| void impeller::Canvas::Save | ( | uint32_t | total_content_depth = kMaxDepth | ) |
Definition at line 934 of file canvas.cc.
References impeller::Entity::kDirect, and impeller::CanvasStackEntry::transform.
Referenced by impeller::DlDispatcherBase::drawDisplayList(), impeller::DlDispatcherBase::drawShadow(), impeller::DlDispatcherBase::save(), and SaveLayer().
| void impeller::Canvas::SaveLayer | ( | const Paint & | paint, |
| std::optional< Rect > | bounds = std::nullopt, |
||
| const flutter::DlImageFilter * | backdrop_filter = nullptr, |
||
| ContentBoundsPromise | bounds_promise = ContentBoundsPromise::kUnknown, |
||
| uint32_t | total_content_depth = kMaxDepth, |
||
| bool | can_distribute_opacity = false |
||
| ) |
Definition at line 982 of file canvas.cc.
References impeller::Color::alpha, impeller::Color::BlackTransparent(), impeller::Paint::blend_mode, impeller::Paint::CanApplyOpacityPeephole(), impeller::CanvasStackEntry::clip_depth, impeller::CanvasStackEntry::clip_height, impeller::Paint::color, impeller::ComputeSaveLayerCoverage(), impeller::CanvasStackEntry::did_round_out, impeller::ContentContext::GetContext(), GetLocalCoverageLimit(), impeller::Paint::image_filter, impeller::Entity::IsBlendModeDestructive(), impeller::kMayClipContents, impeller::Entity::kSubpassAppendSnapshotTransform, impeller::Entity::kSubpassPrependSnapshotTransform, impeller::FilterInput::Make(), impeller::TRect< Scalar >::MakeMaximum(), impeller::Matrix::MakeTranslation(), impeller::EntityPassClipStack::PushSubpass(), impeller::Entity::Render(), impeller::CanvasStackEntry::rendering_mode, impeller::TRect< T >::RoundOut(), Save(), impeller::Entity::SetClipDepth(), impeller::Entity::SetContents(), impeller::Entity::SetTransform(), subpass_size, impeller::CanvasStackEntry::transform, impeller::Paint::WithImageFilter(), and impeller::WrapInput().
Referenced by impeller::DlDispatcherBase::drawDisplayList(), and impeller::DlDispatcherBase::saveLayer().
| void impeller::Canvas::Scale | ( | const Vector2 & | scale | ) |
Definition at line 339 of file canvas.cc.
References Concat(), impeller::Matrix::MakeScale(), and scale.
Referenced by impeller::DlDispatcherBase::scale().
| void impeller::Canvas::Scale | ( | const Vector3 & | scale | ) |
Definition at line 343 of file canvas.cc.
References Concat(), impeller::Matrix::MakeScale(), and scale.
Definition at line 347 of file canvas.cc.
References Concat(), and impeller::Matrix::MakeSkew().
Referenced by impeller::DlDispatcherBase::skew().
| void impeller::Canvas::Transform | ( | const Matrix & | transform | ) |
Definition at line 327 of file canvas.cc.
References Concat(), and transform.
Referenced by impeller::DlDispatcherBase::transformFullPerspective(), and impeller::DlDispatcherBase::transformReset().
| void impeller::Canvas::Translate | ( | const Vector3 & | offset | ) |
Definition at line 335 of file canvas.cc.
References Concat(), impeller::Matrix::MakeTranslation(), and offset.
Referenced by impeller::DlDispatcherBase::translate().
|
staticconstexpr |