More Clang Tidy --fix[es] to header files (flutter/engine#46151)
More work towards https://github.com/flutter/flutter/issues/134969. I decided not to touch the `LOG_X` variables since they are just used in macro expansion.
This commit is contained in:
@@ -102,7 +102,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
// DrawLine
|
// DrawLine
|
||||||
#define DRAW_LINE_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_LINE_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawLine, BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawLine, BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES) \
|
ATTRIBUTES) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
->Range(16, 2048) \
|
->Range(16, 2048) \
|
||||||
@@ -112,7 +112,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
// DrawRect
|
// DrawRect
|
||||||
#define DRAW_RECT_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_RECT_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawRect, BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawRect, BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES) \
|
ATTRIBUTES) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
->Range(16, 2048) \
|
->Range(16, 2048) \
|
||||||
@@ -122,7 +122,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
// DrawOval
|
// DrawOval
|
||||||
#define DRAW_OVAL_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_OVAL_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawOval, BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawOval, BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES) \
|
ATTRIBUTES) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
->Range(16, 2048) \
|
->Range(16, 2048) \
|
||||||
@@ -132,7 +132,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
// DrawCircle
|
// DrawCircle
|
||||||
#define DRAW_CIRCLE_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_CIRCLE_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawCircle, BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawCircle, BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES) \
|
ATTRIBUTES) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
->Range(16, 2048) \
|
->Range(16, 2048) \
|
||||||
@@ -142,7 +142,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
// DrawArc
|
// DrawArc
|
||||||
#define DRAW_ARC_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_ARC_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawArc, BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawArc, BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES) \
|
ATTRIBUTES) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
->Range(128, 2048) \
|
->Range(128, 2048) \
|
||||||
@@ -153,7 +153,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
#define DRAW_PATH_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_PATH_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawPath, \
|
BENCHMARK_CAPTURE(BM_DrawPath, \
|
||||||
Lines/BACKEND, \
|
Lines/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
SkPath::Verb::kLine_Verb) \
|
SkPath::Verb::kLine_Verb) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -164,7 +164,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawPath, \
|
BENCHMARK_CAPTURE(BM_DrawPath, \
|
||||||
Quads/BACKEND, \
|
Quads/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
SkPath::Verb::kQuad_Verb) \
|
SkPath::Verb::kQuad_Verb) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -175,7 +175,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawPath, \
|
BENCHMARK_CAPTURE(BM_DrawPath, \
|
||||||
Conics/BACKEND, \
|
Conics/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
SkPath::Verb::kConic_Verb) \
|
SkPath::Verb::kConic_Verb) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -186,7 +186,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawPath, \
|
BENCHMARK_CAPTURE(BM_DrawPath, \
|
||||||
Cubics/BACKEND, \
|
Cubics/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
SkPath::Verb::kCubic_Verb) \
|
SkPath::Verb::kCubic_Verb) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -198,7 +198,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
// DrawPoints
|
// DrawPoints
|
||||||
#define DRAW_POINTS_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_POINTS_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawPoints, Points/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawPoints, Points/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlCanvas::PointMode::kPoints) \
|
DlCanvas::PointMode::kPoints) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -207,7 +207,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawPoints, Lines/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawPoints, Lines/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlCanvas::PointMode::kLines) \
|
DlCanvas::PointMode::kLines) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -216,7 +216,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawPoints, Polygon/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawPoints, Polygon/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlCanvas::PointMode::kPolygon) \
|
DlCanvas::PointMode::kPolygon) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -228,7 +228,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
#define DRAW_VERTICES_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_VERTICES_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawVertices, \
|
BENCHMARK_CAPTURE(BM_DrawVertices, \
|
||||||
TriangleStrip/BACKEND, \
|
TriangleStrip/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlVertexMode::kTriangleStrip) \
|
DlVertexMode::kTriangleStrip) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -239,7 +239,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawVertices, \
|
BENCHMARK_CAPTURE(BM_DrawVertices, \
|
||||||
TriangleFan/BACKEND, \
|
TriangleFan/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlVertexMode::kTriangleFan) \
|
DlVertexMode::kTriangleFan) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -250,7 +250,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawVertices, \
|
BENCHMARK_CAPTURE(BM_DrawVertices, \
|
||||||
Triangles/BACKEND, \
|
Triangles/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlVertexMode::kTriangles) \
|
DlVertexMode::kTriangles) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -262,7 +262,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
// DrawRRect
|
// DrawRRect
|
||||||
#define DRAW_RRECT_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_RRECT_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawRRect, Symmetric/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawRRect, Symmetric/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
SkRRect::Type::kSimple_Type) \
|
SkRRect::Type::kSimple_Type) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -271,7 +271,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawRRect, NinePatch/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawRRect, NinePatch/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
SkRRect::Type::kNinePatch_Type) \
|
SkRRect::Type::kNinePatch_Type) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -280,7 +280,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawRRect, Complex/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawRRect, Complex/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
SkRRect::Type::kComplex_Type) \
|
SkRRect::Type::kComplex_Type) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -291,7 +291,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
// DrawDRRect
|
// DrawDRRect
|
||||||
#define DRAW_DRRECT_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_DRRECT_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawDRRect, Symmetric/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawDRRect, Symmetric/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
SkRRect::Type::kSimple_Type) \
|
SkRRect::Type::kSimple_Type) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -300,7 +300,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawDRRect, NinePatch/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawDRRect, NinePatch/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
SkRRect::Type::kNinePatch_Type) \
|
SkRRect::Type::kNinePatch_Type) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -309,7 +309,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawDRRect, Complex/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawDRRect, Complex/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
SkRRect::Type::kComplex_Type) \
|
SkRRect::Type::kComplex_Type) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -320,7 +320,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
// DrawImage
|
// DrawImage
|
||||||
#define DRAW_IMAGE_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_IMAGE_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawImage, Texture/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawImage, Texture/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlImageSampling::kNearestNeighbor, false) \
|
DlImageSampling::kNearestNeighbor, false) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -329,7 +329,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawImage, Upload/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawImage, Upload/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlImageSampling::kNearestNeighbor, true) \
|
DlImageSampling::kNearestNeighbor, true) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -341,7 +341,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
#define DRAW_IMAGE_RECT_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_IMAGE_RECT_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE( \
|
BENCHMARK_CAPTURE( \
|
||||||
BM_DrawImageRect, Texture/Strict/BACKEND, \
|
BM_DrawImageRect, Texture/Strict/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlImageSampling::kNearestNeighbor, \
|
DlImageSampling::kNearestNeighbor, \
|
||||||
DlCanvas::SrcRectConstraint::kStrict, false) \
|
DlCanvas::SrcRectConstraint::kStrict, false) \
|
||||||
@@ -352,7 +352,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE( \
|
BENCHMARK_CAPTURE( \
|
||||||
BM_DrawImageRect, Texture/Fast/BACKEND, \
|
BM_DrawImageRect, Texture/Fast/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlImageSampling::kNearestNeighbor, \
|
DlImageSampling::kNearestNeighbor, \
|
||||||
DlCanvas::SrcRectConstraint::kFast, false) \
|
DlCanvas::SrcRectConstraint::kFast, false) \
|
||||||
@@ -363,7 +363,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE( \
|
BENCHMARK_CAPTURE( \
|
||||||
BM_DrawImageRect, Upload/Strict/BACKEND, \
|
BM_DrawImageRect, Upload/Strict/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlImageSampling::kNearestNeighbor, \
|
DlImageSampling::kNearestNeighbor, \
|
||||||
DlCanvas::SrcRectConstraint::kStrict, true) \
|
DlCanvas::SrcRectConstraint::kStrict, true) \
|
||||||
@@ -374,7 +374,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE( \
|
BENCHMARK_CAPTURE( \
|
||||||
BM_DrawImageRect, Upload/Fast/BACKEND, \
|
BM_DrawImageRect, Upload/Fast/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlImageSampling::kNearestNeighbor, \
|
DlImageSampling::kNearestNeighbor, \
|
||||||
DlCanvas::SrcRectConstraint::kFast, true) \
|
DlCanvas::SrcRectConstraint::kFast, true) \
|
||||||
@@ -386,7 +386,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
// DrawImageNine
|
// DrawImageNine
|
||||||
#define DRAW_IMAGE_NINE_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_IMAGE_NINE_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawImageNine, Texture/Nearest/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawImageNine, Texture/Nearest/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlFilterMode::kNearest, false) \
|
DlFilterMode::kNearest, false) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -395,7 +395,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawImageNine, Upload/Nearest/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawImageNine, Upload/Nearest/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlFilterMode::kNearest, true) \
|
DlFilterMode::kNearest, true) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -404,7 +404,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawImageNine, Texture/Linear/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawImageNine, Texture/Linear/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlFilterMode::kLinear, false) \
|
DlFilterMode::kLinear, false) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -413,7 +413,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawImageNine, Upload/Linear/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawImageNine, Upload/Linear/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlFilterMode::kLinear, true) \
|
DlFilterMode::kLinear, true) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -424,7 +424,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
// DrawTextBlob
|
// DrawTextBlob
|
||||||
#define DRAW_TEXT_BLOB_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_TEXT_BLOB_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawTextBlob, BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawTextBlob, BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES) \
|
ATTRIBUTES) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
->Range(1, 256) \
|
->Range(1, 256) \
|
||||||
@@ -435,7 +435,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
// DrawShadow
|
// DrawShadow
|
||||||
#define DRAW_SHADOW_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define DRAW_SHADOW_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_DrawShadow, Lines/Transparent/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawShadow, Lines/Transparent/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
true, \
|
true, \
|
||||||
SkPath::Verb::kLine_Verb) \
|
SkPath::Verb::kLine_Verb) \
|
||||||
@@ -445,7 +445,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawShadow, Quads/Transparent/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawShadow, Quads/Transparent/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
true, \
|
true, \
|
||||||
SkPath::Verb::kQuad_Verb) \
|
SkPath::Verb::kQuad_Verb) \
|
||||||
@@ -455,7 +455,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawShadow, Conics/Transparent/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawShadow, Conics/Transparent/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
true, \
|
true, \
|
||||||
SkPath::Verb::kConic_Verb) \
|
SkPath::Verb::kConic_Verb) \
|
||||||
@@ -465,7 +465,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawShadow, Cubics/Transparent/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawShadow, Cubics/Transparent/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
true, \
|
true, \
|
||||||
SkPath::Verb::kCubic_Verb) \
|
SkPath::Verb::kCubic_Verb) \
|
||||||
@@ -475,7 +475,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawShadow, Lines/Opaque/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawShadow, Lines/Opaque/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
false, \
|
false, \
|
||||||
SkPath::Verb::kLine_Verb) \
|
SkPath::Verb::kLine_Verb) \
|
||||||
@@ -485,7 +485,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawShadow, Quads/Opaque/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawShadow, Quads/Opaque/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
false, \
|
false, \
|
||||||
SkPath::Verb::kQuad_Verb) \
|
SkPath::Verb::kQuad_Verb) \
|
||||||
@@ -495,7 +495,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawShadow, Conics/Opaque/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawShadow, Conics/Opaque/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
false, \
|
false, \
|
||||||
SkPath::Verb::kConic_Verb) \
|
SkPath::Verb::kConic_Verb) \
|
||||||
@@ -505,7 +505,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_DrawShadow, Cubics/Opaque/BACKEND, \
|
BENCHMARK_CAPTURE(BM_DrawShadow, Cubics/Opaque/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
false, \
|
false, \
|
||||||
SkPath::Verb::kCubic_Verb) \
|
SkPath::Verb::kCubic_Verb) \
|
||||||
@@ -517,7 +517,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
// SaveLayer
|
// SaveLayer
|
||||||
#define SAVE_LAYER_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
#define SAVE_LAYER_BENCHMARKS(BACKEND, ATTRIBUTES) \
|
||||||
BENCHMARK_CAPTURE(BM_SaveLayer, Depth 1/BACKEND, \
|
BENCHMARK_CAPTURE(BM_SaveLayer, Depth 1/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
1) \
|
1) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
@@ -526,7 +526,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
->Unit(benchmark::kMillisecond); \
|
->Unit(benchmark::kMillisecond); \
|
||||||
\
|
\
|
||||||
BENCHMARK_CAPTURE(BM_SaveLayer, Depth 8/BACKEND, \
|
BENCHMARK_CAPTURE(BM_SaveLayer, Depth 8/BACKEND, \
|
||||||
BackendType::k##BACKEND##_Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
8) \
|
8) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class DisplayListGLComplexityCalculator
|
|||||||
private:
|
private:
|
||||||
class GLHelper : public ComplexityCalculatorHelper {
|
class GLHelper : public ComplexityCalculatorHelper {
|
||||||
public:
|
public:
|
||||||
GLHelper(unsigned int ceiling)
|
explicit GLHelper(unsigned int ceiling)
|
||||||
: ComplexityCalculatorHelper(ceiling),
|
: ComplexityCalculatorHelper(ceiling),
|
||||||
save_layer_count_(0),
|
save_layer_count_(0),
|
||||||
draw_text_blob_count_(0) {}
|
draw_text_blob_count_(0) {}
|
||||||
|
|||||||
@@ -96,8 +96,8 @@ class ComplexityCalculatorHelper
|
|||||||
public virtual IgnoreClipDispatchHelper,
|
public virtual IgnoreClipDispatchHelper,
|
||||||
public virtual IgnoreTransformDispatchHelper {
|
public virtual IgnoreTransformDispatchHelper {
|
||||||
public:
|
public:
|
||||||
ComplexityCalculatorHelper(unsigned int ceiling)
|
explicit ComplexityCalculatorHelper(unsigned int ceiling)
|
||||||
: is_complex_(false), ceiling_(ceiling), complexity_score_(0) {}
|
: ceiling_(ceiling) {}
|
||||||
|
|
||||||
virtual ~ComplexityCalculatorHelper() = default;
|
virtual ~ComplexityCalculatorHelper() = default;
|
||||||
|
|
||||||
@@ -261,10 +261,10 @@ class ComplexityCalculatorHelper
|
|||||||
// If we exceed the ceiling (defaults to the largest number representable
|
// If we exceed the ceiling (defaults to the largest number representable
|
||||||
// by unsigned int), then set the is_complex_ bool and we no longer
|
// by unsigned int), then set the is_complex_ bool and we no longer
|
||||||
// accumulate.
|
// accumulate.
|
||||||
bool is_complex_;
|
bool is_complex_ = false;
|
||||||
unsigned int ceiling_;
|
unsigned int ceiling_;
|
||||||
|
|
||||||
unsigned int complexity_score_;
|
unsigned int complexity_score_ = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace flutter
|
} // namespace flutter
|
||||||
|
|||||||
@@ -32,10 +32,8 @@ class DisplayListMetalComplexityCalculator
|
|||||||
private:
|
private:
|
||||||
class MetalHelper : public ComplexityCalculatorHelper {
|
class MetalHelper : public ComplexityCalculatorHelper {
|
||||||
public:
|
public:
|
||||||
MetalHelper(unsigned int ceiling)
|
explicit MetalHelper(unsigned int ceiling)
|
||||||
: ComplexityCalculatorHelper(ceiling),
|
: ComplexityCalculatorHelper(ceiling) {}
|
||||||
save_layer_count_(0),
|
|
||||||
draw_text_blob_count_(0) {}
|
|
||||||
|
|
||||||
void saveLayer(const SkRect* bounds,
|
void saveLayer(const SkRect* bounds,
|
||||||
const SaveLayerOptions options,
|
const SaveLayerOptions options,
|
||||||
@@ -85,8 +83,8 @@ class DisplayListMetalComplexityCalculator
|
|||||||
unsigned int BatchedComplexity() override;
|
unsigned int BatchedComplexity() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int save_layer_count_;
|
unsigned int save_layer_count_ = 0;
|
||||||
unsigned int draw_text_blob_count_;
|
unsigned int draw_text_blob_count_ = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
DisplayListMetalComplexityCalculator()
|
DisplayListMetalComplexityCalculator()
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const DisplayListSpecialGeometryFlags DisplayListAttributeFlags::WithPathEffect(
|
|||||||
// end caps to areas that might not have had them before so all
|
// end caps to areas that might not have had them before so all
|
||||||
// we need to do is to indicate the potential for diagonal
|
// we need to do is to indicate the potential for diagonal
|
||||||
// end caps and move on.
|
// end caps and move on.
|
||||||
return special_flags_.with(kMayHaveCaps_ | kMayHaveDiagonalCaps_);
|
return special_flags_.with(kMayHaveCaps | kMayHaveDiagonalCaps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,36 +23,36 @@ class DlPathEffect;
|
|||||||
class DisplayListFlags {
|
class DisplayListFlags {
|
||||||
protected:
|
protected:
|
||||||
// A drawing operation that is not geometric in nature (but which
|
// A drawing operation that is not geometric in nature (but which
|
||||||
// may still apply a MaskFilter - see |kUsesMaskFilter_| below).
|
// may still apply a MaskFilter - see |kUsesMaskFilter| below).
|
||||||
static constexpr int kIsNonGeometric_ = 0;
|
static constexpr int kIsNonGeometric = 0;
|
||||||
|
|
||||||
// A geometric operation that is defined as a fill operation
|
// A geometric operation that is defined as a fill operation
|
||||||
// regardless of what the current paint Style is set to.
|
// regardless of what the current paint Style is set to.
|
||||||
// This flag will automatically assume |kUsesMaskFilter_|.
|
// This flag will automatically assume |kUsesMaskFilter|.
|
||||||
static constexpr int kIsFilledGeometry_ = 1 << 0;
|
static constexpr int kIsFilledGeometry = 1 << 0;
|
||||||
|
|
||||||
// A geometric operation that is defined as a stroke operation
|
// A geometric operation that is defined as a stroke operation
|
||||||
// regardless of what the current paint Style is set to.
|
// regardless of what the current paint Style is set to.
|
||||||
// This flag will automatically assume |kUsesMaskFilter_|.
|
// This flag will automatically assume |kUsesMaskFilter|.
|
||||||
static constexpr int kIsStrokedGeometry_ = 1 << 1;
|
static constexpr int kIsStrokedGeometry = 1 << 1;
|
||||||
|
|
||||||
// A geometric operation that may be a stroke or fill operation
|
// A geometric operation that may be a stroke or fill operation
|
||||||
// depending on the current state of the paint Style attribute.
|
// depending on the current state of the paint Style attribute.
|
||||||
// This flag will automatically assume |kUsesMaskFilter_|.
|
// This flag will automatically assume |kUsesMaskFilter|.
|
||||||
static constexpr int kIsDrawnGeometry_ = 1 << 2;
|
static constexpr int kIsDrawnGeometry = 1 << 2;
|
||||||
|
|
||||||
static constexpr int kIsAnyGeometryMask_ = //
|
static constexpr int kIsAnyGeometryMask = //
|
||||||
kIsFilledGeometry_ | //
|
kIsFilledGeometry | //
|
||||||
kIsStrokedGeometry_ | //
|
kIsStrokedGeometry | //
|
||||||
kIsDrawnGeometry_;
|
kIsDrawnGeometry;
|
||||||
|
|
||||||
// A primitive that floods the surface (or clip) with no
|
// A primitive that floods the surface (or clip) with no
|
||||||
// natural bounds, such as |drawColor| or |drawPaint|.
|
// natural bounds, such as |drawColor| or |drawPaint|.
|
||||||
static constexpr int kFloodsSurface_ = 1 << 3;
|
static constexpr int kFloodsSurface = 1 << 3;
|
||||||
|
|
||||||
static constexpr int kMayHaveCaps_ = 1 << 4;
|
static constexpr int kMayHaveCaps = 1 << 4;
|
||||||
static constexpr int kMayHaveJoins_ = 1 << 5;
|
static constexpr int kMayHaveJoins = 1 << 5;
|
||||||
static constexpr int kButtCapIsSquare_ = 1 << 6;
|
static constexpr int kButtCapIsSquare = 1 << 6;
|
||||||
|
|
||||||
// A geometric operation which has a path that might have
|
// A geometric operation which has a path that might have
|
||||||
// end caps that are not rectilinear which means that square
|
// end caps that are not rectilinear which means that square
|
||||||
@@ -62,7 +62,7 @@ class DisplayListFlags {
|
|||||||
// diagonal end caps. |drawLine| might have diagonal end
|
// diagonal end caps. |drawLine| might have diagonal end
|
||||||
// caps depending on the angle of the line, and more likely
|
// caps depending on the angle of the line, and more likely
|
||||||
// |drawPath| will often have such end caps.
|
// |drawPath| will often have such end caps.
|
||||||
static constexpr int kMayHaveDiagonalCaps_ = 1 << 7;
|
static constexpr int kMayHaveDiagonalCaps = 1 << 7;
|
||||||
|
|
||||||
// A geometric operation which has joined vertices that are
|
// A geometric operation which has joined vertices that are
|
||||||
// not guaranteed to be smooth (angles of incoming and outgoing)
|
// not guaranteed to be smooth (angles of incoming and outgoing)
|
||||||
@@ -73,23 +73,23 @@ class DisplayListFlags {
|
|||||||
// |drawRect|, |drawOval| and |drawRRect| all have well
|
// |drawRect|, |drawOval| and |drawRRect| all have well
|
||||||
// behaved joins, but |drawPath| might have joins that cause
|
// behaved joins, but |drawPath| might have joins that cause
|
||||||
// mitered extensions outside the pre-transformed bounding box.
|
// mitered extensions outside the pre-transformed bounding box.
|
||||||
static constexpr int kMayHaveAcuteJoins_ = 1 << 8;
|
static constexpr int kMayHaveAcuteJoins = 1 << 8;
|
||||||
|
|
||||||
static constexpr int kAnySpecialGeometryMask_ = //
|
static constexpr int kAnySpecialGeometryMask = //
|
||||||
kMayHaveCaps_ | kMayHaveJoins_ | kButtCapIsSquare_ | //
|
kMayHaveCaps | kMayHaveJoins | kButtCapIsSquare | //
|
||||||
kMayHaveDiagonalCaps_ | kMayHaveAcuteJoins_;
|
kMayHaveDiagonalCaps | kMayHaveAcuteJoins;
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static constexpr int kUsesAntiAlias_ = 1 << 10;
|
static constexpr int kUsesAntiAlias = 1 << 10;
|
||||||
static constexpr int kUsesDither_ = 1 << 11;
|
static constexpr int kUsesDither = 1 << 11;
|
||||||
static constexpr int kUsesAlpha_ = 1 << 12;
|
static constexpr int kUsesAlpha = 1 << 12;
|
||||||
static constexpr int kUsesColor_ = 1 << 13;
|
static constexpr int kUsesColor = 1 << 13;
|
||||||
static constexpr int kUsesBlend_ = 1 << 14;
|
static constexpr int kUsesBlend = 1 << 14;
|
||||||
static constexpr int kUsesShader_ = 1 << 15;
|
static constexpr int kUsesShader = 1 << 15;
|
||||||
static constexpr int kUsesColorFilter_ = 1 << 16;
|
static constexpr int kUsesColorFilter = 1 << 16;
|
||||||
static constexpr int kUsesPathEffect_ = 1 << 17;
|
static constexpr int kUsesPathEffect = 1 << 17;
|
||||||
static constexpr int kUsesMaskFilter_ = 1 << 18;
|
static constexpr int kUsesMaskFilter = 1 << 18;
|
||||||
static constexpr int kUsesImageFilter_ = 1 << 19;
|
static constexpr int kUsesImageFilter = 1 << 19;
|
||||||
|
|
||||||
// Some ops have an optional paint argument. If the version
|
// Some ops have an optional paint argument. If the version
|
||||||
// stored in the DisplayList ignores the paint, but there
|
// stored in the DisplayList ignores the paint, but there
|
||||||
@@ -98,13 +98,13 @@ class DisplayListFlags {
|
|||||||
// a default paint object can be constructed when rendering
|
// a default paint object can be constructed when rendering
|
||||||
// the op to carry information imposed from outside the
|
// the op to carry information imposed from outside the
|
||||||
// DisplayList (for example, the opacity override).
|
// DisplayList (for example, the opacity override).
|
||||||
static constexpr int kIgnoresPaint_ = 1 << 30;
|
static constexpr int kIgnoresPaint = 1 << 30;
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
static constexpr int kAnyAttributeMask_ = //
|
static constexpr int kAnyAttributeMask = //
|
||||||
kUsesAntiAlias_ | kUsesDither_ | kUsesAlpha_ | kUsesColor_ | kUsesBlend_ |
|
kUsesAntiAlias | kUsesDither | kUsesAlpha | kUsesColor | kUsesBlend |
|
||||||
kUsesShader_ | kUsesColorFilter_ | kUsesPathEffect_ | kUsesMaskFilter_ |
|
kUsesShader | kUsesColorFilter | kUsesPathEffect | kUsesMaskFilter |
|
||||||
kUsesImageFilter_;
|
kUsesImageFilter;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DisplayListFlagsBase : protected DisplayListFlags {
|
class DisplayListFlagsBase : protected DisplayListFlags {
|
||||||
@@ -126,21 +126,21 @@ class DisplayListFlagsBase : protected DisplayListFlags {
|
|||||||
class DisplayListSpecialGeometryFlags : DisplayListFlagsBase {
|
class DisplayListSpecialGeometryFlags : DisplayListFlagsBase {
|
||||||
public:
|
public:
|
||||||
/// The geometry may have segments that end without closing the path.
|
/// The geometry may have segments that end without closing the path.
|
||||||
constexpr bool may_have_end_caps() const { return has_any(kMayHaveCaps_); }
|
constexpr bool may_have_end_caps() const { return has_any(kMayHaveCaps); }
|
||||||
|
|
||||||
/// The geometry may have segments connect non-continuously.
|
/// The geometry may have segments connect non-continuously.
|
||||||
constexpr bool may_have_joins() const { return has_any(kMayHaveJoins_); }
|
constexpr bool may_have_joins() const { return has_any(kMayHaveJoins); }
|
||||||
|
|
||||||
/// Mainly for drawPoints(PointMode) where Butt caps are rendered as squares.
|
/// Mainly for drawPoints(PointMode) where Butt caps are rendered as squares.
|
||||||
constexpr bool butt_cap_becomes_square() const {
|
constexpr bool butt_cap_becomes_square() const {
|
||||||
return has_any(kButtCapIsSquare_);
|
return has_any(kButtCapIsSquare);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The geometry may have segments that end on a diagonal
|
/// The geometry may have segments that end on a diagonal
|
||||||
/// such that their end caps extend further than the default
|
/// such that their end caps extend further than the default
|
||||||
/// |strokeWidth * 0.5| margin around the geometry.
|
/// |strokeWidth * 0.5| margin around the geometry.
|
||||||
constexpr bool may_have_diagonal_caps() const {
|
constexpr bool may_have_diagonal_caps() const {
|
||||||
return has_any(kMayHaveDiagonalCaps_);
|
return has_any(kMayHaveDiagonalCaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The geometry may have segments that meet at vertices at
|
/// The geometry may have segments that meet at vertices at
|
||||||
@@ -148,13 +148,13 @@ class DisplayListSpecialGeometryFlags : DisplayListFlagsBase {
|
|||||||
/// further than the default |strokeWidth * 0.5| margin around
|
/// further than the default |strokeWidth * 0.5| margin around
|
||||||
/// the geometry.
|
/// the geometry.
|
||||||
constexpr bool may_have_acute_joins() const {
|
constexpr bool may_have_acute_joins() const {
|
||||||
return has_any(kMayHaveAcuteJoins_);
|
return has_any(kMayHaveAcuteJoins);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit constexpr DisplayListSpecialGeometryFlags(int flags)
|
explicit constexpr DisplayListSpecialGeometryFlags(int flags)
|
||||||
: DisplayListFlagsBase(flags) {
|
: DisplayListFlagsBase(flags) {
|
||||||
FML_DCHECK((flags & kAnySpecialGeometryMask_) == flags);
|
FML_DCHECK((flags & kAnySpecialGeometryMask) == flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DisplayListSpecialGeometryFlags with(int extra) const {
|
const DisplayListSpecialGeometryFlags with(int extra) const {
|
||||||
@@ -170,19 +170,19 @@ class DisplayListAttributeFlags : DisplayListFlagsBase {
|
|||||||
const DlPathEffect* effect,
|
const DlPathEffect* effect,
|
||||||
bool is_stroked) const;
|
bool is_stroked) const;
|
||||||
|
|
||||||
constexpr bool ignores_paint() const { return has_any(kIgnoresPaint_); }
|
constexpr bool ignores_paint() const { return has_any(kIgnoresPaint); }
|
||||||
|
|
||||||
constexpr bool applies_anti_alias() const { return has_any(kUsesAntiAlias_); }
|
constexpr bool applies_anti_alias() const { return has_any(kUsesAntiAlias); }
|
||||||
constexpr bool applies_dither() const { return has_any(kUsesDither_); }
|
constexpr bool applies_dither() const { return has_any(kUsesDither); }
|
||||||
constexpr bool applies_color() const { return has_any(kUsesColor_); }
|
constexpr bool applies_color() const { return has_any(kUsesColor); }
|
||||||
constexpr bool applies_alpha() const { return has_any(kUsesAlpha_); }
|
constexpr bool applies_alpha() const { return has_any(kUsesAlpha); }
|
||||||
constexpr bool applies_alpha_or_color() const {
|
constexpr bool applies_alpha_or_color() const {
|
||||||
return has_any(kUsesAlpha_ | kUsesColor_);
|
return has_any(kUsesAlpha | kUsesColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The primitive dynamically determines whether it is a stroke or fill
|
/// The primitive dynamically determines whether it is a stroke or fill
|
||||||
/// operation (or both) based on the setting of the |Style| attribute.
|
/// operation (or both) based on the setting of the |Style| attribute.
|
||||||
constexpr bool applies_style() const { return has_any(kIsDrawnGeometry_); }
|
constexpr bool applies_style() const { return has_any(kIsDrawnGeometry); }
|
||||||
/// The primitive can use any of the stroke attributes, such as
|
/// The primitive can use any of the stroke attributes, such as
|
||||||
/// StrokeWidth, StrokeMiter, StrokeCap, or StrokeJoin. This
|
/// StrokeWidth, StrokeMiter, StrokeCap, or StrokeJoin. This
|
||||||
/// method will return if the primitive is defined as one that
|
/// method will return if the primitive is defined as one that
|
||||||
@@ -193,34 +193,34 @@ class DisplayListAttributeFlags : DisplayListFlagsBase {
|
|||||||
/// the style.
|
/// the style.
|
||||||
// bool applies_stroke_attributes() const { return is_stroked(); }
|
// bool applies_stroke_attributes() const { return is_stroked(); }
|
||||||
|
|
||||||
constexpr bool applies_shader() const { return has_any(kUsesShader_); }
|
constexpr bool applies_shader() const { return has_any(kUsesShader); }
|
||||||
/// The primitive honors the current DlColorFilter, including
|
/// The primitive honors the current DlColorFilter, including
|
||||||
/// the related attribute InvertColors
|
/// the related attribute InvertColors
|
||||||
constexpr bool applies_color_filter() const {
|
constexpr bool applies_color_filter() const {
|
||||||
return has_any(kUsesColorFilter_);
|
return has_any(kUsesColorFilter);
|
||||||
}
|
}
|
||||||
/// The primitive honors the DlBlendMode
|
/// The primitive honors the DlBlendMode
|
||||||
constexpr bool applies_blend() const { return has_any(kUsesBlend_); }
|
constexpr bool applies_blend() const { return has_any(kUsesBlend); }
|
||||||
constexpr bool applies_path_effect() const {
|
constexpr bool applies_path_effect() const {
|
||||||
return has_any(kUsesPathEffect_);
|
return has_any(kUsesPathEffect);
|
||||||
}
|
}
|
||||||
/// The primitive honors the DlMaskFilter whether set using the
|
/// The primitive honors the DlMaskFilter whether set using the
|
||||||
/// filter object or using the convenience method |setMaskBlurFilter|
|
/// filter object or using the convenience method |setMaskBlurFilter|
|
||||||
constexpr bool applies_mask_filter() const {
|
constexpr bool applies_mask_filter() const {
|
||||||
return has_any(kUsesMaskFilter_);
|
return has_any(kUsesMaskFilter);
|
||||||
}
|
}
|
||||||
constexpr bool applies_image_filter() const {
|
constexpr bool applies_image_filter() const {
|
||||||
return has_any(kUsesImageFilter_);
|
return has_any(kUsesImageFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool is_geometric() const { return has_any(kIsAnyGeometryMask_); }
|
constexpr bool is_geometric() const { return has_any(kIsAnyGeometryMask); }
|
||||||
constexpr bool always_stroked() const { return has_any(kIsStrokedGeometry_); }
|
constexpr bool always_stroked() const { return has_any(kIsStrokedGeometry); }
|
||||||
constexpr bool is_stroked(DlDrawStyle style = DlDrawStyle::kStroke) const {
|
constexpr bool is_stroked(DlDrawStyle style = DlDrawStyle::kStroke) const {
|
||||||
return (has_any(kIsStrokedGeometry_) ||
|
return (has_any(kIsStrokedGeometry) ||
|
||||||
(style != DlDrawStyle::kFill && has_any(kIsDrawnGeometry_)));
|
(style != DlDrawStyle::kFill && has_any(kIsDrawnGeometry)));
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool is_flood() const { return has_any(kFloodsSurface_); }
|
constexpr bool is_flood() const { return has_any(kFloodsSurface); }
|
||||||
|
|
||||||
constexpr bool operator==(DisplayListAttributeFlags const& other) const {
|
constexpr bool operator==(DisplayListAttributeFlags const& other) const {
|
||||||
return flags_ == other.flags_;
|
return flags_ == other.flags_;
|
||||||
@@ -229,15 +229,15 @@ class DisplayListAttributeFlags : DisplayListFlagsBase {
|
|||||||
private:
|
private:
|
||||||
explicit constexpr DisplayListAttributeFlags(int flags)
|
explicit constexpr DisplayListAttributeFlags(int flags)
|
||||||
: DisplayListFlagsBase(flags),
|
: DisplayListFlagsBase(flags),
|
||||||
special_flags_(flags & kAnySpecialGeometryMask_) {
|
special_flags_(flags & kAnySpecialGeometryMask) {
|
||||||
FML_DCHECK((flags & kIsAnyGeometryMask_) == kIsNonGeometric_ ||
|
FML_DCHECK((flags & kIsAnyGeometryMask) == kIsNonGeometric ||
|
||||||
(flags & kIsAnyGeometryMask_) == kIsFilledGeometry_ ||
|
(flags & kIsAnyGeometryMask) == kIsFilledGeometry ||
|
||||||
(flags & kIsAnyGeometryMask_) == kIsStrokedGeometry_ ||
|
(flags & kIsAnyGeometryMask) == kIsStrokedGeometry ||
|
||||||
(flags & kIsAnyGeometryMask_) == kIsDrawnGeometry_);
|
(flags & kIsAnyGeometryMask) == kIsDrawnGeometry);
|
||||||
FML_DCHECK(((flags & kAnyAttributeMask_) == 0) !=
|
FML_DCHECK(((flags & kAnyAttributeMask) == 0) !=
|
||||||
((flags & kIgnoresPaint_) == 0));
|
((flags & kIgnoresPaint) == 0));
|
||||||
FML_DCHECK((flags & kIsAnyGeometryMask_) != 0 ||
|
FML_DCHECK((flags & kIsAnyGeometryMask) != 0 ||
|
||||||
(flags & kAnySpecialGeometryMask_) == 0);
|
(flags & kAnySpecialGeometryMask) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr DisplayListAttributeFlags operator+(int extra) const {
|
constexpr DisplayListAttributeFlags operator+(int extra) const {
|
||||||
@@ -257,171 +257,171 @@ class DisplayListAttributeFlags : DisplayListFlagsBase {
|
|||||||
class DisplayListOpFlags : DisplayListFlags {
|
class DisplayListOpFlags : DisplayListFlags {
|
||||||
private:
|
private:
|
||||||
// Flags common to all primitives that apply colors
|
// Flags common to all primitives that apply colors
|
||||||
static constexpr int kBASE_PaintFlags_ = (kUsesDither_ | //
|
static constexpr int kBasePaintFlags = (kUsesDither | //
|
||||||
kUsesColor_ | //
|
kUsesColor | //
|
||||||
kUsesAlpha_ | //
|
kUsesAlpha | //
|
||||||
kUsesBlend_ | //
|
kUsesBlend | //
|
||||||
kUsesShader_ | //
|
kUsesShader | //
|
||||||
kUsesColorFilter_ | //
|
kUsesColorFilter | //
|
||||||
kUsesImageFilter_);
|
kUsesImageFilter);
|
||||||
|
|
||||||
// Flags common to all primitives that stroke or fill
|
// Flags common to all primitives that stroke or fill
|
||||||
static constexpr int kBASE_StrokeOrFillFlags_ = (kIsDrawnGeometry_ | //
|
static constexpr int kBaseStrokeOrFillFlags = (kIsDrawnGeometry | //
|
||||||
kUsesAntiAlias_ | //
|
kUsesAntiAlias | //
|
||||||
kUsesMaskFilter_ | //
|
kUsesMaskFilter | //
|
||||||
kUsesPathEffect_);
|
kUsesPathEffect);
|
||||||
|
|
||||||
// Flags common to primitives that stroke geometry
|
// Flags common to primitives that stroke geometry
|
||||||
static constexpr int kBASE_StrokeFlags_ = (kIsStrokedGeometry_ | //
|
static constexpr int kBaseStrokeFlags = (kIsStrokedGeometry | //
|
||||||
kUsesAntiAlias_ | //
|
kUsesAntiAlias | //
|
||||||
kUsesMaskFilter_ | //
|
kUsesMaskFilter | //
|
||||||
kUsesPathEffect_);
|
kUsesPathEffect);
|
||||||
|
|
||||||
// Flags common to primitives that render an image with paint attributes
|
// Flags common to primitives that render an image with paint attributes
|
||||||
static constexpr int kBASE_ImageFlags_ = (kIsNonGeometric_ | //
|
static constexpr int kBaseImageFlags = (kIsNonGeometric | //
|
||||||
kUsesAlpha_ | //
|
kUsesAlpha | //
|
||||||
kUsesDither_ | //
|
kUsesDither | //
|
||||||
kUsesBlend_ | //
|
kUsesBlend | //
|
||||||
kUsesColorFilter_ | //
|
kUsesColorFilter | //
|
||||||
kUsesImageFilter_);
|
kUsesImageFilter);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr DisplayListAttributeFlags kSaveLayerFlags{
|
static constexpr DisplayListAttributeFlags kSaveLayerFlags{
|
||||||
kIgnoresPaint_ //
|
kIgnoresPaint //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kSaveLayerWithPaintFlags{
|
static constexpr DisplayListAttributeFlags kSaveLayerWithPaintFlags{
|
||||||
kIsNonGeometric_ | //
|
kIsNonGeometric | //
|
||||||
kUsesAlpha_ | //
|
kUsesAlpha | //
|
||||||
kUsesBlend_ | //
|
kUsesBlend | //
|
||||||
kUsesColorFilter_ | //
|
kUsesColorFilter | //
|
||||||
kUsesImageFilter_ //
|
kUsesImageFilter //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawColorFlags{
|
static constexpr DisplayListAttributeFlags kDrawColorFlags{
|
||||||
kFloodsSurface_ | //
|
kFloodsSurface | //
|
||||||
kIgnoresPaint_ //
|
kIgnoresPaint //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawPaintFlags{
|
static constexpr DisplayListAttributeFlags kDrawPaintFlags{
|
||||||
kBASE_PaintFlags_ | //
|
kBasePaintFlags | //
|
||||||
kFloodsSurface_ //
|
kFloodsSurface //
|
||||||
};
|
};
|
||||||
// Special case flags for horizonal and vertical lines
|
// Special case flags for horizonal and vertical lines
|
||||||
static constexpr DisplayListAttributeFlags kDrawHVLineFlags{
|
static constexpr DisplayListAttributeFlags kDrawHVLineFlags{
|
||||||
kBASE_PaintFlags_ | //
|
kBasePaintFlags | //
|
||||||
kBASE_StrokeFlags_ | //
|
kBaseStrokeFlags | //
|
||||||
kMayHaveCaps_ //
|
kMayHaveCaps //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawLineFlags{
|
static constexpr DisplayListAttributeFlags kDrawLineFlags{
|
||||||
kDrawHVLineFlags //
|
kDrawHVLineFlags //
|
||||||
+ kMayHaveDiagonalCaps_ //
|
+ kMayHaveDiagonalCaps //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawRectFlags{
|
static constexpr DisplayListAttributeFlags kDrawRectFlags{
|
||||||
kBASE_PaintFlags_ | //
|
kBasePaintFlags | //
|
||||||
kBASE_StrokeOrFillFlags_ | //
|
kBaseStrokeOrFillFlags | //
|
||||||
kMayHaveJoins_ //
|
kMayHaveJoins //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawOvalFlags{
|
static constexpr DisplayListAttributeFlags kDrawOvalFlags{
|
||||||
kBASE_PaintFlags_ | //
|
kBasePaintFlags | //
|
||||||
kBASE_StrokeOrFillFlags_ //
|
kBaseStrokeOrFillFlags //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawCircleFlags{
|
static constexpr DisplayListAttributeFlags kDrawCircleFlags{
|
||||||
kBASE_PaintFlags_ | //
|
kBasePaintFlags | //
|
||||||
kBASE_StrokeOrFillFlags_ //
|
kBaseStrokeOrFillFlags //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawRRectFlags{
|
static constexpr DisplayListAttributeFlags kDrawRRectFlags{
|
||||||
kBASE_PaintFlags_ | //
|
kBasePaintFlags | //
|
||||||
kBASE_StrokeOrFillFlags_ //
|
kBaseStrokeOrFillFlags //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawDRRectFlags{
|
static constexpr DisplayListAttributeFlags kDrawDRRectFlags{
|
||||||
kBASE_PaintFlags_ | //
|
kBasePaintFlags | //
|
||||||
kBASE_StrokeOrFillFlags_ //
|
kBaseStrokeOrFillFlags //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawPathFlags{
|
static constexpr DisplayListAttributeFlags kDrawPathFlags{
|
||||||
kBASE_PaintFlags_ | //
|
kBasePaintFlags | //
|
||||||
kBASE_StrokeOrFillFlags_ | //
|
kBaseStrokeOrFillFlags | //
|
||||||
kMayHaveCaps_ | //
|
kMayHaveCaps | //
|
||||||
kMayHaveDiagonalCaps_ | //
|
kMayHaveDiagonalCaps | //
|
||||||
kMayHaveJoins_ | //
|
kMayHaveJoins | //
|
||||||
kMayHaveAcuteJoins_ //
|
kMayHaveAcuteJoins //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawArcNoCenterFlags{
|
static constexpr DisplayListAttributeFlags kDrawArcNoCenterFlags{
|
||||||
kBASE_PaintFlags_ | //
|
kBasePaintFlags | //
|
||||||
kBASE_StrokeOrFillFlags_ | //
|
kBaseStrokeOrFillFlags | //
|
||||||
kMayHaveCaps_ | //
|
kMayHaveCaps | //
|
||||||
kMayHaveDiagonalCaps_ //
|
kMayHaveDiagonalCaps //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawArcWithCenterFlags{
|
static constexpr DisplayListAttributeFlags kDrawArcWithCenterFlags{
|
||||||
kBASE_PaintFlags_ | //
|
kBasePaintFlags | //
|
||||||
kBASE_StrokeOrFillFlags_ | //
|
kBaseStrokeOrFillFlags | //
|
||||||
kMayHaveJoins_ | //
|
kMayHaveJoins | //
|
||||||
kMayHaveAcuteJoins_ //
|
kMayHaveAcuteJoins //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawPointsAsPointsFlags{
|
static constexpr DisplayListAttributeFlags kDrawPointsAsPointsFlags{
|
||||||
kBASE_PaintFlags_ | //
|
kBasePaintFlags | //
|
||||||
kBASE_StrokeFlags_ | //
|
kBaseStrokeFlags | //
|
||||||
kMayHaveCaps_ | //
|
kMayHaveCaps | //
|
||||||
kButtCapIsSquare_ //
|
kButtCapIsSquare //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawPointsAsLinesFlags{
|
static constexpr DisplayListAttributeFlags kDrawPointsAsLinesFlags{
|
||||||
kBASE_PaintFlags_ | //
|
kBasePaintFlags | //
|
||||||
kBASE_StrokeFlags_ | //
|
kBaseStrokeFlags | //
|
||||||
kMayHaveCaps_ | //
|
kMayHaveCaps | //
|
||||||
kMayHaveDiagonalCaps_ //
|
kMayHaveDiagonalCaps //
|
||||||
};
|
};
|
||||||
// Polygon mode just draws (count-1) separate lines, no joins
|
// Polygon mode just draws (count-1) separate lines, no joins
|
||||||
static constexpr DisplayListAttributeFlags kDrawPointsAsPolygonFlags{
|
static constexpr DisplayListAttributeFlags kDrawPointsAsPolygonFlags{
|
||||||
kBASE_PaintFlags_ | //
|
kBasePaintFlags | //
|
||||||
kBASE_StrokeFlags_ | //
|
kBaseStrokeFlags | //
|
||||||
kMayHaveCaps_ | //
|
kMayHaveCaps | //
|
||||||
kMayHaveDiagonalCaps_ //
|
kMayHaveDiagonalCaps //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawVerticesFlags{
|
static constexpr DisplayListAttributeFlags kDrawVerticesFlags{
|
||||||
kIsNonGeometric_ | //
|
kIsNonGeometric | //
|
||||||
kUsesDither_ | //
|
kUsesDither | //
|
||||||
kUsesAlpha_ | //
|
kUsesAlpha | //
|
||||||
kUsesShader_ | //
|
kUsesShader | //
|
||||||
kUsesBlend_ | //
|
kUsesBlend | //
|
||||||
kUsesColorFilter_ | //
|
kUsesColorFilter | //
|
||||||
kUsesImageFilter_ //
|
kUsesImageFilter //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawImageFlags{
|
static constexpr DisplayListAttributeFlags kDrawImageFlags{
|
||||||
kIgnoresPaint_ //
|
kIgnoresPaint //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawImageWithPaintFlags{
|
static constexpr DisplayListAttributeFlags kDrawImageWithPaintFlags{
|
||||||
kBASE_ImageFlags_ | //
|
kBaseImageFlags | //
|
||||||
kUsesAntiAlias_ | //
|
kUsesAntiAlias | //
|
||||||
kUsesMaskFilter_ //
|
kUsesMaskFilter //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawImageRectFlags{
|
static constexpr DisplayListAttributeFlags kDrawImageRectFlags{
|
||||||
kIgnoresPaint_ //
|
kIgnoresPaint //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawImageRectWithPaintFlags{
|
static constexpr DisplayListAttributeFlags kDrawImageRectWithPaintFlags{
|
||||||
kBASE_ImageFlags_ | //
|
kBaseImageFlags | //
|
||||||
kUsesAntiAlias_ | //
|
kUsesAntiAlias | //
|
||||||
kUsesMaskFilter_ //
|
kUsesMaskFilter //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawImageNineFlags{
|
static constexpr DisplayListAttributeFlags kDrawImageNineFlags{
|
||||||
kIgnoresPaint_ //
|
kIgnoresPaint //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawImageNineWithPaintFlags{
|
static constexpr DisplayListAttributeFlags kDrawImageNineWithPaintFlags{
|
||||||
kBASE_ImageFlags_ //
|
kBaseImageFlags //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawAtlasFlags{
|
static constexpr DisplayListAttributeFlags kDrawAtlasFlags{
|
||||||
kIgnoresPaint_ //
|
kIgnoresPaint //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawAtlasWithPaintFlags{
|
static constexpr DisplayListAttributeFlags kDrawAtlasWithPaintFlags{
|
||||||
kBASE_ImageFlags_ //
|
kBaseImageFlags //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawDisplayListFlags{
|
static constexpr DisplayListAttributeFlags kDrawDisplayListFlags{
|
||||||
kIgnoresPaint_ //
|
kIgnoresPaint //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawTextBlobFlags{
|
static constexpr DisplayListAttributeFlags kDrawTextBlobFlags{
|
||||||
DisplayListAttributeFlags(kBASE_PaintFlags_ | //
|
DisplayListAttributeFlags(kBasePaintFlags | //
|
||||||
kBASE_StrokeOrFillFlags_ | //
|
kBaseStrokeOrFillFlags | //
|
||||||
kMayHaveJoins_) //
|
kMayHaveJoins) //
|
||||||
- kUsesAntiAlias_ //
|
- kUsesAntiAlias //
|
||||||
};
|
};
|
||||||
static constexpr DisplayListAttributeFlags kDrawShadowFlags{
|
static constexpr DisplayListAttributeFlags kDrawShadowFlags{
|
||||||
kIgnoresPaint_ //
|
kIgnoresPaint //
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ DEFINE_SET_CLEAR_DLATTR_OP(PathEffect, PathEffect, effect)
|
|||||||
struct SetImageColorSourceOp : DLOp {
|
struct SetImageColorSourceOp : DLOp {
|
||||||
static const auto kType = DisplayListOpType::kSetImageColorSource;
|
static const auto kType = DisplayListOpType::kSetImageColorSource;
|
||||||
|
|
||||||
SetImageColorSourceOp(const DlImageColorSource* source)
|
explicit SetImageColorSourceOp(const DlImageColorSource* source)
|
||||||
: source(source->image(),
|
: source(source->image(),
|
||||||
source->horizontal_tile_mode(),
|
source->horizontal_tile_mode(),
|
||||||
source->vertical_tile_mode(),
|
source->vertical_tile_mode(),
|
||||||
@@ -254,7 +254,8 @@ struct SetImageColorSourceOp : DLOp {
|
|||||||
struct SetRuntimeEffectColorSourceOp : DLOp {
|
struct SetRuntimeEffectColorSourceOp : DLOp {
|
||||||
static const auto kType = DisplayListOpType::kSetRuntimeEffectColorSource;
|
static const auto kType = DisplayListOpType::kSetRuntimeEffectColorSource;
|
||||||
|
|
||||||
SetRuntimeEffectColorSourceOp(const DlRuntimeEffectColorSource* source)
|
explicit SetRuntimeEffectColorSourceOp(
|
||||||
|
const DlRuntimeEffectColorSource* source)
|
||||||
: source(source->runtime_effect(),
|
: source(source->runtime_effect(),
|
||||||
source->samplers(),
|
source->samplers(),
|
||||||
source->uniform_data()) {}
|
source->uniform_data()) {}
|
||||||
@@ -295,7 +296,7 @@ struct SetSceneColorSourceOp : DLOp {
|
|||||||
struct SetSharedImageFilterOp : DLOp {
|
struct SetSharedImageFilterOp : DLOp {
|
||||||
static const auto kType = DisplayListOpType::kSetSharedImageFilter;
|
static const auto kType = DisplayListOpType::kSetSharedImageFilter;
|
||||||
|
|
||||||
SetSharedImageFilterOp(const DlImageFilter* filter)
|
explicit SetSharedImageFilterOp(const DlImageFilter* filter)
|
||||||
: filter(filter->shared()) {}
|
: filter(filter->shared()) {}
|
||||||
|
|
||||||
const std::shared_ptr<DlImageFilter> filter;
|
const std::shared_ptr<DlImageFilter> filter;
|
||||||
@@ -315,7 +316,7 @@ struct SetSharedImageFilterOp : DLOp {
|
|||||||
struct SaveOpBase : DLOp {
|
struct SaveOpBase : DLOp {
|
||||||
SaveOpBase() : options(), restore_index(0) {}
|
SaveOpBase() : options(), restore_index(0) {}
|
||||||
|
|
||||||
SaveOpBase(const SaveLayerOptions options)
|
explicit SaveOpBase(const SaveLayerOptions& options)
|
||||||
: options(options), restore_index(0) {}
|
: options(options), restore_index(0) {}
|
||||||
|
|
||||||
// options parameter is only used by saveLayer operations, but since
|
// options parameter is only used by saveLayer operations, but since
|
||||||
@@ -347,7 +348,7 @@ struct SaveOp final : SaveOpBase {
|
|||||||
struct SaveLayerOp final : SaveOpBase {
|
struct SaveLayerOp final : SaveOpBase {
|
||||||
static const auto kType = DisplayListOpType::kSaveLayer;
|
static const auto kType = DisplayListOpType::kSaveLayer;
|
||||||
|
|
||||||
explicit SaveLayerOp(const SaveLayerOptions options) : SaveOpBase(options) {}
|
explicit SaveLayerOp(const SaveLayerOptions& options) : SaveOpBase(options) {}
|
||||||
|
|
||||||
void dispatch(DispatchContext& ctx) const {
|
void dispatch(DispatchContext& ctx) const {
|
||||||
if (save_needed(ctx)) {
|
if (save_needed(ctx)) {
|
||||||
@@ -359,7 +360,7 @@ struct SaveLayerOp final : SaveOpBase {
|
|||||||
struct SaveLayerBoundsOp final : SaveOpBase {
|
struct SaveLayerBoundsOp final : SaveOpBase {
|
||||||
static const auto kType = DisplayListOpType::kSaveLayerBounds;
|
static const auto kType = DisplayListOpType::kSaveLayerBounds;
|
||||||
|
|
||||||
SaveLayerBoundsOp(const SaveLayerOptions options, const SkRect& rect)
|
SaveLayerBoundsOp(const SaveLayerOptions& options, const SkRect& rect)
|
||||||
: SaveOpBase(options), rect(rect) {}
|
: SaveOpBase(options), rect(rect) {}
|
||||||
|
|
||||||
const SkRect rect;
|
const SkRect rect;
|
||||||
@@ -374,7 +375,7 @@ struct SaveLayerBoundsOp final : SaveOpBase {
|
|||||||
struct SaveLayerBackdropOp final : SaveOpBase {
|
struct SaveLayerBackdropOp final : SaveOpBase {
|
||||||
static const auto kType = DisplayListOpType::kSaveLayerBackdrop;
|
static const auto kType = DisplayListOpType::kSaveLayerBackdrop;
|
||||||
|
|
||||||
explicit SaveLayerBackdropOp(const SaveLayerOptions options,
|
explicit SaveLayerBackdropOp(const SaveLayerOptions& options,
|
||||||
const DlImageFilter* backdrop)
|
const DlImageFilter* backdrop)
|
||||||
: SaveOpBase(options), backdrop(backdrop->shared()) {}
|
: SaveOpBase(options), backdrop(backdrop->shared()) {}
|
||||||
|
|
||||||
@@ -396,7 +397,7 @@ struct SaveLayerBackdropOp final : SaveOpBase {
|
|||||||
struct SaveLayerBackdropBoundsOp final : SaveOpBase {
|
struct SaveLayerBackdropBoundsOp final : SaveOpBase {
|
||||||
static const auto kType = DisplayListOpType::kSaveLayerBackdropBounds;
|
static const auto kType = DisplayListOpType::kSaveLayerBackdropBounds;
|
||||||
|
|
||||||
SaveLayerBackdropBoundsOp(const SaveLayerOptions options,
|
SaveLayerBackdropBoundsOp(const SaveLayerOptions& options,
|
||||||
const SkRect& rect,
|
const SkRect& rect,
|
||||||
const DlImageFilter* backdrop)
|
const DlImageFilter* backdrop)
|
||||||
: SaveOpBase(options), rect(rect), backdrop(backdrop->shared()) {}
|
: SaveOpBase(options), rect(rect), backdrop(backdrop->shared()) {}
|
||||||
@@ -603,7 +604,7 @@ DEFINE_CLIP_SHAPE_OP(RRect, Difference)
|
|||||||
struct Clip##clipop##PathOp final : TransformClipOpBase { \
|
struct Clip##clipop##PathOp final : TransformClipOpBase { \
|
||||||
static const auto kType = DisplayListOpType::kClip##clipop##Path; \
|
static const auto kType = DisplayListOpType::kClip##clipop##Path; \
|
||||||
\
|
\
|
||||||
Clip##clipop##PathOp(SkPath path, bool is_aa) \
|
Clip##clipop##PathOp(const SkPath& path, bool is_aa) \
|
||||||
: is_aa(is_aa), path(path) {} \
|
: is_aa(is_aa), path(path) {} \
|
||||||
\
|
\
|
||||||
const bool is_aa; \
|
const bool is_aa; \
|
||||||
@@ -689,7 +690,7 @@ DEFINE_DRAW_1ARG_OP(RRect, SkRRect, rrect)
|
|||||||
struct DrawPathOp final : DrawOpBase {
|
struct DrawPathOp final : DrawOpBase {
|
||||||
static const auto kType = DisplayListOpType::kDrawPath;
|
static const auto kType = DisplayListOpType::kDrawPath;
|
||||||
|
|
||||||
explicit DrawPathOp(SkPath path) : path(path) {}
|
explicit DrawPathOp(const SkPath& path) : path(path) {}
|
||||||
|
|
||||||
const SkPath path;
|
const SkPath path;
|
||||||
|
|
||||||
@@ -787,7 +788,7 @@ DEFINE_DRAW_POINTS_OP(Polygon, kPolygon);
|
|||||||
struct DrawVerticesOp final : DrawOpBase {
|
struct DrawVerticesOp final : DrawOpBase {
|
||||||
static const auto kType = DisplayListOpType::kDrawVertices;
|
static const auto kType = DisplayListOpType::kDrawVertices;
|
||||||
|
|
||||||
DrawVerticesOp(DlBlendMode mode) : mode(mode) {}
|
explicit DrawVerticesOp(DlBlendMode mode) : mode(mode) {}
|
||||||
|
|
||||||
const DlBlendMode mode;
|
const DlBlendMode mode;
|
||||||
|
|
||||||
@@ -806,7 +807,7 @@ struct DrawVerticesOp final : DrawOpBase {
|
|||||||
struct name##Op final : DrawOpBase { \
|
struct name##Op final : DrawOpBase { \
|
||||||
static const auto kType = DisplayListOpType::k##name; \
|
static const auto kType = DisplayListOpType::k##name; \
|
||||||
\
|
\
|
||||||
name##Op(const sk_sp<DlImage> image, \
|
name##Op(const sk_sp<DlImage>& image, \
|
||||||
const SkPoint& point, \
|
const SkPoint& point, \
|
||||||
DlImageSampling sampling) \
|
DlImageSampling sampling) \
|
||||||
: point(point), sampling(sampling), image(std::move(image)) {} \
|
: point(point), sampling(sampling), image(std::move(image)) {} \
|
||||||
@@ -837,7 +838,7 @@ DEFINE_DRAW_IMAGE_OP(DrawImageWithAttr, true)
|
|||||||
struct DrawImageRectOp final : DrawOpBase {
|
struct DrawImageRectOp final : DrawOpBase {
|
||||||
static const auto kType = DisplayListOpType::kDrawImageRect;
|
static const auto kType = DisplayListOpType::kDrawImageRect;
|
||||||
|
|
||||||
DrawImageRectOp(const sk_sp<DlImage> image,
|
DrawImageRectOp(const sk_sp<DlImage>& image,
|
||||||
const SkRect& src,
|
const SkRect& src,
|
||||||
const SkRect& dst,
|
const SkRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
@@ -848,7 +849,7 @@ struct DrawImageRectOp final : DrawOpBase {
|
|||||||
sampling(sampling),
|
sampling(sampling),
|
||||||
render_with_attributes(render_with_attributes),
|
render_with_attributes(render_with_attributes),
|
||||||
constraint(constraint),
|
constraint(constraint),
|
||||||
image(std::move(image)) {}
|
image(image) {}
|
||||||
|
|
||||||
const SkRect src;
|
const SkRect src;
|
||||||
const SkRect dst;
|
const SkRect dst;
|
||||||
@@ -879,7 +880,7 @@ struct DrawImageRectOp final : DrawOpBase {
|
|||||||
struct name##Op final : DrawOpBase { \
|
struct name##Op final : DrawOpBase { \
|
||||||
static const auto kType = DisplayListOpType::k##name; \
|
static const auto kType = DisplayListOpType::k##name; \
|
||||||
\
|
\
|
||||||
name##Op(const sk_sp<DlImage> image, \
|
name##Op(const sk_sp<DlImage>& image, \
|
||||||
const SkIRect& center, \
|
const SkIRect& center, \
|
||||||
const SkRect& dst, \
|
const SkRect& dst, \
|
||||||
DlFilterMode mode) \
|
DlFilterMode mode) \
|
||||||
@@ -916,7 +917,7 @@ DEFINE_DRAW_IMAGE_NINE_OP(DrawImageNineWithAttr, true)
|
|||||||
// DlColor list only packs well if the count is even, otherwise there
|
// DlColor list only packs well if the count is even, otherwise there
|
||||||
// can be 4 unusued bytes at the end.
|
// can be 4 unusued bytes at the end.
|
||||||
struct DrawAtlasBaseOp : DrawOpBase {
|
struct DrawAtlasBaseOp : DrawOpBase {
|
||||||
DrawAtlasBaseOp(const sk_sp<DlImage> atlas,
|
DrawAtlasBaseOp(const sk_sp<DlImage>& atlas,
|
||||||
int count,
|
int count,
|
||||||
DlBlendMode mode,
|
DlBlendMode mode,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
@@ -927,7 +928,7 @@ struct DrawAtlasBaseOp : DrawOpBase {
|
|||||||
has_colors(has_colors),
|
has_colors(has_colors),
|
||||||
render_with_attributes(render_with_attributes),
|
render_with_attributes(render_with_attributes),
|
||||||
sampling(sampling),
|
sampling(sampling),
|
||||||
atlas(std::move(atlas)) {}
|
atlas(atlas) {}
|
||||||
|
|
||||||
const int count;
|
const int count;
|
||||||
const uint16_t mode_index;
|
const uint16_t mode_index;
|
||||||
@@ -959,7 +960,7 @@ struct DrawAtlasBaseOp : DrawOpBase {
|
|||||||
struct DrawAtlasOp final : DrawAtlasBaseOp {
|
struct DrawAtlasOp final : DrawAtlasBaseOp {
|
||||||
static const auto kType = DisplayListOpType::kDrawAtlas;
|
static const auto kType = DisplayListOpType::kDrawAtlas;
|
||||||
|
|
||||||
DrawAtlasOp(const sk_sp<DlImage> atlas,
|
DrawAtlasOp(const sk_sp<DlImage>& atlas,
|
||||||
int count,
|
int count,
|
||||||
DlBlendMode mode,
|
DlBlendMode mode,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
@@ -1000,7 +1001,7 @@ struct DrawAtlasOp final : DrawAtlasBaseOp {
|
|||||||
struct DrawAtlasCulledOp final : DrawAtlasBaseOp {
|
struct DrawAtlasCulledOp final : DrawAtlasBaseOp {
|
||||||
static const auto kType = DisplayListOpType::kDrawAtlasCulled;
|
static const auto kType = DisplayListOpType::kDrawAtlasCulled;
|
||||||
|
|
||||||
DrawAtlasCulledOp(const sk_sp<DlImage> atlas,
|
DrawAtlasCulledOp(const sk_sp<DlImage>& atlas,
|
||||||
int count,
|
int count,
|
||||||
DlBlendMode mode,
|
DlBlendMode mode,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
@@ -1044,9 +1045,9 @@ struct DrawAtlasCulledOp final : DrawAtlasBaseOp {
|
|||||||
struct DrawDisplayListOp final : DrawOpBase {
|
struct DrawDisplayListOp final : DrawOpBase {
|
||||||
static const auto kType = DisplayListOpType::kDrawDisplayList;
|
static const auto kType = DisplayListOpType::kDrawDisplayList;
|
||||||
|
|
||||||
explicit DrawDisplayListOp(const sk_sp<DisplayList> display_list,
|
explicit DrawDisplayListOp(const sk_sp<DisplayList>& display_list,
|
||||||
SkScalar opacity)
|
SkScalar opacity)
|
||||||
: opacity(opacity), display_list(std::move(display_list)) {}
|
: opacity(opacity), display_list(display_list) {}
|
||||||
|
|
||||||
SkScalar opacity;
|
SkScalar opacity;
|
||||||
const sk_sp<DisplayList> display_list;
|
const sk_sp<DisplayList> display_list;
|
||||||
@@ -1070,8 +1071,8 @@ struct DrawDisplayListOp final : DrawOpBase {
|
|||||||
struct DrawTextBlobOp final : DrawOpBase {
|
struct DrawTextBlobOp final : DrawOpBase {
|
||||||
static const auto kType = DisplayListOpType::kDrawTextBlob;
|
static const auto kType = DisplayListOpType::kDrawTextBlob;
|
||||||
|
|
||||||
DrawTextBlobOp(const sk_sp<SkTextBlob> blob, SkScalar x, SkScalar y)
|
DrawTextBlobOp(const sk_sp<SkTextBlob>& blob, SkScalar x, SkScalar y)
|
||||||
: x(x), y(y), blob(std::move(blob)) {}
|
: x(x), y(y), blob(blob) {}
|
||||||
|
|
||||||
const SkScalar x;
|
const SkScalar x;
|
||||||
const SkScalar y;
|
const SkScalar y;
|
||||||
|
|||||||
@@ -592,7 +592,7 @@ class DlColorFilterImageFilter final : public DlImageFilter {
|
|||||||
: DlColorFilterImageFilter(&filter) {}
|
: DlColorFilterImageFilter(&filter) {}
|
||||||
|
|
||||||
static std::shared_ptr<DlImageFilter> Make(
|
static std::shared_ptr<DlImageFilter> Make(
|
||||||
std::shared_ptr<const DlColorFilter> filter) {
|
const std::shared_ptr<const DlColorFilter>& filter) {
|
||||||
if (filter) {
|
if (filter) {
|
||||||
return std::make_shared<DlColorFilterImageFilter>(filter);
|
return std::make_shared<DlColorFilterImageFilter>(filter);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace flutter {
|
|||||||
// which can be accessed at any time via paint().
|
// which can be accessed at any time via paint().
|
||||||
class DlSkPaintDispatchHelper : public virtual DlOpReceiver {
|
class DlSkPaintDispatchHelper : public virtual DlOpReceiver {
|
||||||
public:
|
public:
|
||||||
DlSkPaintDispatchHelper(SkScalar opacity = SK_Scalar1)
|
explicit DlSkPaintDispatchHelper(SkScalar opacity = SK_Scalar1)
|
||||||
: current_color_(SK_ColorBLACK), opacity_(opacity) {
|
: current_color_(SK_ColorBLACK), opacity_(opacity) {
|
||||||
if (opacity < SK_Scalar1) {
|
if (opacity < SK_Scalar1) {
|
||||||
paint_.setAlphaf(opacity);
|
paint_.setAlphaf(opacity);
|
||||||
@@ -76,7 +76,7 @@ class DlSkPaintDispatchHelper : public virtual DlOpReceiver {
|
|||||||
sk_sp<SkColorFilter> makeColorFilter() const;
|
sk_sp<SkColorFilter> makeColorFilter() const;
|
||||||
|
|
||||||
struct SaveInfo {
|
struct SaveInfo {
|
||||||
SaveInfo(SkScalar opacity) : opacity(opacity) {}
|
explicit SaveInfo(SkScalar opacity) : opacity(opacity) {}
|
||||||
|
|
||||||
SkScalar opacity;
|
SkScalar opacity;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -456,11 +456,11 @@ class RenderEnvironment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static RenderEnvironment Make565(const DlSurfaceProvider* provider) {
|
static RenderEnvironment Make565(const DlSurfaceProvider* provider) {
|
||||||
return RenderEnvironment(provider, PixelFormat::k565_PixelFormat);
|
return RenderEnvironment(provider, PixelFormat::k565PixelFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RenderEnvironment MakeN32(const DlSurfaceProvider* provider) {
|
static RenderEnvironment MakeN32(const DlSurfaceProvider* provider) {
|
||||||
return RenderEnvironment(provider, PixelFormat::kN32Premul_PixelFormat);
|
return RenderEnvironment(provider, PixelFormat::kN32PremulPixelFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_ref(SkRenderer& sk_renderer,
|
void init_ref(SkRenderer& sk_renderer,
|
||||||
@@ -1540,7 +1540,7 @@ class CanvasCompareTester {
|
|||||||
// See https://bugs.chromium.org/p/skia/issues/detail?id=14046
|
// See https://bugs.chromium.org/p/skia/issues/detail?id=14046
|
||||||
bool no_hairlines =
|
bool no_hairlines =
|
||||||
testP.is_draw_path() &&
|
testP.is_draw_path() &&
|
||||||
env.provider()->backend_type() != BackendType::kSoftware_Backend;
|
env.provider()->backend_type() != BackendType::kSoftwareBackend;
|
||||||
RenderWith(testP, env, tolerance,
|
RenderWith(testP, env, tolerance,
|
||||||
CaseParameters(
|
CaseParameters(
|
||||||
"Stroke + defaults",
|
"Stroke + defaults",
|
||||||
@@ -2082,10 +2082,10 @@ class CanvasCompareTester {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int groupOpacityFudgeFactor(const RenderEnvironment& env) {
|
static int groupOpacityFudgeFactor(const RenderEnvironment& env) {
|
||||||
if (env.format() == PixelFormat::k565_PixelFormat) {
|
if (env.format() == PixelFormat::k565PixelFormat) {
|
||||||
return 9;
|
return 9;
|
||||||
}
|
}
|
||||||
if (env.provider()->backend_type() == BackendType::kOpenGL_Backend) {
|
if (env.provider()->backend_type() == BackendType::kOpenGlBackend) {
|
||||||
// OpenGL gets a little fuzzy at times. Still, "within 5" (aka +/-4)
|
// OpenGL gets a little fuzzy at times. Still, "within 5" (aka +/-4)
|
||||||
// for byte samples is not bad, though the other backends give +/-1
|
// for byte samples is not bad, though the other backends give +/-1
|
||||||
return 5;
|
return 5;
|
||||||
@@ -2421,7 +2421,7 @@ class DisplayListCanvasTestBase : public BaseT, protected DisplayListOpFlags {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
provider->InitializeSurface(kTestWidth, kTestHeight,
|
provider->InitializeSurface(kTestWidth, kTestHeight,
|
||||||
PixelFormat::kN32Premul_PixelFormat);
|
PixelFormat::kN32PremulPixelFormat);
|
||||||
CanvasCompareTester::kTestProviders.push_back(std::move(provider));
|
CanvasCompareTester::kTestProviders.push_back(std::move(provider));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2446,13 +2446,13 @@ class DisplayListCanvasTestBase : public BaseT, protected DisplayListOpFlags {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (do_software) {
|
if (do_software) {
|
||||||
AddProvider(BackendType::kSoftware_Backend, "Software");
|
AddProvider(BackendType::kSoftwareBackend, "Software");
|
||||||
}
|
}
|
||||||
if (do_opengl) {
|
if (do_opengl) {
|
||||||
AddProvider(BackendType::kOpenGL_Backend, "OpenGL");
|
AddProvider(BackendType::kOpenGlBackend, "OpenGL");
|
||||||
}
|
}
|
||||||
if (do_metal) {
|
if (do_metal) {
|
||||||
AddProvider(BackendType::kMetal_Backend, "Metal");
|
AddProvider(BackendType::kMetalBackend, "Metal");
|
||||||
}
|
}
|
||||||
std::string providers = "";
|
std::string providers = "";
|
||||||
auto begin = CanvasCompareTester::kTestProviders.cbegin();
|
auto begin = CanvasCompareTester::kTestProviders.cbegin();
|
||||||
@@ -3501,7 +3501,7 @@ TEST_F(DisplayListCanvas, SaveLayerConsolidation) {
|
|||||||
std::vector<std::unique_ptr<RenderEnvironment>> environments;
|
std::vector<std::unique_ptr<RenderEnvironment>> environments;
|
||||||
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
||||||
auto env = std::make_unique<RenderEnvironment>(
|
auto env = std::make_unique<RenderEnvironment>(
|
||||||
provider.get(), PixelFormat::kN32Premul_PixelFormat);
|
provider.get(), PixelFormat::kN32PremulPixelFormat);
|
||||||
environments.push_back(std::move(env));
|
environments.push_back(std::move(env));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3645,7 +3645,7 @@ TEST_F(DisplayListCanvas, MatrixColorFilterModifyTransparencyCheck) {
|
|||||||
std::vector<std::unique_ptr<RenderEnvironment>> environments;
|
std::vector<std::unique_ptr<RenderEnvironment>> environments;
|
||||||
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
||||||
auto env = std::make_unique<RenderEnvironment>(
|
auto env = std::make_unique<RenderEnvironment>(
|
||||||
provider.get(), PixelFormat::kN32Premul_PixelFormat);
|
provider.get(), PixelFormat::kN32PremulPixelFormat);
|
||||||
environments.push_back(std::move(env));
|
environments.push_back(std::move(env));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3719,7 +3719,7 @@ TEST_F(DisplayListCanvas, MatrixColorFilterOpacityCommuteCheck) {
|
|||||||
std::vector<std::unique_ptr<RenderEnvironment>> environments;
|
std::vector<std::unique_ptr<RenderEnvironment>> environments;
|
||||||
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
||||||
auto env = std::make_unique<RenderEnvironment>(
|
auto env = std::make_unique<RenderEnvironment>(
|
||||||
provider.get(), PixelFormat::kN32Premul_PixelFormat);
|
provider.get(), PixelFormat::kN32PremulPixelFormat);
|
||||||
environments.push_back(std::move(env));
|
environments.push_back(std::move(env));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3836,7 +3836,7 @@ TEST_F(DisplayListCanvas, BlendColorFilterModifyTransparencyCheck) {
|
|||||||
std::vector<std::unique_ptr<RenderEnvironment>> environments;
|
std::vector<std::unique_ptr<RenderEnvironment>> environments;
|
||||||
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
||||||
auto env = std::make_unique<RenderEnvironment>(
|
auto env = std::make_unique<RenderEnvironment>(
|
||||||
provider.get(), PixelFormat::kN32Premul_PixelFormat);
|
provider.get(), PixelFormat::kN32PremulPixelFormat);
|
||||||
environments.push_back(std::move(env));
|
environments.push_back(std::move(env));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3898,7 +3898,7 @@ TEST_F(DisplayListCanvas, BlendColorFilterOpacityCommuteCheck) {
|
|||||||
std::vector<std::unique_ptr<RenderEnvironment>> environments;
|
std::vector<std::unique_ptr<RenderEnvironment>> environments;
|
||||||
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
||||||
auto env = std::make_unique<RenderEnvironment>(
|
auto env = std::make_unique<RenderEnvironment>(
|
||||||
provider.get(), PixelFormat::kN32Premul_PixelFormat);
|
provider.get(), PixelFormat::kN32PremulPixelFormat);
|
||||||
environments.push_back(std::move(env));
|
environments.push_back(std::move(env));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4196,7 +4196,7 @@ class DisplayListNopTest : public DisplayListCanvas {
|
|||||||
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
||||||
auto result_surface = provider->MakeOffscreenSurface(
|
auto result_surface = provider->MakeOffscreenSurface(
|
||||||
test_image->width(), test_image->height(),
|
test_image->width(), test_image->height(),
|
||||||
DlSurfaceProvider::kN32Premul_PixelFormat);
|
DlSurfaceProvider::kN32PremulPixelFormat);
|
||||||
SkCanvas* result_canvas = result_surface->sk_surface()->getCanvas();
|
SkCanvas* result_canvas = result_surface->sk_surface()->getCanvas();
|
||||||
result_canvas->clear(SK_ColorTRANSPARENT);
|
result_canvas->clear(SK_ColorTRANSPARENT);
|
||||||
result_canvas->drawImage(test_image.get(), 0, 0);
|
result_canvas->drawImage(test_image.get(), 0, 0);
|
||||||
@@ -4257,7 +4257,7 @@ class DisplayListNopTest : public DisplayListCanvas {
|
|||||||
sk_paint.setImageFilter(ToSk(image_filter));
|
sk_paint.setImageFilter(ToSk(image_filter));
|
||||||
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
for (auto& provider : CanvasCompareTester::kTestProviders) {
|
||||||
auto result_surface = provider->MakeOffscreenSurface(
|
auto result_surface = provider->MakeOffscreenSurface(
|
||||||
w, h, DlSurfaceProvider::kN32Premul_PixelFormat);
|
w, h, DlSurfaceProvider::kN32PremulPixelFormat);
|
||||||
SkCanvas* result_canvas = result_surface->sk_surface()->getCanvas();
|
SkCanvas* result_canvas = result_surface->sk_surface()->getCanvas();
|
||||||
result_canvas->clear(SK_ColorTRANSPARENT);
|
result_canvas->clear(SK_ColorTRANSPARENT);
|
||||||
result_canvas->drawImage(test_image_dst_data->image(), 0, 0);
|
result_canvas->drawImage(test_image_dst_data->image(), 0, 0);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ static void TestEquals(T& source1, T& source2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static void TestNotEquals(T& source1, T& source2, std::string label) {
|
static void TestNotEquals(T& source1, T& source2, const std::string& label) {
|
||||||
ASSERT_FALSE(source1 == source2) << label;
|
ASSERT_FALSE(source1 == source2) << label;
|
||||||
ASSERT_FALSE(source2 == source1) << label;
|
ASSERT_FALSE(source2 == source1) << label;
|
||||||
ASSERT_TRUE(source1 != source2) << label;
|
ASSERT_TRUE(source1 != source2) << label;
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ class DlOpenGLSurfaceProvider : public DlSurfaceProvider {
|
|||||||
size_t height,
|
size_t height,
|
||||||
PixelFormat format) const override;
|
PixelFormat format) const override;
|
||||||
const std::string backend_name() const override { return "OpenGL"; }
|
const std::string backend_name() const override { return "OpenGL"; }
|
||||||
BackendType backend_type() const override { return kOpenGL_Backend; }
|
BackendType backend_type() const override { return kOpenGlBackend; }
|
||||||
bool supports(PixelFormat format) const override {
|
bool supports(PixelFormat format) const override {
|
||||||
return format == kN32Premul_PixelFormat;
|
return format == kN32PremulPixelFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class DlMetalSurfaceInstance : public DlSurfaceInstance {
|
|||||||
bool DlMetalSurfaceProvider::InitializeSurface(size_t width,
|
bool DlMetalSurfaceProvider::InitializeSurface(size_t width,
|
||||||
size_t height,
|
size_t height,
|
||||||
PixelFormat format) {
|
PixelFormat format) {
|
||||||
if (format != kN32Premul_PixelFormat) {
|
if (format != kN32PremulPixelFormat) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
metal_context_ = std::make_unique<TestMetalContext>();
|
metal_context_ = std::make_unique<TestMetalContext>();
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ class DlMetalSurfaceProvider : public DlSurfaceProvider {
|
|||||||
size_t height,
|
size_t height,
|
||||||
PixelFormat format) const override;
|
PixelFormat format) const override;
|
||||||
const std::string backend_name() const override { return "Metal"; }
|
const std::string backend_name() const override { return "Metal"; }
|
||||||
BackendType backend_type() const override { return kMetal_Backend; }
|
BackendType backend_type() const override { return kMetalBackend; }
|
||||||
bool supports(PixelFormat format) const override {
|
bool supports(PixelFormat format) const override {
|
||||||
return format == kN32Premul_PixelFormat;
|
return format == kN32PremulPixelFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -27,15 +27,15 @@ std::unique_ptr<DlSurfaceProvider> DlSurfaceProvider::Create(
|
|||||||
BackendType backend_type) {
|
BackendType backend_type) {
|
||||||
switch (backend_type) {
|
switch (backend_type) {
|
||||||
#ifdef ENABLE_SOFTWARE_BENCHMARKS
|
#ifdef ENABLE_SOFTWARE_BENCHMARKS
|
||||||
case kSoftware_Backend:
|
case kSoftwareBackend:
|
||||||
return std::make_unique<DlSoftwareSurfaceProvider>();
|
return std::make_unique<DlSoftwareSurfaceProvider>();
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_OPENGL_BENCHMARKS
|
#ifdef ENABLE_OPENGL_BENCHMARKS
|
||||||
case kOpenGL_Backend:
|
case kOpenGLBackend:
|
||||||
return std::make_unique<DlOpenGLSurfaceProvider>();
|
return std::make_unique<DlOpenGLSurfaceProvider>();
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_METAL_BENCHMARKS
|
#ifdef ENABLE_METAL_BENCHMARKS
|
||||||
case kMetal_Backend:
|
case kMetalBackend:
|
||||||
return std::make_unique<DlMetalSurfaceProvider>();
|
return std::make_unique<DlMetalSurfaceProvider>();
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
#ifndef FLUTTER_DISPLAY_LIST_TESTING_DL_TEST_SURFACE_PROVIDER_H_
|
#ifndef FLUTTER_DISPLAY_LIST_TESTING_DL_TEST_SURFACE_PROVIDER_H_
|
||||||
#define FLUTTER_DISPLAY_LIST_TESTING_DL_TEST_SURFACE_PROVIDER_H_
|
#define FLUTTER_DISPLAY_LIST_TESTING_DL_TEST_SURFACE_PROVIDER_H_
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "flutter/fml/mapping.h"
|
#include "flutter/fml/mapping.h"
|
||||||
#include "flutter/testing/testing.h"
|
#include "flutter/testing/testing.h"
|
||||||
|
|
||||||
@@ -25,7 +27,8 @@ class DlSurfaceInstance {
|
|||||||
|
|
||||||
class DlSurfaceInstanceBase : public DlSurfaceInstance {
|
class DlSurfaceInstanceBase : public DlSurfaceInstance {
|
||||||
public:
|
public:
|
||||||
DlSurfaceInstanceBase(sk_sp<SkSurface> surface) : surface_(surface) {}
|
explicit DlSurfaceInstanceBase(sk_sp<SkSurface> surface)
|
||||||
|
: surface_(std::move(surface)) {}
|
||||||
~DlSurfaceInstanceBase() = default;
|
~DlSurfaceInstanceBase() = default;
|
||||||
|
|
||||||
sk_sp<SkSurface> sk_surface() const override { return surface_; }
|
sk_sp<SkSurface> sk_surface() const override { return surface_; }
|
||||||
@@ -36,18 +39,14 @@ class DlSurfaceInstanceBase : public DlSurfaceInstance {
|
|||||||
|
|
||||||
class DlSurfaceProvider {
|
class DlSurfaceProvider {
|
||||||
public:
|
public:
|
||||||
typedef enum { kN32Premul_PixelFormat, k565_PixelFormat } PixelFormat;
|
typedef enum { kN32PremulPixelFormat, k565PixelFormat } PixelFormat;
|
||||||
typedef enum {
|
typedef enum { kSoftwareBackend, kOpenGlBackend, kMetalBackend } BackendType;
|
||||||
kSoftware_Backend,
|
|
||||||
kOpenGL_Backend,
|
|
||||||
kMetal_Backend
|
|
||||||
} BackendType;
|
|
||||||
|
|
||||||
static SkImageInfo MakeInfo(PixelFormat format, int w, int h) {
|
static SkImageInfo MakeInfo(PixelFormat format, int w, int h) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case kN32Premul_PixelFormat:
|
case kN32PremulPixelFormat:
|
||||||
return SkImageInfo::MakeN32Premul(w, h);
|
return SkImageInfo::MakeN32Premul(w, h);
|
||||||
case k565_PixelFormat:
|
case k565PixelFormat:
|
||||||
return SkImageInfo::Make(SkISize::Make(w, h), kRGB_565_SkColorType,
|
return SkImageInfo::Make(SkISize::Make(w, h), kRGB_565_SkColorType,
|
||||||
kOpaque_SkAlphaType);
|
kOpaque_SkAlphaType);
|
||||||
}
|
}
|
||||||
@@ -63,12 +62,12 @@ class DlSurfaceProvider {
|
|||||||
virtual bool InitializeSurface(
|
virtual bool InitializeSurface(
|
||||||
size_t width,
|
size_t width,
|
||||||
size_t height,
|
size_t height,
|
||||||
PixelFormat format = kN32Premul_PixelFormat) = 0;
|
PixelFormat format = kN32PremulPixelFormat) = 0;
|
||||||
virtual std::shared_ptr<DlSurfaceInstance> GetPrimarySurface() const = 0;
|
virtual std::shared_ptr<DlSurfaceInstance> GetPrimarySurface() const = 0;
|
||||||
virtual std::shared_ptr<DlSurfaceInstance> MakeOffscreenSurface(
|
virtual std::shared_ptr<DlSurfaceInstance> MakeOffscreenSurface(
|
||||||
size_t width,
|
size_t width,
|
||||||
size_t height,
|
size_t height,
|
||||||
PixelFormat format = kN32Premul_PixelFormat) const = 0;
|
PixelFormat format = kN32PremulPixelFormat) const = 0;
|
||||||
|
|
||||||
virtual bool Snapshot(std::string& filename) const;
|
virtual bool Snapshot(std::string& filename) const;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class DlSoftwareSurfaceProvider : public DlSurfaceProvider {
|
|||||||
size_t height,
|
size_t height,
|
||||||
PixelFormat format) const override;
|
PixelFormat format) const override;
|
||||||
const std::string backend_name() const override { return "Software"; }
|
const std::string backend_name() const override { return "Software"; }
|
||||||
BackendType backend_type() const override { return kSoftware_Backend; }
|
BackendType backend_type() const override { return kSoftwareBackend; }
|
||||||
bool supports(PixelFormat format) const override { return true; }
|
bool supports(PixelFormat format) const override { return true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class DisplayListMatrixClipTracker {
|
|||||||
virtual void resetBounds(const SkRect& cull_rect);
|
virtual void resetBounds(const SkRect& cull_rect);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Data(const SkRect& rect) : cull_rect_(rect) {}
|
explicit Data(const SkRect& rect) : cull_rect_(rect) {}
|
||||||
|
|
||||||
virtual bool has_perspective() const = 0;
|
virtual bool has_perspective() const = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -17,20 +17,25 @@ constexpr LogSeverity kLogFatal = 3;
|
|||||||
constexpr LogSeverity kLogNumSeverities = 4;
|
constexpr LogSeverity kLogNumSeverities = 4;
|
||||||
|
|
||||||
// DEPRECATED: Use |kLogInfo|.
|
// DEPRECATED: Use |kLogInfo|.
|
||||||
|
// Ignoring Clang Tidy because this is used in a very common substitution macro.
|
||||||
|
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||||
constexpr LogSeverity LOG_INFO = kLogInfo;
|
constexpr LogSeverity LOG_INFO = kLogInfo;
|
||||||
|
|
||||||
// DEPRECATED: Use |kLogWarning|.
|
// DEPRECATED: Use |kLogWarning|.
|
||||||
|
// Ignoring Clang Tidy because this is used in a very common substitution macro.
|
||||||
|
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||||
constexpr LogSeverity LOG_WARNING = kLogWarning;
|
constexpr LogSeverity LOG_WARNING = kLogWarning;
|
||||||
|
|
||||||
// DEPRECATED: Use |kLogError|.
|
// DEPRECATED: Use |kLogError|.
|
||||||
|
// Ignoring Clang Tidy because this is used in a very common substitution macro.
|
||||||
|
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||||
constexpr LogSeverity LOG_ERROR = kLogError;
|
constexpr LogSeverity LOG_ERROR = kLogError;
|
||||||
|
|
||||||
// DEPRECATED: Use |kLogFatal|.
|
// DEPRECATED: Use |kLogFatal|.
|
||||||
|
// Ignoring Clang Tidy because this is used in a very common substitution macro.
|
||||||
|
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||||
constexpr LogSeverity LOG_FATAL = kLogFatal;
|
constexpr LogSeverity LOG_FATAL = kLogFatal;
|
||||||
|
|
||||||
// DEPRECATED: Use |kLogNumSeverities|.
|
|
||||||
constexpr LogSeverity LOG_NUM_SEVERITIES = kLogNumSeverities;
|
|
||||||
|
|
||||||
// One of the Windows headers defines ERROR to 0. This makes the token
|
// One of the Windows headers defines ERROR to 0. This makes the token
|
||||||
// concatenation in FML_LOG(ERROR) to resolve to LOG_0. We define this back to
|
// concatenation in FML_LOG(ERROR) to resolve to LOG_0. We define this back to
|
||||||
// the appropriate log level.
|
// the appropriate log level.
|
||||||
@@ -46,6 +51,8 @@ const LogSeverity kLogDFatal = kLogFatal;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// DEPRECATED: Use |kLogDFatal|.
|
// DEPRECATED: Use |kLogDFatal|.
|
||||||
|
// Ignoring Clang Tidy because this is used in a very common substitution macro.
|
||||||
|
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||||
const LogSeverity LOG_DFATAL = kLogDFatal;
|
const LogSeverity LOG_DFATAL = kLogDFatal;
|
||||||
|
|
||||||
} // namespace fml
|
} // namespace fml
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ class RefCountedThreadSafeBase {
|
|||||||
mutable std::atomic_uint_fast32_t ref_count_;
|
mutable std::atomic_uint_fast32_t ref_count_;
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
mutable bool adoption_required_;
|
mutable bool adoption_required_ = false;
|
||||||
mutable bool destruction_started_;
|
mutable bool destruction_started_ = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FML_DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase);
|
FML_DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class CanvasImage final : public RefCountedDartWrappable<CanvasImage> {
|
|||||||
|
|
||||||
sk_sp<DlImage> image() const { return image_; }
|
sk_sp<DlImage> image() const { return image_; }
|
||||||
|
|
||||||
void set_image(sk_sp<DlImage> image) {
|
void set_image(const sk_sp<DlImage>& image) {
|
||||||
FML_DCHECK(image->isUIThreadSafe());
|
FML_DCHECK(image->isUIThreadSafe());
|
||||||
image_ = image;
|
image_ = image;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,16 +17,16 @@ bool DisplayListsEQ_Verbose(const DisplayList* a, const DisplayList* b);
|
|||||||
bool inline DisplayListsEQ_Verbose(const DisplayList& a, const DisplayList& b) {
|
bool inline DisplayListsEQ_Verbose(const DisplayList& a, const DisplayList& b) {
|
||||||
return DisplayListsEQ_Verbose(&a, &b);
|
return DisplayListsEQ_Verbose(&a, &b);
|
||||||
}
|
}
|
||||||
bool inline DisplayListsEQ_Verbose(sk_sp<const DisplayList> a,
|
bool inline DisplayListsEQ_Verbose(const sk_sp<const DisplayList>& a,
|
||||||
sk_sp<const DisplayList> b) {
|
const sk_sp<const DisplayList>& b) {
|
||||||
return DisplayListsEQ_Verbose(a.get(), b.get());
|
return DisplayListsEQ_Verbose(a.get(), b.get());
|
||||||
}
|
}
|
||||||
bool DisplayListsNE_Verbose(const DisplayList* a, const DisplayList* b);
|
bool DisplayListsNE_Verbose(const DisplayList* a, const DisplayList* b);
|
||||||
bool inline DisplayListsNE_Verbose(const DisplayList& a, const DisplayList& b) {
|
bool inline DisplayListsNE_Verbose(const DisplayList& a, const DisplayList& b) {
|
||||||
return DisplayListsNE_Verbose(&a, &b);
|
return DisplayListsNE_Verbose(&a, &b);
|
||||||
}
|
}
|
||||||
bool inline DisplayListsNE_Verbose(sk_sp<const DisplayList> a,
|
bool inline DisplayListsNE_Verbose(const sk_sp<const DisplayList>& a,
|
||||||
sk_sp<const DisplayList> b) {
|
const sk_sp<const DisplayList>& b) {
|
||||||
return DisplayListsNE_Verbose(a.get(), b.get());
|
return DisplayListsNE_Verbose(a.get(), b.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,9 +52,9 @@ extern std::ostream& operator<<(std::ostream& os, const DlImage* image);
|
|||||||
|
|
||||||
class DisplayListStreamDispatcher final : public DlOpReceiver {
|
class DisplayListStreamDispatcher final : public DlOpReceiver {
|
||||||
public:
|
public:
|
||||||
DisplayListStreamDispatcher(std::ostream& os,
|
explicit DisplayListStreamDispatcher(std::ostream& os,
|
||||||
int cur_indent = 2,
|
int cur_indent = 2,
|
||||||
int indent = 2)
|
int indent = 2)
|
||||||
: os_(os), cur_indent_(cur_indent), indent_(indent) {}
|
: os_(os), cur_indent_(cur_indent), indent_(indent) {}
|
||||||
|
|
||||||
void setAntiAlias(bool aa) override;
|
void setAntiAlias(bool aa) override;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class TestMetalContext {
|
|||||||
void* device_;
|
void* device_;
|
||||||
void* command_queue_;
|
void* command_queue_;
|
||||||
sk_sp<GrDirectContext> skia_context_;
|
sk_sp<GrDirectContext> skia_context_;
|
||||||
std::mutex textures_mutex;
|
std::mutex textures_mutex_;
|
||||||
int64_t texture_id_ctr_ = 1; // guarded by textures_mutex
|
int64_t texture_id_ctr_ = 1; // guarded by textures_mutex
|
||||||
std::map<int64_t, sk_cfp<void*>> textures_; // guarded by textures_mutex
|
std::map<int64_t, sk_cfp<void*>> textures_; // guarded by textures_mutex
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ TestMetalContext::TestMetalContext() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TestMetalContext::~TestMetalContext() {
|
TestMetalContext::~TestMetalContext() {
|
||||||
std::scoped_lock lock(textures_mutex);
|
std::scoped_lock lock(textures_mutex_);
|
||||||
textures_.clear();
|
textures_.clear();
|
||||||
if (device_) {
|
if (device_) {
|
||||||
[(__bridge id)device_ release];
|
[(__bridge id)device_ release];
|
||||||
@@ -64,7 +64,7 @@ sk_sp<GrDirectContext> TestMetalContext::GetSkiaContext() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TestMetalContext::TextureInfo TestMetalContext::CreateMetalTexture(const SkISize& size) {
|
TestMetalContext::TextureInfo TestMetalContext::CreateMetalTexture(const SkISize& size) {
|
||||||
std::scoped_lock lock(textures_mutex);
|
std::scoped_lock lock(textures_mutex_);
|
||||||
auto texture_descriptor = fml::scoped_nsobject{
|
auto texture_descriptor = fml::scoped_nsobject{
|
||||||
[[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatBGRA8Unorm
|
[[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatBGRA8Unorm
|
||||||
width:size.width()
|
width:size.width()
|
||||||
@@ -100,7 +100,7 @@ TestMetalContext::TextureInfo TestMetalContext::CreateMetalTexture(const SkISize
|
|||||||
|
|
||||||
// Don't remove the texture from the map here.
|
// Don't remove the texture from the map here.
|
||||||
bool TestMetalContext::Present(int64_t texture_id) {
|
bool TestMetalContext::Present(int64_t texture_id) {
|
||||||
std::scoped_lock lock(textures_mutex);
|
std::scoped_lock lock(textures_mutex_);
|
||||||
if (textures_.find(texture_id) == textures_.end()) {
|
if (textures_.find(texture_id) == textures_.end()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -109,7 +109,7 @@ bool TestMetalContext::Present(int64_t texture_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TestMetalContext::TextureInfo TestMetalContext::GetTextureInfo(int64_t texture_id) {
|
TestMetalContext::TextureInfo TestMetalContext::GetTextureInfo(int64_t texture_id) {
|
||||||
std::scoped_lock lock(textures_mutex);
|
std::scoped_lock lock(textures_mutex_);
|
||||||
if (textures_.find(texture_id) == textures_.end()) {
|
if (textures_.find(texture_id) == textures_.end()) {
|
||||||
FML_CHECK(false) << "Invalid texture id: " << texture_id;
|
FML_CHECK(false) << "Invalid texture id: " << texture_id;
|
||||||
return {.texture_id = -1, .texture = nullptr};
|
return {.texture_id = -1, .texture = nullptr};
|
||||||
|
|||||||
Reference in New Issue
Block a user