Flutter Impeller
impeller::DlDispatcherBase Class Referenceabstract

#include <dl_dispatcher.h>

Inheritance diagram for impeller::DlDispatcherBase:
impeller::DlDispatcher impeller::ExperimentalDlDispatcher

Public Member Functions

Picture EndRecordingAsPicture ()
 
bool PrefersImpellerPaths () const override
 
void setAntiAlias (bool aa) override
 
void setDrawStyle (flutter::DlDrawStyle style) override
 
void setColor (flutter::DlColor color) override
 
void setStrokeWidth (SkScalar width) override
 
void setStrokeMiter (SkScalar limit) override
 
void setStrokeCap (flutter::DlStrokeCap cap) override
 
void setStrokeJoin (flutter::DlStrokeJoin join) override
 
void setColorSource (const flutter::DlColorSource *source) override
 
void setColorFilter (const flutter::DlColorFilter *filter) override
 
void setInvertColors (bool invert) override
 
void setBlendMode (flutter::DlBlendMode mode) override
 
void setMaskFilter (const flutter::DlMaskFilter *filter) override
 
void setImageFilter (const flutter::DlImageFilter *filter) override
 
void save (uint32_t total_content_depth) override
 
void saveLayer (const SkRect &bounds, const flutter::SaveLayerOptions &options, uint32_t total_content_depth, flutter::DlBlendMode max_content_mode, const flutter::DlImageFilter *backdrop) override
 
void restore () override
 
void translate (SkScalar tx, SkScalar ty) override
 
void scale (SkScalar sx, SkScalar sy) override
 
void rotate (SkScalar degrees) override
 
void skew (SkScalar sx, SkScalar sy) override
 
void transform2DAffine (SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt) override
 
void transformFullPerspective (SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt, SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt, SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) override
 
void transformReset () override
 
void clipRect (const SkRect &rect, ClipOp clip_op, bool is_aa) override
 
void clipRRect (const SkRRect &rrect, ClipOp clip_op, bool is_aa) override
 
void clipPath (const SkPath &path, ClipOp clip_op, bool is_aa) override
 
void clipPath (const CacheablePath &cache, ClipOp clip_op, bool is_aa) override
 
void drawColor (flutter::DlColor color, flutter::DlBlendMode mode) override
 
void drawPaint () override
 
void drawLine (const SkPoint &p0, const SkPoint &p1) override
 
void drawDashedLine (const DlPoint &p0, const DlPoint &p1, DlScalar on_length, DlScalar off_length) override
 
void drawRect (const SkRect &rect) override
 
void drawOval (const SkRect &bounds) override
 
void drawCircle (const SkPoint &center, SkScalar radius) override
 
void drawRRect (const SkRRect &rrect) override
 
void drawDRRect (const SkRRect &outer, const SkRRect &inner) override
 
void drawPath (const SkPath &path) override
 
void drawPath (const CacheablePath &cache) override
 
void drawArc (const SkRect &oval_bounds, SkScalar start_degrees, SkScalar sweep_degrees, bool use_center) override
 
void drawPoints (PointMode mode, uint32_t count, const SkPoint points[]) override
 
void drawVertices (const std::shared_ptr< flutter::DlVertices > &vertices, flutter::DlBlendMode dl_mode) override
 
void drawImage (const sk_sp< flutter::DlImage > image, const SkPoint point, flutter::DlImageSampling sampling, bool render_with_attributes) override
 
void drawImageRect (const sk_sp< flutter::DlImage > image, const SkRect &src, const SkRect &dst, flutter::DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint) override
 
void drawImageNine (const sk_sp< flutter::DlImage > image, const SkIRect &center, const SkRect &dst, flutter::DlFilterMode filter, bool render_with_attributes) override
 
void drawAtlas (const sk_sp< flutter::DlImage > atlas, const SkRSXform xform[], const SkRect tex[], const flutter::DlColor colors[], int count, flutter::DlBlendMode mode, flutter::DlImageSampling sampling, const SkRect *cull_rect, bool render_with_attributes) override
 
void drawDisplayList (const sk_sp< flutter::DisplayList > display_list, SkScalar opacity) override
 
void drawTextBlob (const sk_sp< SkTextBlob > blob, SkScalar x, SkScalar y) override
 
void drawTextFrame (const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y) override
 
void drawShadow (const SkPath &path, const flutter::DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
 
void drawShadow (const CacheablePath &cache, const flutter::DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
 
virtual CanvasGetCanvas ()=0
 

Detailed Description

Definition at line 23 of file dl_dispatcher.h.

Member Function Documentation

◆ clipPath() [1/2]

void impeller::DlDispatcherBase::clipPath ( const CacheablePath &  cache,
ClipOp  clip_op,
bool  is_aa 
)
override

Definition at line 767 of file dl_dispatcher.cc.

769  {
770  auto clip_op = ToClipOperation(sk_op);
771 
772  SkRect rect;
773  if (cache.sk_path.isRect(&rect)) {
774  GetCanvas().ClipRect(skia_conversions::ToRect(rect), clip_op);
775  } else if (cache.sk_path.isOval(&rect)) {
776  GetCanvas().ClipOval(skia_conversions::ToRect(rect), clip_op);
777  } else {
778  SkRRect rrect;
779  if (cache.sk_path.isRRect(&rrect) && rrect.isSimple()) {
781  skia_conversions::ToSize(rrect.getSimpleRadii()),
782  clip_op);
783  } else {
784  GetCanvas().ClipPath(GetOrCachePath(cache), clip_op);
785  }
786  }
787 }

References impeller::Canvas::ClipOval(), impeller::Canvas::ClipPath(), impeller::Canvas::ClipRect(), impeller::Canvas::ClipRRect(), GetCanvas(), impeller::ToClipOperation(), impeller::skia_conversions::ToRect(), and impeller::skia_conversions::ToSize().

◆ clipPath() [2/2]

void impeller::DlDispatcherBase::clipPath ( const SkPath &  path,
ClipOp  clip_op,
bool  is_aa 
)
override

Definition at line 755 of file dl_dispatcher.cc.

755  {
757 }

References UNIMPLEMENTED.

◆ clipRect()

void impeller::DlDispatcherBase::clipRect ( const SkRect &  rect,
ClipOp  clip_op,
bool  is_aa 
)
override

◆ clipRRect()

void impeller::DlDispatcherBase::clipRRect ( const SkRRect &  rrect,
ClipOp  clip_op,
bool  is_aa 
)
override

Definition at line 737 of file dl_dispatcher.cc.

739  {
740  auto clip_op = ToClipOperation(sk_op);
741  if (rrect.isRect()) {
742  GetCanvas().ClipRect(skia_conversions::ToRect(rrect.rect()), clip_op);
743  } else if (rrect.isOval()) {
744  GetCanvas().ClipOval(skia_conversions::ToRect(rrect.rect()), clip_op);
745  } else if (rrect.isSimple()) {
747  skia_conversions::ToSize(rrect.getSimpleRadii()),
748  clip_op);
749  } else {
750  GetCanvas().ClipPath(skia_conversions::ToPath(rrect), clip_op);
751  }
752 }

References impeller::Canvas::ClipOval(), impeller::Canvas::ClipPath(), impeller::Canvas::ClipRect(), impeller::Canvas::ClipRRect(), GetCanvas(), impeller::ToClipOperation(), impeller::skia_conversions::ToPath(), impeller::skia_conversions::ToRect(), and impeller::skia_conversions::ToSize().

◆ drawArc()

void impeller::DlDispatcherBase::drawArc ( const SkRect &  oval_bounds,
SkScalar  start_degrees,
SkScalar  sweep_degrees,
bool  use_center 
)
override

Definition at line 921 of file dl_dispatcher.cc.

924  {
925  PathBuilder builder;
926  builder.AddArc(skia_conversions::ToRect(oval_bounds), Degrees(start_degrees),
927  Degrees(sweep_degrees), use_center);
928  GetCanvas().DrawPath(builder.TakePath(), paint_);
929 }

References impeller::PathBuilder::AddArc(), impeller::Canvas::DrawPath(), GetCanvas(), impeller::PathBuilder::TakePath(), and impeller::skia_conversions::ToRect().

◆ drawAtlas()

void impeller::DlDispatcherBase::drawAtlas ( const sk_sp< flutter::DlImage >  atlas,
const SkRSXform  xform[],
const SkRect  tex[],
const flutter::DlColor  colors[],
int  count,
flutter::DlBlendMode  mode,
flutter::DlImageSampling  sampling,
const SkRect *  cull_rect,
bool  render_with_attributes 
)
override

Definition at line 1037 of file dl_dispatcher.cc.

1045  {
1046  GetCanvas().DrawAtlas(std::make_shared<Image>(atlas->impeller_texture()),
1047  skia_conversions::ToRSXForms(xform, count),
1048  skia_conversions::ToRects(tex, count),
1049  ToColors(colors, count), ToBlendMode(mode),
1050  ToSamplerDescriptor(sampling),
1051  skia_conversions::ToRect(cull_rect), paint_);
1052 }

References impeller::Canvas::DrawAtlas(), GetCanvas(), impeller::ToBlendMode(), impeller::ToColors(), impeller::skia_conversions::ToRect(), impeller::skia_conversions::ToRects(), impeller::skia_conversions::ToRSXForms(), and impeller::ToSamplerDescriptor().

◆ drawCircle()

void impeller::DlDispatcherBase::drawCircle ( const SkPoint &  center,
SkScalar  radius 
)
override

Definition at line 859 of file dl_dispatcher.cc.

859  {
860  GetCanvas().DrawCircle(skia_conversions::ToPoint(center), radius, paint_);
861 }

References impeller::Canvas::DrawCircle(), GetCanvas(), and impeller::skia_conversions::ToPoint().

◆ drawColor()

void impeller::DlDispatcherBase::drawColor ( flutter::DlColor  color,
flutter::DlBlendMode  mode 
)
override

Definition at line 790 of file dl_dispatcher.cc.

791  {
792  Paint paint;
794  paint.blend_mode = ToBlendMode(dl_mode);
796 }

References color, impeller::Canvas::DrawPaint(), GetCanvas(), paint, impeller::ToBlendMode(), and impeller::skia_conversions::ToColor().

◆ drawDashedLine()

void impeller::DlDispatcherBase::drawDashedLine ( const DlPoint p0,
const DlPoint p1,
DlScalar  on_length,
DlScalar  off_length 
)
override

Definition at line 809 of file dl_dispatcher.cc.

812  {
813  Scalar length = p0.GetDistance(p1);
814  // Reasons to defer to regular DrawLine:
815  // length is non-positive - drawLine will draw appropriate "dot"
816  // off_length is non-positive - no gaps, drawLine will draw it solid
817  // on_length is negative - invalid dashing
818  // Note that a 0 length "on" dash will draw "dot"s every "off" distance apart
819  if (length > 0.0f && on_length >= 0.0f && off_length > 0.0f) {
820  Point delta = (p1 - p0) / length; // length > 0 already tested
821  PathBuilder builder;
822 
823  Scalar consumed = 0.0f;
824  while (consumed < length) {
825  builder.MoveTo(p0 + delta * consumed);
826 
827  Scalar dash_end = consumed + on_length;
828  if (dash_end < length) {
829  builder.LineTo(p0 + delta * dash_end);
830  } else {
831  builder.LineTo(p1);
832  // Should happen anyway due to the math, but let's make it explicit
833  // in case of bit errors. We're done with this line.
834  break;
835  }
836 
837  consumed = dash_end + off_length;
838  }
839 
840  Paint stroke_paint = paint_;
841  stroke_paint.style = Paint::Style::kStroke;
842  GetCanvas().DrawPath(builder.TakePath(), stroke_paint);
843  } else {
844  drawLine(flutter::ToSkPoint(p0), flutter::ToSkPoint(p1));
845  }
846 }

References drawLine(), impeller::Canvas::DrawPath(), GetCanvas(), impeller::Paint::kStroke, impeller::PathBuilder::LineTo(), impeller::PathBuilder::MoveTo(), impeller::Paint::style, and impeller::PathBuilder::TakePath().

◆ drawDisplayList()

void impeller::DlDispatcherBase::drawDisplayList ( const sk_sp< flutter::DisplayList >  display_list,
SkScalar  opacity 
)
override

Definition at line 1055 of file dl_dispatcher.cc.

1057  {
1058  // Save all values that must remain untouched after the operation.
1059  Paint saved_paint = paint_;
1060  Matrix saved_initial_matrix = initial_matrix_;
1061 
1062  // Establish a new baseline for interpreting the new DL.
1063  // Matrix and clip are left untouched, the current
1064  // transform is saved as the new base matrix, and paint
1065  // values are reset to defaults.
1066  initial_matrix_ = GetCanvas().GetCurrentTransform();
1067  paint_ = Paint();
1068 
1069  // Handle passed opacity in the most brute-force way by using
1070  // a SaveLayer. If the display_list is able to inherit the
1071  // opacity, this could also be handled by modulating all of its
1072  // attribute settings (for example, color), by the indicated
1073  // opacity.
1074  int restore_count = GetCanvas().GetSaveCount();
1075  if (opacity < SK_Scalar1) {
1076  Paint save_paint;
1077  save_paint.color = Color(0, 0, 0, opacity);
1078  GetCanvas().SaveLayer(
1079  save_paint, skia_conversions::ToRect(display_list->bounds()), nullptr,
1080  ContentBoundsPromise::kContainsContents, display_list->total_depth(),
1081  display_list->can_apply_group_opacity());
1082  } else {
1083  // The display list may alter the clip, which must be restored to the
1084  // current clip at the end of playback.
1085  GetCanvas().Save(display_list->total_depth());
1086  }
1087 
1088  // TODO(131445): Remove this restriction if we can correctly cull with
1089  // perspective transforms.
1090  if (display_list->has_rtree() && !initial_matrix_.HasPerspective()) {
1091  // The canvas remembers the screen-space culling bounds clipped by
1092  // the surface and the history of clip calls. DisplayList can cull
1093  // the ops based on a rectangle expressed in its "destination bounds"
1094  // so we need the canvas to transform those into the current local
1095  // coordinate space into which the DisplayList will be rendered.
1096  auto cull_bounds = GetCanvas().GetCurrentLocalCullingBounds();
1097  if (cull_bounds.has_value()) {
1098  Rect cull_rect = cull_bounds.value();
1099  display_list->Dispatch(
1100  *this, SkRect::MakeLTRB(cull_rect.GetLeft(), cull_rect.GetTop(),
1101  cull_rect.GetRight(), cull_rect.GetBottom()));
1102  } else {
1103  display_list->Dispatch(*this);
1104  }
1105  } else {
1106  display_list->Dispatch(*this);
1107  }
1108 
1109  // Restore all saved state back to what it was before we interpreted
1110  // the display_list
1111  GetCanvas().RestoreToCount(restore_count);
1112  initial_matrix_ = saved_initial_matrix;
1113  paint_ = saved_paint;
1114 }

References impeller::Paint::color, impeller::TRect< T >::GetBottom(), GetCanvas(), impeller::Canvas::GetCurrentLocalCullingBounds(), impeller::Canvas::GetCurrentTransform(), impeller::TRect< T >::GetLeft(), impeller::TRect< T >::GetRight(), impeller::Canvas::GetSaveCount(), impeller::TRect< T >::GetTop(), impeller::Matrix::HasPerspective(), impeller::kContainsContents, impeller::Canvas::RestoreToCount(), impeller::Canvas::Save(), impeller::Canvas::SaveLayer(), and impeller::skia_conversions::ToRect().

Referenced by impeller::testing::TEST_P().

◆ drawDRRect()

void impeller::DlDispatcherBase::drawDRRect ( const SkRRect &  outer,
const SkRRect &  inner 
)
override

Definition at line 875 of file dl_dispatcher.cc.

875  {
876  PathBuilder builder;
877  builder.AddPath(skia_conversions::ToPath(outer));
878  builder.AddPath(skia_conversions::ToPath(inner));
879  GetCanvas().DrawPath(builder.TakePath(FillType::kOdd), paint_);
880 }

References impeller::PathBuilder::AddPath(), impeller::Canvas::DrawPath(), GetCanvas(), impeller::kOdd, impeller::PathBuilder::TakePath(), and impeller::skia_conversions::ToPath().

◆ drawImage()

void impeller::DlDispatcherBase::drawImage ( const sk_sp< flutter::DlImage >  image,
const SkPoint  point,
flutter::DlImageSampling  sampling,
bool  render_with_attributes 
)
override

Definition at line 978 of file dl_dispatcher.cc.

981  {
982  if (!image) {
983  return;
984  }
985 
986  auto texture = image->impeller_texture();
987  if (!texture) {
988  return;
989  }
990 
991  const auto size = texture->GetSize();
992  const auto src = SkRect::MakeWH(size.width, size.height);
993  const auto dest =
994  SkRect::MakeXYWH(point.fX, point.fY, size.width, size.height);
995 
996  drawImageRect(image, // image
997  src, // source rect
998  dest, // destination rect
999  sampling, // sampling options
1000  render_with_attributes, // render with attributes
1001  SrcRectConstraint::kStrict // constraint
1002  );
1003 }

References drawImageRect().

◆ drawImageNine()

void impeller::DlDispatcherBase::drawImageNine ( const sk_sp< flutter::DlImage >  image,
const SkIRect &  center,
const SkRect &  dst,
flutter::DlFilterMode  filter,
bool  render_with_attributes 
)
override

Definition at line 1023 of file dl_dispatcher.cc.

1027  {
1028  NinePatchConverter converter = {};
1029  converter.DrawNinePatch(
1030  std::make_shared<Image>(image->impeller_texture()),
1031  Rect::MakeLTRB(center.fLeft, center.fTop, center.fRight, center.fBottom),
1033  &paint_);
1034 }

References impeller::NinePatchConverter::DrawNinePatch(), GetCanvas(), impeller::TRect< Scalar >::MakeLTRB(), impeller::skia_conversions::ToRect(), and impeller::ToSamplerDescriptor().

◆ drawImageRect()

void impeller::DlDispatcherBase::drawImageRect ( const sk_sp< flutter::DlImage >  image,
const SkRect &  src,
const SkRect &  dst,
flutter::DlImageSampling  sampling,
bool  render_with_attributes,
SrcRectConstraint  constraint = SrcRectConstraint::kFast 
)
override

Definition at line 1006 of file dl_dispatcher.cc.

1012  {
1014  std::make_shared<Image>(image->impeller_texture()), // image
1015  skia_conversions::ToRect(src), // source rect
1016  skia_conversions::ToRect(dst), // destination rect
1017  render_with_attributes ? paint_ : Paint(), // paint
1018  ToSamplerDescriptor(sampling) // sampling
1019  );
1020 }

References impeller::Canvas::DrawImageRect(), GetCanvas(), impeller::skia_conversions::ToRect(), and impeller::ToSamplerDescriptor().

Referenced by drawImage().

◆ drawLine()

void impeller::DlDispatcherBase::drawLine ( const SkPoint &  p0,
const SkPoint &  p1 
)
override

Definition at line 804 of file dl_dispatcher.cc.

804  {
806  skia_conversions::ToPoint(p1), paint_);
807 }

References impeller::Canvas::DrawLine(), GetCanvas(), and impeller::skia_conversions::ToPoint().

Referenced by drawDashedLine().

◆ drawOval()

void impeller::DlDispatcherBase::drawOval ( const SkRect &  bounds)
override

Definition at line 854 of file dl_dispatcher.cc.

854  {
855  GetCanvas().DrawOval(skia_conversions::ToRect(bounds), paint_);
856 }

References impeller::Canvas::DrawOval(), GetCanvas(), and impeller::skia_conversions::ToRect().

◆ drawPaint()

void impeller::DlDispatcherBase::drawPaint ( )
override

Definition at line 799 of file dl_dispatcher.cc.

799  {
800  GetCanvas().DrawPaint(paint_);
801 }

References impeller::Canvas::DrawPaint(), and GetCanvas().

◆ drawPath() [1/2]

void impeller::DlDispatcherBase::drawPath ( const CacheablePath &  cache)
override

Definition at line 888 of file dl_dispatcher.cc.

888  {
889  SimplifyOrDrawPath(GetCanvas(), cache, paint_);
890 }

References GetCanvas().

◆ drawPath() [2/2]

void impeller::DlDispatcherBase::drawPath ( const SkPath &  path)
override

Definition at line 883 of file dl_dispatcher.cc.

883  {
885 }

References UNIMPLEMENTED.

◆ drawPoints()

void impeller::DlDispatcherBase::drawPoints ( PointMode  mode,
uint32_t  count,
const SkPoint  points[] 
)
override

Definition at line 932 of file dl_dispatcher.cc.

934  {
935  Paint paint = paint_;
937  switch (mode) {
938  case flutter::DlCanvas::PointMode::kPoints: {
939  // Cap::kButt is also treated as a square.
940  auto point_style = paint.stroke_cap == Cap::kRound ? PointStyle::kRound
942  auto radius = paint.stroke_width;
943  if (radius > 0) {
944  radius /= 2.0;
945  }
946  GetCanvas().DrawPoints(skia_conversions::ToPoints(points, count), radius,
947  paint, point_style);
948  } break;
949  case flutter::DlCanvas::PointMode::kLines:
950  for (uint32_t i = 1; i < count; i += 2) {
951  Point p0 = skia_conversions::ToPoint(points[i - 1]);
952  Point p1 = skia_conversions::ToPoint(points[i]);
953  GetCanvas().DrawLine(p0, p1, paint);
954  }
955  break;
956  case flutter::DlCanvas::PointMode::kPolygon:
957  if (count > 1) {
958  Point p0 = skia_conversions::ToPoint(points[0]);
959  for (uint32_t i = 1; i < count; i++) {
960  Point p1 = skia_conversions::ToPoint(points[i]);
961  GetCanvas().DrawLine(p0, p1, paint);
962  p0 = p1;
963  }
964  }
965  break;
966  }
967 }

References impeller::Canvas::DrawLine(), impeller::Canvas::DrawPoints(), GetCanvas(), impeller::kRound, impeller::kSquare, impeller::Paint::kStroke, paint, impeller::skia_conversions::ToPoint(), and impeller::skia_conversions::ToPoints().

◆ drawRect()

void impeller::DlDispatcherBase::drawRect ( const SkRect &  rect)
override

Definition at line 849 of file dl_dispatcher.cc.

849  {
851 }

References impeller::Canvas::DrawRect(), GetCanvas(), and impeller::skia_conversions::ToRect().

◆ drawRRect()

void impeller::DlDispatcherBase::drawRRect ( const SkRRect &  rrect)
override

◆ drawShadow() [1/2]

void impeller::DlDispatcherBase::drawShadow ( const CacheablePath &  cache,
const flutter::DlColor  color,
const SkScalar  elevation,
bool  transparent_occluder,
SkScalar  dpr 
)
override

Definition at line 1145 of file dl_dispatcher.cc.

1149  {
1150  Color spot_color = skia_conversions::ToColor(color);
1151  spot_color.alpha *= 0.25;
1152 
1153  // Compute the spot color -- ported from SkShadowUtils::ComputeTonalColors.
1154  {
1155  Scalar max =
1156  std::max(std::max(spot_color.red, spot_color.green), spot_color.blue);
1157  Scalar min =
1158  std::min(std::min(spot_color.red, spot_color.green), spot_color.blue);
1159  Scalar luminance = (min + max) * 0.5;
1160 
1161  Scalar alpha_adjust =
1162  (2.6f + (-2.66667f + 1.06667f * spot_color.alpha) * spot_color.alpha) *
1163  spot_color.alpha;
1164  Scalar color_alpha =
1165  (3.544762f + (-4.891428f + 2.3466f * luminance) * luminance) *
1166  luminance;
1167  color_alpha = std::clamp(alpha_adjust * color_alpha, 0.0f, 1.0f);
1168 
1169  Scalar greyscale_alpha =
1170  std::clamp(spot_color.alpha * (1 - 0.4f * luminance), 0.0f, 1.0f);
1171 
1172  Scalar color_scale = color_alpha * (1 - greyscale_alpha);
1173  Scalar tonal_alpha = color_scale + greyscale_alpha;
1174  Scalar unpremul_scale = tonal_alpha != 0 ? color_scale / tonal_alpha : 0;
1175  spot_color = Color(unpremul_scale * spot_color.red,
1176  unpremul_scale * spot_color.green,
1177  unpremul_scale * spot_color.blue, tonal_alpha);
1178  }
1179 
1180  Vector3 light_position(0, -1, 1);
1181  Scalar occluder_z = dpr * elevation;
1182 
1183  constexpr Scalar kLightRadius = 800 / 600; // Light radius / light height
1184 
1185  Paint paint;
1186  paint.style = Paint::Style::kFill;
1187  paint.color = spot_color;
1188  paint.mask_blur_descriptor = Paint::MaskBlurDescriptor{
1190  .sigma = Radius{kLightRadius * occluder_z /
1192  };
1193 
1194  GetCanvas().Save(1u);
1195  GetCanvas().PreConcat(
1196  Matrix::MakeTranslation(Vector2(0, -occluder_z * light_position.y)));
1197 
1198  SimplifyOrDrawPath(GetCanvas(), cache, paint);
1199 
1200  GetCanvas().Restore();
1201 }

References impeller::Color::alpha, impeller::Color::blue, color, GetCanvas(), impeller::Canvas::GetCurrentTransform(), impeller::Matrix::GetScale(), impeller::Color::green, impeller::Paint::kFill, impeller::FilterContents::kNormal, impeller::Matrix::MakeTranslation(), paint, impeller::Canvas::PreConcat(), impeller::Color::red, impeller::Canvas::Restore(), impeller::Canvas::Save(), impeller::Paint::MaskBlurDescriptor::style, impeller::skia_conversions::ToColor(), and impeller::Vector3::y.

◆ drawShadow() [2/2]

void impeller::DlDispatcherBase::drawShadow ( const SkPath &  path,
const flutter::DlColor  color,
const SkScalar  elevation,
bool  transparent_occluder,
SkScalar  dpr 
)
override

Definition at line 1136 of file dl_dispatcher.cc.

1140  {
1141  UNIMPLEMENTED;
1142 }

References UNIMPLEMENTED.

Referenced by impeller::testing::TEST_P().

◆ drawTextBlob()

void impeller::DlDispatcherBase::drawTextBlob ( const sk_sp< SkTextBlob >  blob,
SkScalar  x,
SkScalar  y 
)
override

Definition at line 1117 of file dl_dispatcher.cc.

1119  {
1120  // When running with Impeller enabled Skia text blobs are converted to
1121  // Impeller text frames in paragraph_skia.cc
1122  UNIMPLEMENTED;
1123 }

References UNIMPLEMENTED.

◆ drawTextFrame()

void impeller::DlDispatcherBase::drawTextFrame ( const std::shared_ptr< impeller::TextFrame > &  text_frame,
SkScalar  x,
SkScalar  y 
)
override

Definition at line 1125 of file dl_dispatcher.cc.

1128  {
1129  GetCanvas().DrawTextFrame(text_frame, //
1130  impeller::Point{x, y}, //
1131  paint_ //
1132  );
1133 }

References impeller::Canvas::DrawTextFrame(), and GetCanvas().

◆ drawVertices()

void impeller::DlDispatcherBase::drawVertices ( const std::shared_ptr< flutter::DlVertices > &  vertices,
flutter::DlBlendMode  dl_mode 
)
override

Definition at line 970 of file dl_dispatcher.cc.

972  {
973  GetCanvas().DrawVertices(MakeVertices(vertices), ToBlendMode(dl_mode),
974  paint_);
975 }

References impeller::Canvas::DrawVertices(), GetCanvas(), impeller::MakeVertices(), and impeller::ToBlendMode().

◆ EndRecordingAsPicture()

Picture impeller::DlDispatcherBase::EndRecordingAsPicture ( )

◆ GetCanvas()

◆ PrefersImpellerPaths()

bool impeller::DlDispatcherBase::PrefersImpellerPaths ( ) const
inlineoverride

Definition at line 28 of file dl_dispatcher.h.

28 { return true; }

◆ restore()

void impeller::DlDispatcherBase::restore ( )
override

Definition at line 641 of file dl_dispatcher.cc.

641  {
642  GetCanvas().Restore();
643 }

References GetCanvas(), and impeller::Canvas::Restore().

Referenced by impeller::testing::TEST_P().

◆ rotate()

void impeller::DlDispatcherBase::rotate ( SkScalar  degrees)
override

Definition at line 656 of file dl_dispatcher.cc.

656  {
657  GetCanvas().Rotate(Degrees{degrees});
658 }

References GetCanvas(), and impeller::Canvas::Rotate().

◆ save()

void impeller::DlDispatcherBase::save ( uint32_t  total_content_depth)
override

Definition at line 611 of file dl_dispatcher.cc.

611  {
612  GetCanvas().Save(total_content_depth);
613 }

References GetCanvas(), and impeller::Canvas::Save().

Referenced by impeller::DlDispatcher::save().

◆ saveLayer()

void impeller::DlDispatcherBase::saveLayer ( const SkRect &  bounds,
const flutter::SaveLayerOptions &  options,
uint32_t  total_content_depth,
flutter::DlBlendMode  max_content_mode,
const flutter::DlImageFilter *  backdrop 
)
override

Definition at line 619 of file dl_dispatcher.cc.

623  {
624  auto paint = options.renders_with_attributes() ? paint_ : Paint{};
625  auto promise = options.content_is_clipped()
628  std::optional<Rect> impeller_bounds;
629  if (bounds == kMaxCullRect) {
630  impeller_bounds = std::nullopt;
631  } else {
632  impeller_bounds = skia_conversions::ToRect(bounds);
633  }
634 
635  GetCanvas().SaveLayer(paint, impeller_bounds, ToImageFilter(backdrop),
636  promise, total_content_depth,
637  options.can_distribute_opacity());
638 }

References GetCanvas(), impeller::kContainsContents, impeller::kMaxCullRect, impeller::kMayClipContents, paint, impeller::Canvas::SaveLayer(), impeller::ToImageFilter(), and impeller::skia_conversions::ToRect().

Referenced by impeller::DlDispatcher::saveLayer().

◆ scale()

void impeller::DlDispatcherBase::scale ( SkScalar  sx,
SkScalar  sy 
)
override

Definition at line 651 of file dl_dispatcher.cc.

651  {
652  GetCanvas().Scale({sx, sy, 1.0});
653 }

References GetCanvas(), and impeller::Canvas::Scale().

Referenced by impeller::testing::TEST_P().

◆ setAntiAlias()

void impeller::DlDispatcherBase::setAntiAlias ( bool  aa)
override

Definition at line 173 of file dl_dispatcher.cc.

173  {
174  // Nothing to do because AA is implicit.
175 }

◆ setBlendMode()

void impeller::DlDispatcherBase::setBlendMode ( flutter::DlBlendMode  mode)
override

Definition at line 477 of file dl_dispatcher.cc.

477  {
478  paint_.blend_mode = ToBlendMode(dl_mode);
479 }

References impeller::Paint::blend_mode, and impeller::ToBlendMode().

◆ setColor()

void impeller::DlDispatcherBase::setColor ( flutter::DlColor  color)
override

Definition at line 196 of file dl_dispatcher.cc.

196  {
197  paint_.color = {
198  color.getRedF(),
199  color.getGreenF(),
200  color.getBlueF(),
201  color.getAlphaF(),
202  };
203 }

References color, and impeller::Paint::color.

Referenced by setColorSource().

◆ setColorFilter()

void impeller::DlDispatcherBase::setColorFilter ( const flutter::DlColorFilter *  filter)
override

Definition at line 467 of file dl_dispatcher.cc.

467  {
468  paint_.color_filter = ToColorFilter(filter);
469 }

References impeller::Paint::color_filter, and impeller::ToColorFilter().

◆ setColorSource()

void impeller::DlDispatcherBase::setColorSource ( const flutter::DlColorSource *  source)
override

Definition at line 281 of file dl_dispatcher.cc.

281  {
282  if (!source) {
284  return;
285  }
286 
287  std::optional<ColorSource::Type> type = ToColorSourceType(source->type());
288 
289  if (!type.has_value()) {
290  FML_LOG(ERROR) << "Requested ColorSourceType::kUnknown";
292  return;
293  }
294 
295  switch (type.value()) {
297  const flutter::DlColorColorSource* color = source->asColor();
298 
300  setColor(color->color());
301  FML_DCHECK(color);
302  return;
303  }
305  const flutter::DlLinearGradientColorSource* linear =
306  source->asLinearGradient();
307  FML_DCHECK(linear);
308  auto start_point = skia_conversions::ToPoint(linear->start_point());
309  auto end_point = skia_conversions::ToPoint(linear->end_point());
310  std::vector<Color> colors;
311  std::vector<float> stops;
312  skia_conversions::ConvertStops(linear, colors, stops);
313 
314  auto tile_mode = ToTileMode(linear->tile_mode());
315  auto matrix = ToMatrix(linear->matrix());
316 
318  start_point, end_point, std::move(colors), std::move(stops),
319  tile_mode, matrix);
320  return;
321  }
323  const flutter::DlConicalGradientColorSource* conical_gradient =
324  source->asConicalGradient();
325  FML_DCHECK(conical_gradient);
326  Point center = skia_conversions::ToPoint(conical_gradient->end_center());
327  SkScalar radius = conical_gradient->end_radius();
328  Point focus_center =
329  skia_conversions::ToPoint(conical_gradient->start_center());
330  SkScalar focus_radius = conical_gradient->start_radius();
331  std::vector<Color> colors;
332  std::vector<float> stops;
333  skia_conversions::ConvertStops(conical_gradient, colors, stops);
334 
335  auto tile_mode = ToTileMode(conical_gradient->tile_mode());
336  auto matrix = ToMatrix(conical_gradient->matrix());
337 
339  center, radius, std::move(colors), std::move(stops), focus_center,
340  focus_radius, tile_mode, matrix);
341  return;
342  }
344  const flutter::DlRadialGradientColorSource* radialGradient =
345  source->asRadialGradient();
346  FML_DCHECK(radialGradient);
347  auto center = skia_conversions::ToPoint(radialGradient->center());
348  auto radius = radialGradient->radius();
349  std::vector<Color> colors;
350  std::vector<float> stops;
351  skia_conversions::ConvertStops(radialGradient, colors, stops);
352 
353  auto tile_mode = ToTileMode(radialGradient->tile_mode());
354  auto matrix = ToMatrix(radialGradient->matrix());
355  paint_.color_source =
356  ColorSource::MakeRadialGradient(center, radius, std::move(colors),
357  std::move(stops), tile_mode, matrix);
358  return;
359  }
361  const flutter::DlSweepGradientColorSource* sweepGradient =
362  source->asSweepGradient();
363  FML_DCHECK(sweepGradient);
364 
365  auto center = skia_conversions::ToPoint(sweepGradient->center());
366  auto start_angle = Degrees(sweepGradient->start());
367  auto end_angle = Degrees(sweepGradient->end());
368  std::vector<Color> colors;
369  std::vector<float> stops;
370  skia_conversions::ConvertStops(sweepGradient, colors, stops);
371 
372  auto tile_mode = ToTileMode(sweepGradient->tile_mode());
373  auto matrix = ToMatrix(sweepGradient->matrix());
375  center, start_angle, end_angle, std::move(colors), std::move(stops),
376  tile_mode, matrix);
377  return;
378  }
380  const flutter::DlImageColorSource* image_color_source = source->asImage();
381  FML_DCHECK(image_color_source &&
382  image_color_source->image()->impeller_texture());
383  auto texture = image_color_source->image()->impeller_texture();
384  auto x_tile_mode = ToTileMode(image_color_source->horizontal_tile_mode());
385  auto y_tile_mode = ToTileMode(image_color_source->vertical_tile_mode());
386  auto desc = ToSamplerDescriptor(image_color_source->sampling());
387  auto matrix = ToMatrix(image_color_source->matrix());
388  paint_.color_source = ColorSource::MakeImage(texture, x_tile_mode,
389  y_tile_mode, desc, matrix);
390  return;
391  }
393  const flutter::DlRuntimeEffectColorSource* runtime_effect_color_source =
394  source->asRuntimeEffect();
395  auto runtime_stage =
396  runtime_effect_color_source->runtime_effect()->runtime_stage();
397  auto uniform_data = runtime_effect_color_source->uniform_data();
398  auto samplers = runtime_effect_color_source->samplers();
399 
400  std::vector<RuntimeEffectContents::TextureInput> texture_inputs;
401 
402  for (auto& sampler : samplers) {
403  if (sampler == nullptr) {
404  return;
405  }
406  auto* image = sampler->asImage();
407  if (!sampler->asImage()) {
409  return;
410  }
411  FML_DCHECK(image->image()->impeller_texture());
412  texture_inputs.push_back({
413  .sampler_descriptor = ToSamplerDescriptor(image->sampling()),
414  .texture = image->image()->impeller_texture(),
415  });
416  }
417 
419  runtime_stage, uniform_data, texture_inputs);
420  return;
421  }
423 #ifdef IMPELLER_ENABLE_3D
424  const flutter::DlSceneColorSource* scene_color_source = source->asScene();
425  std::shared_ptr<scene::Node> scene_node =
426  scene_color_source->scene_node();
427  Matrix camera_transform = scene_color_source->camera_matrix();
428 
429  paint_.color_source =
430  ColorSource::MakeScene(scene_node, camera_transform);
431 #else // IMPELLER_ENABLE_3D
432  FML_LOG(ERROR) << "ColorSourceType::kScene can only be used if Impeller "
433  "Scene is enabled.";
434 #endif // IMPELLER_ENABLE_3D
435  return;
436  }
437  }
438 }

References color, impeller::Paint::color_source, impeller::skia_conversions::ConvertStops(), impeller::ColorSource::kColor, impeller::ColorSource::kConicalGradient, impeller::ColorSource::kImage, impeller::ColorSource::kLinearGradient, impeller::ColorSource::kRadialGradient, impeller::ColorSource::kRuntimeEffect, impeller::ColorSource::kScene, impeller::ColorSource::kSweepGradient, impeller::ColorSource::MakeColor(), impeller::ColorSource::MakeConicalGradient(), impeller::ColorSource::MakeImage(), impeller::ColorSource::MakeLinearGradient(), impeller::ColorSource::MakeRadialGradient(), impeller::ColorSource::MakeRuntimeEffect(), impeller::ColorSource::MakeSweepGradient(), setColor(), impeller::ToColorSourceType(), impeller::ToMatrix(), impeller::skia_conversions::ToPoint(), impeller::ToSamplerDescriptor(), impeller::ToTileMode(), type, and UNIMPLEMENTED.

◆ setDrawStyle()

void impeller::DlDispatcherBase::setDrawStyle ( flutter::DlDrawStyle  style)
override

Definition at line 191 of file dl_dispatcher.cc.

191  {
192  paint_.style = ToStyle(style);
193 }

References impeller::Paint::style, and impeller::ToStyle().

◆ setImageFilter()

void impeller::DlDispatcherBase::setImageFilter ( const flutter::DlImageFilter *  filter)
override

Definition at line 606 of file dl_dispatcher.cc.

606  {
607  paint_.image_filter = ToImageFilter(filter);
608 }

References impeller::Paint::image_filter, and impeller::ToImageFilter().

◆ setInvertColors()

void impeller::DlDispatcherBase::setInvertColors ( bool  invert)
override

Definition at line 472 of file dl_dispatcher.cc.

472  {
473  paint_.invert_colors = invert;
474 }

References impeller::Paint::invert_colors.

◆ setMaskFilter()

void impeller::DlDispatcherBase::setMaskFilter ( const flutter::DlMaskFilter *  filter)
override

Definition at line 495 of file dl_dispatcher.cc.

495  {
496  // Needs https://github.com/flutter/flutter/issues/95434
497  if (filter == nullptr) {
498  paint_.mask_blur_descriptor = std::nullopt;
499  return;
500  }
501  switch (filter->type()) {
502  case flutter::DlMaskFilterType::kBlur: {
503  auto blur = filter->asBlur();
504 
505  paint_.mask_blur_descriptor = {
506  .style = ToBlurStyle(blur->style()),
507  .sigma = Sigma(blur->sigma()),
508  .respect_ctm = blur->respectCTM(),
509  };
510  break;
511  }
512  }
513 }

References impeller::Paint::mask_blur_descriptor, and impeller::ToBlurStyle().

◆ setStrokeCap()

void impeller::DlDispatcherBase::setStrokeCap ( flutter::DlStrokeCap  cap)
override

Definition at line 216 of file dl_dispatcher.cc.

216  {
217  switch (cap) {
218  case flutter::DlStrokeCap::kButt:
219  paint_.stroke_cap = Cap::kButt;
220  break;
221  case flutter::DlStrokeCap::kRound:
222  paint_.stroke_cap = Cap::kRound;
223  break;
224  case flutter::DlStrokeCap::kSquare:
225  paint_.stroke_cap = Cap::kSquare;
226  break;
227  }
228 }

References impeller::kButt, impeller::kRound, impeller::kSquare, and impeller::Paint::stroke_cap.

◆ setStrokeJoin()

void impeller::DlDispatcherBase::setStrokeJoin ( flutter::DlStrokeJoin  join)
override

Definition at line 231 of file dl_dispatcher.cc.

231  {
232  switch (join) {
233  case flutter::DlStrokeJoin::kMiter:
234  paint_.stroke_join = Join::kMiter;
235  break;
236  case flutter::DlStrokeJoin::kRound:
237  paint_.stroke_join = Join::kRound;
238  break;
239  case flutter::DlStrokeJoin::kBevel:
240  paint_.stroke_join = Join::kBevel;
241  break;
242  }
243 }

References impeller::kBevel, impeller::kMiter, impeller::kRound, and impeller::Paint::stroke_join.

◆ setStrokeMiter()

void impeller::DlDispatcherBase::setStrokeMiter ( SkScalar  limit)
override

Definition at line 211 of file dl_dispatcher.cc.

211  {
212  paint_.stroke_miter = limit;
213 }

References impeller::Paint::stroke_miter.

◆ setStrokeWidth()

void impeller::DlDispatcherBase::setStrokeWidth ( SkScalar  width)
override

Definition at line 206 of file dl_dispatcher.cc.

206  {
207  paint_.stroke_width = width;
208 }

References impeller::Paint::stroke_width.

◆ skew()

void impeller::DlDispatcherBase::skew ( SkScalar  sx,
SkScalar  sy 
)
override

Definition at line 661 of file dl_dispatcher.cc.

661  {
662  GetCanvas().Skew(sx, sy);
663 }

References GetCanvas(), and impeller::Canvas::Skew().

◆ transform2DAffine()

void impeller::DlDispatcherBase::transform2DAffine ( SkScalar  mxx,
SkScalar  mxy,
SkScalar  mxt,
SkScalar  myx,
SkScalar  myy,
SkScalar  myt 
)
override

Definition at line 666 of file dl_dispatcher.cc.

671  {
672  // clang-format off
674  mxx, mxy, 0, mxt,
675  myx, myy, 0, myt,
676  0 , 0, 1, 0,
677  0 , 0, 0, 1
678  );
679  // clang-format on
680 }

References transformFullPerspective().

◆ transformFullPerspective()

void impeller::DlDispatcherBase::transformFullPerspective ( SkScalar  mxx,
SkScalar  mxy,
SkScalar  mxz,
SkScalar  mxt,
SkScalar  myx,
SkScalar  myy,
SkScalar  myz,
SkScalar  myt,
SkScalar  mzx,
SkScalar  mzy,
SkScalar  mzz,
SkScalar  mzt,
SkScalar  mwx,
SkScalar  mwy,
SkScalar  mwz,
SkScalar  mwt 
)
override

Definition at line 683 of file dl_dispatcher.cc.

698  {
699  // The order of arguments is row-major but Impeller matrices are
700  // column-major.
701  // clang-format off
702  auto transform = Matrix{
703  mxx, myx, mzx, mwx,
704  mxy, myy, mzy, mwy,
705  mxz, myz, mzz, mwz,
706  mxt, myt, mzt, mwt
707  };
708  // clang-format on
710 }

References GetCanvas(), impeller::Canvas::Transform(), and transform.

Referenced by impeller::testing::TEST_P(), and transform2DAffine().

◆ transformReset()

void impeller::DlDispatcherBase::transformReset ( )
override

Definition at line 713 of file dl_dispatcher.cc.

713  {
715  GetCanvas().Transform(initial_matrix_);
716 }

References GetCanvas(), impeller::Canvas::ResetTransform(), and impeller::Canvas::Transform().

◆ translate()

void impeller::DlDispatcherBase::translate ( SkScalar  tx,
SkScalar  ty 
)
override

Definition at line 646 of file dl_dispatcher.cc.

646  {
647  GetCanvas().Translate({tx, ty, 0.0});
648 }

References GetCanvas(), and impeller::Canvas::Translate().

Referenced by impeller::testing::TEST_P().


The documentation for this class was generated from the following files:
impeller::Paint::stroke_cap
Cap stroke_cap
Definition: paint.h:72
impeller::Matrix::HasPerspective
constexpr bool HasPerspective() const
Definition: matrix.h:330
impeller::Canvas::DrawPoints
void DrawPoints(std::vector< Point > points, Scalar radius, const Paint &paint, PointStyle point_style)
Definition: canvas.cc:733
impeller::Canvas::EndRecordingAsPicture
Picture EndRecordingAsPicture()
Definition: canvas.cc:804
impeller::Canvas::ClipOval
void ClipOval(const Rect &bounds, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:620
impeller::ColorSource::Type::kScene
@ kScene
impeller::ColorSource::Type::kLinearGradient
@ kLinearGradient
impeller::ToClipOperation
static Entity::ClipOperation ToClipOperation(flutter::DlCanvas::ClipOp clip_op)
Definition: dl_dispatcher.cc:718
impeller::Cap::kRound
@ kRound
impeller::Cap::kSquare
@ kSquare
impeller::Canvas::DrawRRect
void DrawRRect(const Rect &rect, const Size &corner_radii, const Paint &paint)
Definition: canvas.cc:540
impeller::skia_conversions::ToPoints
std::vector< Point > ToPoints(const SkPoint points[], int count)
Definition: skia_conversions.cc:45
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::Canvas::RestoreToCount
void RestoreToCount(size_t count)
Definition: canvas.cc:335
impeller::Canvas::DrawImageRect
void DrawImageRect(const std::shared_ptr< Image > &image, Rect source, Rect dest, const Paint &paint, SamplerDescriptor sampler={}, SourceRectConstraint src_rect_constraint=SourceRectConstraint::kFast)
Definition: canvas.cc:766
impeller::ContentBoundsPromise::kMayClipContents
@ kMayClipContents
The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely cl...
impeller::skia_conversions::IsNearlySimpleRRect
bool IsNearlySimpleRRect(const SkRRect &rr)
Like SkRRect.isSimple, but allows the corners to differ by kEhCloseEnough.
Definition: skia_conversions.cc:12
impeller::ColorSource::Type::kRadialGradient
@ kRadialGradient
impeller::kMaxCullRect
static constexpr SkRect kMaxCullRect
Definition: dl_dispatcher.cc:615
impeller::Paint::Style::kStroke
@ kStroke
impeller::skia_conversions::ConvertStops
void ConvertStops(const flutter::DlGradientColorSourceBase *gradient, std::vector< Color > &colors, std::vector< float > &stops)
Convert display list colors + stops into impeller colors and stops, taking care to ensure that the st...
Definition: skia_conversions.cc:212
impeller::ColorSource::MakeLinearGradient
static ColorSource MakeLinearGradient(Point start_point, Point end_point, std::vector< Color > colors, std::vector< Scalar > stops, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:166
impeller::FillType::kOdd
@ kOdd
impeller::skia_conversions::ToSize
Size ToSize(const SkPoint &point)
Definition: skia_conversions.cc:158
impeller::Canvas::Skew
void Skew(Scalar sx, Scalar sy)
Definition: canvas.cc:323
impeller::ToImageFilter
static std::shared_ptr< ImageFilter > ToImageFilter(const flutter::DlImageFilter *filter)
Definition: dl_dispatcher.cc:515
impeller::Paint::color
Color color
Definition: paint.h:68
impeller::Canvas::DrawTextFrame
virtual void DrawTextFrame(const std::shared_ptr< TextFrame > &text_frame, Point position, const Paint &paint)
Definition: canvas.cc:884
impeller::PointStyle::kRound
@ kRound
Points are drawn as squares.
impeller::Vector2
Point Vector2
Definition: point.h:326
impeller::Canvas::ResetTransform
void ResetTransform()
Definition: canvas.cc:290
impeller::Canvas::DrawVertices
void DrawVertices(const std::shared_ptr< VerticesGeometry > &vertices, BlendMode blend_mode, const Paint &paint)
Definition: canvas.cc:933
impeller::skia_conversions::ToRects
std::vector< Rect > ToRects(const SkRect tex[], int count)
Definition: skia_conversions.cc:37
impeller::skia_conversions::ToColor
Color ToColor(const flutter::DlColor &color)
Definition: skia_conversions.cc:162
impeller::ColorSource::MakeSweepGradient
static ColorSource MakeSweepGradient(Point center, Degrees start_angle, Degrees end_angle, std::vector< Color > colors, std::vector< Scalar > stops, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:210
impeller::ColorSource::MakeColor
static ColorSource MakeColor()
Definition: color_source.cc:162
impeller::ColorSource::MakeImage
static ColorSource MakeImage(std::shared_ptr< Texture > texture, Entity::TileMode x_tile_mode, Entity::TileMode y_tile_mode, SamplerDescriptor sampler_descriptor, Matrix effect_transform)
Definition: color_source.cc:225
impeller::FilterContents::BlurStyle::kNormal
@ kNormal
Blurred inside and outside.
impeller::DlDispatcherBase::transformFullPerspective
void transformFullPerspective(SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt, SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt, SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) override
Definition: dl_dispatcher.cc:683
impeller::Cap::kButt
@ kButt
impeller::Matrix::MakeTranslation
static constexpr Matrix MakeTranslation(const Vector3 &t)
Definition: matrix.h:95
impeller::Canvas::DrawLine
void DrawLine(const Point &p0, const Point &p1, const Paint &paint)
Definition: canvas.cc:485
impeller::Paint::color_source
ColorSource color_source
Definition: paint.h:69
impeller::Canvas::DrawRect
void DrawRect(const Rect &rect, const Paint &paint)
Definition: canvas.cc:495
impeller::Canvas::GetCurrentTransform
const Matrix & GetCurrentTransform() const
Definition: canvas.cc:298
UNIMPLEMENTED
#define UNIMPLEMENTED
Definition: dl_dispatcher.cc:39
impeller::ToTileMode
static Entity::TileMode ToTileMode(flutter::DlTileMode tile_mode)
Definition: dl_dispatcher.cc:106
impeller::DlDispatcherBase::drawImageRect
void drawImageRect(const sk_sp< flutter::DlImage > image, const SkRect &src, const SkRect &dst, flutter::DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint) override
Definition: dl_dispatcher.cc:1006
impeller::Join::kMiter
@ kMiter
impeller::Paint::stroke_miter
Scalar stroke_miter
Definition: paint.h:74
impeller::ToMatrix
static Matrix ToMatrix(const SkMatrix &m)
Definition: dl_dispatcher.cc:161
impeller::ToColors
static std::vector< Color > ToColors(const flutter::DlColor colors[], int count)
Definition: dl_dispatcher.cc:245
impeller::skia_conversions::ToRect
Rect ToRect(const SkRect &rect)
Definition: skia_conversions.cc:26
impeller::Paint::color_filter
std::shared_ptr< ColorFilter > color_filter
Definition: paint.h:80
impeller::PointStyle::kSquare
@ kSquare
Points are drawn as circles.
impeller::Point
TPoint< Scalar > Point
Definition: point.h:322
impeller::Canvas::Scale
void Scale(const Vector2 &scale)
Definition: canvas.cc:315
impeller::Matrix::GetScale
constexpr Vector3 GetScale() const
Definition: matrix.h:311
impeller::ColorSource::MakeConicalGradient
static ColorSource MakeConicalGradient(Point center, Scalar radius, std::vector< Color > colors, std::vector< Scalar > stops, Point focus_center, Scalar focus_radius, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:180
impeller::ColorSource::Type::kRuntimeEffect
@ kRuntimeEffect
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:231
impeller::Paint::style
Style style
Definition: paint.h:75
impeller::Paint::Style::kFill
@ kFill
impeller::ToColorSourceType
static std::optional< ColorSource::Type > ToColorSourceType(flutter::DlColorSourceType type)
Definition: dl_dispatcher.cc:256
impeller::Canvas::DrawCircle
void DrawCircle(const Point &center, Scalar radius, const Paint &paint)
Definition: canvas.cc:566
impeller::ToStyle
static Paint::Style ToStyle(flutter::DlDrawStyle style)
Definition: dl_dispatcher.cc:177
type
GLenum type
Definition: blit_command_gles.cc:126
impeller::Canvas::Restore
virtual bool Restore()
Definition: canvas.cc:257
impeller::Canvas::DrawAtlas
void DrawAtlas(const std::shared_ptr< Image > &atlas, std::vector< Matrix > transforms, std::vector< Rect > texture_coordinates, std::vector< Color > colors, BlendMode blend_mode, SamplerDescriptor sampler, std::optional< Rect > cull_rect, const Paint &paint)
Definition: canvas.cc:1027
impeller::Canvas::DrawPath
void DrawPath(const Path &path, const Paint &paint)
Definition: canvas.cc:343
impeller::DlDispatcherBase::drawLine
void drawLine(const SkPoint &p0, const SkPoint &p1) override
Definition: dl_dispatcher.cc:804
impeller::Canvas::DrawPaint
void DrawPaint(const Paint &paint)
Definition: canvas.cc:352
impeller::Rect
TRect< Scalar > Rect
Definition: rect.h:769
impeller::ToBlurStyle
static FilterContents::BlurStyle ToBlurStyle(flutter::DlBlurStyle blur_style)
Definition: dl_dispatcher.cc:481
impeller::Join::kRound
@ kRound
impeller::Canvas::GetSaveCount
size_t GetSaveCount() const
Definition: canvas.cc:331
impeller::Vector3::y
Scalar y
Definition: vector.h:24
impeller::DlDispatcherBase::GetCanvas
virtual Canvas & GetCanvas()=0
impeller::skia_conversions::ToPoint
Point ToPoint(const SkPoint &point)
Definition: skia_conversions.cc:154
impeller::ColorSource::MakeRadialGradient
static ColorSource MakeRadialGradient(Point center, Scalar radius, std::vector< Color > colors, std::vector< Scalar > stops, Entity::TileMode tile_mode, Matrix effect_transform)
Definition: color_source.cc:196
impeller::Canvas::ClipRRect
void ClipRRect(const Rect &rect, const Size &corner_radii, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:640
impeller::Canvas::PreConcat
void PreConcat(const Matrix &transform)
Definition: canvas.cc:286
impeller::Join::kBevel
@ kBevel
impeller::ColorSource::Type::kImage
@ kImage
impeller::ColorSource::MakeRuntimeEffect
static ColorSource MakeRuntimeEffect(std::shared_ptr< RuntimeStage > runtime_stage, std::shared_ptr< std::vector< uint8_t >> uniform_data, std::vector< RuntimeEffectContents::TextureInput > texture_inputs)
Definition: color_source.cc:238
impeller::Canvas::DrawOval
void DrawOval(const Rect &rect, const Paint &paint)
Definition: canvas.cc:514
impeller::Canvas::Rotate
void Rotate(Radians radians)
Definition: canvas.cc:327
impeller::ColorSource::Type::kConicalGradient
@ kConicalGradient
impeller::TPoint< Scalar >
impeller::Canvas::Transform
void Transform(const Matrix &transform)
Definition: canvas.cc:294
impeller::skia_conversions::ToRSXForms
std::vector< Matrix > ToRSXForms(const SkRSXform xform[], int count)
Definition: skia_conversions.cc:171
impeller::Paint::invert_colors
bool invert_colors
Definition: paint.h:77
impeller::Canvas::Save
virtual void Save(uint32_t total_content_depth=kMaxDepth)
Definition: canvas.cc:184
impeller::Canvas::GetCurrentLocalCullingBounds
const std::optional< Rect > GetCurrentLocalCullingBounds() const
Definition: canvas.cc:302
impeller::DlDispatcherBase::setColor
void setColor(flutter::DlColor color) override
Definition: dl_dispatcher.cc:196
paint
const Paint & paint
Definition: color_source.cc:38
impeller::ToBlendMode
static BlendMode ToBlendMode(flutter::DlBlendMode mode)
Definition: dl_dispatcher.cc:42
color
DlColor color
Definition: dl_golden_blur_unittests.cc:23
impeller::Canvas::ClipRect
void ClipRect(const Rect &rect, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:599
impeller::ToSamplerDescriptor
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlImageSampling options)
Definition: dl_dispatcher.cc:119
impeller::TRect< Scalar >::MakeLTRB
constexpr static TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition: rect.h:129
impeller::ToColorFilter
static std::shared_ptr< ColorFilter > ToColorFilter(const flutter::DlColorFilter *filter)
Definition: dl_dispatcher.cc:440
impeller::ColorSource::Type::kSweepGradient
@ kSweepGradient
impeller::ContentBoundsPromise::kContainsContents
@ kContainsContents
The caller claims the bounds are a reasonably tight estimate of the coverage of the contents and shou...
impeller::Paint::mask_blur_descriptor
std::optional< MaskBlurDescriptor > mask_blur_descriptor
Definition: paint.h:81
impeller::Paint::stroke_width
Scalar stroke_width
Definition: paint.h:71
impeller::skia_conversions::ToPath
Path ToPath(const SkPath &path, Point shift)
Definition: skia_conversions.cc:63
impeller::Canvas::SaveLayer
virtual void SaveLayer(const Paint &paint, std::optional< Rect > bounds=std::nullopt, const std::shared_ptr< ImageFilter > &backdrop_filter=nullptr, ContentBoundsPromise bounds_promise=ContentBoundsPromise::kUnknown, uint32_t total_content_depth=kMaxDepth, bool can_distribute_opacity=false)
Definition: canvas.cc:842
impeller::ColorSource::Type::kColor
@ kColor
impeller::MakeVertices
std::shared_ptr< impeller::VerticesGeometry > MakeVertices(const std::shared_ptr< const flutter::DlVertices > &vertices)
Definition: dl_vertices_geometry.cc:31
impeller::Paint::blend_mode
BlendMode blend_mode
Definition: paint.h:76
impeller::Paint::image_filter
std::shared_ptr< ImageFilter > image_filter
Definition: paint.h:79
impeller::Paint::stroke_join
Join stroke_join
Definition: paint.h:73
impeller::Canvas::Translate
void Translate(const Vector3 &offset)
Definition: canvas.cc:311
impeller::Canvas::ClipPath
void ClipPath(const Path &path, Entity::ClipOperation clip_op=Entity::ClipOperation::kIntersect)
Definition: canvas.cc:589