Skip to content

Commit

Permalink
move definition of DLOpFlags to matching .cc file (flutter#34674)
Browse files Browse the repository at this point in the history
  • Loading branch information
flar authored Jul 19, 2022
1 parent 32c4b4b commit 9290433
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 161 deletions.
161 changes: 0 additions & 161 deletions display_list/display_list_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1046,165 +1046,4 @@ void DisplayListBuilder::drawShadow(const SkPath& path,
UpdateLayerOpacityCompatibility(false);
}

// clang-format off
// Flags common to all primitives that apply colors
#define PAINT_FLAGS (kUsesDither_ | \
kUsesColor_ | \
kUsesAlpha_ | \
kUsesBlend_ | \
kUsesShader_ | \
kUsesColorFilter_ | \
kUsesImageFilter_)

// Flags common to all primitives that stroke or fill
#define STROKE_OR_FILL_FLAGS (kIsDrawnGeometry_ | \
kUsesAntiAlias_ | \
kUsesMaskFilter_ | \
kUsesPathEffect_)

// Flags common to primitives that stroke geometry
#define STROKE_FLAGS (kIsStrokedGeometry_ | \
kUsesAntiAlias_ | \
kUsesMaskFilter_ | \
kUsesPathEffect_)

// Flags common to primitives that render an image with paint attributes
#define IMAGE_FLAGS_BASE (kIsNonGeometric_ | \
kUsesAlpha_ | \
kUsesDither_ | \
kUsesBlend_ | \
kUsesColorFilter_ | \
kUsesImageFilter_)
// clang-format on

const DisplayListAttributeFlags DisplayListOpFlags::kSaveLayerFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags DisplayListOpFlags::kSaveLayerWithPaintFlags =
DisplayListAttributeFlags(kIsNonGeometric_ | //
kUsesAlpha_ | //
kUsesBlend_ | //
kUsesColorFilter_ | //
kUsesImageFilter_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawColorFlags =
DisplayListAttributeFlags(kFloodsSurface_ | kIgnoresPaint_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawPaintFlags =
DisplayListAttributeFlags(PAINT_FLAGS | kFloodsSurface_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawHVLineFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_FLAGS | kMayHaveCaps_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawLineFlags =
kDrawHVLineFlags.with(kMayHaveDiagonalCaps_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawRectFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS |
kMayHaveJoins_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawOvalFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawCircleFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawRRectFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawDRRectFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawPathFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS |
kMayHaveCaps_ | kMayHaveDiagonalCaps_ |
kMayHaveJoins_ | kMayHaveAcuteJoins_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawArcNoCenterFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS |
kMayHaveCaps_ | kMayHaveDiagonalCaps_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawArcWithCenterFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS |
kMayHaveJoins_ | kMayHaveAcuteJoins_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawPointsAsPointsFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_FLAGS | //
kMayHaveCaps_ | kButtCapIsSquare_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawPointsAsLinesFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_FLAGS | //
kMayHaveCaps_ | kMayHaveDiagonalCaps_);

// Polygon mode just draws (count-1) separate lines, no joins
const DisplayListAttributeFlags DisplayListOpFlags::kDrawPointsAsPolygonFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_FLAGS | //
kMayHaveCaps_ | kMayHaveDiagonalCaps_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawVerticesFlags =
DisplayListAttributeFlags(kIsNonGeometric_ | //
kUsesDither_ | //
kUsesAlpha_ | //
kUsesShader_ | //
kUsesBlend_ | //
kUsesColorFilter_ | //
kUsesImageFilter_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawImageFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawImageWithPaintFlags =
DisplayListAttributeFlags(IMAGE_FLAGS_BASE | //
kUsesAntiAlias_ | kUsesMaskFilter_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawImageRectFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags
DisplayListOpFlags::kDrawImageRectWithPaintFlags =
DisplayListAttributeFlags(IMAGE_FLAGS_BASE | //
kUsesAntiAlias_ | kUsesMaskFilter_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawImageNineFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags
DisplayListOpFlags::kDrawImageNineWithPaintFlags =
DisplayListAttributeFlags(IMAGE_FLAGS_BASE);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawImageLatticeFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags
DisplayListOpFlags::kDrawImageLatticeWithPaintFlags =
DisplayListAttributeFlags(IMAGE_FLAGS_BASE);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawAtlasFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawAtlasWithPaintFlags =
DisplayListAttributeFlags(IMAGE_FLAGS_BASE);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawPictureFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawPictureWithPaintFlags =
kSaveLayerWithPaintFlags;

const DisplayListAttributeFlags DisplayListOpFlags::kDrawDisplayListFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawTextBlobFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS |
kMayHaveJoins_)
.without(kUsesAntiAlias_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawShadowFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

#undef PAINT_FLAGS
#undef STROKE_OR_FILL_FLAGS
#undef STROKE_FLAGS
#undef IMAGE_FLAGS_BASE

} // namespace flutter
161 changes: 161 additions & 0 deletions display_list/display_list_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,165 @@ const DisplayListSpecialGeometryFlags DisplayListAttributeFlags::WithPathEffect(
return special_flags_;
}

// clang-format off
// Flags common to all primitives that apply colors
#define PAINT_FLAGS (kUsesDither_ | \
kUsesColor_ | \
kUsesAlpha_ | \
kUsesBlend_ | \
kUsesShader_ | \
kUsesColorFilter_ | \
kUsesImageFilter_)

// Flags common to all primitives that stroke or fill
#define STROKE_OR_FILL_FLAGS (kIsDrawnGeometry_ | \
kUsesAntiAlias_ | \
kUsesMaskFilter_ | \
kUsesPathEffect_)

// Flags common to primitives that stroke geometry
#define STROKE_FLAGS (kIsStrokedGeometry_ | \
kUsesAntiAlias_ | \
kUsesMaskFilter_ | \
kUsesPathEffect_)

// Flags common to primitives that render an image with paint attributes
#define IMAGE_FLAGS_BASE (kIsNonGeometric_ | \
kUsesAlpha_ | \
kUsesDither_ | \
kUsesBlend_ | \
kUsesColorFilter_ | \
kUsesImageFilter_)
// clang-format on

const DisplayListAttributeFlags DisplayListOpFlags::kSaveLayerFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags DisplayListOpFlags::kSaveLayerWithPaintFlags =
DisplayListAttributeFlags(kIsNonGeometric_ | //
kUsesAlpha_ | //
kUsesBlend_ | //
kUsesColorFilter_ | //
kUsesImageFilter_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawColorFlags =
DisplayListAttributeFlags(kFloodsSurface_ | kIgnoresPaint_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawPaintFlags =
DisplayListAttributeFlags(PAINT_FLAGS | kFloodsSurface_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawHVLineFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_FLAGS | kMayHaveCaps_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawLineFlags =
kDrawHVLineFlags.with(kMayHaveDiagonalCaps_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawRectFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS |
kMayHaveJoins_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawOvalFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawCircleFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawRRectFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawDRRectFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawPathFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS |
kMayHaveCaps_ | kMayHaveDiagonalCaps_ |
kMayHaveJoins_ | kMayHaveAcuteJoins_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawArcNoCenterFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS |
kMayHaveCaps_ | kMayHaveDiagonalCaps_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawArcWithCenterFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS |
kMayHaveJoins_ | kMayHaveAcuteJoins_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawPointsAsPointsFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_FLAGS | //
kMayHaveCaps_ | kButtCapIsSquare_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawPointsAsLinesFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_FLAGS | //
kMayHaveCaps_ | kMayHaveDiagonalCaps_);

// Polygon mode just draws (count-1) separate lines, no joins
const DisplayListAttributeFlags DisplayListOpFlags::kDrawPointsAsPolygonFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_FLAGS | //
kMayHaveCaps_ | kMayHaveDiagonalCaps_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawVerticesFlags =
DisplayListAttributeFlags(kIsNonGeometric_ | //
kUsesDither_ | //
kUsesAlpha_ | //
kUsesShader_ | //
kUsesBlend_ | //
kUsesColorFilter_ | //
kUsesImageFilter_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawImageFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawImageWithPaintFlags =
DisplayListAttributeFlags(IMAGE_FLAGS_BASE | //
kUsesAntiAlias_ | kUsesMaskFilter_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawImageRectFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags
DisplayListOpFlags::kDrawImageRectWithPaintFlags =
DisplayListAttributeFlags(IMAGE_FLAGS_BASE | //
kUsesAntiAlias_ | kUsesMaskFilter_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawImageNineFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags
DisplayListOpFlags::kDrawImageNineWithPaintFlags =
DisplayListAttributeFlags(IMAGE_FLAGS_BASE);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawImageLatticeFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags
DisplayListOpFlags::kDrawImageLatticeWithPaintFlags =
DisplayListAttributeFlags(IMAGE_FLAGS_BASE);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawAtlasFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawAtlasWithPaintFlags =
DisplayListAttributeFlags(IMAGE_FLAGS_BASE);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawPictureFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawPictureWithPaintFlags =
kSaveLayerWithPaintFlags;

const DisplayListAttributeFlags DisplayListOpFlags::kDrawDisplayListFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawTextBlobFlags =
DisplayListAttributeFlags(PAINT_FLAGS | STROKE_OR_FILL_FLAGS |
kMayHaveJoins_)
.without(kUsesAntiAlias_);

const DisplayListAttributeFlags DisplayListOpFlags::kDrawShadowFlags =
DisplayListAttributeFlags(kIgnoresPaint_);

#undef PAINT_FLAGS
#undef STROKE_OR_FILL_FLAGS
#undef STROKE_FLAGS
#undef IMAGE_FLAGS_BASE

} // namespace flutter

0 comments on commit 9290433

Please sign in to comment.