Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make DisplayListFlags constexpr throughout #38649

Merged
merged 1 commit into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 1 addition & 161 deletions display_list/display_list_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "flutter/display_list/display_list_flags.h"
#include "flutter/display_list/display_list_path_effect.h"

namespace flutter {

const DisplayListSpecialGeometryFlags DisplayListAttributeFlags::WithPathEffect(
Expand All @@ -27,165 +28,4 @@ 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
Loading