[DisplayList] Move nested canvas enums into their own TU. (#162037)
These cause ambiguous compiler reference errors on some GCC versions. And, the errors seem right. But, newer versions of clang seem to resolve that ambiguity by also checking if the references to the types are also references to identical types. Per the chat with Jim, also added the Dl prefix to those types. No change in functionality. Just a rename of the types and removal of the now unnecessary typedefs.
This commit is contained in:
parent
489b186904
commit
cd586eea50
@ -39882,6 +39882,8 @@ ORIGIN: ../../../flutter/display_list/dl_sampling_options.h + ../../../flutter/L
|
|||||||
ORIGIN: ../../../flutter/display_list/dl_storage.cc + ../../../flutter/LICENSE
|
ORIGIN: ../../../flutter/display_list/dl_storage.cc + ../../../flutter/LICENSE
|
||||||
ORIGIN: ../../../flutter/display_list/dl_storage.h + ../../../flutter/LICENSE
|
ORIGIN: ../../../flutter/display_list/dl_storage.h + ../../../flutter/LICENSE
|
||||||
ORIGIN: ../../../flutter/display_list/dl_tile_mode.h + ../../../flutter/LICENSE
|
ORIGIN: ../../../flutter/display_list/dl_tile_mode.h + ../../../flutter/LICENSE
|
||||||
|
ORIGIN: ../../../flutter/display_list/dl_types.cc + ../../../flutter/LICENSE
|
||||||
|
ORIGIN: ../../../flutter/display_list/dl_types.h + ../../../flutter/LICENSE
|
||||||
ORIGIN: ../../../flutter/display_list/dl_vertices.cc + ../../../flutter/LICENSE
|
ORIGIN: ../../../flutter/display_list/dl_vertices.cc + ../../../flutter/LICENSE
|
||||||
ORIGIN: ../../../flutter/display_list/dl_vertices.h + ../../../flutter/LICENSE
|
ORIGIN: ../../../flutter/display_list/dl_vertices.h + ../../../flutter/LICENSE
|
||||||
ORIGIN: ../../../flutter/display_list/effects/color_filters/dl_blend_color_filter.cc + ../../../flutter/LICENSE
|
ORIGIN: ../../../flutter/display_list/effects/color_filters/dl_blend_color_filter.cc + ../../../flutter/LICENSE
|
||||||
@ -42824,6 +42826,8 @@ FILE: ../../../flutter/display_list/dl_sampling_options.h
|
|||||||
FILE: ../../../flutter/display_list/dl_storage.cc
|
FILE: ../../../flutter/display_list/dl_storage.cc
|
||||||
FILE: ../../../flutter/display_list/dl_storage.h
|
FILE: ../../../flutter/display_list/dl_storage.h
|
||||||
FILE: ../../../flutter/display_list/dl_tile_mode.h
|
FILE: ../../../flutter/display_list/dl_tile_mode.h
|
||||||
|
FILE: ../../../flutter/display_list/dl_types.cc
|
||||||
|
FILE: ../../../flutter/display_list/dl_types.h
|
||||||
FILE: ../../../flutter/display_list/dl_vertices.cc
|
FILE: ../../../flutter/display_list/dl_vertices.cc
|
||||||
FILE: ../../../flutter/display_list/dl_vertices.h
|
FILE: ../../../flutter/display_list/dl_vertices.h
|
||||||
FILE: ../../../flutter/display_list/effects/color_filters/dl_blend_color_filter.cc
|
FILE: ../../../flutter/display_list/effects/color_filters/dl_blend_color_filter.cc
|
||||||
|
@ -45,6 +45,8 @@ source_set("display_list") {
|
|||||||
"dl_storage.cc",
|
"dl_storage.cc",
|
||||||
"dl_storage.h",
|
"dl_storage.h",
|
||||||
"dl_tile_mode.h",
|
"dl_tile_mode.h",
|
||||||
|
"dl_types.cc",
|
||||||
|
"dl_types.h",
|
||||||
"dl_vertices.cc",
|
"dl_vertices.cc",
|
||||||
"dl_vertices.h",
|
"dl_vertices.h",
|
||||||
"effects/color_filters/dl_blend_color_filter.cc",
|
"effects/color_filters/dl_blend_color_filter.cc",
|
||||||
|
@ -852,13 +852,13 @@ std::vector<SkPoint> GetTestPoints(size_t count, SkISize canvas_size) {
|
|||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string PointModeToString(DlCanvas::PointMode mode) {
|
std::string PointModeToString(DlPointMode mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case DlCanvas::PointMode::kLines:
|
case DlPointMode::kLines:
|
||||||
return "Lines";
|
return "Lines";
|
||||||
case DlCanvas::PointMode::kPolygon:
|
case DlPointMode::kPolygon:
|
||||||
return "Polygon";
|
return "Polygon";
|
||||||
case DlCanvas::PointMode::kPoints:
|
case DlPointMode::kPoints:
|
||||||
default:
|
default:
|
||||||
return "Points";
|
return "Points";
|
||||||
}
|
}
|
||||||
@ -873,21 +873,21 @@ std::string PointModeToString(DlCanvas::PointMode mode) {
|
|||||||
void BM_DrawPoints(benchmark::State& state,
|
void BM_DrawPoints(benchmark::State& state,
|
||||||
BackendType backend_type,
|
BackendType backend_type,
|
||||||
unsigned attributes,
|
unsigned attributes,
|
||||||
DlCanvas::PointMode mode) {
|
DlPointMode mode) {
|
||||||
auto surface_provider = DlSurfaceProvider::Create(backend_type);
|
auto surface_provider = DlSurfaceProvider::Create(backend_type);
|
||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
DlPaint paint = GetPaintForRun(attributes);
|
DlPaint paint = GetPaintForRun(attributes);
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case DlCanvas::PointMode::kPoints:
|
case DlPointMode::kPoints:
|
||||||
AnnotateAttributes(attributes, state,
|
AnnotateAttributes(attributes, state,
|
||||||
DisplayListOpFlags::kDrawPointsAsPointsFlags);
|
DisplayListOpFlags::kDrawPointsAsPointsFlags);
|
||||||
break;
|
break;
|
||||||
case DlCanvas::PointMode::kLines:
|
case DlPointMode::kLines:
|
||||||
AnnotateAttributes(attributes, state,
|
AnnotateAttributes(attributes, state,
|
||||||
DisplayListOpFlags::kDrawPointsAsLinesFlags);
|
DisplayListOpFlags::kDrawPointsAsLinesFlags);
|
||||||
break;
|
break;
|
||||||
case DlCanvas::PointMode::kPolygon:
|
case DlPointMode::kPolygon:
|
||||||
AnnotateAttributes(attributes, state,
|
AnnotateAttributes(attributes, state,
|
||||||
DisplayListOpFlags::kDrawPointsAsPolygonFlags);
|
DisplayListOpFlags::kDrawPointsAsPolygonFlags);
|
||||||
break;
|
break;
|
||||||
@ -998,11 +998,11 @@ void BM_DrawImage(benchmark::State& state,
|
|||||||
surface_provider->Snapshot(filename);
|
surface_provider->Snapshot(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ConstraintToString(DlCanvas::SrcRectConstraint constraint) {
|
std::string ConstraintToString(DlSrcRectConstraint constraint) {
|
||||||
switch (constraint) {
|
switch (constraint) {
|
||||||
case DlCanvas::SrcRectConstraint::kStrict:
|
case DlSrcRectConstraint::kStrict:
|
||||||
return "Strict";
|
return "Strict";
|
||||||
case DlCanvas::SrcRectConstraint::kFast:
|
case DlSrcRectConstraint::kFast:
|
||||||
return "Fast";
|
return "Fast";
|
||||||
default:
|
default:
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
@ -1017,7 +1017,7 @@ void BM_DrawImageRect(benchmark::State& state,
|
|||||||
BackendType backend_type,
|
BackendType backend_type,
|
||||||
unsigned attributes,
|
unsigned attributes,
|
||||||
DlImageSampling options,
|
DlImageSampling options,
|
||||||
DlCanvas::SrcRectConstraint constraint,
|
DlSrcRectConstraint constraint,
|
||||||
bool upload_bitmap) {
|
bool upload_bitmap) {
|
||||||
auto surface_provider = DlSurfaceProvider::Create(backend_type);
|
auto surface_provider = DlSurfaceProvider::Create(backend_type);
|
||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
|
@ -69,7 +69,7 @@ void BM_DrawPath(benchmark::State& state,
|
|||||||
void BM_DrawPoints(benchmark::State& state,
|
void BM_DrawPoints(benchmark::State& state,
|
||||||
BackendType backend_type,
|
BackendType backend_type,
|
||||||
unsigned attributes,
|
unsigned attributes,
|
||||||
DlCanvas::PointMode mode);
|
DlPointMode mode);
|
||||||
void BM_DrawVertices(benchmark::State& state,
|
void BM_DrawVertices(benchmark::State& state,
|
||||||
BackendType backend_type,
|
BackendType backend_type,
|
||||||
unsigned attributes,
|
unsigned attributes,
|
||||||
@ -83,7 +83,7 @@ void BM_DrawImageRect(benchmark::State& state,
|
|||||||
BackendType backend_type,
|
BackendType backend_type,
|
||||||
unsigned attributes,
|
unsigned attributes,
|
||||||
DlImageSampling options,
|
DlImageSampling options,
|
||||||
DlCanvas::SrcRectConstraint constraint,
|
DlSrcRectConstraint constraint,
|
||||||
bool upload_bitmap);
|
bool upload_bitmap);
|
||||||
void BM_DrawImageNine(benchmark::State& state,
|
void BM_DrawImageNine(benchmark::State& state,
|
||||||
BackendType backend_type,
|
BackendType backend_type,
|
||||||
@ -205,7 +205,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
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) \
|
DlPointMode::kPoints) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
->Range(1024, 32768) \
|
->Range(1024, 32768) \
|
||||||
->UseRealTime() \
|
->UseRealTime() \
|
||||||
@ -214,7 +214,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
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) \
|
DlPointMode::kLines) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
->Range(1024, 32768) \
|
->Range(1024, 32768) \
|
||||||
->UseRealTime() \
|
->UseRealTime() \
|
||||||
@ -223,7 +223,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
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) \
|
DlPointMode::kPolygon) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
->Range(1024, 32768) \
|
->Range(1024, 32768) \
|
||||||
->UseRealTime() \
|
->UseRealTime() \
|
||||||
@ -349,7 +349,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
BackendType::k##BACKEND##Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlImageSampling::kNearestNeighbor, \
|
DlImageSampling::kNearestNeighbor, \
|
||||||
DlCanvas::SrcRectConstraint::kStrict, false) \
|
DlSrcRectConstraint::kStrict, false) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
->Range(32, 256) \
|
->Range(32, 256) \
|
||||||
->UseRealTime() \
|
->UseRealTime() \
|
||||||
@ -360,7 +360,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
BackendType::k##BACKEND##Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlImageSampling::kNearestNeighbor, \
|
DlImageSampling::kNearestNeighbor, \
|
||||||
DlCanvas::SrcRectConstraint::kFast, false) \
|
DlSrcRectConstraint::kFast, false) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
->Range(32, 256) \
|
->Range(32, 256) \
|
||||||
->UseRealTime() \
|
->UseRealTime() \
|
||||||
@ -371,7 +371,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
BackendType::k##BACKEND##Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlImageSampling::kNearestNeighbor, \
|
DlImageSampling::kNearestNeighbor, \
|
||||||
DlCanvas::SrcRectConstraint::kStrict, true) \
|
DlSrcRectConstraint::kStrict, true) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
->Range(32, 256) \
|
->Range(32, 256) \
|
||||||
->UseRealTime() \
|
->UseRealTime() \
|
||||||
@ -382,7 +382,7 @@ void BM_SaveLayer(benchmark::State& state,
|
|||||||
BackendType::k##BACKEND##Backend, \
|
BackendType::k##BACKEND##Backend, \
|
||||||
ATTRIBUTES, \
|
ATTRIBUTES, \
|
||||||
DlImageSampling::kNearestNeighbor, \
|
DlImageSampling::kNearestNeighbor, \
|
||||||
DlCanvas::SrcRectConstraint::kFast, true) \
|
DlSrcRectConstraint::kFast, true) \
|
||||||
->RangeMultiplier(2) \
|
->RangeMultiplier(2) \
|
||||||
->Range(32, 256) \
|
->Range(32, 256) \
|
||||||
->UseRealTime() \
|
->UseRealTime() \
|
||||||
|
@ -131,7 +131,7 @@ static void BM_DisplayListBuilderWithClipRect(
|
|||||||
bool prepare_rtree = NeedPrepareRTree(type);
|
bool prepare_rtree = NeedPrepareRTree(type);
|
||||||
while (state.KeepRunning()) {
|
while (state.KeepRunning()) {
|
||||||
DisplayListBuilder builder(prepare_rtree);
|
DisplayListBuilder builder(prepare_rtree);
|
||||||
builder.ClipRect(clip_bounds, DlCanvas::ClipOp::kIntersect, true);
|
builder.ClipRect(clip_bounds, DlClipOp::kIntersect, true);
|
||||||
InvokeAllRenderingOps(builder);
|
InvokeAllRenderingOps(builder);
|
||||||
Complete(builder, type);
|
Complete(builder, type);
|
||||||
}
|
}
|
||||||
|
@ -428,7 +428,7 @@ void DisplayListGLComplexityCalculator::GLHelper::drawArc(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListGLComplexityCalculator::GLHelper::drawPoints(
|
void DisplayListGLComplexityCalculator::GLHelper::drawPoints(
|
||||||
DlCanvas::PointMode mode,
|
DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint points[]) {
|
const DlPoint points[]) {
|
||||||
if (IsComplex()) {
|
if (IsComplex()) {
|
||||||
@ -437,7 +437,7 @@ void DisplayListGLComplexityCalculator::GLHelper::drawPoints(
|
|||||||
unsigned int complexity;
|
unsigned int complexity;
|
||||||
|
|
||||||
if (IsAntiAliased()) {
|
if (IsAntiAliased()) {
|
||||||
if (mode == DlCanvas::PointMode::kPoints) {
|
if (mode == DlPointMode::kPoints) {
|
||||||
if (IsHairline()) {
|
if (IsHairline()) {
|
||||||
// This is a special case, it triggers an extremely fast path.
|
// This is a special case, it triggers an extremely fast path.
|
||||||
// m = 1/4500
|
// m = 1/4500
|
||||||
@ -448,7 +448,7 @@ void DisplayListGLComplexityCalculator::GLHelper::drawPoints(
|
|||||||
// c = 0
|
// c = 0
|
||||||
complexity = count * 400;
|
complexity = count * 400;
|
||||||
}
|
}
|
||||||
} else if (mode == DlCanvas::PointMode::kLines) {
|
} else if (mode == DlPointMode::kLines) {
|
||||||
if (IsHairline()) {
|
if (IsHairline()) {
|
||||||
// m = 1/750
|
// m = 1/750
|
||||||
// c = 0
|
// c = 0
|
||||||
@ -470,12 +470,12 @@ void DisplayListGLComplexityCalculator::GLHelper::drawPoints(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mode == DlCanvas::PointMode::kPoints) {
|
if (mode == DlPointMode::kPoints) {
|
||||||
// Hairline vs non hairline makes no difference for points without AA.
|
// Hairline vs non hairline makes no difference for points without AA.
|
||||||
// m = 1/18000
|
// m = 1/18000
|
||||||
// c = 0.25
|
// c = 0.25
|
||||||
complexity = (count + 4500) * 100 / 9;
|
complexity = (count + 4500) * 100 / 9;
|
||||||
} else if (mode == DlCanvas::PointMode::kLines) {
|
} else if (mode == DlPointMode::kLines) {
|
||||||
if (IsHairline()) {
|
if (IsHairline()) {
|
||||||
// m = 1/8500
|
// m = 1/8500
|
||||||
// c = 0.25
|
// c = 0.25
|
||||||
|
@ -56,7 +56,7 @@ class DisplayListGLComplexityCalculator
|
|||||||
DlScalar start_degrees,
|
DlScalar start_degrees,
|
||||||
DlScalar sweep_degrees,
|
DlScalar sweep_degrees,
|
||||||
bool use_center) override;
|
bool use_center) override;
|
||||||
void drawPoints(DlCanvas::PointMode mode,
|
void drawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint points[]) override;
|
const DlPoint points[]) override;
|
||||||
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
||||||
|
@ -149,12 +149,13 @@ class ComplexityCalculatorHelper
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) override {
|
DlSrcRectConstraint constraint = DlSrcRectConstraint::kFast) override {
|
||||||
if (IsComplex()) {
|
if (IsComplex()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ImageRect(image->dimensions(), image->isTextureBacked(),
|
ImageRect(image->dimensions(), image->isTextureBacked(),
|
||||||
render_with_attributes, constraint == SrcRectConstraint::kStrict);
|
render_with_attributes,
|
||||||
|
constraint == DlSrcRectConstraint::kStrict);
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawAtlas(const sk_sp<DlImage> atlas,
|
void drawAtlas(const sk_sp<DlImage> atlas,
|
||||||
|
@ -412,7 +412,7 @@ void DisplayListMetalComplexityCalculator::MetalHelper::drawArc(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListMetalComplexityCalculator::MetalHelper::drawPoints(
|
void DisplayListMetalComplexityCalculator::MetalHelper::drawPoints(
|
||||||
DlCanvas::PointMode mode,
|
DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint points[]) {
|
const DlPoint points[]) {
|
||||||
if (IsComplex()) {
|
if (IsComplex()) {
|
||||||
@ -427,12 +427,12 @@ void DisplayListMetalComplexityCalculator::MetalHelper::drawPoints(
|
|||||||
// c = 0.75
|
// c = 0.75
|
||||||
complexity = (count + 12000) * 25 / 2;
|
complexity = (count + 12000) * 25 / 2;
|
||||||
} else {
|
} else {
|
||||||
if (mode == DlCanvas::PointMode::kPolygon) {
|
if (mode == DlPointMode::kPolygon) {
|
||||||
// m = 1/1250
|
// m = 1/1250
|
||||||
// c = 1
|
// c = 1
|
||||||
complexity = (count + 1250) * 160;
|
complexity = (count + 1250) * 160;
|
||||||
} else {
|
} else {
|
||||||
if (IsHairline() && mode == DlCanvas::PointMode::kPoints) {
|
if (IsHairline() && mode == DlPointMode::kPoints) {
|
||||||
// This is a special case, it triggers an extremely fast path.
|
// This is a special case, it triggers an extremely fast path.
|
||||||
// m = 1/14500
|
// m = 1/14500
|
||||||
// c = 0
|
// c = 0
|
||||||
|
@ -56,7 +56,7 @@ class DisplayListMetalComplexityCalculator
|
|||||||
DlScalar start_degrees,
|
DlScalar start_degrees,
|
||||||
DlScalar sweep_degrees,
|
DlScalar sweep_degrees,
|
||||||
bool use_center) override;
|
bool use_center) override;
|
||||||
void drawPoints(DlCanvas::PointMode mode,
|
void drawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint points[]) override;
|
const DlPoint points[]) override;
|
||||||
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
||||||
|
@ -328,17 +328,17 @@ TEST(DisplayListComplexity, DrawTextBlob) {
|
|||||||
TEST(DisplayListComplexity, DrawPoints) {
|
TEST(DisplayListComplexity, DrawPoints) {
|
||||||
auto points = GetTestPoints();
|
auto points = GetTestPoints();
|
||||||
DisplayListBuilder builder_lines;
|
DisplayListBuilder builder_lines;
|
||||||
builder_lines.DrawPoints(DlCanvas::PointMode::kLines, points.size(),
|
builder_lines.DrawPoints(DlPointMode::kLines, points.size(), points.data(),
|
||||||
points.data(), DlPaint());
|
DlPaint());
|
||||||
auto display_list_lines = builder_lines.Build();
|
auto display_list_lines = builder_lines.Build();
|
||||||
|
|
||||||
DisplayListBuilder builder_points;
|
DisplayListBuilder builder_points;
|
||||||
builder_points.DrawPoints(DlCanvas::PointMode::kPoints, points.size(),
|
builder_points.DrawPoints(DlPointMode::kPoints, points.size(), points.data(),
|
||||||
points.data(), DlPaint());
|
DlPaint());
|
||||||
auto display_list_points = builder_points.Build();
|
auto display_list_points = builder_points.Build();
|
||||||
|
|
||||||
DisplayListBuilder builder_polygon;
|
DisplayListBuilder builder_polygon;
|
||||||
builder_polygon.DrawPoints(DlCanvas::PointMode::kPolygon, points.size(),
|
builder_polygon.DrawPoints(DlPointMode::kPolygon, points.size(),
|
||||||
points.data(), DlPaint());
|
points.data(), DlPaint());
|
||||||
auto display_list_polygon = builder_polygon.Build();
|
auto display_list_polygon = builder_polygon.Build();
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -505,7 +505,7 @@ void DisplayListBuilder::saveLayer(const DlRect& bounds,
|
|||||||
// in a rotated or skewed coordinate system (but it will work
|
// in a rotated or skewed coordinate system (but it will work
|
||||||
// conservatively).
|
// conservatively).
|
||||||
if (in_options.bounds_from_caller()) {
|
if (in_options.bounds_from_caller()) {
|
||||||
current_info().global_state.clipRect(bounds, ClipOp::kIntersect, false);
|
current_info().global_state.clipRect(bounds, DlClipOp::kIntersect, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -928,7 +928,7 @@ void DisplayListBuilder::Transform(const DlMatrix& matrix) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListBuilder::ClipRect(const DlRect& rect,
|
void DisplayListBuilder::ClipRect(const DlRect& rect,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
if (!rect.IsFinite()) {
|
if (!rect.IsFinite()) {
|
||||||
return;
|
return;
|
||||||
@ -936,8 +936,7 @@ void DisplayListBuilder::ClipRect(const DlRect& rect,
|
|||||||
if (current_info().is_nop) {
|
if (current_info().is_nop) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (current_info().has_valid_clip &&
|
if (current_info().has_valid_clip && clip_op == DlClipOp::kIntersect &&
|
||||||
clip_op == DlCanvas::ClipOp::kIntersect &&
|
|
||||||
layer_local_state().rect_covers_cull(rect)) {
|
layer_local_state().rect_covers_cull(rect)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -951,16 +950,16 @@ void DisplayListBuilder::ClipRect(const DlRect& rect,
|
|||||||
current_info().has_valid_clip = true;
|
current_info().has_valid_clip = true;
|
||||||
checkForDeferredSave();
|
checkForDeferredSave();
|
||||||
switch (clip_op) {
|
switch (clip_op) {
|
||||||
case ClipOp::kIntersect:
|
case DlClipOp::kIntersect:
|
||||||
Push<ClipIntersectRectOp>(0, rect, is_aa);
|
Push<ClipIntersectRectOp>(0, rect, is_aa);
|
||||||
break;
|
break;
|
||||||
case ClipOp::kDifference:
|
case DlClipOp::kDifference:
|
||||||
Push<ClipDifferenceRectOp>(0, rect, is_aa);
|
Push<ClipDifferenceRectOp>(0, rect, is_aa);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::ClipOval(const DlRect& bounds,
|
void DisplayListBuilder::ClipOval(const DlRect& bounds,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
if (!bounds.IsFinite()) {
|
if (!bounds.IsFinite()) {
|
||||||
return;
|
return;
|
||||||
@ -968,8 +967,7 @@ void DisplayListBuilder::ClipOval(const DlRect& bounds,
|
|||||||
if (current_info().is_nop) {
|
if (current_info().is_nop) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (current_info().has_valid_clip &&
|
if (current_info().has_valid_clip && clip_op == DlClipOp::kIntersect &&
|
||||||
clip_op == DlCanvas::ClipOp::kIntersect &&
|
|
||||||
layer_local_state().oval_covers_cull(bounds)) {
|
layer_local_state().oval_covers_cull(bounds)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -983,16 +981,16 @@ void DisplayListBuilder::ClipOval(const DlRect& bounds,
|
|||||||
current_info().has_valid_clip = true;
|
current_info().has_valid_clip = true;
|
||||||
checkForDeferredSave();
|
checkForDeferredSave();
|
||||||
switch (clip_op) {
|
switch (clip_op) {
|
||||||
case ClipOp::kIntersect:
|
case DlClipOp::kIntersect:
|
||||||
Push<ClipIntersectOvalOp>(0, bounds, is_aa);
|
Push<ClipIntersectOvalOp>(0, bounds, is_aa);
|
||||||
break;
|
break;
|
||||||
case ClipOp::kDifference:
|
case DlClipOp::kDifference:
|
||||||
Push<ClipDifferenceOvalOp>(0, bounds, is_aa);
|
Push<ClipDifferenceOvalOp>(0, bounds, is_aa);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::ClipRoundRect(const DlRoundRect& rrect,
|
void DisplayListBuilder::ClipRoundRect(const DlRoundRect& rrect,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
if (rrect.IsRect()) {
|
if (rrect.IsRect()) {
|
||||||
ClipRect(rrect.GetBounds(), clip_op, is_aa);
|
ClipRect(rrect.GetBounds(), clip_op, is_aa);
|
||||||
@ -1005,8 +1003,7 @@ void DisplayListBuilder::ClipRoundRect(const DlRoundRect& rrect,
|
|||||||
if (current_info().is_nop) {
|
if (current_info().is_nop) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (current_info().has_valid_clip &&
|
if (current_info().has_valid_clip && clip_op == DlClipOp::kIntersect &&
|
||||||
clip_op == DlCanvas::ClipOp::kIntersect &&
|
|
||||||
layer_local_state().rrect_covers_cull(rrect)) {
|
layer_local_state().rrect_covers_cull(rrect)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1020,16 +1017,16 @@ void DisplayListBuilder::ClipRoundRect(const DlRoundRect& rrect,
|
|||||||
current_info().has_valid_clip = true;
|
current_info().has_valid_clip = true;
|
||||||
checkForDeferredSave();
|
checkForDeferredSave();
|
||||||
switch (clip_op) {
|
switch (clip_op) {
|
||||||
case ClipOp::kIntersect:
|
case DlClipOp::kIntersect:
|
||||||
Push<ClipIntersectRoundRectOp>(0, rrect, is_aa);
|
Push<ClipIntersectRoundRectOp>(0, rrect, is_aa);
|
||||||
break;
|
break;
|
||||||
case ClipOp::kDifference:
|
case DlClipOp::kDifference:
|
||||||
Push<ClipDifferenceRoundRectOp>(0, rrect, is_aa);
|
Push<ClipDifferenceRoundRectOp>(0, rrect, is_aa);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::ClipPath(const DlPath& path,
|
void DisplayListBuilder::ClipPath(const DlPath& path,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
if (current_info().is_nop) {
|
if (current_info().is_nop) {
|
||||||
return;
|
return;
|
||||||
@ -1060,10 +1057,10 @@ void DisplayListBuilder::ClipPath(const DlPath& path,
|
|||||||
current_info().has_valid_clip = true;
|
current_info().has_valid_clip = true;
|
||||||
checkForDeferredSave();
|
checkForDeferredSave();
|
||||||
switch (clip_op) {
|
switch (clip_op) {
|
||||||
case ClipOp::kIntersect:
|
case DlClipOp::kIntersect:
|
||||||
Push<ClipIntersectPathOp>(0, path, is_aa);
|
Push<ClipIntersectPathOp>(0, path, is_aa);
|
||||||
break;
|
break;
|
||||||
case ClipOp::kDifference:
|
case DlClipOp::kDifference:
|
||||||
Push<ClipDifferencePathOp>(0, path, is_aa);
|
Push<ClipDifferencePathOp>(0, path, is_aa);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1267,18 +1264,18 @@ void DisplayListBuilder::DrawArc(const DlRect& bounds,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DisplayListAttributeFlags DisplayListBuilder::FlagsForPointMode(
|
DisplayListAttributeFlags DisplayListBuilder::FlagsForPointMode(
|
||||||
PointMode mode) {
|
DlPointMode mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case DlCanvas::PointMode::kPoints:
|
case DlPointMode::kPoints:
|
||||||
return kDrawPointsAsPointsFlags;
|
return kDrawPointsAsPointsFlags;
|
||||||
case PointMode::kLines:
|
case DlPointMode::kLines:
|
||||||
return kDrawPointsAsLinesFlags;
|
return kDrawPointsAsLinesFlags;
|
||||||
case PointMode::kPolygon:
|
case DlPointMode::kPolygon:
|
||||||
return kDrawPointsAsPolygonFlags;
|
return kDrawPointsAsPolygonFlags;
|
||||||
}
|
}
|
||||||
FML_UNREACHABLE();
|
FML_UNREACHABLE();
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::drawPoints(PointMode mode,
|
void DisplayListBuilder::drawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint pts[]) {
|
const DlPoint pts[]) {
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
@ -1302,13 +1299,13 @@ void DisplayListBuilder::drawPoints(PointMode mode,
|
|||||||
|
|
||||||
void* data_ptr;
|
void* data_ptr;
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case PointMode::kPoints:
|
case DlPointMode::kPoints:
|
||||||
data_ptr = Push<DrawPointsOp>(bytes, count);
|
data_ptr = Push<DrawPointsOp>(bytes, count);
|
||||||
break;
|
break;
|
||||||
case PointMode::kLines:
|
case DlPointMode::kLines:
|
||||||
data_ptr = Push<DrawLinesOp>(bytes, count);
|
data_ptr = Push<DrawLinesOp>(bytes, count);
|
||||||
break;
|
break;
|
||||||
case PointMode::kPolygon:
|
case DlPointMode::kPolygon:
|
||||||
data_ptr = Push<DrawPolygonOp>(bytes, count);
|
data_ptr = Push<DrawPolygonOp>(bytes, count);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1329,7 +1326,7 @@ void DisplayListBuilder::drawPoints(PointMode mode,
|
|||||||
CheckLayerOpacityCompatibility();
|
CheckLayerOpacityCompatibility();
|
||||||
UpdateLayerResult(result);
|
UpdateLayerResult(result);
|
||||||
}
|
}
|
||||||
void DisplayListBuilder::DrawPoints(PointMode mode,
|
void DisplayListBuilder::DrawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint pts[],
|
const DlPoint pts[],
|
||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
@ -1408,7 +1405,7 @@ void DisplayListBuilder::drawImageRect(const sk_sp<DlImage> image,
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
SrcRectConstraint constraint) {
|
DlSrcRectConstraint constraint) {
|
||||||
DisplayListAttributeFlags flags = render_with_attributes
|
DisplayListAttributeFlags flags = render_with_attributes
|
||||||
? kDrawImageRectWithPaintFlags
|
? kDrawImageRectWithPaintFlags
|
||||||
: kDrawImageRectFlags;
|
: kDrawImageRectFlags;
|
||||||
@ -1426,7 +1423,7 @@ void DisplayListBuilder::DrawImageRect(const sk_sp<DlImage>& image,
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint,
|
const DlPaint* paint,
|
||||||
SrcRectConstraint constraint) {
|
DlSrcRectConstraint constraint) {
|
||||||
if (paint != nullptr) {
|
if (paint != nullptr) {
|
||||||
SetAttributesFromPaint(*paint,
|
SetAttributesFromPaint(*paint,
|
||||||
DisplayListOpFlags::kDrawImageRectWithPaintFlags);
|
DisplayListOpFlags::kDrawImageRectWithPaintFlags);
|
||||||
|
@ -107,19 +107,19 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
|
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void ClipRect(const DlRect& rect,
|
void ClipRect(const DlRect& rect,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
DlClipOp clip_op = DlClipOp::kIntersect,
|
||||||
bool is_aa = false) override;
|
bool is_aa = false) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void ClipOval(const DlRect& bounds,
|
void ClipOval(const DlRect& bounds,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
DlClipOp clip_op = DlClipOp::kIntersect,
|
||||||
bool is_aa = false) override;
|
bool is_aa = false) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void ClipRoundRect(const DlRoundRect& rrect,
|
void ClipRoundRect(const DlRoundRect& rrect,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
DlClipOp clip_op = DlClipOp::kIntersect,
|
||||||
bool is_aa = false) override;
|
bool is_aa = false) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void ClipPath(const DlPath& path,
|
void ClipPath(const DlPath& path,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
DlClipOp clip_op = DlClipOp::kIntersect,
|
||||||
bool is_aa = false) override;
|
bool is_aa = false) override;
|
||||||
|
|
||||||
/// Conservative estimate of the bounds of all outstanding clip operations
|
/// Conservative estimate of the bounds of all outstanding clip operations
|
||||||
@ -180,7 +180,7 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
bool useCenter,
|
bool useCenter,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawPoints(PointMode mode,
|
void DrawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint pts[],
|
const DlPoint pts[],
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
@ -200,7 +200,7 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) override;
|
DlSrcRectConstraint constraint = DlSrcRectConstraint::kFast) override;
|
||||||
// |DlCanvas|
|
// |DlCanvas|
|
||||||
void DrawImageNine(const sk_sp<DlImage>& image,
|
void DrawImageNine(const sk_sp<DlImage>& image,
|
||||||
const DlIRect& center,
|
const DlIRect& center,
|
||||||
@ -395,21 +395,21 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
void transformReset() override { TransformReset(); }
|
void transformReset() override { TransformReset(); }
|
||||||
|
|
||||||
// |DlOpReceiver|
|
// |DlOpReceiver|
|
||||||
void clipRect(const DlRect& rect, ClipOp clip_op, bool is_aa) override {
|
void clipRect(const DlRect& rect, DlClipOp clip_op, bool is_aa) override {
|
||||||
ClipRect(rect, clip_op, is_aa);
|
ClipRect(rect, clip_op, is_aa);
|
||||||
}
|
}
|
||||||
// |DlOpReceiver|
|
// |DlOpReceiver|
|
||||||
void clipOval(const DlRect& bounds, ClipOp clip_op, bool is_aa) override {
|
void clipOval(const DlRect& bounds, DlClipOp clip_op, bool is_aa) override {
|
||||||
ClipOval(bounds, clip_op, is_aa);
|
ClipOval(bounds, clip_op, is_aa);
|
||||||
}
|
}
|
||||||
// |DlOpReceiver|
|
// |DlOpReceiver|
|
||||||
void clipRoundRect(const DlRoundRect& rrect,
|
void clipRoundRect(const DlRoundRect& rrect,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) override {
|
bool is_aa) override {
|
||||||
ClipRoundRect(rrect, clip_op, is_aa);
|
ClipRoundRect(rrect, clip_op, is_aa);
|
||||||
}
|
}
|
||||||
// |DlOpReceiver|
|
// |DlOpReceiver|
|
||||||
void clipPath(const DlPath& path, ClipOp clip_op, bool is_aa) override {
|
void clipPath(const DlPath& path, DlClipOp clip_op, bool is_aa) override {
|
||||||
ClipPath(path, clip_op, is_aa);
|
ClipPath(path, clip_op, is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
DlScalar sweep,
|
DlScalar sweep,
|
||||||
bool useCenter) override;
|
bool useCenter) override;
|
||||||
// |DlOpReceiver|
|
// |DlOpReceiver|
|
||||||
void drawPoints(PointMode mode, uint32_t count, const DlPoint pts[]) override;
|
void drawPoints(DlPointMode mode, uint32_t count, const DlPoint pts[]) override;
|
||||||
// |DlOpReceiver|
|
// |DlOpReceiver|
|
||||||
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
||||||
DlBlendMode mode) override;
|
DlBlendMode mode) override;
|
||||||
@ -462,7 +462,7 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) override;
|
DlSrcRectConstraint constraint = DlSrcRectConstraint::kFast) override;
|
||||||
// |DlOpReceiver|
|
// |DlOpReceiver|
|
||||||
void drawImageNine(const sk_sp<DlImage> image,
|
void drawImageNine(const sk_sp<DlImage> image,
|
||||||
const DlIRect& center,
|
const DlIRect& center,
|
||||||
@ -773,7 +773,7 @@ class DisplayListBuilder final : public virtual DlCanvas,
|
|||||||
void onSetColorFilter(const DlColorFilter* filter);
|
void onSetColorFilter(const DlColorFilter* filter);
|
||||||
void onSetMaskFilter(const DlMaskFilter* filter);
|
void onSetMaskFilter(const DlMaskFilter* filter);
|
||||||
|
|
||||||
static DisplayListAttributeFlags FlagsForPointMode(PointMode mode);
|
static DisplayListAttributeFlags FlagsForPointMode(DlPointMode mode);
|
||||||
|
|
||||||
enum class OpResult {
|
enum class OpResult {
|
||||||
kNoEffect,
|
kNoEffect,
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "flutter/display_list/display_list.h"
|
#include "flutter/display_list/display_list.h"
|
||||||
#include "flutter/display_list/dl_blend_mode.h"
|
#include "flutter/display_list/dl_blend_mode.h"
|
||||||
#include "flutter/display_list/dl_paint.h"
|
#include "flutter/display_list/dl_paint.h"
|
||||||
|
#include "flutter/display_list/dl_types.h"
|
||||||
#include "flutter/display_list/dl_vertices.h"
|
#include "flutter/display_list/dl_vertices.h"
|
||||||
#include "flutter/display_list/geometry/dl_geometry_types.h"
|
#include "flutter/display_list/geometry/dl_geometry_types.h"
|
||||||
#include "flutter/display_list/geometry/dl_path.h"
|
#include "flutter/display_list/geometry/dl_path.h"
|
||||||
@ -38,22 +39,6 @@ namespace flutter {
|
|||||||
/// used throughout the engine.
|
/// used throughout the engine.
|
||||||
class DlCanvas {
|
class DlCanvas {
|
||||||
public:
|
public:
|
||||||
enum class ClipOp {
|
|
||||||
kDifference,
|
|
||||||
kIntersect,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class PointMode {
|
|
||||||
kPoints, //!< draw each point separately
|
|
||||||
kLines, //!< draw each separate pair of points as a line segment
|
|
||||||
kPolygon, //!< draw each pair of overlapping points as a line segment
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class SrcRectConstraint {
|
|
||||||
kStrict,
|
|
||||||
kFast,
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual ~DlCanvas() = default;
|
virtual ~DlCanvas() = default;
|
||||||
|
|
||||||
virtual DlISize GetBaseLayerDimensions() const = 0;
|
virtual DlISize GetBaseLayerDimensions() const = 0;
|
||||||
@ -92,16 +77,16 @@ class DlCanvas {
|
|||||||
virtual DlMatrix GetMatrix() const = 0;
|
virtual DlMatrix GetMatrix() const = 0;
|
||||||
|
|
||||||
virtual void ClipRect(const DlRect& rect,
|
virtual void ClipRect(const DlRect& rect,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
DlClipOp clip_op = DlClipOp::kIntersect,
|
||||||
bool is_aa = false) = 0;
|
bool is_aa = false) = 0;
|
||||||
virtual void ClipOval(const DlRect& bounds,
|
virtual void ClipOval(const DlRect& bounds,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
DlClipOp clip_op = DlClipOp::kIntersect,
|
||||||
bool is_aa = false) = 0;
|
bool is_aa = false) = 0;
|
||||||
virtual void ClipRoundRect(const DlRoundRect& rrect,
|
virtual void ClipRoundRect(const DlRoundRect& rrect,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
DlClipOp clip_op = DlClipOp::kIntersect,
|
||||||
bool is_aa = false) = 0;
|
bool is_aa = false) = 0;
|
||||||
virtual void ClipPath(const DlPath& path,
|
virtual void ClipPath(const DlPath& path,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
DlClipOp clip_op = DlClipOp::kIntersect,
|
||||||
bool is_aa = false) = 0;
|
bool is_aa = false) = 0;
|
||||||
|
|
||||||
/// Conservative estimate of the bounds of all outstanding clip operations
|
/// Conservative estimate of the bounds of all outstanding clip operations
|
||||||
@ -146,7 +131,7 @@ class DlCanvas {
|
|||||||
DlScalar sweep,
|
DlScalar sweep,
|
||||||
bool useCenter,
|
bool useCenter,
|
||||||
const DlPaint& paint) = 0;
|
const DlPaint& paint) = 0;
|
||||||
virtual void DrawPoints(PointMode mode,
|
virtual void DrawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint pts[],
|
const DlPoint pts[],
|
||||||
const DlPaint& paint) = 0;
|
const DlPaint& paint) = 0;
|
||||||
@ -163,23 +148,24 @@ class DlCanvas {
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) = 0;
|
DlSrcRectConstraint constraint = DlSrcRectConstraint::kFast) = 0;
|
||||||
virtual void DrawImageRect(
|
virtual void DrawImageRect(
|
||||||
const sk_sp<DlImage>& image,
|
const sk_sp<DlImage>& image,
|
||||||
const DlIRect& src,
|
const DlIRect& src,
|
||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
|
DlSrcRectConstraint constraint = DlSrcRectConstraint::kFast) {
|
||||||
auto float_src = DlRect::MakeLTRB(src.GetLeft(), src.GetTop(),
|
auto float_src = DlRect::MakeLTRB(src.GetLeft(), src.GetTop(),
|
||||||
src.GetRight(), src.GetBottom());
|
src.GetRight(), src.GetBottom());
|
||||||
DrawImageRect(image, float_src, dst, sampling, paint, constraint);
|
DrawImageRect(image, float_src, dst, sampling, paint, constraint);
|
||||||
}
|
}
|
||||||
void DrawImageRect(const sk_sp<DlImage>& image,
|
void DrawImageRect(
|
||||||
const DlRect& dst,
|
const sk_sp<DlImage>& image,
|
||||||
DlImageSampling sampling,
|
const DlRect& dst,
|
||||||
const DlPaint* paint = nullptr,
|
DlImageSampling sampling,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
|
const DlPaint* paint = nullptr,
|
||||||
|
DlSrcRectConstraint constraint = DlSrcRectConstraint::kFast) {
|
||||||
DrawImageRect(image, image->GetBounds(), dst, sampling, paint, constraint);
|
DrawImageRect(image, image->GetBounds(), dst, sampling, paint, constraint);
|
||||||
}
|
}
|
||||||
virtual void DrawImageNine(const sk_sp<DlImage>& image,
|
virtual void DrawImageNine(const sk_sp<DlImage>& image,
|
||||||
@ -267,22 +253,22 @@ class DlCanvas {
|
|||||||
SkMatrix GetTransform() const { return ToSkMatrix(GetMatrix()); }
|
SkMatrix GetTransform() const { return ToSkMatrix(GetMatrix()); }
|
||||||
|
|
||||||
void ClipRect(const SkRect& rect,
|
void ClipRect(const SkRect& rect,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
DlClipOp clip_op = DlClipOp::kIntersect,
|
||||||
bool is_aa = false) {
|
bool is_aa = false) {
|
||||||
ClipRect(ToDlRect(rect), clip_op, is_aa);
|
ClipRect(ToDlRect(rect), clip_op, is_aa);
|
||||||
}
|
}
|
||||||
void ClipOval(const SkRect& bounds,
|
void ClipOval(const SkRect& bounds,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
DlClipOp clip_op = DlClipOp::kIntersect,
|
||||||
bool is_aa = false) {
|
bool is_aa = false) {
|
||||||
ClipOval(ToDlRect(bounds), clip_op, is_aa);
|
ClipOval(ToDlRect(bounds), clip_op, is_aa);
|
||||||
}
|
}
|
||||||
void ClipRRect(const SkRRect& rrect,
|
void ClipRRect(const SkRRect& rrect,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
DlClipOp clip_op = DlClipOp::kIntersect,
|
||||||
bool is_aa = false) {
|
bool is_aa = false) {
|
||||||
ClipRoundRect(ToDlRoundRect(rrect), clip_op, is_aa);
|
ClipRoundRect(ToDlRoundRect(rrect), clip_op, is_aa);
|
||||||
}
|
}
|
||||||
void ClipPath(const SkPath& path,
|
void ClipPath(const SkPath& path,
|
||||||
ClipOp clip_op = ClipOp::kIntersect,
|
DlClipOp clip_op = DlClipOp::kIntersect,
|
||||||
bool is_aa = false) {
|
bool is_aa = false) {
|
||||||
ClipPath(DlPath(path), clip_op, is_aa);
|
ClipPath(DlPath(path), clip_op, is_aa);
|
||||||
}
|
}
|
||||||
@ -327,7 +313,7 @@ class DlCanvas {
|
|||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
DrawArc(ToDlRect(bounds), start, sweep, useCenter, paint);
|
DrawArc(ToDlRect(bounds), start, sweep, useCenter, paint);
|
||||||
}
|
}
|
||||||
void DrawPoints(PointMode mode,
|
void DrawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const SkPoint pts[],
|
const SkPoint pts[],
|
||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
@ -339,29 +325,32 @@ class DlCanvas {
|
|||||||
const DlPaint* paint = nullptr) {
|
const DlPaint* paint = nullptr) {
|
||||||
DrawImage(image, ToDlPoint(point), sampling, paint);
|
DrawImage(image, ToDlPoint(point), sampling, paint);
|
||||||
}
|
}
|
||||||
void DrawImageRect(const sk_sp<DlImage>& image,
|
void DrawImageRect(
|
||||||
const SkRect& src,
|
const sk_sp<DlImage>& image,
|
||||||
const SkRect& dst,
|
const SkRect& src,
|
||||||
DlImageSampling sampling,
|
const SkRect& dst,
|
||||||
const DlPaint* paint = nullptr,
|
DlImageSampling sampling,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
|
const DlPaint* paint = nullptr,
|
||||||
|
DlSrcRectConstraint constraint = DlSrcRectConstraint::kFast) {
|
||||||
DrawImageRect(image, ToDlRect(src), ToDlRect(dst), sampling, paint,
|
DrawImageRect(image, ToDlRect(src), ToDlRect(dst), sampling, paint,
|
||||||
constraint);
|
constraint);
|
||||||
}
|
}
|
||||||
void DrawImageRect(const sk_sp<DlImage>& image,
|
void DrawImageRect(
|
||||||
const SkIRect& src,
|
const sk_sp<DlImage>& image,
|
||||||
const SkRect& dst,
|
const SkIRect& src,
|
||||||
DlImageSampling sampling,
|
const SkRect& dst,
|
||||||
const DlPaint* paint = nullptr,
|
DlImageSampling sampling,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
|
const DlPaint* paint = nullptr,
|
||||||
|
DlSrcRectConstraint constraint = DlSrcRectConstraint::kFast) {
|
||||||
DrawImageRect(image, ToDlRect(src), ToDlRect(dst), sampling, paint,
|
DrawImageRect(image, ToDlRect(src), ToDlRect(dst), sampling, paint,
|
||||||
constraint);
|
constraint);
|
||||||
}
|
}
|
||||||
void DrawImageRect(const sk_sp<DlImage>& image,
|
void DrawImageRect(
|
||||||
const SkRect& dst,
|
const sk_sp<DlImage>& image,
|
||||||
DlImageSampling sampling,
|
const SkRect& dst,
|
||||||
const DlPaint* paint = nullptr,
|
DlImageSampling sampling,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
|
const DlPaint* paint = nullptr,
|
||||||
|
DlSrcRectConstraint constraint = DlSrcRectConstraint::kFast) {
|
||||||
DrawImageRect(image, image->GetBounds(), ToDlRect(dst), sampling, paint,
|
DrawImageRect(image, image->GetBounds(), ToDlRect(dst), sampling, paint,
|
||||||
constraint);
|
constraint);
|
||||||
}
|
}
|
||||||
|
@ -85,11 +85,6 @@ class DisplayList;
|
|||||||
/// @see impeller::DlDispatcher
|
/// @see impeller::DlDispatcher
|
||||||
/// @see DlOpSpy
|
/// @see DlOpSpy
|
||||||
class DlOpReceiver {
|
class DlOpReceiver {
|
||||||
protected:
|
|
||||||
using ClipOp = DlCanvas::ClipOp;
|
|
||||||
using PointMode = DlCanvas::PointMode;
|
|
||||||
using SrcRectConstraint = DlCanvas::SrcRectConstraint;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// MaxDrawPointsCount * sizeof(DlPoint) must be less than 1 << 32
|
// MaxDrawPointsCount * sizeof(DlPoint) must be less than 1 << 32
|
||||||
static constexpr int kMaxDrawPointsCount = ((1 << 29) - 1);
|
static constexpr int kMaxDrawPointsCount = ((1 << 29) - 1);
|
||||||
@ -291,12 +286,12 @@ class DlOpReceiver {
|
|||||||
// Clears the transformation stack.
|
// Clears the transformation stack.
|
||||||
virtual void transformReset() = 0;
|
virtual void transformReset() = 0;
|
||||||
|
|
||||||
virtual void clipRect(const DlRect& rect, ClipOp clip_op, bool is_aa) = 0;
|
virtual void clipRect(const DlRect& rect, DlClipOp clip_op, bool is_aa) = 0;
|
||||||
virtual void clipOval(const DlRect& bounds, ClipOp clip_op, bool is_aa) = 0;
|
virtual void clipOval(const DlRect& bounds, DlClipOp clip_op, bool is_aa) = 0;
|
||||||
virtual void clipRoundRect(const DlRoundRect& rrect,
|
virtual void clipRoundRect(const DlRoundRect& rrect,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) = 0;
|
bool is_aa) = 0;
|
||||||
virtual void clipPath(const DlPath& path, ClipOp clip_op, bool is_aa) = 0;
|
virtual void clipPath(const DlPath& path, DlClipOp clip_op, bool is_aa) = 0;
|
||||||
|
|
||||||
// The following rendering methods all take their rendering attributes
|
// The following rendering methods all take their rendering attributes
|
||||||
// from the last value set by the attribute methods above (regardless
|
// from the last value set by the attribute methods above (regardless
|
||||||
@ -323,7 +318,7 @@ class DlOpReceiver {
|
|||||||
DlScalar start_degrees,
|
DlScalar start_degrees,
|
||||||
DlScalar sweep_degrees,
|
DlScalar sweep_degrees,
|
||||||
bool use_center) = 0;
|
bool use_center) = 0;
|
||||||
virtual void drawPoints(PointMode mode,
|
virtual void drawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint points[]) = 0;
|
const DlPoint points[]) = 0;
|
||||||
virtual void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
virtual void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
||||||
@ -338,7 +333,7 @@ class DlOpReceiver {
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) = 0;
|
DlSrcRectConstraint constraint = DlSrcRectConstraint::kFast) = 0;
|
||||||
virtual void drawImageNine(const sk_sp<DlImage> image,
|
virtual void drawImageNine(const sk_sp<DlImage> image,
|
||||||
const DlIRect& center,
|
const DlIRect& center,
|
||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
|
@ -503,7 +503,7 @@ struct TransformResetOp final : TransformClipOpBase {
|
|||||||
const shapetype shape; \
|
const shapetype shape; \
|
||||||
\
|
\
|
||||||
void dispatch(DlOpReceiver& receiver) const { \
|
void dispatch(DlOpReceiver& receiver) const { \
|
||||||
receiver.clip##shapename(shape, DlCanvas::ClipOp::k##clipop, is_aa); \
|
receiver.clip##shapename(shape, DlClipOp::k##clipop, is_aa); \
|
||||||
} \
|
} \
|
||||||
};
|
};
|
||||||
DEFINE_CLIP_SHAPE_OP(Rect, DlRect, Intersect)
|
DEFINE_CLIP_SHAPE_OP(Rect, DlRect, Intersect)
|
||||||
@ -526,7 +526,7 @@ DEFINE_CLIP_SHAPE_OP(RoundRect, DlRoundRect, Difference)
|
|||||||
const DlPath path; \
|
const DlPath path; \
|
||||||
\
|
\
|
||||||
void dispatch(DlOpReceiver& receiver) const { \
|
void dispatch(DlOpReceiver& receiver) const { \
|
||||||
receiver.clipPath(path, DlCanvas::ClipOp::k##clipop, is_aa); \
|
receiver.clipPath(path, DlClipOp::k##clipop, is_aa); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
DisplayListCompare equals(const Clip##clipop##PathOp* other) const { \
|
DisplayListCompare equals(const Clip##clipop##PathOp* other) const { \
|
||||||
@ -702,7 +702,7 @@ struct DrawArcOp final : DrawOpBase {
|
|||||||
\
|
\
|
||||||
void dispatch(DlOpReceiver& receiver) const { \
|
void dispatch(DlOpReceiver& receiver) const { \
|
||||||
const DlPoint* pts = reinterpret_cast<const DlPoint*>(this + 1); \
|
const DlPoint* pts = reinterpret_cast<const DlPoint*>(this + 1); \
|
||||||
receiver.drawPoints(DlCanvas::PointMode::mode, count, pts); \
|
receiver.drawPoints(DlPointMode::mode, count, pts); \
|
||||||
} \
|
} \
|
||||||
};
|
};
|
||||||
DEFINE_DRAW_POINTS_OP(Points, kPoints);
|
DEFINE_DRAW_POINTS_OP(Points, kPoints);
|
||||||
@ -769,7 +769,7 @@ struct DrawImageRectOp final : DrawOpBase {
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
DlCanvas::SrcRectConstraint constraint)
|
DlSrcRectConstraint constraint)
|
||||||
: DrawOpBase(kType),
|
: DrawOpBase(kType),
|
||||||
src(src),
|
src(src),
|
||||||
dst(dst),
|
dst(dst),
|
||||||
@ -782,7 +782,7 @@ struct DrawImageRectOp final : DrawOpBase {
|
|||||||
const DlRect dst;
|
const DlRect dst;
|
||||||
const DlImageSampling sampling;
|
const DlImageSampling sampling;
|
||||||
const bool render_with_attributes;
|
const bool render_with_attributes;
|
||||||
const DlCanvas::SrcRectConstraint constraint;
|
const DlSrcRectConstraint constraint;
|
||||||
const sk_sp<DlImage> image;
|
const sk_sp<DlImage> image;
|
||||||
|
|
||||||
void dispatch(DlOpReceiver& receiver) const {
|
void dispatch(DlOpReceiver& receiver) const {
|
||||||
|
11
engine/src/flutter/display_list/dl_types.cc
Normal file
11
engine/src/flutter/display_list/dl_types.cc
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "flutter/display_list/dl_types.h"
|
||||||
|
|
||||||
|
namespace flutter {
|
||||||
|
|
||||||
|
// Only exists to verify that the types can be cleanly included.
|
||||||
|
|
||||||
|
} // namespace flutter
|
28
engine/src/flutter/display_list/dl_types.h
Normal file
28
engine/src/flutter/display_list/dl_types.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef FLUTTER_DISPLAY_LIST_DL_TYPES_H_
|
||||||
|
#define FLUTTER_DISPLAY_LIST_DL_TYPES_H_
|
||||||
|
|
||||||
|
namespace flutter {
|
||||||
|
|
||||||
|
enum class DlClipOp {
|
||||||
|
kDifference,
|
||||||
|
kIntersect,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class DlPointMode {
|
||||||
|
kPoints, //!< draw each point separately
|
||||||
|
kLines, //!< draw each separate pair of points as a line segment
|
||||||
|
kPolygon, //!< draw each pair of overlapping points as a line segment
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class DlSrcRectConstraint {
|
||||||
|
kStrict,
|
||||||
|
kFast,
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace flutter
|
||||||
|
|
||||||
|
#endif // FLUTTER_DISPLAY_LIST_DL_TYPES_H_
|
@ -139,26 +139,26 @@ DlMatrix DlSkCanvasAdapter::GetMatrix() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::ClipRect(const DlRect& rect,
|
void DlSkCanvasAdapter::ClipRect(const DlRect& rect,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
delegate_->clipRect(ToSkRect(rect), ToSk(clip_op), is_aa);
|
delegate_->clipRect(ToSkRect(rect), ToSk(clip_op), is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::ClipOval(const DlRect& bounds,
|
void DlSkCanvasAdapter::ClipOval(const DlRect& bounds,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
delegate_->clipRRect(SkRRect::MakeOval(ToSkRect(bounds)), ToSk(clip_op),
|
delegate_->clipRRect(SkRRect::MakeOval(ToSkRect(bounds)), ToSk(clip_op),
|
||||||
is_aa);
|
is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::ClipRoundRect(const DlRoundRect& rrect,
|
void DlSkCanvasAdapter::ClipRoundRect(const DlRoundRect& rrect,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
delegate_->clipRRect(ToSkRRect(rrect), ToSk(clip_op), is_aa);
|
delegate_->clipRRect(ToSkRRect(rrect), ToSk(clip_op), is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::ClipPath(const DlPath& path,
|
void DlSkCanvasAdapter::ClipPath(const DlPath& path,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
path.WillRenderSkPath();
|
path.WillRenderSkPath();
|
||||||
delegate_->clipPath(path.GetSkPath(), ToSk(clip_op), is_aa);
|
delegate_->clipPath(path.GetSkPath(), ToSk(clip_op), is_aa);
|
||||||
@ -248,7 +248,7 @@ void DlSkCanvasAdapter::DrawArc(const DlRect& bounds,
|
|||||||
delegate_->drawArc(ToSkRect(bounds), start, sweep, useCenter, ToSk(paint));
|
delegate_->drawArc(ToSkRect(bounds), start, sweep, useCenter, ToSk(paint));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasAdapter::DrawPoints(PointMode mode,
|
void DlSkCanvasAdapter::DrawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint pts[],
|
const DlPoint pts[],
|
||||||
const DlPaint& paint) {
|
const DlPaint& paint) {
|
||||||
@ -277,7 +277,7 @@ void DlSkCanvasAdapter::DrawImageRect(const sk_sp<DlImage>& image,
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint,
|
const DlPaint* paint,
|
||||||
SrcRectConstraint constraint) {
|
DlSrcRectConstraint constraint) {
|
||||||
SkOptionalPaint sk_paint(paint);
|
SkOptionalPaint sk_paint(paint);
|
||||||
sk_sp<SkImage> sk_image = image->skia_image();
|
sk_sp<SkImage> sk_image = image->skia_image();
|
||||||
delegate_->drawImageRect(sk_image.get(), ToSkRect(src), ToSkRect(dst),
|
delegate_->drawImageRect(sk_image.get(), ToSkRect(src), ToSkRect(dst),
|
||||||
|
@ -64,12 +64,12 @@ class DlSkCanvasAdapter final : public virtual DlCanvas {
|
|||||||
/// save stack.
|
/// save stack.
|
||||||
DlMatrix GetMatrix() const override;
|
DlMatrix GetMatrix() const override;
|
||||||
|
|
||||||
void ClipRect(const DlRect& rect, ClipOp clip_op, bool is_aa) override;
|
void ClipRect(const DlRect& rect, DlClipOp clip_op, bool is_aa) override;
|
||||||
void ClipOval(const DlRect& bounds, ClipOp clip_op, bool is_aa) override;
|
void ClipOval(const DlRect& bounds, DlClipOp clip_op, bool is_aa) override;
|
||||||
void ClipRoundRect(const DlRoundRect& rrect,
|
void ClipRoundRect(const DlRoundRect& rrect,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) override;
|
bool is_aa) override;
|
||||||
void ClipPath(const DlPath& path, ClipOp clip_op, bool is_aa) override;
|
void ClipPath(const DlPath& path, DlClipOp clip_op, bool is_aa) override;
|
||||||
|
|
||||||
/// Conservative estimate of the bounds of all outstanding clip operations
|
/// Conservative estimate of the bounds of all outstanding clip operations
|
||||||
/// measured in the coordinate space within which this DisplayList will
|
/// measured in the coordinate space within which this DisplayList will
|
||||||
@ -110,7 +110,7 @@ class DlSkCanvasAdapter final : public virtual DlCanvas {
|
|||||||
DlScalar sweep,
|
DlScalar sweep,
|
||||||
bool useCenter,
|
bool useCenter,
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
void DrawPoints(PointMode mode,
|
void DrawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint pts[],
|
const DlPoint pts[],
|
||||||
const DlPaint& paint) override;
|
const DlPaint& paint) override;
|
||||||
@ -127,7 +127,7 @@ class DlSkCanvasAdapter final : public virtual DlCanvas {
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
const DlPaint* paint = nullptr,
|
const DlPaint* paint = nullptr,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) override;
|
DlSrcRectConstraint constraint = DlSrcRectConstraint::kFast) override;
|
||||||
void DrawImageNine(const sk_sp<DlImage>& image,
|
void DrawImageNine(const sk_sp<DlImage>& image,
|
||||||
const DlIRect& center,
|
const DlIRect& center,
|
||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
|
@ -63,16 +63,15 @@ inline SkSamplingOptions ToSk(DlImageSampling sampling) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline SkCanvas::SrcRectConstraint ToSk(
|
inline SkCanvas::SrcRectConstraint ToSk(DlSrcRectConstraint constraint) {
|
||||||
DlCanvas::SrcRectConstraint constraint) {
|
|
||||||
return static_cast<SkCanvas::SrcRectConstraint>(constraint);
|
return static_cast<SkCanvas::SrcRectConstraint>(constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline SkClipOp ToSk(DlCanvas::ClipOp op) {
|
inline SkClipOp ToSk(DlClipOp op) {
|
||||||
return static_cast<SkClipOp>(op);
|
return static_cast<SkClipOp>(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline SkCanvas::PointMode ToSk(DlCanvas::PointMode mode) {
|
inline SkCanvas::PointMode ToSk(DlPointMode mode) {
|
||||||
return static_cast<SkCanvas::PointMode>(mode);
|
return static_cast<SkCanvas::PointMode>(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,9 +92,9 @@ TEST(DisplayListSkConversions, ToSkFilterMode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DisplayListSkConversions, ToSkSrcRectConstraint) {
|
TEST(DisplayListSkConversions, ToSkSrcRectConstraint) {
|
||||||
ASSERT_EQ(ToSk(DlCanvas::SrcRectConstraint::kFast),
|
ASSERT_EQ(ToSk(DlSrcRectConstraint::kFast),
|
||||||
SkCanvas::SrcRectConstraint::kFast_SrcRectConstraint);
|
SkCanvas::SrcRectConstraint::kFast_SrcRectConstraint);
|
||||||
ASSERT_EQ(ToSk(DlCanvas::SrcRectConstraint::kStrict),
|
ASSERT_EQ(ToSk(DlSrcRectConstraint::kStrict),
|
||||||
SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint);
|
SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,22 +126,22 @@ void DlSkCanvasDispatcher::transformReset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DlSkCanvasDispatcher::clipRect(const DlRect& rect,
|
void DlSkCanvasDispatcher::clipRect(const DlRect& rect,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
canvas_->clipRect(ToSkRect(rect), ToSk(clip_op), is_aa);
|
canvas_->clipRect(ToSkRect(rect), ToSk(clip_op), is_aa);
|
||||||
}
|
}
|
||||||
void DlSkCanvasDispatcher::clipOval(const DlRect& bounds,
|
void DlSkCanvasDispatcher::clipOval(const DlRect& bounds,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
canvas_->clipRRect(SkRRect::MakeOval(ToSkRect(bounds)), ToSk(clip_op), is_aa);
|
canvas_->clipRRect(SkRRect::MakeOval(ToSkRect(bounds)), ToSk(clip_op), is_aa);
|
||||||
}
|
}
|
||||||
void DlSkCanvasDispatcher::clipRoundRect(const DlRoundRect& rrect,
|
void DlSkCanvasDispatcher::clipRoundRect(const DlRoundRect& rrect,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
canvas_->clipRRect(ToSkRRect(rrect), ToSk(clip_op), is_aa);
|
canvas_->clipRRect(ToSkRRect(rrect), ToSk(clip_op), is_aa);
|
||||||
}
|
}
|
||||||
void DlSkCanvasDispatcher::clipPath(const DlPath& path,
|
void DlSkCanvasDispatcher::clipPath(const DlPath& path,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
path.WillRenderSkPath();
|
path.WillRenderSkPath();
|
||||||
canvas_->clipPath(path.GetSkPath(), ToSk(clip_op), is_aa);
|
canvas_->clipPath(path.GetSkPath(), ToSk(clip_op), is_aa);
|
||||||
@ -202,7 +202,7 @@ void DlSkCanvasDispatcher::drawArc(const DlRect& bounds,
|
|||||||
bool useCenter) {
|
bool useCenter) {
|
||||||
canvas_->drawArc(ToSkRect(bounds), start, sweep, useCenter, paint());
|
canvas_->drawArc(ToSkRect(bounds), start, sweep, useCenter, paint());
|
||||||
}
|
}
|
||||||
void DlSkCanvasDispatcher::drawPoints(PointMode mode,
|
void DlSkCanvasDispatcher::drawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint pts[]) {
|
const DlPoint pts[]) {
|
||||||
canvas_->drawPoints(ToSk(mode), count, ToSkPoints(pts), paint());
|
canvas_->drawPoints(ToSk(mode), count, ToSkPoints(pts), paint());
|
||||||
@ -224,7 +224,7 @@ void DlSkCanvasDispatcher::drawImageRect(const sk_sp<DlImage> image,
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
SrcRectConstraint constraint) {
|
DlSrcRectConstraint constraint) {
|
||||||
canvas_->drawImageRect(image ? image->skia_image() : nullptr, ToSkRect(src),
|
canvas_->drawImageRect(image ? image->skia_image() : nullptr, ToSkRect(src),
|
||||||
ToSkRect(dst), ToSk(sampling),
|
ToSkRect(dst), ToSk(sampling),
|
||||||
safe_paint(render_with_attributes), ToSk(constraint));
|
safe_paint(render_with_attributes), ToSk(constraint));
|
||||||
|
@ -51,12 +51,12 @@ class DlSkCanvasDispatcher : public virtual DlOpReceiver,
|
|||||||
// clang-format on
|
// clang-format on
|
||||||
void transformReset() override;
|
void transformReset() override;
|
||||||
|
|
||||||
void clipRect(const DlRect& rect, ClipOp clip_op, bool is_aa) override;
|
void clipRect(const DlRect& rect, DlClipOp clip_op, bool is_aa) override;
|
||||||
void clipOval(const DlRect& bounds, ClipOp clip_op, bool is_aa) override;
|
void clipOval(const DlRect& bounds, DlClipOp clip_op, bool is_aa) override;
|
||||||
void clipRoundRect(const DlRoundRect& rrect,
|
void clipRoundRect(const DlRoundRect& rrect,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) override;
|
bool is_aa) override;
|
||||||
void clipPath(const DlPath& path, ClipOp clip_op, bool is_aa) override;
|
void clipPath(const DlPath& path, DlClipOp clip_op, bool is_aa) override;
|
||||||
|
|
||||||
void drawPaint() override;
|
void drawPaint() override;
|
||||||
void drawColor(DlColor color, DlBlendMode mode) override;
|
void drawColor(DlColor color, DlBlendMode mode) override;
|
||||||
@ -76,7 +76,9 @@ class DlSkCanvasDispatcher : public virtual DlOpReceiver,
|
|||||||
DlScalar start,
|
DlScalar start,
|
||||||
DlScalar sweep,
|
DlScalar sweep,
|
||||||
bool useCenter) override;
|
bool useCenter) override;
|
||||||
void drawPoints(PointMode mode, uint32_t count, const DlPoint pts[]) override;
|
void drawPoints(DlPointMode mode,
|
||||||
|
uint32_t count,
|
||||||
|
const DlPoint pts[]) override;
|
||||||
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
||||||
DlBlendMode mode) override;
|
DlBlendMode mode) override;
|
||||||
void drawImage(const sk_sp<DlImage> image,
|
void drawImage(const sk_sp<DlImage> image,
|
||||||
@ -88,7 +90,7 @@ class DlSkCanvasDispatcher : public virtual DlOpReceiver,
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
SrcRectConstraint constraint) override;
|
DlSrcRectConstraint constraint) override;
|
||||||
void drawImageNine(const sk_sp<DlImage> image,
|
void drawImageNine(const sk_sp<DlImage> image,
|
||||||
const DlIRect& center,
|
const DlIRect& center,
|
||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
|
@ -44,9 +44,6 @@
|
|||||||
namespace flutter {
|
namespace flutter {
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
using ClipOp = DlCanvas::ClipOp;
|
|
||||||
using PointMode = DlCanvas::PointMode;
|
|
||||||
|
|
||||||
constexpr int kTestWidth = 200;
|
constexpr int kTestWidth = 200;
|
||||||
constexpr int kTestHeight = 200;
|
constexpr int kTestHeight = 200;
|
||||||
constexpr int kRenderWidth = 100;
|
constexpr int kRenderWidth = 100;
|
||||||
@ -1223,7 +1220,7 @@ class CanvasCompareTester {
|
|||||||
},
|
},
|
||||||
[=](const DlSetupContext& ctx) {
|
[=](const DlSetupContext& ctx) {
|
||||||
ctx.canvas->Save();
|
ctx.canvas->Save();
|
||||||
ctx.canvas->ClipRect(clip, ClipOp::kIntersect, false);
|
ctx.canvas->ClipRect(clip, DlClipOp::kIntersect, false);
|
||||||
DlPaint p2;
|
DlPaint p2;
|
||||||
ctx.canvas->DrawRect(rect, p2);
|
ctx.canvas->DrawRect(rect, p2);
|
||||||
p2.setBlendMode(DlBlendMode::kClear);
|
p2.setBlendMode(DlBlendMode::kClear);
|
||||||
@ -2079,7 +2076,7 @@ class CanvasCompareTester {
|
|||||||
ctx.canvas->clipRect(r_clip, SkClipOp::kIntersect, false);
|
ctx.canvas->clipRect(r_clip, SkClipOp::kIntersect, false);
|
||||||
},
|
},
|
||||||
[=](const DlSetupContext& ctx) {
|
[=](const DlSetupContext& ctx) {
|
||||||
ctx.canvas->ClipRect(r_clip, ClipOp::kIntersect, false);
|
ctx.canvas->ClipRect(r_clip, DlClipOp::kIntersect, false);
|
||||||
}));
|
}));
|
||||||
RenderWith(testP, env, intersect_tolerance,
|
RenderWith(testP, env, intersect_tolerance,
|
||||||
CaseParameters(
|
CaseParameters(
|
||||||
@ -2088,7 +2085,7 @@ class CanvasCompareTester {
|
|||||||
ctx.canvas->clipRect(r_clip, SkClipOp::kIntersect, true);
|
ctx.canvas->clipRect(r_clip, SkClipOp::kIntersect, true);
|
||||||
},
|
},
|
||||||
[=](const DlSetupContext& ctx) {
|
[=](const DlSetupContext& ctx) {
|
||||||
ctx.canvas->ClipRect(r_clip, ClipOp::kIntersect, true);
|
ctx.canvas->ClipRect(r_clip, DlClipOp::kIntersect, true);
|
||||||
}));
|
}));
|
||||||
RenderWith(testP, env, diff_tolerance,
|
RenderWith(testP, env, diff_tolerance,
|
||||||
CaseParameters(
|
CaseParameters(
|
||||||
@ -2097,7 +2094,7 @@ class CanvasCompareTester {
|
|||||||
ctx.canvas->clipRect(r_clip, SkClipOp::kDifference, false);
|
ctx.canvas->clipRect(r_clip, SkClipOp::kDifference, false);
|
||||||
},
|
},
|
||||||
[=](const DlSetupContext& ctx) {
|
[=](const DlSetupContext& ctx) {
|
||||||
ctx.canvas->ClipRect(r_clip, ClipOp::kDifference, false);
|
ctx.canvas->ClipRect(r_clip, DlClipOp::kDifference, false);
|
||||||
})
|
})
|
||||||
.with_diff_clip());
|
.with_diff_clip());
|
||||||
// Skia lacks clipOval and requires us to make an oval SkRRect
|
// Skia lacks clipOval and requires us to make an oval SkRRect
|
||||||
@ -2110,7 +2107,7 @@ class CanvasCompareTester {
|
|||||||
false);
|
false);
|
||||||
},
|
},
|
||||||
[=](const DlSetupContext& ctx) {
|
[=](const DlSetupContext& ctx) {
|
||||||
ctx.canvas->ClipOval(r_clip, ClipOp::kIntersect, false);
|
ctx.canvas->ClipOval(r_clip, DlClipOp::kIntersect, false);
|
||||||
}));
|
}));
|
||||||
RenderWith(testP, env, intersect_tolerance,
|
RenderWith(testP, env, intersect_tolerance,
|
||||||
CaseParameters(
|
CaseParameters(
|
||||||
@ -2120,7 +2117,7 @@ class CanvasCompareTester {
|
|||||||
true);
|
true);
|
||||||
},
|
},
|
||||||
[=](const DlSetupContext& ctx) {
|
[=](const DlSetupContext& ctx) {
|
||||||
ctx.canvas->ClipOval(r_clip, ClipOp::kIntersect, true);
|
ctx.canvas->ClipOval(r_clip, DlClipOp::kIntersect, true);
|
||||||
}));
|
}));
|
||||||
RenderWith(testP, env, diff_tolerance,
|
RenderWith(testP, env, diff_tolerance,
|
||||||
CaseParameters(
|
CaseParameters(
|
||||||
@ -2130,7 +2127,7 @@ class CanvasCompareTester {
|
|||||||
false);
|
false);
|
||||||
},
|
},
|
||||||
[=](const DlSetupContext& ctx) {
|
[=](const DlSetupContext& ctx) {
|
||||||
ctx.canvas->ClipOval(r_clip, ClipOp::kDifference, false);
|
ctx.canvas->ClipOval(r_clip, DlClipOp::kDifference, false);
|
||||||
})
|
})
|
||||||
.with_diff_clip());
|
.with_diff_clip());
|
||||||
// This test RR clip used to use very small radii, but due to
|
// This test RR clip used to use very small radii, but due to
|
||||||
@ -2139,16 +2136,16 @@ class CanvasCompareTester {
|
|||||||
// "clip overruns" by the clip OOB pixel testing code. Using less
|
// "clip overruns" by the clip OOB pixel testing code. Using less
|
||||||
// abusively small radii fixes the problem.
|
// abusively small radii fixes the problem.
|
||||||
SkRRect rr_clip = SkRRect::MakeRectXY(r_clip, 9, 9);
|
SkRRect rr_clip = SkRRect::MakeRectXY(r_clip, 9, 9);
|
||||||
RenderWith(testP, env, intersect_tolerance,
|
RenderWith(
|
||||||
CaseParameters(
|
testP, env, intersect_tolerance,
|
||||||
"Hard ClipRRect with radius of 15.4",
|
CaseParameters(
|
||||||
[=](const SkSetupContext& ctx) {
|
"Hard ClipRRect with radius of 15.4",
|
||||||
ctx.canvas->clipRRect(rr_clip, SkClipOp::kIntersect,
|
[=](const SkSetupContext& ctx) {
|
||||||
false);
|
ctx.canvas->clipRRect(rr_clip, SkClipOp::kIntersect, false);
|
||||||
},
|
},
|
||||||
[=](const DlSetupContext& ctx) {
|
[=](const DlSetupContext& ctx) {
|
||||||
ctx.canvas->ClipRRect(rr_clip, ClipOp::kIntersect, false);
|
ctx.canvas->ClipRRect(rr_clip, DlClipOp::kIntersect, false);
|
||||||
}));
|
}));
|
||||||
RenderWith(testP, env, intersect_tolerance,
|
RenderWith(testP, env, intersect_tolerance,
|
||||||
CaseParameters(
|
CaseParameters(
|
||||||
"AntiAlias ClipRRect with radius of 15.4",
|
"AntiAlias ClipRRect with radius of 15.4",
|
||||||
@ -2156,43 +2153,43 @@ class CanvasCompareTester {
|
|||||||
ctx.canvas->clipRRect(rr_clip, SkClipOp::kIntersect, true);
|
ctx.canvas->clipRRect(rr_clip, SkClipOp::kIntersect, true);
|
||||||
},
|
},
|
||||||
[=](const DlSetupContext& ctx) {
|
[=](const DlSetupContext& ctx) {
|
||||||
ctx.canvas->ClipRRect(rr_clip, ClipOp::kIntersect, true);
|
ctx.canvas->ClipRRect(rr_clip, DlClipOp::kIntersect, true);
|
||||||
}));
|
}));
|
||||||
RenderWith(testP, env, diff_tolerance,
|
RenderWith(
|
||||||
CaseParameters(
|
testP, env, diff_tolerance,
|
||||||
"Hard ClipRRect Diff, with radius of 15.4",
|
CaseParameters(
|
||||||
[=](const SkSetupContext& ctx) {
|
"Hard ClipRRect Diff, with radius of 15.4",
|
||||||
ctx.canvas->clipRRect(rr_clip, SkClipOp::kDifference,
|
[=](const SkSetupContext& ctx) {
|
||||||
false);
|
ctx.canvas->clipRRect(rr_clip, SkClipOp::kDifference, false);
|
||||||
},
|
},
|
||||||
[=](const DlSetupContext& ctx) {
|
[=](const DlSetupContext& ctx) {
|
||||||
ctx.canvas->ClipRRect(rr_clip, ClipOp::kDifference, false);
|
ctx.canvas->ClipRRect(rr_clip, DlClipOp::kDifference, false);
|
||||||
})
|
})
|
||||||
.with_diff_clip());
|
.with_diff_clip());
|
||||||
SkPath path_clip = SkPath();
|
SkPath path_clip = SkPath();
|
||||||
path_clip.setFillType(SkPathFillType::kEvenOdd);
|
path_clip.setFillType(SkPathFillType::kEvenOdd);
|
||||||
path_clip.addRect(r_clip);
|
path_clip.addRect(r_clip);
|
||||||
path_clip.addCircle(kRenderCenterX, kRenderCenterY, 1.0);
|
path_clip.addCircle(kRenderCenterX, kRenderCenterY, 1.0);
|
||||||
RenderWith(testP, env, intersect_tolerance,
|
RenderWith(
|
||||||
CaseParameters(
|
testP, env, intersect_tolerance,
|
||||||
"Hard ClipPath inset by 15.4",
|
CaseParameters(
|
||||||
[=](const SkSetupContext& ctx) {
|
"Hard ClipPath inset by 15.4",
|
||||||
ctx.canvas->clipPath(path_clip, SkClipOp::kIntersect,
|
[=](const SkSetupContext& ctx) {
|
||||||
false);
|
ctx.canvas->clipPath(path_clip, SkClipOp::kIntersect, false);
|
||||||
},
|
},
|
||||||
[=](const DlSetupContext& ctx) {
|
[=](const DlSetupContext& ctx) {
|
||||||
ctx.canvas->ClipPath(path_clip, ClipOp::kIntersect, false);
|
ctx.canvas->ClipPath(path_clip, DlClipOp::kIntersect, false);
|
||||||
}));
|
}));
|
||||||
RenderWith(testP, env, intersect_tolerance,
|
RenderWith(
|
||||||
CaseParameters(
|
testP, env, intersect_tolerance,
|
||||||
"AntiAlias ClipPath inset by 15.4",
|
CaseParameters(
|
||||||
[=](const SkSetupContext& ctx) {
|
"AntiAlias ClipPath inset by 15.4",
|
||||||
ctx.canvas->clipPath(path_clip, SkClipOp::kIntersect,
|
[=](const SkSetupContext& ctx) {
|
||||||
true);
|
ctx.canvas->clipPath(path_clip, SkClipOp::kIntersect, true);
|
||||||
},
|
},
|
||||||
[=](const DlSetupContext& ctx) {
|
[=](const DlSetupContext& ctx) {
|
||||||
ctx.canvas->ClipPath(path_clip, ClipOp::kIntersect, true);
|
ctx.canvas->ClipPath(path_clip, DlClipOp::kIntersect, true);
|
||||||
}));
|
}));
|
||||||
RenderWith(
|
RenderWith(
|
||||||
testP, env, diff_tolerance,
|
testP, env, diff_tolerance,
|
||||||
CaseParameters(
|
CaseParameters(
|
||||||
@ -2201,7 +2198,7 @@ class CanvasCompareTester {
|
|||||||
ctx.canvas->clipPath(path_clip, SkClipOp::kDifference, false);
|
ctx.canvas->clipPath(path_clip, SkClipOp::kDifference, false);
|
||||||
},
|
},
|
||||||
[=](const DlSetupContext& ctx) {
|
[=](const DlSetupContext& ctx) {
|
||||||
ctx.canvas->ClipPath(path_clip, ClipOp::kDifference, false);
|
ctx.canvas->ClipPath(path_clip, DlClipOp::kDifference, false);
|
||||||
})
|
})
|
||||||
.with_diff_clip());
|
.with_diff_clip());
|
||||||
}
|
}
|
||||||
@ -3240,7 +3237,7 @@ TEST_F(DisplayListRendering, DrawPointsAsPoints) {
|
|||||||
ctx.canvas->drawPoints(mode, count, points, p);
|
ctx.canvas->drawPoints(mode, count, points, p);
|
||||||
},
|
},
|
||||||
[=](const DlRenderContext& ctx) {
|
[=](const DlRenderContext& ctx) {
|
||||||
auto mode = PointMode::kPoints;
|
auto mode = DlPointMode::kPoints;
|
||||||
ctx.canvas->DrawPoints(mode, count, points, ctx.paint);
|
ctx.canvas->DrawPoints(mode, count, points, ctx.paint);
|
||||||
},
|
},
|
||||||
kDrawPointsAsPointsFlags)
|
kDrawPointsAsPointsFlags)
|
||||||
@ -3292,7 +3289,7 @@ TEST_F(DisplayListRendering, DrawPointsAsLines) {
|
|||||||
ctx.canvas->drawPoints(mode, count, points, p);
|
ctx.canvas->drawPoints(mode, count, points, p);
|
||||||
},
|
},
|
||||||
[=](const DlRenderContext& ctx) {
|
[=](const DlRenderContext& ctx) {
|
||||||
auto mode = PointMode::kLines;
|
auto mode = DlPointMode::kLines;
|
||||||
ctx.canvas->DrawPoints(mode, count, points, ctx.paint);
|
ctx.canvas->DrawPoints(mode, count, points, ctx.paint);
|
||||||
},
|
},
|
||||||
kDrawPointsAsLinesFlags));
|
kDrawPointsAsLinesFlags));
|
||||||
@ -3327,7 +3324,7 @@ TEST_F(DisplayListRendering, DrawPointsAsPolygon) {
|
|||||||
ctx.canvas->drawPoints(mode, count1, points1, p);
|
ctx.canvas->drawPoints(mode, count1, points1, p);
|
||||||
},
|
},
|
||||||
[=](const DlRenderContext& ctx) {
|
[=](const DlRenderContext& ctx) {
|
||||||
auto mode = PointMode::kPolygon;
|
auto mode = DlPointMode::kPolygon;
|
||||||
ctx.canvas->DrawPoints(mode, count1, points1, ctx.paint);
|
ctx.canvas->DrawPoints(mode, count1, points1, ctx.paint);
|
||||||
},
|
},
|
||||||
kDrawPointsAsPolygonFlags));
|
kDrawPointsAsPolygonFlags));
|
||||||
@ -3492,9 +3489,9 @@ TEST_F(DisplayListRendering, DrawImageRectNearest) {
|
|||||||
&ctx.paint, SkCanvas::kFast_SrcRectConstraint);
|
&ctx.paint, SkCanvas::kFast_SrcRectConstraint);
|
||||||
},
|
},
|
||||||
[=](const DlRenderContext& ctx) {
|
[=](const DlRenderContext& ctx) {
|
||||||
ctx.canvas->DrawImageRect(
|
ctx.canvas->DrawImageRect(ctx.image, src, dst,
|
||||||
ctx.image, src, dst, DlImageSampling::kNearestNeighbor,
|
DlImageSampling::kNearestNeighbor,
|
||||||
&ctx.paint, DlCanvas::SrcRectConstraint::kFast);
|
&ctx.paint, DlSrcRectConstraint::kFast);
|
||||||
},
|
},
|
||||||
kDrawImageRectWithPaintFlags));
|
kDrawImageRectWithPaintFlags));
|
||||||
}
|
}
|
||||||
@ -3510,9 +3507,9 @@ TEST_F(DisplayListRendering, DrawImageRectNearestNoPaint) {
|
|||||||
nullptr, SkCanvas::kFast_SrcRectConstraint);
|
nullptr, SkCanvas::kFast_SrcRectConstraint);
|
||||||
},
|
},
|
||||||
[=](const DlRenderContext& ctx) {
|
[=](const DlRenderContext& ctx) {
|
||||||
ctx.canvas->DrawImageRect(
|
ctx.canvas->DrawImageRect(ctx.image, src, dst,
|
||||||
ctx.image, src, dst, DlImageSampling::kNearestNeighbor, //
|
DlImageSampling::kNearestNeighbor, //
|
||||||
nullptr, DlCanvas::SrcRectConstraint::kFast);
|
nullptr, DlSrcRectConstraint::kFast);
|
||||||
},
|
},
|
||||||
kDrawImageRectFlags));
|
kDrawImageRectFlags));
|
||||||
}
|
}
|
||||||
@ -3528,9 +3525,9 @@ TEST_F(DisplayListRendering, DrawImageRectLinear) {
|
|||||||
&ctx.paint, SkCanvas::kFast_SrcRectConstraint);
|
&ctx.paint, SkCanvas::kFast_SrcRectConstraint);
|
||||||
},
|
},
|
||||||
[=](const DlRenderContext& ctx) { //
|
[=](const DlRenderContext& ctx) { //
|
||||||
ctx.canvas->DrawImageRect(
|
ctx.canvas->DrawImageRect(ctx.image, src, dst,
|
||||||
ctx.image, src, dst, DlImageSampling::kLinear, //
|
DlImageSampling::kLinear, //
|
||||||
&ctx.paint, DlCanvas::SrcRectConstraint::kFast);
|
&ctx.paint, DlSrcRectConstraint::kFast);
|
||||||
},
|
},
|
||||||
kDrawImageRectWithPaintFlags));
|
kDrawImageRectWithPaintFlags));
|
||||||
}
|
}
|
||||||
@ -3932,7 +3929,7 @@ TEST_F(DisplayListRendering, SaveLayerClippedContentStillFilters) {
|
|||||||
DlPaint layer_paint;
|
DlPaint layer_paint;
|
||||||
layer_paint.setImageFilter(layer_filter);
|
layer_paint.setImageFilter(layer_filter);
|
||||||
ctx.canvas->Save();
|
ctx.canvas->Save();
|
||||||
ctx.canvas->ClipRect(kRenderBounds, ClipOp::kIntersect, false);
|
ctx.canvas->ClipRect(kRenderBounds, DlClipOp::kIntersect, false);
|
||||||
ctx.canvas->SaveLayer(&kTestBounds2, &layer_paint);
|
ctx.canvas->SaveLayer(&kTestBounds2, &layer_paint);
|
||||||
ctx.canvas->DrawRect(draw_rect, ctx.paint);
|
ctx.canvas->DrawRect(draw_rect, ctx.paint);
|
||||||
ctx.canvas->Restore();
|
ctx.canvas->Restore();
|
||||||
|
@ -324,8 +324,8 @@ std::vector<DisplayListInvocationGroup> CreateAllSaveRestoreOps() {
|
|||||||
{5, 96, 2,
|
{5, 96, 2,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.save();
|
r.save();
|
||||||
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25),
|
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25), DlClipOp::kIntersect,
|
||||||
DlCanvas::ClipOp::kIntersect, true);
|
true);
|
||||||
r.drawRect(DlRect::MakeLTRB(5, 5, 15, 15));
|
r.drawRect(DlRect::MakeLTRB(5, 5, 15, 15));
|
||||||
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
||||||
r.restore();
|
r.restore();
|
||||||
@ -333,8 +333,8 @@ std::vector<DisplayListInvocationGroup> CreateAllSaveRestoreOps() {
|
|||||||
{5, 120, 3,
|
{5, 120, 3,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.saveLayer(nullptr, SaveLayerOptions::kNoAttributes);
|
r.saveLayer(nullptr, SaveLayerOptions::kNoAttributes);
|
||||||
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25),
|
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25), DlClipOp::kIntersect,
|
||||||
DlCanvas::ClipOp::kIntersect, true);
|
true);
|
||||||
r.drawRect(DlRect::MakeLTRB(5, 5, 15, 15));
|
r.drawRect(DlRect::MakeLTRB(5, 5, 15, 15));
|
||||||
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
||||||
r.restore();
|
r.restore();
|
||||||
@ -342,8 +342,8 @@ std::vector<DisplayListInvocationGroup> CreateAllSaveRestoreOps() {
|
|||||||
{5, 120, 3,
|
{5, 120, 3,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.saveLayer(nullptr, SaveLayerOptions::kWithAttributes);
|
r.saveLayer(nullptr, SaveLayerOptions::kWithAttributes);
|
||||||
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25),
|
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25), DlClipOp::kIntersect,
|
||||||
DlCanvas::ClipOp::kIntersect, true);
|
true);
|
||||||
r.drawRect(DlRect::MakeLTRB(5, 5, 15, 15));
|
r.drawRect(DlRect::MakeLTRB(5, 5, 15, 15));
|
||||||
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
||||||
r.restore();
|
r.restore();
|
||||||
@ -355,8 +355,8 @@ std::vector<DisplayListInvocationGroup> CreateAllSaveRestoreOps() {
|
|||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.saveLayer(&kTestBounds, SaveLayerOptions::kNoAttributes);
|
r.saveLayer(&kTestBounds, SaveLayerOptions::kNoAttributes);
|
||||||
r.drawRect(kTestBounds);
|
r.drawRect(kTestBounds);
|
||||||
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25),
|
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25), DlClipOp::kIntersect,
|
||||||
DlCanvas::ClipOp::kIntersect, true);
|
true);
|
||||||
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
||||||
r.restore();
|
r.restore();
|
||||||
}},
|
}},
|
||||||
@ -364,8 +364,8 @@ std::vector<DisplayListInvocationGroup> CreateAllSaveRestoreOps() {
|
|||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.saveLayer(&kTestBounds, SaveLayerOptions::kWithAttributes);
|
r.saveLayer(&kTestBounds, SaveLayerOptions::kWithAttributes);
|
||||||
r.drawRect(kTestBounds);
|
r.drawRect(kTestBounds);
|
||||||
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25),
|
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25), DlClipOp::kIntersect,
|
||||||
DlCanvas::ClipOp::kIntersect, true);
|
true);
|
||||||
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
||||||
r.restore();
|
r.restore();
|
||||||
}},
|
}},
|
||||||
@ -373,8 +373,8 @@ std::vector<DisplayListInvocationGroup> CreateAllSaveRestoreOps() {
|
|||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.saveLayer(nullptr, SaveLayerOptions::kNoAttributes,
|
r.saveLayer(nullptr, SaveLayerOptions::kNoAttributes,
|
||||||
&kTestCFImageFilter1);
|
&kTestCFImageFilter1);
|
||||||
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25),
|
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25), DlClipOp::kIntersect,
|
||||||
DlCanvas::ClipOp::kIntersect, true);
|
true);
|
||||||
r.drawRect(DlRect::MakeLTRB(5, 5, 15, 15));
|
r.drawRect(DlRect::MakeLTRB(5, 5, 15, 15));
|
||||||
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
||||||
r.restore();
|
r.restore();
|
||||||
@ -383,8 +383,8 @@ std::vector<DisplayListInvocationGroup> CreateAllSaveRestoreOps() {
|
|||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.saveLayer(nullptr, SaveLayerOptions::kWithAttributes,
|
r.saveLayer(nullptr, SaveLayerOptions::kWithAttributes,
|
||||||
&kTestCFImageFilter1);
|
&kTestCFImageFilter1);
|
||||||
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25),
|
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25), DlClipOp::kIntersect,
|
||||||
DlCanvas::ClipOp::kIntersect, true);
|
true);
|
||||||
r.drawRect(DlRect::MakeLTRB(5, 5, 15, 15));
|
r.drawRect(DlRect::MakeLTRB(5, 5, 15, 15));
|
||||||
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
||||||
r.restore();
|
r.restore();
|
||||||
@ -394,8 +394,8 @@ std::vector<DisplayListInvocationGroup> CreateAllSaveRestoreOps() {
|
|||||||
r.saveLayer(&kTestBounds, SaveLayerOptions::kNoAttributes,
|
r.saveLayer(&kTestBounds, SaveLayerOptions::kNoAttributes,
|
||||||
&kTestCFImageFilter1);
|
&kTestCFImageFilter1);
|
||||||
r.drawRect(kTestBounds);
|
r.drawRect(kTestBounds);
|
||||||
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25),
|
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25), DlClipOp::kIntersect,
|
||||||
DlCanvas::ClipOp::kIntersect, true);
|
true);
|
||||||
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
||||||
r.restore();
|
r.restore();
|
||||||
}},
|
}},
|
||||||
@ -404,8 +404,8 @@ std::vector<DisplayListInvocationGroup> CreateAllSaveRestoreOps() {
|
|||||||
r.saveLayer(&kTestBounds, SaveLayerOptions::kWithAttributes,
|
r.saveLayer(&kTestBounds, SaveLayerOptions::kWithAttributes,
|
||||||
&kTestCFImageFilter1);
|
&kTestCFImageFilter1);
|
||||||
r.drawRect(kTestBounds);
|
r.drawRect(kTestBounds);
|
||||||
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25),
|
r.clipRect(DlRect::MakeLTRB(0, 0, 25, 25), DlClipOp::kIntersect,
|
||||||
DlCanvas::ClipOp::kIntersect, true);
|
true);
|
||||||
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
r.drawRect(DlRect::MakeLTRB(10, 10, 20, 20));
|
||||||
r.restore();
|
r.restore();
|
||||||
}},
|
}},
|
||||||
@ -480,114 +480,112 @@ std::vector<DisplayListInvocationGroup> CreateAllClipOps() {
|
|||||||
{
|
{
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipRect(kTestBounds, DlCanvas::ClipOp::kIntersect, true);
|
r.clipRect(kTestBounds, DlClipOp::kIntersect, true);
|
||||||
}},
|
}},
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipRect(kTestBounds.Shift(1, 1), DlCanvas::ClipOp::kIntersect,
|
r.clipRect(kTestBounds.Shift(1, 1), DlClipOp::kIntersect, true);
|
||||||
true);
|
|
||||||
}},
|
}},
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipRect(kTestBounds, DlCanvas::ClipOp::kIntersect, false);
|
r.clipRect(kTestBounds, DlClipOp::kIntersect, false);
|
||||||
}},
|
}},
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipRect(kTestBounds, DlCanvas::ClipOp::kDifference, true);
|
r.clipRect(kTestBounds, DlClipOp::kDifference, true);
|
||||||
}},
|
}},
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipRect(kTestBounds, DlCanvas::ClipOp::kDifference, false);
|
r.clipRect(kTestBounds, DlClipOp::kDifference, false);
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
{"ClipOval",
|
{"ClipOval",
|
||||||
{
|
{
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipOval(kTestBounds, DlCanvas::ClipOp::kIntersect, true);
|
r.clipOval(kTestBounds, DlClipOp::kIntersect, true);
|
||||||
}},
|
}},
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipOval(kTestBounds.Shift(1, 1), DlCanvas::ClipOp::kIntersect,
|
r.clipOval(kTestBounds.Shift(1, 1), DlClipOp::kIntersect, true);
|
||||||
true);
|
|
||||||
}},
|
}},
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipOval(kTestBounds, DlCanvas::ClipOp::kIntersect, false);
|
r.clipOval(kTestBounds, DlClipOp::kIntersect, false);
|
||||||
}},
|
}},
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipOval(kTestBounds, DlCanvas::ClipOp::kDifference, true);
|
r.clipOval(kTestBounds, DlClipOp::kDifference, true);
|
||||||
}},
|
}},
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipOval(kTestBounds, DlCanvas::ClipOp::kDifference, false);
|
r.clipOval(kTestBounds, DlClipOp::kDifference, false);
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
{"ClipRRect",
|
{"ClipRRect",
|
||||||
{
|
{
|
||||||
{1, 56, 0,
|
{1, 56, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipRoundRect(kTestRRect, DlCanvas::ClipOp::kIntersect, true);
|
r.clipRoundRect(kTestRRect, DlClipOp::kIntersect, true);
|
||||||
}},
|
}},
|
||||||
{1, 56, 0,
|
{1, 56, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipRoundRect(kTestRRect.Shift(1, 1),
|
r.clipRoundRect(kTestRRect.Shift(1, 1), DlClipOp::kIntersect,
|
||||||
DlCanvas::ClipOp::kIntersect, true);
|
true);
|
||||||
}},
|
}},
|
||||||
{1, 56, 0,
|
{1, 56, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipRoundRect(kTestRRect, DlCanvas::ClipOp::kIntersect, false);
|
r.clipRoundRect(kTestRRect, DlClipOp::kIntersect, false);
|
||||||
}},
|
}},
|
||||||
{1, 56, 0,
|
{1, 56, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipRoundRect(kTestRRect, DlCanvas::ClipOp::kDifference, true);
|
r.clipRoundRect(kTestRRect, DlClipOp::kDifference, true);
|
||||||
}},
|
}},
|
||||||
{1, 56, 0,
|
{1, 56, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipRoundRect(kTestRRect, DlCanvas::ClipOp::kDifference, false);
|
r.clipRoundRect(kTestRRect, DlClipOp::kDifference, false);
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
{"ClipPath",
|
{"ClipPath",
|
||||||
{
|
{
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipPath(kTestPath1, DlCanvas::ClipOp::kIntersect, true);
|
r.clipPath(kTestPath1, DlClipOp::kIntersect, true);
|
||||||
}},
|
}},
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipPath(kTestPath2, DlCanvas::ClipOp::kIntersect, true);
|
r.clipPath(kTestPath2, DlClipOp::kIntersect, true);
|
||||||
}},
|
}},
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipPath(kTestPath3, DlCanvas::ClipOp::kIntersect, true);
|
r.clipPath(kTestPath3, DlClipOp::kIntersect, true);
|
||||||
}},
|
}},
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipPath(kTestPath1, DlCanvas::ClipOp::kIntersect, false);
|
r.clipPath(kTestPath1, DlClipOp::kIntersect, false);
|
||||||
}},
|
}},
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipPath(kTestPath1, DlCanvas::ClipOp::kDifference, true);
|
r.clipPath(kTestPath1, DlClipOp::kDifference, true);
|
||||||
}},
|
}},
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipPath(kTestPath1, DlCanvas::ClipOp::kDifference, false);
|
r.clipPath(kTestPath1, DlClipOp::kDifference, false);
|
||||||
}},
|
}},
|
||||||
// clipPath(rect) becomes clipRect
|
// clipPath(rect) becomes clipRect
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipPath(kTestPathRect, DlCanvas::ClipOp::kIntersect, true);
|
r.clipPath(kTestPathRect, DlClipOp::kIntersect, true);
|
||||||
}},
|
}},
|
||||||
// clipPath(oval) becomes clipOval
|
// clipPath(oval) becomes clipOval
|
||||||
{1, 24, 0,
|
{1, 24, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipPath(kTestPathOval, DlCanvas::ClipOp::kIntersect, true);
|
r.clipPath(kTestPathOval, DlClipOp::kIntersect, true);
|
||||||
}},
|
}},
|
||||||
// clipPath(rrect) becomes clipRRect
|
// clipPath(rrect) becomes clipRRect
|
||||||
{1, 56, 0,
|
{1, 56, 0,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.clipPath(kTestPathRRect, DlCanvas::ClipOp::kIntersect, true);
|
r.clipPath(kTestPathRRect, DlClipOp::kIntersect, true);
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
};
|
};
|
||||||
@ -768,23 +766,20 @@ std::vector<DisplayListInvocationGroup> CreateAllRenderingOps() {
|
|||||||
{
|
{
|
||||||
{1, 8 + TestPointCount * 8, 1,
|
{1, 8 + TestPointCount * 8, 1,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.drawPoints(DlCanvas::PointMode::kPoints, TestPointCount,
|
r.drawPoints(DlPointMode::kPoints, TestPointCount, kTestPoints);
|
||||||
kTestPoints);
|
|
||||||
}},
|
}},
|
||||||
{1, 8 + (TestPointCount - 1) * 8, 1,
|
{1, 8 + (TestPointCount - 1) * 8, 1,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.drawPoints(DlCanvas::PointMode::kPoints, TestPointCount - 1,
|
r.drawPoints(DlPointMode::kPoints, TestPointCount - 1,
|
||||||
kTestPoints);
|
kTestPoints);
|
||||||
}},
|
}},
|
||||||
{1, 8 + TestPointCount * 8, 1,
|
{1, 8 + TestPointCount * 8, 1,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.drawPoints(DlCanvas::PointMode::kLines, TestPointCount,
|
r.drawPoints(DlPointMode::kLines, TestPointCount, kTestPoints);
|
||||||
kTestPoints);
|
|
||||||
}},
|
}},
|
||||||
{1, 8 + TestPointCount * 8, 1,
|
{1, 8 + TestPointCount * 8, 1,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.drawPoints(DlCanvas::PointMode::kPolygon, TestPointCount,
|
r.drawPoints(DlPointMode::kPolygon, TestPointCount, kTestPoints);
|
||||||
kTestPoints);
|
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
{"DrawVertices",
|
{"DrawVertices",
|
||||||
@ -841,48 +836,48 @@ std::vector<DisplayListInvocationGroup> CreateAllRenderingOps() {
|
|||||||
r.drawImageRect(kTestImage1, DlRect::MakeLTRB(10, 10, 20, 20),
|
r.drawImageRect(kTestImage1, DlRect::MakeLTRB(10, 10, 20, 20),
|
||||||
DlRect::MakeLTRB(10, 10, 80, 80),
|
DlRect::MakeLTRB(10, 10, 80, 80),
|
||||||
kNearestSampling, false,
|
kNearestSampling, false,
|
||||||
DlCanvas::SrcRectConstraint::kFast);
|
DlSrcRectConstraint::kFast);
|
||||||
}},
|
}},
|
||||||
{1, 56, 1,
|
{1, 56, 1,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.drawImageRect(kTestImage1, DlRect::MakeLTRB(10, 10, 20, 20),
|
r.drawImageRect(kTestImage1, DlRect::MakeLTRB(10, 10, 20, 20),
|
||||||
DlRect::MakeLTRB(10, 10, 80, 80),
|
DlRect::MakeLTRB(10, 10, 80, 80),
|
||||||
kNearestSampling, true,
|
kNearestSampling, true,
|
||||||
DlCanvas::SrcRectConstraint::kFast);
|
DlSrcRectConstraint::kFast);
|
||||||
}},
|
}},
|
||||||
{1, 56, 1,
|
{1, 56, 1,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.drawImageRect(kTestImage1, DlRect::MakeLTRB(10, 10, 20, 20),
|
r.drawImageRect(kTestImage1, DlRect::MakeLTRB(10, 10, 20, 20),
|
||||||
DlRect::MakeLTRB(10, 10, 80, 80),
|
DlRect::MakeLTRB(10, 10, 80, 80),
|
||||||
kNearestSampling, false,
|
kNearestSampling, false,
|
||||||
DlCanvas::SrcRectConstraint::kStrict);
|
DlSrcRectConstraint::kStrict);
|
||||||
}},
|
}},
|
||||||
{1, 56, 1,
|
{1, 56, 1,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.drawImageRect(kTestImage1, DlRect::MakeLTRB(10, 10, 25, 20),
|
r.drawImageRect(kTestImage1, DlRect::MakeLTRB(10, 10, 25, 20),
|
||||||
DlRect::MakeLTRB(10, 10, 80, 80),
|
DlRect::MakeLTRB(10, 10, 80, 80),
|
||||||
kNearestSampling, false,
|
kNearestSampling, false,
|
||||||
DlCanvas::SrcRectConstraint::kFast);
|
DlSrcRectConstraint::kFast);
|
||||||
}},
|
}},
|
||||||
{1, 56, 1,
|
{1, 56, 1,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.drawImageRect(kTestImage1, DlRect::MakeLTRB(10, 10, 20, 20),
|
r.drawImageRect(kTestImage1, DlRect::MakeLTRB(10, 10, 20, 20),
|
||||||
DlRect::MakeLTRB(10, 10, 85, 80),
|
DlRect::MakeLTRB(10, 10, 85, 80),
|
||||||
kNearestSampling, false,
|
kNearestSampling, false,
|
||||||
DlCanvas::SrcRectConstraint::kFast);
|
DlSrcRectConstraint::kFast);
|
||||||
}},
|
}},
|
||||||
{1, 56, 1,
|
{1, 56, 1,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.drawImageRect(kTestImage1, DlRect::MakeLTRB(10, 10, 20, 20),
|
r.drawImageRect(kTestImage1, DlRect::MakeLTRB(10, 10, 20, 20),
|
||||||
DlRect::MakeLTRB(10, 10, 80, 80), kLinearSampling,
|
DlRect::MakeLTRB(10, 10, 80, 80), kLinearSampling,
|
||||||
false, DlCanvas::SrcRectConstraint::kFast);
|
false, DlSrcRectConstraint::kFast);
|
||||||
}},
|
}},
|
||||||
{1, 56, 1,
|
{1, 56, 1,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
r.drawImageRect(kTestImage2, DlRect::MakeLTRB(10, 10, 15, 15),
|
r.drawImageRect(kTestImage2, DlRect::MakeLTRB(10, 10, 15, 15),
|
||||||
DlRect::MakeLTRB(10, 10, 80, 80),
|
DlRect::MakeLTRB(10, 10, 80, 80),
|
||||||
kNearestSampling, false,
|
kNearestSampling, false,
|
||||||
DlCanvas::SrcRectConstraint::kFast);
|
DlSrcRectConstraint::kFast);
|
||||||
}},
|
}},
|
||||||
{1, 56, 1,
|
{1, 56, 1,
|
||||||
[](DlOpReceiver& r) {
|
[](DlOpReceiver& r) {
|
||||||
@ -890,7 +885,7 @@ std::vector<DisplayListInvocationGroup> CreateAllRenderingOps() {
|
|||||||
r.drawImageRect(dl_image, DlRect::MakeLTRB(10, 10, 15, 15),
|
r.drawImageRect(dl_image, DlRect::MakeLTRB(10, 10, 15, 15),
|
||||||
DlRect::MakeLTRB(10, 10, 80, 80),
|
DlRect::MakeLTRB(10, 10, 80, 80),
|
||||||
kNearestSampling, false,
|
kNearestSampling, false,
|
||||||
DlCanvas::SrcRectConstraint::kFast);
|
DlSrcRectConstraint::kFast);
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
{"DrawImageNine",
|
{"DrawImageNine",
|
||||||
|
@ -42,7 +42,7 @@ bool DisplayListMatrixClipState::mapAndClipRect(const DlRect& src,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListMatrixClipState::clipRect(const DlRect& rect,
|
void DisplayListMatrixClipState::clipRect(const DlRect& rect,
|
||||||
ClipOp op,
|
DlClipOp op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
if (rect.IsFinite()) {
|
if (rect.IsFinite()) {
|
||||||
adjustCullRect(rect, op, is_aa);
|
adjustCullRect(rect, op, is_aa);
|
||||||
@ -50,16 +50,16 @@ void DisplayListMatrixClipState::clipRect(const DlRect& rect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListMatrixClipState::clipOval(const DlRect& bounds,
|
void DisplayListMatrixClipState::clipOval(const DlRect& bounds,
|
||||||
ClipOp op,
|
DlClipOp op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
if (!bounds.IsFinite()) {
|
if (!bounds.IsFinite()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case DlCanvas::ClipOp::kIntersect:
|
case DlClipOp::kIntersect:
|
||||||
adjustCullRect(bounds, op, is_aa);
|
adjustCullRect(bounds, op, is_aa);
|
||||||
break;
|
break;
|
||||||
case DlCanvas::ClipOp::kDifference:
|
case DlClipOp::kDifference:
|
||||||
if (oval_covers_cull(bounds)) {
|
if (oval_covers_cull(bounds)) {
|
||||||
cull_rect_ = DlRect();
|
cull_rect_ = DlRect();
|
||||||
}
|
}
|
||||||
@ -68,17 +68,17 @@ void DisplayListMatrixClipState::clipOval(const DlRect& bounds,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListMatrixClipState::clipRRect(const DlRoundRect& rrect,
|
void DisplayListMatrixClipState::clipRRect(const DlRoundRect& rrect,
|
||||||
ClipOp op,
|
DlClipOp op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
DlRect bounds = rrect.GetBounds();
|
DlRect bounds = rrect.GetBounds();
|
||||||
if (rrect.IsRect()) {
|
if (rrect.IsRect()) {
|
||||||
return clipRect(bounds, op, is_aa);
|
return clipRect(bounds, op, is_aa);
|
||||||
}
|
}
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case ClipOp::kIntersect:
|
case DlClipOp::kIntersect:
|
||||||
adjustCullRect(bounds, op, is_aa);
|
adjustCullRect(bounds, op, is_aa);
|
||||||
break;
|
break;
|
||||||
case ClipOp::kDifference: {
|
case DlClipOp::kDifference: {
|
||||||
if (rrect_covers_cull(rrect)) {
|
if (rrect_covers_cull(rrect)) {
|
||||||
cull_rect_ = DlRect();
|
cull_rect_ = DlRect();
|
||||||
return;
|
return;
|
||||||
@ -98,17 +98,17 @@ void DisplayListMatrixClipState::clipRRect(const DlRoundRect& rrect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListMatrixClipState::clipPath(const DlPath& path,
|
void DisplayListMatrixClipState::clipPath(const DlPath& path,
|
||||||
ClipOp op,
|
DlClipOp op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
DlRect bounds = path.GetBounds();
|
DlRect bounds = path.GetBounds();
|
||||||
if (path.IsRect(nullptr)) {
|
if (path.IsRect(nullptr)) {
|
||||||
return clipRect(bounds, op, is_aa);
|
return clipRect(bounds, op, is_aa);
|
||||||
}
|
}
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case ClipOp::kIntersect:
|
case DlClipOp::kIntersect:
|
||||||
adjustCullRect(bounds, op, is_aa);
|
adjustCullRect(bounds, op, is_aa);
|
||||||
break;
|
break;
|
||||||
case ClipOp::kDifference:
|
case DlClipOp::kDifference:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ void DisplayListMatrixClipState::resetLocalCullRect(const DlRect& cull_rect) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListMatrixClipState::adjustCullRect(const DlRect& clip,
|
void DisplayListMatrixClipState::adjustCullRect(const DlRect& clip,
|
||||||
ClipOp op,
|
DlClipOp op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
if (cull_rect_.IsEmpty()) {
|
if (cull_rect_.IsEmpty()) {
|
||||||
// No point in constraining further.
|
// No point in constraining further.
|
||||||
@ -159,7 +159,7 @@ void DisplayListMatrixClipState::adjustCullRect(const DlRect& clip,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case ClipOp::kIntersect: {
|
case DlClipOp::kIntersect: {
|
||||||
if (clip.IsEmpty()) {
|
if (clip.IsEmpty()) {
|
||||||
cull_rect_ = DlRect();
|
cull_rect_ = DlRect();
|
||||||
break;
|
break;
|
||||||
@ -172,7 +172,7 @@ void DisplayListMatrixClipState::adjustCullRect(const DlRect& clip,
|
|||||||
cull_rect_ = cull_rect_.Intersection(rect).value_or(DlRect());
|
cull_rect_ = cull_rect_.Intersection(rect).value_or(DlRect());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ClipOp::kDifference: {
|
case DlClipOp::kDifference: {
|
||||||
if (clip.IsEmpty()) {
|
if (clip.IsEmpty()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,6 @@
|
|||||||
namespace flutter {
|
namespace flutter {
|
||||||
|
|
||||||
class DisplayListMatrixClipState {
|
class DisplayListMatrixClipState {
|
||||||
private:
|
|
||||||
using ClipOp = DlCanvas::ClipOp;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DisplayListMatrixClipState(const DlRect& cull_rect,
|
explicit DisplayListMatrixClipState(const DlRect& cull_rect,
|
||||||
const DlMatrix& matrix = DlMatrix());
|
const DlMatrix& matrix = DlMatrix());
|
||||||
@ -107,17 +104,17 @@ class DisplayListMatrixClipState {
|
|||||||
}
|
}
|
||||||
bool mapAndClipRect(const DlRect& src, DlRect* mapped) const;
|
bool mapAndClipRect(const DlRect& src, DlRect* mapped) const;
|
||||||
|
|
||||||
void clipRect(const DlRect& rect, ClipOp op, bool is_aa);
|
void clipRect(const DlRect& rect, DlClipOp op, bool is_aa);
|
||||||
void clipOval(const DlRect& bounds, ClipOp op, bool is_aa);
|
void clipOval(const DlRect& bounds, DlClipOp op, bool is_aa);
|
||||||
void clipRRect(const DlRoundRect& rrect, ClipOp op, bool is_aa);
|
void clipRRect(const DlRoundRect& rrect, DlClipOp op, bool is_aa);
|
||||||
void clipPath(const DlPath& path, ClipOp op, bool is_aa);
|
void clipPath(const DlPath& path, DlClipOp op, bool is_aa);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DlRect cull_rect_;
|
DlRect cull_rect_;
|
||||||
DlMatrix matrix_;
|
DlMatrix matrix_;
|
||||||
|
|
||||||
bool getLocalCullCorners(DlPoint corners[4]) const;
|
bool getLocalCullCorners(DlPoint corners[4]) const;
|
||||||
void adjustCullRect(const DlRect& clip, ClipOp op, bool is_aa);
|
void adjustCullRect(const DlRect& clip, DlClipOp op, bool is_aa);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace flutter
|
} // namespace flutter
|
||||||
|
@ -200,20 +200,20 @@ TEST(DisplayListMatrixClipState, ClipDifference) {
|
|||||||
const std::string& label) {
|
const std::string& label) {
|
||||||
{
|
{
|
||||||
DisplayListMatrixClipState state(cull_rect, DlMatrix());
|
DisplayListMatrixClipState state(cull_rect, DlMatrix());
|
||||||
state.clipRect(diff_rect, DlCanvas::ClipOp::kDifference, false);
|
state.clipRect(diff_rect, DlClipOp::kDifference, false);
|
||||||
EXPECT_EQ(state.GetDeviceCullCoverage(), cull_rect) << label;
|
EXPECT_EQ(state.GetDeviceCullCoverage(), cull_rect) << label;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
DisplayListMatrixClipState state(cull_rect, DlMatrix());
|
DisplayListMatrixClipState state(cull_rect, DlMatrix());
|
||||||
const DlRoundRect diff_rrect = DlRoundRect::MakeRect(diff_rect);
|
const DlRoundRect diff_rrect = DlRoundRect::MakeRect(diff_rect);
|
||||||
state.clipRRect(diff_rrect, DlCanvas::ClipOp::kDifference, false);
|
state.clipRRect(diff_rrect, DlClipOp::kDifference, false);
|
||||||
EXPECT_EQ(state.GetDeviceCullCoverage(), cull_rect)
|
EXPECT_EQ(state.GetDeviceCullCoverage(), cull_rect)
|
||||||
<< label << " (RRect)";
|
<< label << " (RRect)";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
DisplayListMatrixClipState state(cull_rect, DlMatrix());
|
DisplayListMatrixClipState state(cull_rect, DlMatrix());
|
||||||
const DlPath diff_path = DlPath::MakeRect(diff_rect);
|
const DlPath diff_path = DlPath::MakeRect(diff_rect);
|
||||||
state.clipPath(diff_path, DlCanvas::ClipOp::kDifference, false);
|
state.clipPath(diff_path, DlClipOp::kDifference, false);
|
||||||
EXPECT_EQ(state.GetDeviceCullCoverage(), cull_rect)
|
EXPECT_EQ(state.GetDeviceCullCoverage(), cull_rect)
|
||||||
<< label << " (RRect)";
|
<< label << " (RRect)";
|
||||||
}
|
}
|
||||||
@ -225,20 +225,20 @@ TEST(DisplayListMatrixClipState, ClipDifference) {
|
|||||||
EXPECT_TRUE(result_rect.IsEmpty() || cull_rect.Contains(result_rect));
|
EXPECT_TRUE(result_rect.IsEmpty() || cull_rect.Contains(result_rect));
|
||||||
{
|
{
|
||||||
DisplayListMatrixClipState state(cull_rect, DlMatrix());
|
DisplayListMatrixClipState state(cull_rect, DlMatrix());
|
||||||
state.clipRect(diff_rect, DlCanvas::ClipOp::kDifference, false);
|
state.clipRect(diff_rect, DlClipOp::kDifference, false);
|
||||||
EXPECT_EQ(state.GetDeviceCullCoverage(), result_rect) << label;
|
EXPECT_EQ(state.GetDeviceCullCoverage(), result_rect) << label;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
DisplayListMatrixClipState state(cull_rect, DlMatrix());
|
DisplayListMatrixClipState state(cull_rect, DlMatrix());
|
||||||
const DlRoundRect diff_rrect = DlRoundRect::MakeRect(diff_rect);
|
const DlRoundRect diff_rrect = DlRoundRect::MakeRect(diff_rect);
|
||||||
state.clipRRect(diff_rrect, DlCanvas::ClipOp::kDifference, false);
|
state.clipRRect(diff_rrect, DlClipOp::kDifference, false);
|
||||||
EXPECT_EQ(state.GetDeviceCullCoverage(), result_rect)
|
EXPECT_EQ(state.GetDeviceCullCoverage(), result_rect)
|
||||||
<< label << " (RRect)";
|
<< label << " (RRect)";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
DisplayListMatrixClipState state(cull_rect, DlMatrix());
|
DisplayListMatrixClipState state(cull_rect, DlMatrix());
|
||||||
const DlPath diff_path = DlPath::MakeRect(diff_rect);
|
const DlPath diff_path = DlPath::MakeRect(diff_rect);
|
||||||
state.clipPath(diff_path, DlCanvas::ClipOp::kDifference, false);
|
state.clipPath(diff_path, DlClipOp::kDifference, false);
|
||||||
EXPECT_EQ(state.GetDeviceCullCoverage(), result_rect)
|
EXPECT_EQ(state.GetDeviceCullCoverage(), result_rect)
|
||||||
<< label << " (RRect)";
|
<< label << " (RRect)";
|
||||||
}
|
}
|
||||||
|
@ -41,18 +41,12 @@ class IgnoreAttributeDispatchHelper : public virtual DlOpReceiver {
|
|||||||
// A utility class that will ignore all DlOpReceiver methods relating
|
// A utility class that will ignore all DlOpReceiver methods relating
|
||||||
// to setting a clip.
|
// to setting a clip.
|
||||||
class IgnoreClipDispatchHelper : public virtual DlOpReceiver {
|
class IgnoreClipDispatchHelper : public virtual DlOpReceiver {
|
||||||
void clipRect(const DlRect& rect,
|
void clipRect(const DlRect& rect, DlClipOp clip_op, bool is_aa) override {}
|
||||||
DlCanvas::ClipOp clip_op,
|
void clipOval(const DlRect& bounds, DlClipOp clip_op, bool is_aa) override {}
|
||||||
bool is_aa) override {}
|
|
||||||
void clipOval(const DlRect& bounds,
|
|
||||||
DlCanvas::ClipOp clip_op,
|
|
||||||
bool is_aa) override {}
|
|
||||||
void clipRoundRect(const DlRoundRect& rrect,
|
void clipRoundRect(const DlRoundRect& rrect,
|
||||||
DlCanvas::ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) override {}
|
bool is_aa) override {}
|
||||||
void clipPath(const DlPath& path,
|
void clipPath(const DlPath& path, DlClipOp clip_op, bool is_aa) override {}
|
||||||
DlCanvas::ClipOp clip_op,
|
|
||||||
bool is_aa) override {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// A utility class that will ignore all DlOpReceiver methods relating
|
// A utility class that will ignore all DlOpReceiver methods relating
|
||||||
@ -103,7 +97,7 @@ class IgnoreDrawDispatchHelper : public virtual DlOpReceiver {
|
|||||||
DlScalar start_degrees,
|
DlScalar start_degrees,
|
||||||
DlScalar sweep_degrees,
|
DlScalar sweep_degrees,
|
||||||
bool use_center) override {}
|
bool use_center) override {}
|
||||||
void drawPoints(DlCanvas::PointMode mode,
|
void drawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint points[]) override {}
|
const DlPoint points[]) override {}
|
||||||
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
||||||
@ -117,7 +111,7 @@ class IgnoreDrawDispatchHelper : public virtual DlOpReceiver {
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
SrcRectConstraint constraint) override {}
|
DlSrcRectConstraint constraint) override {}
|
||||||
void drawImageNine(const sk_sp<DlImage> image,
|
void drawImageNine(const sk_sp<DlImage> image,
|
||||||
const DlIRect& center,
|
const DlIRect& center,
|
||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
|
@ -143,7 +143,7 @@ DlRect DiffContext::MapRect(const DlRect& rect) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DiffContext::PushCullRect(const DlRect& clip) {
|
bool DiffContext::PushCullRect(const DlRect& clip) {
|
||||||
state_.matrix_clip.clipRect(clip, DlCanvas::ClipOp::kIntersect, false);
|
state_.matrix_clip.clipRect(clip, DlClipOp::kIntersect, false);
|
||||||
return !state_.matrix_clip.is_cull_rect_empty();
|
return !state_.matrix_clip.is_cull_rect_empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +74,7 @@ TEST_F(BackdropFilterLayerTest, EmptyFilter) {
|
|||||||
/* (ClipRect)parent::Paint */ {
|
/* (ClipRect)parent::Paint */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
{
|
{
|
||||||
expected_builder.ClipRect(child_bounds, DlCanvas::ClipOp::kIntersect,
|
expected_builder.ClipRect(child_bounds, DlClipOp::kIntersect, false);
|
||||||
false);
|
|
||||||
/* (BackdropFilter)layer::Paint */ {
|
/* (BackdropFilter)layer::Paint */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
{
|
{
|
||||||
@ -120,8 +119,7 @@ TEST_F(BackdropFilterLayerTest, SimpleFilter) {
|
|||||||
/* (ClipRect)parent::Paint */ {
|
/* (ClipRect)parent::Paint */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
{
|
{
|
||||||
expected_builder.ClipRect(child_bounds, DlCanvas::ClipOp::kIntersect,
|
expected_builder.ClipRect(child_bounds, DlClipOp::kIntersect, false);
|
||||||
false);
|
|
||||||
/* (BackdropFilter)layer::Paint */ {
|
/* (BackdropFilter)layer::Paint */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
{
|
{
|
||||||
@ -169,8 +167,7 @@ TEST_F(BackdropFilterLayerTest, NonSrcOverBlend) {
|
|||||||
/* (ClipRect)parent::Paint */ {
|
/* (ClipRect)parent::Paint */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
{
|
{
|
||||||
expected_builder.ClipRect(child_bounds, DlCanvas::ClipOp::kIntersect,
|
expected_builder.ClipRect(child_bounds, DlClipOp::kIntersect, false);
|
||||||
false);
|
|
||||||
/* (BackdropFilter)layer::Paint */ {
|
/* (BackdropFilter)layer::Paint */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
{
|
{
|
||||||
@ -229,8 +226,7 @@ TEST_F(BackdropFilterLayerTest, MultipleChildren) {
|
|||||||
/* (ClipRect)parent::Paint */ {
|
/* (ClipRect)parent::Paint */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
{
|
{
|
||||||
expected_builder.ClipRect(children_bounds, DlCanvas::ClipOp::kIntersect,
|
expected_builder.ClipRect(children_bounds, DlClipOp::kIntersect, false);
|
||||||
false);
|
|
||||||
/* (BackdropFilter)layer::Paint */ {
|
/* (BackdropFilter)layer::Paint */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
{
|
{
|
||||||
@ -297,8 +293,7 @@ TEST_F(BackdropFilterLayerTest, Nested) {
|
|||||||
/* (ClipRect)parent::Paint */ {
|
/* (ClipRect)parent::Paint */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
{
|
{
|
||||||
expected_builder.ClipRect(children_bounds, DlCanvas::ClipOp::kIntersect,
|
expected_builder.ClipRect(children_bounds, DlClipOp::kIntersect, false);
|
||||||
false);
|
|
||||||
/* (BackdropFilter)layer1::Paint */ {
|
/* (BackdropFilter)layer1::Paint */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
{
|
{
|
||||||
@ -390,7 +385,7 @@ TEST_F(BackdropFilterLayerTest, OpacityInheritance) {
|
|||||||
/* ClipRectLayer::Paint */ {
|
/* ClipRectLayer::Paint */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
{
|
{
|
||||||
expected_builder.ClipRect(clip_rect, DlCanvas::ClipOp::kIntersect, false);
|
expected_builder.ClipRect(clip_rect, DlClipOp::kIntersect, false);
|
||||||
/* OpacityLayer::Paint */ {
|
/* OpacityLayer::Paint */ {
|
||||||
// NOP - it hands opacity down to BackdropFilterLayer
|
// NOP - it hands opacity down to BackdropFilterLayer
|
||||||
/* BackdropFilterLayer::Paint */ {
|
/* BackdropFilterLayer::Paint */ {
|
||||||
|
@ -21,8 +21,6 @@ namespace testing {
|
|||||||
|
|
||||||
using ClipPathLayerTest = LayerTest;
|
using ClipPathLayerTest = LayerTest;
|
||||||
|
|
||||||
using ClipOp = DlCanvas::ClipOp;
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
TEST_F(ClipPathLayerTest, ClipNoneBehaviorDies) {
|
TEST_F(ClipPathLayerTest, ClipNoneBehaviorDies) {
|
||||||
EXPECT_DEATH_IF_SUPPORTED(
|
EXPECT_DEATH_IF_SUPPORTED(
|
||||||
@ -430,7 +428,7 @@ TEST_F(ClipPathLayerTest, OpacityInheritancePainting) {
|
|||||||
expected_builder.Translate(offset.x, offset.y);
|
expected_builder.Translate(offset.x, offset.y);
|
||||||
/* ClipRectLayer::Paint() */ {
|
/* ClipRectLayer::Paint() */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
expected_builder.ClipPath(layer_clip, ClipOp::kIntersect, true);
|
expected_builder.ClipPath(layer_clip, DlClipOp::kIntersect, true);
|
||||||
/* child layer1 paint */ {
|
/* child layer1 paint */ {
|
||||||
expected_builder.DrawPath(path1, DlPaint().setAlpha(opacity_alpha));
|
expected_builder.DrawPath(path1, DlPaint().setAlpha(opacity_alpha));
|
||||||
}
|
}
|
||||||
@ -480,7 +478,7 @@ TEST_F(ClipPathLayerTest, OpacityInheritanceSaveLayerPainting) {
|
|||||||
expected_builder.Translate(offset.x, offset.y);
|
expected_builder.Translate(offset.x, offset.y);
|
||||||
/* ClipRectLayer::Paint() */ {
|
/* ClipRectLayer::Paint() */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
expected_builder.ClipPath(layer_clip, ClipOp::kIntersect, true);
|
expected_builder.ClipPath(layer_clip, DlClipOp::kIntersect, true);
|
||||||
expected_builder.SaveLayer(children_bounds,
|
expected_builder.SaveLayer(children_bounds,
|
||||||
&DlPaint().setAlpha(opacity_alpha));
|
&DlPaint().setAlpha(opacity_alpha));
|
||||||
/* child layer1 paint */ {
|
/* child layer1 paint */ {
|
||||||
|
@ -20,8 +20,6 @@ namespace testing {
|
|||||||
|
|
||||||
using ClipRectLayerTest = LayerTest;
|
using ClipRectLayerTest = LayerTest;
|
||||||
|
|
||||||
using ClipOp = DlCanvas::ClipOp;
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
TEST_F(ClipRectLayerTest, ClipNoneBehaviorDies) {
|
TEST_F(ClipRectLayerTest, ClipNoneBehaviorDies) {
|
||||||
EXPECT_DEATH_IF_SUPPORTED(
|
EXPECT_DEATH_IF_SUPPORTED(
|
||||||
@ -417,7 +415,7 @@ TEST_F(ClipRectLayerTest, OpacityInheritancePainting) {
|
|||||||
expected_builder.Translate(offset.x, offset.y);
|
expected_builder.Translate(offset.x, offset.y);
|
||||||
/* ClipRectLayer::Paint() */ {
|
/* ClipRectLayer::Paint() */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
expected_builder.ClipRect(clip_rect, ClipOp::kIntersect, true);
|
expected_builder.ClipRect(clip_rect, DlClipOp::kIntersect, true);
|
||||||
/* child layer1 paint */ {
|
/* child layer1 paint */ {
|
||||||
expected_builder.DrawPath(path1, DlPaint().setAlpha(opacity_alpha));
|
expected_builder.DrawPath(path1, DlPaint().setAlpha(opacity_alpha));
|
||||||
}
|
}
|
||||||
@ -466,7 +464,7 @@ TEST_F(ClipRectLayerTest, OpacityInheritanceSaveLayerPainting) {
|
|||||||
expected_builder.Translate(offset.x, offset.y);
|
expected_builder.Translate(offset.x, offset.y);
|
||||||
/* ClipRectLayer::Paint() */ {
|
/* ClipRectLayer::Paint() */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
expected_builder.ClipRect(clip_rect, ClipOp::kIntersect, true);
|
expected_builder.ClipRect(clip_rect, DlClipOp::kIntersect, true);
|
||||||
expected_builder.SaveLayer(children_bounds,
|
expected_builder.SaveLayer(children_bounds,
|
||||||
&DlPaint().setAlpha(opacity_alpha));
|
&DlPaint().setAlpha(opacity_alpha));
|
||||||
/* child layer1 paint */ {
|
/* child layer1 paint */ {
|
||||||
|
@ -20,8 +20,6 @@ namespace testing {
|
|||||||
|
|
||||||
using ClipRRectLayerTest = LayerTest;
|
using ClipRRectLayerTest = LayerTest;
|
||||||
|
|
||||||
using ClipOp = DlCanvas::ClipOp;
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
TEST_F(ClipRRectLayerTest, ClipNoneBehaviorDies) {
|
TEST_F(ClipRRectLayerTest, ClipNoneBehaviorDies) {
|
||||||
const DlRoundRect layer_rrect = DlRoundRect();
|
const DlRoundRect layer_rrect = DlRoundRect();
|
||||||
@ -428,7 +426,7 @@ TEST_F(ClipRRectLayerTest, OpacityInheritancePainting) {
|
|||||||
expected_builder.Translate(offset.x, offset.y);
|
expected_builder.Translate(offset.x, offset.y);
|
||||||
/* ClipRectLayer::Paint() */ {
|
/* ClipRectLayer::Paint() */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
expected_builder.ClipRoundRect(clip_rrect, ClipOp::kIntersect, true);
|
expected_builder.ClipRoundRect(clip_rrect, DlClipOp::kIntersect, true);
|
||||||
/* child layer1 paint */ {
|
/* child layer1 paint */ {
|
||||||
expected_builder.DrawPath(path1, DlPaint().setAlpha(opacity_alpha));
|
expected_builder.DrawPath(path1, DlPaint().setAlpha(opacity_alpha));
|
||||||
}
|
}
|
||||||
@ -478,7 +476,7 @@ TEST_F(ClipRRectLayerTest, OpacityInheritanceSaveLayerPainting) {
|
|||||||
expected_builder.Translate(offset.x, offset.y);
|
expected_builder.Translate(offset.x, offset.y);
|
||||||
/* ClipRectLayer::Paint() */ {
|
/* ClipRectLayer::Paint() */ {
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
expected_builder.ClipRoundRect(clip_rrect, ClipOp::kIntersect, true);
|
expected_builder.ClipRoundRect(clip_rrect, DlClipOp::kIntersect, true);
|
||||||
expected_builder.SaveLayer(children_bounds,
|
expected_builder.SaveLayer(children_bounds,
|
||||||
&DlPaint().setAlpha(opacity_alpha));
|
&DlPaint().setAlpha(opacity_alpha));
|
||||||
/* child layer1 paint */ {
|
/* child layer1 paint */ {
|
||||||
|
@ -56,9 +56,9 @@ class DummyDelegate : public LayerStateStack::Delegate {
|
|||||||
void transform(const DlMatrix& matrix) override {}
|
void transform(const DlMatrix& matrix) override {}
|
||||||
void integralTransform() override {}
|
void integralTransform() override {}
|
||||||
|
|
||||||
void clipRect(const DlRect& rect, ClipOp op, bool is_aa) override {}
|
void clipRect(const DlRect& rect, DlClipOp op, bool is_aa) override {}
|
||||||
void clipRRect(const DlRoundRect& rrect, ClipOp op, bool is_aa) override {}
|
void clipRRect(const DlRoundRect& rrect, DlClipOp op, bool is_aa) override {}
|
||||||
void clipPath(const DlPath& path, ClipOp op, bool is_aa) override {}
|
void clipPath(const DlPath& path, DlClipOp op, bool is_aa) override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void error() {
|
static void error() {
|
||||||
@ -115,13 +115,13 @@ class DlCanvasDelegate : public LayerStateStack::Delegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void clipRect(const DlRect& rect, ClipOp op, bool is_aa) override {
|
void clipRect(const DlRect& rect, DlClipOp op, bool is_aa) override {
|
||||||
canvas_->ClipRect(rect, op, is_aa);
|
canvas_->ClipRect(rect, op, is_aa);
|
||||||
}
|
}
|
||||||
void clipRRect(const DlRoundRect& rrect, ClipOp op, bool is_aa) override {
|
void clipRRect(const DlRoundRect& rrect, DlClipOp op, bool is_aa) override {
|
||||||
canvas_->ClipRoundRect(rrect, op, is_aa);
|
canvas_->ClipRoundRect(rrect, op, is_aa);
|
||||||
}
|
}
|
||||||
void clipPath(const DlPath& path, ClipOp op, bool is_aa) override {
|
void clipPath(const DlPath& path, DlClipOp op, bool is_aa) override {
|
||||||
canvas_->ClipPath(path, op, is_aa);
|
canvas_->ClipPath(path, op, is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,13 +170,13 @@ class PrerollDelegate : public LayerStateStack::Delegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void clipRect(const DlRect& rect, ClipOp op, bool is_aa) override {
|
void clipRect(const DlRect& rect, DlClipOp op, bool is_aa) override {
|
||||||
state().clipRect(rect, op, is_aa);
|
state().clipRect(rect, op, is_aa);
|
||||||
}
|
}
|
||||||
void clipRRect(const DlRoundRect& rrect, ClipOp op, bool is_aa) override {
|
void clipRRect(const DlRoundRect& rrect, DlClipOp op, bool is_aa) override {
|
||||||
state().clipRRect(rrect, op, is_aa);
|
state().clipRRect(rrect, op, is_aa);
|
||||||
}
|
}
|
||||||
void clipPath(const DlPath& path, ClipOp op, bool is_aa) override {
|
void clipPath(const DlPath& path, DlClipOp op, bool is_aa) override {
|
||||||
state().clipPath(path, op, is_aa);
|
state().clipPath(path, op, is_aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,8 +414,7 @@ class ClipRectEntry : public LayerStateStack::StateEntry {
|
|||||||
: clip_rect_(clip_rect), is_aa_(is_aa) {}
|
: clip_rect_(clip_rect), is_aa_(is_aa) {}
|
||||||
|
|
||||||
void apply(LayerStateStack* stack) const override {
|
void apply(LayerStateStack* stack) const override {
|
||||||
stack->delegate_->clipRect(clip_rect_, DlCanvas::ClipOp::kIntersect,
|
stack->delegate_->clipRect(clip_rect_, DlClipOp::kIntersect, is_aa_);
|
||||||
is_aa_);
|
|
||||||
}
|
}
|
||||||
void update_mutators(MutatorsStack* mutators_stack) const override {
|
void update_mutators(MutatorsStack* mutators_stack) const override {
|
||||||
mutators_stack->PushClipRect(ToSkRect(clip_rect_));
|
mutators_stack->PushClipRect(ToSkRect(clip_rect_));
|
||||||
@ -434,8 +433,7 @@ class ClipRRectEntry : public LayerStateStack::StateEntry {
|
|||||||
: clip_rrect_(clip_rrect), is_aa_(is_aa) {}
|
: clip_rrect_(clip_rrect), is_aa_(is_aa) {}
|
||||||
|
|
||||||
void apply(LayerStateStack* stack) const override {
|
void apply(LayerStateStack* stack) const override {
|
||||||
stack->delegate_->clipRRect(clip_rrect_, DlCanvas::ClipOp::kIntersect,
|
stack->delegate_->clipRRect(clip_rrect_, DlClipOp::kIntersect, is_aa_);
|
||||||
is_aa_);
|
|
||||||
}
|
}
|
||||||
void update_mutators(MutatorsStack* mutators_stack) const override {
|
void update_mutators(MutatorsStack* mutators_stack) const override {
|
||||||
mutators_stack->PushClipRRect(ToSkRRect(clip_rrect_));
|
mutators_stack->PushClipRRect(ToSkRRect(clip_rrect_));
|
||||||
@ -455,8 +453,7 @@ class ClipPathEntry : public LayerStateStack::StateEntry {
|
|||||||
~ClipPathEntry() override = default;
|
~ClipPathEntry() override = default;
|
||||||
|
|
||||||
void apply(LayerStateStack* stack) const override {
|
void apply(LayerStateStack* stack) const override {
|
||||||
stack->delegate_->clipPath(clip_path_, DlCanvas::ClipOp::kIntersect,
|
stack->delegate_->clipPath(clip_path_, DlClipOp::kIntersect, is_aa_);
|
||||||
is_aa_);
|
|
||||||
}
|
}
|
||||||
void update_mutators(MutatorsStack* mutators_stack) const override {
|
void update_mutators(MutatorsStack* mutators_stack) const override {
|
||||||
mutators_stack->PushClipPath(clip_path_.GetSkPath());
|
mutators_stack->PushClipPath(clip_path_.GetSkPath());
|
||||||
|
@ -411,9 +411,6 @@ class LayerStateStack {
|
|||||||
friend class ClipPathEntry;
|
friend class ClipPathEntry;
|
||||||
|
|
||||||
class Delegate {
|
class Delegate {
|
||||||
protected:
|
|
||||||
using ClipOp = DlCanvas::ClipOp;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~Delegate() = default;
|
virtual ~Delegate() = default;
|
||||||
|
|
||||||
@ -446,9 +443,11 @@ class LayerStateStack {
|
|||||||
virtual void transform(const DlMatrix& matrix) = 0;
|
virtual void transform(const DlMatrix& matrix) = 0;
|
||||||
virtual void integralTransform() = 0;
|
virtual void integralTransform() = 0;
|
||||||
|
|
||||||
virtual void clipRect(const DlRect& rect, ClipOp op, bool is_aa) = 0;
|
virtual void clipRect(const DlRect& rect, DlClipOp op, bool is_aa) = 0;
|
||||||
virtual void clipRRect(const DlRoundRect& rrect, ClipOp op, bool is_aa) = 0;
|
virtual void clipRRect(const DlRoundRect& rrect,
|
||||||
virtual void clipPath(const DlPath& path, ClipOp op, bool is_aa) = 0;
|
DlClipOp op,
|
||||||
|
bool is_aa) = 0;
|
||||||
|
virtual void clipPath(const DlPath& path, DlClipOp op, bool is_aa) = 0;
|
||||||
};
|
};
|
||||||
friend class DummyDelegate;
|
friend class DummyDelegate;
|
||||||
friend class DlCanvasDelegate;
|
friend class DlCanvasDelegate;
|
||||||
|
@ -16,8 +16,6 @@ namespace testing {
|
|||||||
|
|
||||||
using PlatformViewLayerTest = LayerTest;
|
using PlatformViewLayerTest = LayerTest;
|
||||||
|
|
||||||
using ClipOp = DlCanvas::ClipOp;
|
|
||||||
|
|
||||||
TEST_F(PlatformViewLayerTest, NullViewEmbedderDoesntPrerollCompositeOrPaint) {
|
TEST_F(PlatformViewLayerTest, NullViewEmbedderDoesntPrerollCompositeOrPaint) {
|
||||||
const DlPoint layer_offset = DlPoint();
|
const DlPoint layer_offset = DlPoint();
|
||||||
const DlSize layer_size = DlSize(8.0f, 8.0f);
|
const DlSize layer_size = DlSize(8.0f, 8.0f);
|
||||||
@ -73,13 +71,13 @@ TEST_F(PlatformViewLayerTest, ClippedPlatformViewPrerollsAndPaintsNothing) {
|
|||||||
|
|
||||||
DisplayListBuilder expected_builder;
|
DisplayListBuilder expected_builder;
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
expected_builder.ClipRect(parent_clip, ClipOp::kIntersect, false);
|
expected_builder.ClipRect(parent_clip, DlClipOp::kIntersect, false);
|
||||||
|
|
||||||
// In reality the following save/clip/restore are elided due to reaching
|
// In reality the following save/clip/restore are elided due to reaching
|
||||||
// a nop state (and the save is then unnecessary), but this is the order
|
// a nop state (and the save is then unnecessary), but this is the order
|
||||||
// of operations that the layers will do...
|
// of operations that the layers will do...
|
||||||
expected_builder.Save();
|
expected_builder.Save();
|
||||||
expected_builder.ClipRect(child_clip, ClipOp::kIntersect, false);
|
expected_builder.ClipRect(child_clip, DlClipOp::kIntersect, false);
|
||||||
expected_builder.Restore();
|
expected_builder.Restore();
|
||||||
// End of section that gets ignored during recording
|
// End of section that gets ignored during recording
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ std::shared_ptr<DlColorSource> CreateCheckerboardShader(SkColor c1,
|
|||||||
void DrawCheckerboard(DlCanvas* canvas, const SkRect& rect) {
|
void DrawCheckerboard(DlCanvas* canvas, const SkRect& rect) {
|
||||||
// Draw a checkerboard
|
// Draw a checkerboard
|
||||||
canvas->Save();
|
canvas->Save();
|
||||||
canvas->ClipRect(rect, DlCanvas::ClipOp::kIntersect, false);
|
canvas->ClipRect(rect, DlClipOp::kIntersect, false);
|
||||||
|
|
||||||
// Secure random number generation isn't needed here.
|
// Secure random number generation isn't needed here.
|
||||||
// NOLINTBEGIN(clang-analyzer-security.insecureAPI.rand)
|
// NOLINTBEGIN(clang-analyzer-security.insecureAPI.rand)
|
||||||
|
@ -112,8 +112,7 @@ std::unordered_map<int64_t, SkRect> SliceViews(
|
|||||||
|
|
||||||
// Clip the background canvas, so it doesn't contain any of the pixels
|
// Clip the background canvas, so it doesn't contain any of the pixels
|
||||||
// drawn on the overlay layer.
|
// drawn on the overlay layer.
|
||||||
background_canvas->ClipRect(full_joined_rect,
|
background_canvas->ClipRect(full_joined_rect, DlClipOp::kDifference);
|
||||||
DlCanvas::ClipOp::kDifference);
|
|
||||||
}
|
}
|
||||||
slice->render_into(background_canvas);
|
slice->render_into(background_canvas);
|
||||||
}
|
}
|
||||||
|
@ -826,7 +826,7 @@ TEST_P(AiksTest, CanRenderClippedBackdropFilter) {
|
|||||||
|
|
||||||
// Draw a clipped SaveLayer, where the clip coverage and SaveLayer size are
|
// Draw a clipped SaveLayer, where the clip coverage and SaveLayer size are
|
||||||
// the same.
|
// the same.
|
||||||
builder.ClipRoundRect(clip_rrect, DlCanvas::ClipOp::kIntersect);
|
builder.ClipRoundRect(clip_rrect, DlClipOp::kIntersect);
|
||||||
|
|
||||||
DlPaint save_paint;
|
DlPaint save_paint;
|
||||||
auto backdrop_filter = DlImageFilter::MakeColorFilter(
|
auto backdrop_filter = DlImageFilter::MakeColorFilter(
|
||||||
@ -854,7 +854,7 @@ TEST_P(AiksTest, CanDrawPerspectiveTransformWithClips) {
|
|||||||
paint.setColor(DlColor::kGreen());
|
paint.setColor(DlColor::kGreen());
|
||||||
builder.DrawPaint(paint);
|
builder.DrawPaint(paint);
|
||||||
builder.ClipRect(DlRect::MakeLTRB(-180, -180, 180, 180),
|
builder.ClipRect(DlRect::MakeLTRB(-180, -180, 180, 180),
|
||||||
DlCanvas::ClipOp::kDifference);
|
DlClipOp::kDifference);
|
||||||
|
|
||||||
paint.setColor(DlColor::kBlack());
|
paint.setColor(DlColor::kBlack());
|
||||||
builder.DrawPaint(paint);
|
builder.DrawPaint(paint);
|
||||||
|
@ -41,14 +41,14 @@ TEST_P(AiksTest, CanRenderDifferenceClips) {
|
|||||||
|
|
||||||
// Cut away eyes/mouth using difference clips.
|
// Cut away eyes/mouth using difference clips.
|
||||||
builder.ClipPath(DlPath::MakeCircle(DlPoint(-100, -50), 30),
|
builder.ClipPath(DlPath::MakeCircle(DlPoint(-100, -50), 30),
|
||||||
DlCanvas::ClipOp::kDifference);
|
DlClipOp::kDifference);
|
||||||
builder.ClipPath(DlPath::MakeCircle(DlPoint(100, -50), 30),
|
builder.ClipPath(DlPath::MakeCircle(DlPoint(100, -50), 30),
|
||||||
DlCanvas::ClipOp::kDifference);
|
DlClipOp::kDifference);
|
||||||
|
|
||||||
DlPathBuilder path_builder;
|
DlPathBuilder path_builder;
|
||||||
path_builder.MoveTo(DlPoint(-100, 50));
|
path_builder.MoveTo(DlPoint(-100, 50));
|
||||||
path_builder.QuadraticCurveTo(DlPoint(0, 150), DlPoint(100, 50));
|
path_builder.QuadraticCurveTo(DlPoint(0, 150), DlPoint(100, 50));
|
||||||
builder.ClipPath(DlPath(path_builder), DlCanvas::ClipOp::kDifference);
|
builder.ClipPath(DlPath(path_builder), DlClipOp::kDifference);
|
||||||
|
|
||||||
// Draw a huge yellow rectangle to prove the clipping works.
|
// Draw a huge yellow rectangle to prove the clipping works.
|
||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
@ -123,7 +123,7 @@ TEST_P(AiksTest, FramebufferBlendsRespectClips) {
|
|||||||
builder.DrawPaint(paint);
|
builder.DrawPaint(paint);
|
||||||
|
|
||||||
builder.ClipPath(DlPath::MakeCircle(DlPoint(150, 150), 50),
|
builder.ClipPath(DlPath::MakeCircle(DlPoint(150, 150), 50),
|
||||||
DlCanvas::ClipOp::kIntersect);
|
DlClipOp::kIntersect);
|
||||||
|
|
||||||
// Draw a red rectangle that should not show through the circle clip.
|
// Draw a red rectangle that should not show through the circle clip.
|
||||||
paint.setColor(DlColor::kRed());
|
paint.setColor(DlColor::kRed());
|
||||||
|
@ -53,7 +53,7 @@ TEST_P(AiksTest, CanRenderClippedRuntimeEffects) {
|
|||||||
builder.Save();
|
builder.Save();
|
||||||
builder.ClipRoundRect(
|
builder.ClipRoundRect(
|
||||||
DlRoundRect::MakeRectXY(DlRect::MakeXYWH(0, 0, 400, 400), 10.0, 10.0),
|
DlRoundRect::MakeRectXY(DlRect::MakeXYWH(0, 0, 400, 400), 10.0, 10.0),
|
||||||
DlCanvas::ClipOp::kIntersect);
|
DlClipOp::kIntersect);
|
||||||
builder.DrawRect(DlRect::MakeXYWH(0, 0, 400, 400), paint);
|
builder.DrawRect(DlRect::MakeXYWH(0, 0, 400, 400), paint);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ TEST_P(AiksTest, DifferenceClipsMustRenderIdenticallyAcrossBackends) {
|
|||||||
builder.DrawRect(frame, paint);
|
builder.DrawRect(frame, paint);
|
||||||
|
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.ClipRect(frame, DlCanvas::ClipOp::kIntersect);
|
builder.ClipRect(frame, DlClipOp::kIntersect);
|
||||||
|
|
||||||
DlMatrix rect_xform = {
|
DlMatrix rect_xform = {
|
||||||
0.8241262, 0.56640625, 0.0, 0.0, -0.56640625, 0.8241262, 0.0, 0.0,
|
0.8241262, 0.56640625, 0.0, 0.0, -0.56640625, 0.8241262, 0.0, 0.0,
|
||||||
@ -517,7 +517,7 @@ TEST_P(AiksTest, DifferenceClipsMustRenderIdenticallyAcrossBackends) {
|
|||||||
builder.DrawRoundRect(rrect, paint);
|
builder.DrawRoundRect(rrect, paint);
|
||||||
|
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.ClipRect(rect, DlCanvas::ClipOp::kIntersect);
|
builder.ClipRect(rect, DlClipOp::kIntersect);
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
@ -419,10 +419,10 @@ TEST_P(AiksTest, CanDrawPoints) {
|
|||||||
builder.DrawPaint(background);
|
builder.DrawPaint(background);
|
||||||
builder.Translate(200, 200);
|
builder.Translate(200, 200);
|
||||||
|
|
||||||
builder.DrawPoints(DlCanvas::PointMode::kPoints, points.size(), points.data(),
|
builder.DrawPoints(DlPointMode::kPoints, points.size(), points.data(),
|
||||||
paint_round);
|
paint_round);
|
||||||
builder.Translate(150, 0);
|
builder.Translate(150, 0);
|
||||||
builder.DrawPoints(DlCanvas::PointMode::kPoints, points.size(), points.data(),
|
builder.DrawPoints(DlPointMode::kPoints, points.size(), points.data(),
|
||||||
paint_square);
|
paint_square);
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -459,10 +459,10 @@ TEST_P(AiksTest, CanDrawPointsWithTextureMap) {
|
|||||||
DisplayListBuilder builder(DlRect::MakeSize(GetWindowSize()));
|
DisplayListBuilder builder(DlRect::MakeSize(GetWindowSize()));
|
||||||
builder.Translate(200, 200);
|
builder.Translate(200, 200);
|
||||||
|
|
||||||
builder.DrawPoints(DlCanvas::PointMode::kPoints, points.size(), points.data(),
|
builder.DrawPoints(DlPointMode::kPoints, points.size(), points.data(),
|
||||||
paint_round);
|
paint_round);
|
||||||
builder.Translate(150, 0);
|
builder.Translate(150, 0);
|
||||||
builder.DrawPoints(DlCanvas::PointMode::kPoints, points.size(), points.data(),
|
builder.DrawPoints(DlPointMode::kPoints, points.size(), points.data(),
|
||||||
paint_square);
|
paint_square);
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
@ -821,8 +821,7 @@ TEST_P(AiksTest, CanDrawScaledPointsSmallScaleLargeRadius) {
|
|||||||
builder.Translate(200, 200);
|
builder.Translate(200, 200);
|
||||||
builder.Scale(0.000001, 0.000001);
|
builder.Scale(0.000001, 0.000001);
|
||||||
|
|
||||||
builder.DrawPoints(DlCanvas::PointMode::kPoints, point.size(), point.data(),
|
builder.DrawPoints(DlPointMode::kPoints, point.size(), point.data(), paint);
|
||||||
paint);
|
|
||||||
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
}
|
}
|
||||||
@ -842,8 +841,7 @@ TEST_P(AiksTest, CanDrawScaledPointsLargeScaleSmallRadius) {
|
|||||||
builder.Translate(200, 200);
|
builder.Translate(200, 200);
|
||||||
builder.Scale(1000000, 1000000);
|
builder.Scale(1000000, 1000000);
|
||||||
|
|
||||||
builder.DrawPoints(DlCanvas::PointMode::kPoints, point.size(), point.data(),
|
builder.DrawPoints(DlPointMode::kPoints, point.size(), point.data(), paint);
|
||||||
paint);
|
|
||||||
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -896,8 +894,7 @@ TEST_P(AiksTest, BackdropRestoreUsesCorrectCoverageForFirstRestoredClip) {
|
|||||||
|
|
||||||
DlPaint paint;
|
DlPaint paint;
|
||||||
// Add a difference clip that cuts out the bottom right corner
|
// Add a difference clip that cuts out the bottom right corner
|
||||||
builder.ClipRect(DlRect::MakeLTRB(50, 50, 100, 100),
|
builder.ClipRect(DlRect::MakeLTRB(50, 50, 100, 100), DlClipOp::kDifference);
|
||||||
DlCanvas::ClipOp::kDifference);
|
|
||||||
|
|
||||||
// Draw a red rectangle that's going to be completely covered by green later.
|
// Draw a red rectangle that's going to be completely covered by green later.
|
||||||
paint.setColor(DlColor::kRed());
|
paint.setColor(DlColor::kRed());
|
||||||
@ -995,8 +992,7 @@ TEST_P(AiksTest, DepthValuesForLineMode) {
|
|||||||
DlPoint::MakeXY(0, 100), DlPoint::MakeXY(400, 500),
|
DlPoint::MakeXY(0, 100), DlPoint::MakeXY(400, 500),
|
||||||
DlPoint::MakeXY(0, 150), DlPoint::MakeXY(400, 600)};
|
DlPoint::MakeXY(0, 150), DlPoint::MakeXY(400, 600)};
|
||||||
|
|
||||||
builder.DrawPoints(DisplayListBuilder::PointMode::kLines, points.size(),
|
builder.DrawPoints(DlPointMode::kLines, points.size(), points.data(),
|
||||||
points.data(),
|
|
||||||
DlPaint().setColor(DlColor::kBlue()).setStrokeWidth(10));
|
DlPaint().setColor(DlColor::kBlue()).setStrokeWidth(10));
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
@ -1024,8 +1020,7 @@ TEST_P(AiksTest, DepthValuesForPolygonMode) {
|
|||||||
DlPoint::MakeXY(0, 100), DlPoint::MakeXY(400, 500),
|
DlPoint::MakeXY(0, 100), DlPoint::MakeXY(400, 500),
|
||||||
DlPoint::MakeXY(0, 150), DlPoint::MakeXY(400, 600)};
|
DlPoint::MakeXY(0, 150), DlPoint::MakeXY(400, 600)};
|
||||||
|
|
||||||
builder.DrawPoints(DisplayListBuilder::PointMode::kPolygon, points.size(),
|
builder.DrawPoints(DlPointMode::kPolygon, points.size(), points.data(),
|
||||||
points.data(),
|
|
||||||
DlPaint().setColor(DlColor::kBlue()).setStrokeWidth(10));
|
DlPaint().setColor(DlColor::kBlue()).setStrokeWidth(10));
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
|
|
||||||
|
@ -417,19 +417,18 @@ void DlDispatcherBase::transformReset() {
|
|||||||
GetCanvas().Transform(initial_matrix_);
|
GetCanvas().Transform(initial_matrix_);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Entity::ClipOperation ToClipOperation(
|
static Entity::ClipOperation ToClipOperation(flutter::DlClipOp clip_op) {
|
||||||
flutter::DlCanvas::ClipOp clip_op) {
|
|
||||||
switch (clip_op) {
|
switch (clip_op) {
|
||||||
case flutter::DlCanvas::ClipOp::kDifference:
|
case flutter::DlClipOp::kDifference:
|
||||||
return Entity::ClipOperation::kDifference;
|
return Entity::ClipOperation::kDifference;
|
||||||
case flutter::DlCanvas::ClipOp::kIntersect:
|
case flutter::DlClipOp::kIntersect:
|
||||||
return Entity::ClipOperation::kIntersect;
|
return Entity::ClipOperation::kIntersect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// |flutter::DlOpReceiver|
|
// |flutter::DlOpReceiver|
|
||||||
void DlDispatcherBase::clipRect(const DlRect& rect,
|
void DlDispatcherBase::clipRect(const DlRect& rect,
|
||||||
ClipOp clip_op,
|
flutter::DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
AUTO_DEPTH_WATCHER(0u);
|
AUTO_DEPTH_WATCHER(0u);
|
||||||
|
|
||||||
@ -439,7 +438,7 @@ void DlDispatcherBase::clipRect(const DlRect& rect,
|
|||||||
|
|
||||||
// |flutter::DlOpReceiver|
|
// |flutter::DlOpReceiver|
|
||||||
void DlDispatcherBase::clipOval(const DlRect& bounds,
|
void DlDispatcherBase::clipOval(const DlRect& bounds,
|
||||||
ClipOp clip_op,
|
flutter::DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
AUTO_DEPTH_WATCHER(0u);
|
AUTO_DEPTH_WATCHER(0u);
|
||||||
|
|
||||||
@ -449,7 +448,7 @@ void DlDispatcherBase::clipOval(const DlRect& bounds,
|
|||||||
|
|
||||||
// |flutter::DlOpReceiver|
|
// |flutter::DlOpReceiver|
|
||||||
void DlDispatcherBase::clipRoundRect(const DlRoundRect& rrect,
|
void DlDispatcherBase::clipRoundRect(const DlRoundRect& rrect,
|
||||||
ClipOp sk_op,
|
flutter::DlClipOp sk_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
AUTO_DEPTH_WATCHER(0u);
|
AUTO_DEPTH_WATCHER(0u);
|
||||||
|
|
||||||
@ -470,7 +469,9 @@ void DlDispatcherBase::clipRoundRect(const DlRoundRect& rrect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |flutter::DlOpReceiver|
|
// |flutter::DlOpReceiver|
|
||||||
void DlDispatcherBase::clipPath(const DlPath& path, ClipOp sk_op, bool is_aa) {
|
void DlDispatcherBase::clipPath(const DlPath& path,
|
||||||
|
flutter::DlClipOp sk_op,
|
||||||
|
bool is_aa) {
|
||||||
AUTO_DEPTH_WATCHER(0u);
|
AUTO_DEPTH_WATCHER(0u);
|
||||||
|
|
||||||
auto clip_op = ToClipOperation(sk_op);
|
auto clip_op = ToClipOperation(sk_op);
|
||||||
@ -665,7 +666,7 @@ void DlDispatcherBase::drawArc(const DlRect& oval_bounds,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |flutter::DlOpReceiver|
|
// |flutter::DlOpReceiver|
|
||||||
void DlDispatcherBase::drawPoints(PointMode mode,
|
void DlDispatcherBase::drawPoints(flutter::DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint points[]) {
|
const DlPoint points[]) {
|
||||||
AUTO_DEPTH_WATCHER(1u);
|
AUTO_DEPTH_WATCHER(1u);
|
||||||
@ -673,7 +674,7 @@ void DlDispatcherBase::drawPoints(PointMode mode,
|
|||||||
Paint paint = paint_;
|
Paint paint = paint_;
|
||||||
paint.style = Paint::Style::kStroke;
|
paint.style = Paint::Style::kStroke;
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case flutter::DlCanvas::PointMode::kPoints: {
|
case flutter::DlPointMode::kPoints: {
|
||||||
// Cap::kButt is also treated as a square.
|
// Cap::kButt is also treated as a square.
|
||||||
PointStyle point_style = paint.stroke_cap == Cap::kRound
|
PointStyle point_style = paint.stroke_cap == Cap::kRound
|
||||||
? PointStyle::kRound
|
? PointStyle::kRound
|
||||||
@ -684,14 +685,14 @@ void DlDispatcherBase::drawPoints(PointMode mode,
|
|||||||
}
|
}
|
||||||
GetCanvas().DrawPoints(points, count, radius, paint, point_style);
|
GetCanvas().DrawPoints(points, count, radius, paint, point_style);
|
||||||
} break;
|
} break;
|
||||||
case flutter::DlCanvas::PointMode::kLines:
|
case flutter::DlPointMode::kLines:
|
||||||
for (uint32_t i = 1; i < count; i += 2) {
|
for (uint32_t i = 1; i < count; i += 2) {
|
||||||
Point p0 = points[i - 1];
|
Point p0 = points[i - 1];
|
||||||
Point p1 = points[i];
|
Point p1 = points[i];
|
||||||
GetCanvas().DrawLine(p0, p1, paint, /*reuse_depth=*/i > 1);
|
GetCanvas().DrawLine(p0, p1, paint, /*reuse_depth=*/i > 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case flutter::DlCanvas::PointMode::kPolygon:
|
case flutter::DlPointMode::kPolygon:
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
Point p0 = points[0];
|
Point p0 = points[0];
|
||||||
for (uint32_t i = 1; i < count; i++) {
|
for (uint32_t i = 1; i < count; i++) {
|
||||||
@ -728,23 +729,23 @@ void DlDispatcherBase::drawImage(const sk_sp<flutter::DlImage> image,
|
|||||||
const auto src = DlRect::MakeWH(size.width, size.height);
|
const auto src = DlRect::MakeWH(size.width, size.height);
|
||||||
const auto dest = DlRect::MakeXYWH(point.x, point.y, size.width, size.height);
|
const auto dest = DlRect::MakeXYWH(point.x, point.y, size.width, size.height);
|
||||||
|
|
||||||
drawImageRect(image, // image
|
drawImageRect(image, // image
|
||||||
src, // source rect
|
src, // source rect
|
||||||
dest, // destination rect
|
dest, // destination rect
|
||||||
sampling, // sampling options
|
sampling, // sampling options
|
||||||
render_with_attributes, // render with attributes
|
render_with_attributes, // render with attributes
|
||||||
SrcRectConstraint::kStrict // constraint
|
flutter::DlSrcRectConstraint::kStrict // constraint
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// |flutter::DlOpReceiver|
|
// |flutter::DlOpReceiver|
|
||||||
void DlDispatcherBase::drawImageRect(
|
void DlDispatcherBase::drawImageRect(const sk_sp<flutter::DlImage> image,
|
||||||
const sk_sp<flutter::DlImage> image,
|
const DlRect& src,
|
||||||
const DlRect& src,
|
const DlRect& dst,
|
||||||
const DlRect& dst,
|
flutter::DlImageSampling sampling,
|
||||||
flutter::DlImageSampling sampling,
|
bool render_with_attributes,
|
||||||
bool render_with_attributes,
|
flutter::DlSrcRectConstraint constraint =
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) {
|
flutter::DlSrcRectConstraint::kFast) {
|
||||||
AUTO_DEPTH_WATCHER(1u);
|
AUTO_DEPTH_WATCHER(1u);
|
||||||
|
|
||||||
GetCanvas().DrawImageRect(
|
GetCanvas().DrawImageRect(
|
||||||
|
@ -124,18 +124,24 @@ class DlDispatcherBase : public flutter::DlOpReceiver {
|
|||||||
void transformReset() override;
|
void transformReset() override;
|
||||||
|
|
||||||
// |flutter::DlOpReceiver|
|
// |flutter::DlOpReceiver|
|
||||||
void clipRect(const DlRect& rect, ClipOp clip_op, bool is_aa) override;
|
void clipRect(const DlRect& rect,
|
||||||
|
flutter::DlClipOp clip_op,
|
||||||
|
bool is_aa) override;
|
||||||
|
|
||||||
// |flutter::DlOpReceiver|
|
// |flutter::DlOpReceiver|
|
||||||
void clipOval(const DlRect& bounds, ClipOp clip_op, bool is_aa) override;
|
void clipOval(const DlRect& bounds,
|
||||||
|
flutter::DlClipOp clip_op,
|
||||||
|
bool is_aa) override;
|
||||||
|
|
||||||
// |flutter::DlOpReceiver|
|
// |flutter::DlOpReceiver|
|
||||||
void clipRoundRect(const DlRoundRect& rrect,
|
void clipRoundRect(const DlRoundRect& rrect,
|
||||||
ClipOp clip_op,
|
flutter::DlClipOp clip_op,
|
||||||
bool is_aa) override;
|
bool is_aa) override;
|
||||||
|
|
||||||
// |flutter::DlOpReceiver|
|
// |flutter::DlOpReceiver|
|
||||||
void clipPath(const DlPath& path, ClipOp clip_op, bool is_aa) override;
|
void clipPath(const DlPath& path,
|
||||||
|
flutter::DlClipOp clip_op,
|
||||||
|
bool is_aa) override;
|
||||||
|
|
||||||
// |flutter::DlOpReceiver|
|
// |flutter::DlOpReceiver|
|
||||||
void drawColor(flutter::DlColor color, flutter::DlBlendMode mode) override;
|
void drawColor(flutter::DlColor color, flutter::DlBlendMode mode) override;
|
||||||
@ -178,7 +184,7 @@ class DlDispatcherBase : public flutter::DlOpReceiver {
|
|||||||
bool use_center) override;
|
bool use_center) override;
|
||||||
|
|
||||||
// |flutter::DlOpReceiver|
|
// |flutter::DlOpReceiver|
|
||||||
void drawPoints(PointMode mode,
|
void drawPoints(flutter::DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint points[]) override;
|
const DlPoint points[]) override;
|
||||||
|
|
||||||
@ -198,7 +204,7 @@ class DlDispatcherBase : public flutter::DlOpReceiver {
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
flutter::DlImageSampling sampling,
|
flutter::DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
SrcRectConstraint constraint) override;
|
flutter::DlSrcRectConstraint constraint) override;
|
||||||
|
|
||||||
// |flutter::DlOpReceiver|
|
// |flutter::DlOpReceiver|
|
||||||
void drawImageNine(const sk_sp<flutter::DlImage> image,
|
void drawImageNine(const sk_sp<flutter::DlImage> image,
|
||||||
|
@ -79,7 +79,7 @@ TEST_P(DlGoldenTest, Bug147807) {
|
|||||||
{
|
{
|
||||||
canvas->ClipRoundRect(
|
canvas->ClipRoundRect(
|
||||||
DlRoundRect::MakeOval(DlRect::MakeLTRB(201.25, 10, 361.25, 170)),
|
DlRoundRect::MakeOval(DlRect::MakeLTRB(201.25, 10, 361.25, 170)),
|
||||||
DlCanvas::ClipOp::kIntersect, true);
|
DlClipOp::kIntersect, true);
|
||||||
DlRect save_layer_bounds = DlRect::MakeLTRB(201.25, 10, 361.25, 170);
|
DlRect save_layer_bounds = DlRect::MakeLTRB(201.25, 10, 361.25, 170);
|
||||||
auto backdrop =
|
auto backdrop =
|
||||||
DlImageFilter::MakeMatrix(DlMatrix::MakeRow(3, 0, 0.0, -280, //
|
DlImageFilter::MakeMatrix(DlMatrix::MakeRow(3, 0, 0.0, -280, //
|
||||||
|
@ -689,7 +689,7 @@ TEST_P(DisplayListTest, CanDrawBackdropFilter) {
|
|||||||
// correctly.
|
// correctly.
|
||||||
if (add_clip) {
|
if (add_clip) {
|
||||||
builder.ClipRect(DlRect::MakeLTRB(0, 0, 99999, 99999),
|
builder.ClipRect(DlRect::MakeLTRB(0, 0, 99999, 99999),
|
||||||
flutter::DlCanvas::ClipOp::kIntersect, true);
|
flutter::DlClipOp::kIntersect, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.DrawImage(DlImageImpeller::Make(texture), DlPoint(200, 200),
|
builder.DrawImage(DlImageImpeller::Make(texture), DlPoint(200, 200),
|
||||||
@ -827,12 +827,11 @@ TEST_P(DisplayListTest, CanDrawPoints) {
|
|||||||
for (auto cap : caps) {
|
for (auto cap : caps) {
|
||||||
paint.setStrokeCap(cap);
|
paint.setStrokeCap(cap);
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.DrawPoints(flutter::DlCanvas::PointMode::kPoints, 7, points, paint);
|
builder.DrawPoints(flutter::DlPointMode::kPoints, 7, points, paint);
|
||||||
builder.Translate(150, 0);
|
builder.Translate(150, 0);
|
||||||
builder.DrawPoints(flutter::DlCanvas::PointMode::kLines, 5, points, paint);
|
builder.DrawPoints(flutter::DlPointMode::kLines, 5, points, paint);
|
||||||
builder.Translate(150, 0);
|
builder.Translate(150, 0);
|
||||||
builder.DrawPoints(flutter::DlCanvas::PointMode::kPolygon, 5, points,
|
builder.DrawPoints(flutter::DlPointMode::kPolygon, 5, points, paint);
|
||||||
paint);
|
|
||||||
builder.Restore();
|
builder.Restore();
|
||||||
builder.Translate(0, 150);
|
builder.Translate(0, 150);
|
||||||
}
|
}
|
||||||
@ -1131,7 +1130,7 @@ TEST_P(DisplayListTest, CanDrawPaintWithColorSource) {
|
|||||||
auto clip_bounds = DlRect::MakeWH(300.0, 300.0);
|
auto clip_bounds = DlRect::MakeWH(300.0, 300.0);
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.Translate(100, 100);
|
builder.Translate(100, 100);
|
||||||
builder.ClipRect(clip_bounds, flutter::DlCanvas::ClipOp::kIntersect, false);
|
builder.ClipRect(clip_bounds, flutter::DlClipOp::kIntersect, false);
|
||||||
auto linear =
|
auto linear =
|
||||||
flutter::DlColorSource::MakeLinear({0.0, 0.0}, {100.0, 100.0}, 2, colors,
|
flutter::DlColorSource::MakeLinear({0.0, 0.0}, {100.0, 100.0}, 2, colors,
|
||||||
stops, flutter::DlTileMode::kRepeat);
|
stops, flutter::DlTileMode::kRepeat);
|
||||||
@ -1141,7 +1140,7 @@ TEST_P(DisplayListTest, CanDrawPaintWithColorSource) {
|
|||||||
|
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.Translate(500, 100);
|
builder.Translate(500, 100);
|
||||||
builder.ClipRect(clip_bounds, flutter::DlCanvas::ClipOp::kIntersect, false);
|
builder.ClipRect(clip_bounds, flutter::DlClipOp::kIntersect, false);
|
||||||
auto radial = flutter::DlColorSource::MakeRadial(
|
auto radial = flutter::DlColorSource::MakeRadial(
|
||||||
{100.0, 100.0}, 100.0, 2, colors, stops, flutter::DlTileMode::kRepeat);
|
{100.0, 100.0}, 100.0, 2, colors, stops, flutter::DlTileMode::kRepeat);
|
||||||
paint.setColorSource(radial);
|
paint.setColorSource(radial);
|
||||||
@ -1150,7 +1149,7 @@ TEST_P(DisplayListTest, CanDrawPaintWithColorSource) {
|
|||||||
|
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.Translate(100, 500);
|
builder.Translate(100, 500);
|
||||||
builder.ClipRect(clip_bounds, flutter::DlCanvas::ClipOp::kIntersect, false);
|
builder.ClipRect(clip_bounds, flutter::DlClipOp::kIntersect, false);
|
||||||
auto sweep =
|
auto sweep =
|
||||||
flutter::DlColorSource::MakeSweep({100.0, 100.0}, 180.0, 270.0, 2, colors,
|
flutter::DlColorSource::MakeSweep({100.0, 100.0}, 180.0, 270.0, 2, colors,
|
||||||
stops, flutter::DlTileMode::kRepeat);
|
stops, flutter::DlTileMode::kRepeat);
|
||||||
@ -1160,7 +1159,7 @@ TEST_P(DisplayListTest, CanDrawPaintWithColorSource) {
|
|||||||
|
|
||||||
builder.Save();
|
builder.Save();
|
||||||
builder.Translate(500, 500);
|
builder.Translate(500, 500);
|
||||||
builder.ClipRect(clip_bounds, flutter::DlCanvas::ClipOp::kIntersect, false);
|
builder.ClipRect(clip_bounds, flutter::DlClipOp::kIntersect, false);
|
||||||
auto texture = CreateTextureForFixture("table_mountain_nx.png");
|
auto texture = CreateTextureForFixture("table_mountain_nx.png");
|
||||||
auto image = flutter::DlColorSource::MakeImage(DlImageImpeller::Make(texture),
|
auto image = flutter::DlColorSource::MakeImage(DlImageImpeller::Make(texture),
|
||||||
flutter::DlTileMode::kRepeat,
|
flutter::DlTileMode::kRepeat,
|
||||||
|
@ -66,24 +66,21 @@ void DisplayListBuilder::RestoreToCount(uint32_t count) {
|
|||||||
builder_.RestoreToCount(count);
|
builder_.RestoreToCount(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListBuilder::ClipRect(const Rect& rect,
|
void DisplayListBuilder::ClipRect(const Rect& rect, flutter::DlClipOp op) {
|
||||||
flutter::DlCanvas::ClipOp op) {
|
|
||||||
builder_.ClipRect(rect, op);
|
builder_.ClipRect(rect, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListBuilder::ClipOval(const Rect& rect,
|
void DisplayListBuilder::ClipOval(const Rect& rect, flutter::DlClipOp op) {
|
||||||
flutter::DlCanvas::ClipOp op) {
|
|
||||||
builder_.ClipOval(rect, op);
|
builder_.ClipOval(rect, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListBuilder::ClipRoundedRect(const Rect& rect,
|
void DisplayListBuilder::ClipRoundedRect(const Rect& rect,
|
||||||
const RoundingRadii& radii,
|
const RoundingRadii& radii,
|
||||||
flutter::DlCanvas::ClipOp op) {
|
flutter::DlClipOp op) {
|
||||||
builder_.ClipRoundRect(RoundRect::MakeRectRadii(rect, radii), op);
|
builder_.ClipRoundRect(RoundRect::MakeRectRadii(rect, radii), op);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListBuilder::ClipPath(const Path& path,
|
void DisplayListBuilder::ClipPath(const Path& path, flutter::DlClipOp op) {
|
||||||
flutter::DlCanvas::ClipOp op) {
|
|
||||||
builder_.ClipPath(flutter::DlPath(path.GetPath()), op);
|
builder_.ClipPath(flutter::DlPath(path.GetPath()), op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,15 +59,15 @@ class DisplayListBuilder final
|
|||||||
|
|
||||||
void RestoreToCount(uint32_t count);
|
void RestoreToCount(uint32_t count);
|
||||||
|
|
||||||
void ClipRect(const Rect& rect, flutter::DlCanvas::ClipOp op);
|
void ClipRect(const Rect& rect, flutter::DlClipOp op);
|
||||||
|
|
||||||
void ClipOval(const Rect& rect, flutter::DlCanvas::ClipOp op);
|
void ClipOval(const Rect& rect, flutter::DlClipOp op);
|
||||||
|
|
||||||
void ClipRoundedRect(const Rect& rect,
|
void ClipRoundedRect(const Rect& rect,
|
||||||
const RoundingRadii& radii,
|
const RoundingRadii& radii,
|
||||||
flutter::DlCanvas::ClipOp op);
|
flutter::DlClipOp op);
|
||||||
|
|
||||||
void ClipPath(const Path& path, flutter::DlCanvas::ClipOp op);
|
void ClipPath(const Path& path, flutter::DlClipOp op);
|
||||||
|
|
||||||
void DrawPaint(const Paint& paint);
|
void DrawPaint(const Paint& paint);
|
||||||
|
|
||||||
|
@ -274,14 +274,14 @@ constexpr FillType ToImpellerType(ImpellerFillType type) {
|
|||||||
return FillType::kNonZero;
|
return FillType::kNonZero;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr flutter::DlCanvas::ClipOp ToImpellerType(ImpellerClipOperation op) {
|
constexpr flutter::DlClipOp ToImpellerType(ImpellerClipOperation op) {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case kImpellerClipOperationDifference:
|
case kImpellerClipOperationDifference:
|
||||||
return flutter::DlCanvas::ClipOp::kDifference;
|
return flutter::DlClipOp::kDifference;
|
||||||
case kImpellerClipOperationIntersect:
|
case kImpellerClipOperationIntersect:
|
||||||
return flutter::DlCanvas::ClipOp::kIntersect;
|
return flutter::DlClipOp::kIntersect;
|
||||||
}
|
}
|
||||||
return flutter::DlCanvas::ClipOp::kDifference;
|
return flutter::DlClipOp::kDifference;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Color ToImpellerType(const ImpellerColor& color) {
|
constexpr Color ToImpellerType(const ImpellerColor& color) {
|
||||||
|
@ -5566,7 +5566,7 @@ base class Vertices extends NativeFieldWrapperClass1 {
|
|||||||
/// Defines how a list of points is interpreted when drawing a set of points.
|
/// Defines how a list of points is interpreted when drawing a set of points.
|
||||||
///
|
///
|
||||||
/// Used by [Canvas.drawPoints] and [Canvas.drawRawPoints].
|
/// Used by [Canvas.drawPoints] and [Canvas.drawRawPoints].
|
||||||
// These enum values must be kept in sync with DlCanvas::PointMode.
|
// These enum values must be kept in sync with DlPointMode.
|
||||||
enum PointMode {
|
enum PointMode {
|
||||||
/// Draw each point separately.
|
/// Draw each point separately.
|
||||||
///
|
///
|
||||||
|
@ -162,7 +162,7 @@ void Canvas::clipRect(double left,
|
|||||||
double top,
|
double top,
|
||||||
double right,
|
double right,
|
||||||
double bottom,
|
double bottom,
|
||||||
DlCanvas::ClipOp clipOp,
|
DlClipOp clipOp,
|
||||||
bool doAntiAlias) {
|
bool doAntiAlias) {
|
||||||
if (display_list_builder_) {
|
if (display_list_builder_) {
|
||||||
builder()->ClipRect(DlRect::MakeLTRB(SafeNarrow(left), SafeNarrow(top),
|
builder()->ClipRect(DlRect::MakeLTRB(SafeNarrow(left), SafeNarrow(top),
|
||||||
@ -173,8 +173,7 @@ void Canvas::clipRect(double left,
|
|||||||
|
|
||||||
void Canvas::clipRRect(const RRect& rrect, bool doAntiAlias) {
|
void Canvas::clipRRect(const RRect& rrect, bool doAntiAlias) {
|
||||||
if (display_list_builder_) {
|
if (display_list_builder_) {
|
||||||
builder()->ClipRoundRect(rrect.rrect, DlCanvas::ClipOp::kIntersect,
|
builder()->ClipRoundRect(rrect.rrect, DlClipOp::kIntersect, doAntiAlias);
|
||||||
doAntiAlias);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,8 +184,7 @@ void Canvas::clipPath(const CanvasPath* path, bool doAntiAlias) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (display_list_builder_) {
|
if (display_list_builder_) {
|
||||||
builder()->ClipPath(path->path(), DlCanvas::ClipOp::kIntersect,
|
builder()->ClipPath(path->path(), DlClipOp::kIntersect, doAntiAlias);
|
||||||
doAntiAlias);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,7 +444,7 @@ Dart_Handle Canvas::drawImageRect(const CanvasImage* image,
|
|||||||
const DlPaint* opt_paint =
|
const DlPaint* opt_paint =
|
||||||
paint.paint(dl_paint, kDrawImageRectWithPaintFlags, DlTileMode::kClamp);
|
paint.paint(dl_paint, kDrawImageRectWithPaintFlags, DlTileMode::kClamp);
|
||||||
builder()->DrawImageRect(dl_image, src, dst, sampling, opt_paint,
|
builder()->DrawImageRect(dl_image, src, dst, sampling, opt_paint,
|
||||||
DlCanvas::SrcRectConstraint::kFast);
|
DlSrcRectConstraint::kFast);
|
||||||
}
|
}
|
||||||
return Dart_Null();
|
return Dart_Null();
|
||||||
}
|
}
|
||||||
@ -511,7 +509,7 @@ void Canvas::drawPicture(Picture* picture) {
|
|||||||
|
|
||||||
void Canvas::drawPoints(Dart_Handle paint_objects,
|
void Canvas::drawPoints(Dart_Handle paint_objects,
|
||||||
Dart_Handle paint_data,
|
Dart_Handle paint_data,
|
||||||
DlCanvas::PointMode point_mode,
|
DlPointMode point_mode,
|
||||||
const tonic::Float32List& points) {
|
const tonic::Float32List& points) {
|
||||||
Paint paint(paint_objects, paint_data);
|
Paint paint(paint_objects, paint_data);
|
||||||
|
|
||||||
@ -522,13 +520,13 @@ void Canvas::drawPoints(Dart_Handle paint_objects,
|
|||||||
if (display_list_builder_) {
|
if (display_list_builder_) {
|
||||||
DlPaint dl_paint;
|
DlPaint dl_paint;
|
||||||
switch (point_mode) {
|
switch (point_mode) {
|
||||||
case DlCanvas::PointMode::kPoints:
|
case DlPointMode::kPoints:
|
||||||
paint.paint(dl_paint, kDrawPointsAsPointsFlags, DlTileMode::kDecal);
|
paint.paint(dl_paint, kDrawPointsAsPointsFlags, DlTileMode::kDecal);
|
||||||
break;
|
break;
|
||||||
case DlCanvas::PointMode::kLines:
|
case DlPointMode::kLines:
|
||||||
paint.paint(dl_paint, kDrawPointsAsLinesFlags, DlTileMode::kDecal);
|
paint.paint(dl_paint, kDrawPointsAsLinesFlags, DlTileMode::kDecal);
|
||||||
break;
|
break;
|
||||||
case DlCanvas::PointMode::kPolygon:
|
case DlPointMode::kPolygon:
|
||||||
paint.paint(dl_paint, kDrawPointsAsPolygonFlags, DlTileMode::kDecal);
|
paint.paint(dl_paint, kDrawPointsAsPolygonFlags, DlTileMode::kDecal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ class Canvas : public RefCountedDartWrappable<Canvas>, DisplayListOpFlags {
|
|||||||
double top,
|
double top,
|
||||||
double right,
|
double right,
|
||||||
double bottom,
|
double bottom,
|
||||||
DlCanvas::ClipOp clipOp,
|
DlClipOp clipOp,
|
||||||
bool doAntiAlias = true);
|
bool doAntiAlias = true);
|
||||||
void clipRRect(const RRect& rrect, bool doAntiAlias = true);
|
void clipRRect(const RRect& rrect, bool doAntiAlias = true);
|
||||||
void clipPath(const CanvasPath* path, bool doAntiAlias = true);
|
void clipPath(const CanvasPath* path, bool doAntiAlias = true);
|
||||||
@ -161,7 +161,7 @@ class Canvas : public RefCountedDartWrappable<Canvas>, DisplayListOpFlags {
|
|||||||
|
|
||||||
void drawPoints(Dart_Handle paint_objects,
|
void drawPoints(Dart_Handle paint_objects,
|
||||||
Dart_Handle paint_data,
|
Dart_Handle paint_data,
|
||||||
DlCanvas::PointMode point_mode,
|
DlPointMode point_mode,
|
||||||
const tonic::Float32List& points);
|
const tonic::Float32List& points);
|
||||||
|
|
||||||
void drawVertices(const Vertices* vertices,
|
void drawVertices(const Vertices* vertices,
|
||||||
|
@ -74,7 +74,7 @@ void DlOpSpy::drawArc(const DlRect& oval_bounds,
|
|||||||
bool use_center) {
|
bool use_center) {
|
||||||
did_draw_ |= will_draw_;
|
did_draw_ |= will_draw_;
|
||||||
}
|
}
|
||||||
void DlOpSpy::drawPoints(PointMode mode,
|
void DlOpSpy::drawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint points[]) {
|
const DlPoint points[]) {
|
||||||
did_draw_ |= will_draw_;
|
did_draw_ |= will_draw_;
|
||||||
@ -99,7 +99,7 @@ void DlOpSpy::drawImageRect(const sk_sp<DlImage> image,
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
SrcRectConstraint constraint) {
|
DlSrcRectConstraint constraint) {
|
||||||
did_draw_ = true;
|
did_draw_ = true;
|
||||||
}
|
}
|
||||||
void DlOpSpy::drawImageNine(const sk_sp<DlImage> image,
|
void DlOpSpy::drawImageNine(const sk_sp<DlImage> image,
|
||||||
|
@ -62,7 +62,7 @@ class DlOpSpy final : public virtual DlOpReceiver,
|
|||||||
DlScalar start_degrees,
|
DlScalar start_degrees,
|
||||||
DlScalar sweep_degrees,
|
DlScalar sweep_degrees,
|
||||||
bool use_center) override;
|
bool use_center) override;
|
||||||
void drawPoints(PointMode mode,
|
void drawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint points[]) override;
|
const DlPoint points[]) override;
|
||||||
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
||||||
@ -77,7 +77,7 @@ class DlOpSpy final : public virtual DlOpReceiver,
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::kFast) override;
|
DlSrcRectConstraint constraint = DlSrcRectConstraint::kFast) override;
|
||||||
void drawImageNine(const sk_sp<DlImage> image,
|
void drawImageNine(const sk_sp<DlImage> image,
|
||||||
const DlIRect& center,
|
const DlIRect& center,
|
||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
|
@ -349,7 +349,7 @@ TEST(DlOpSpy, DrawPoints) {
|
|||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
DlPaint paint(DlColor::kBlack());
|
DlPaint paint(DlColor::kBlack());
|
||||||
const DlPoint points[] = {DlPoint(5, 4)};
|
const DlPoint points[] = {DlPoint(5, 4)};
|
||||||
builder.DrawPoints(DlCanvas::PointMode::kPoints, 1, points, paint);
|
builder.DrawPoints(DlPointMode::kPoints, 1, points, paint);
|
||||||
sk_sp<DisplayList> dl = builder.Build();
|
sk_sp<DisplayList> dl = builder.Build();
|
||||||
DlOpSpy dl_op_spy;
|
DlOpSpy dl_op_spy;
|
||||||
dl->Dispatch(dl_op_spy);
|
dl->Dispatch(dl_op_spy);
|
||||||
@ -359,7 +359,7 @@ TEST(DlOpSpy, DrawPoints) {
|
|||||||
DisplayListBuilder builder;
|
DisplayListBuilder builder;
|
||||||
DlPaint paint(DlColor::kTransparent());
|
DlPaint paint(DlColor::kTransparent());
|
||||||
const DlPoint points[] = {DlPoint(5, 4)};
|
const DlPoint points[] = {DlPoint(5, 4)};
|
||||||
builder.DrawPoints(DlCanvas::PointMode::kPoints, 1, points, paint);
|
builder.DrawPoints(DlPointMode::kPoints, 1, points, paint);
|
||||||
sk_sp<DisplayList> dl = builder.Build();
|
sk_sp<DisplayList> dl = builder.Build();
|
||||||
DlOpSpy dl_op_spy;
|
DlOpSpy dl_op_spy;
|
||||||
dl->Dispatch(dl_op_spy);
|
dl->Dispatch(dl_op_spy);
|
||||||
|
@ -38,12 +38,12 @@ void ImageExternalTexture::Paint(PaintContext& context,
|
|||||||
}
|
}
|
||||||
if (dl_image_) {
|
if (dl_image_) {
|
||||||
context.canvas->DrawImageRect(
|
context.canvas->DrawImageRect(
|
||||||
dl_image_, // image
|
dl_image_, // image
|
||||||
SkRect::Make(dl_image_->bounds()), // source rect
|
SkRect::Make(dl_image_->bounds()), // source rect
|
||||||
bounds, // destination rect
|
bounds, // destination rect
|
||||||
sampling, // sampling
|
sampling, // sampling
|
||||||
context.paint, // paint
|
context.paint, // paint
|
||||||
flutter::DlCanvas::SrcRectConstraint::kStrict // enforce edges
|
flutter::DlSrcRectConstraint::kStrict // enforce edges
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
FML_LOG(INFO) << "No DlImage available for ImageExternalTexture to paint.";
|
FML_LOG(INFO) << "No DlImage available for ImageExternalTexture to paint.";
|
||||||
|
@ -66,12 +66,12 @@ FLUTTER_ASSERT_ARC
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_externalImage) {
|
if (_externalImage) {
|
||||||
context.canvas->DrawImageRect(_externalImage, // image
|
context.canvas->DrawImageRect(_externalImage, // image
|
||||||
SkRect::Make(_externalImage->bounds()), // source rect
|
SkRect::Make(_externalImage->bounds()), // source rect
|
||||||
bounds, // destination rect
|
bounds, // destination rect
|
||||||
sampling, // sampling
|
sampling, // sampling
|
||||||
context.paint, // paint
|
context.paint, // paint
|
||||||
flutter::DlCanvas::SrcRectConstraint::kStrict // enforce edges
|
flutter::DlSrcRectConstraint::kStrict // enforce edges
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,18 +205,18 @@ extern std::ostream& operator<<(std::ostream& os, const DlPath& path) {
|
|||||||
<< ")";
|
<< ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const DlCanvas::ClipOp& op) {
|
std::ostream& operator<<(std::ostream& os, const flutter::DlClipOp& op) {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case DlCanvas::ClipOp::kDifference: return os << "ClipOp::kDifference";
|
case flutter::DlClipOp::kDifference: return os << "ClipOp::kDifference";
|
||||||
case DlCanvas::ClipOp::kIntersect: return os << "ClipOp::kIntersect";
|
case flutter::DlClipOp::kIntersect: return os << "ClipOp::kIntersect";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const DlCanvas::SrcRectConstraint& constraint) {
|
std::ostream& operator<<(std::ostream& os, const flutter::DlSrcRectConstraint& constraint) {
|
||||||
switch (constraint) {
|
switch (constraint) {
|
||||||
case DlCanvas::SrcRectConstraint::kFast:
|
case flutter::DlSrcRectConstraint::kFast:
|
||||||
return os << "SrcRectConstraint::kFast";
|
return os << "SrcRectConstraint::kFast";
|
||||||
case DlCanvas::SrcRectConstraint::kStrict:
|
case flutter::DlSrcRectConstraint::kStrict:
|
||||||
return os << "SrcRectConstraint::kStrict";
|
return os << "SrcRectConstraint::kStrict";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,11 +254,11 @@ std::ostream& operator<<(std::ostream& os, const DlBlurStyle& style) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const DlCanvas::PointMode& mode) {
|
std::ostream& operator<<(std::ostream& os, const flutter::DlPointMode& mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case DlCanvas::PointMode::kPoints: return os << "PointMode::kPoints";
|
case flutter::DlPointMode::kPoints: return os << "PointMode::kPoints";
|
||||||
case DlCanvas::PointMode::kLines: return os << "PointMode::kLines";
|
case flutter::DlPointMode::kLines: return os << "PointMode::kLines";
|
||||||
case DlCanvas::PointMode::kPolygon: return os << "PointMode::kPolygon";
|
case flutter::DlPointMode::kPolygon: return os << "PointMode::kPolygon";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -759,7 +759,7 @@ void DisplayListStreamDispatcher::transformReset() {
|
|||||||
startl() << "transformReset();" << std::endl;
|
startl() << "transformReset();" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayListStreamDispatcher::clipRect(const DlRect& rect, ClipOp clip_op,
|
void DisplayListStreamDispatcher::clipRect(const DlRect& rect, DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
startl() << "clipRect("
|
startl() << "clipRect("
|
||||||
<< rect << ", "
|
<< rect << ", "
|
||||||
@ -767,7 +767,7 @@ void DisplayListStreamDispatcher::clipRect(const DlRect& rect, ClipOp clip_op,
|
|||||||
<< "isaa: " << is_aa
|
<< "isaa: " << is_aa
|
||||||
<< ");" << std::endl;
|
<< ");" << std::endl;
|
||||||
}
|
}
|
||||||
void DisplayListStreamDispatcher::clipOval(const DlRect& bounds, ClipOp clip_op,
|
void DisplayListStreamDispatcher::clipOval(const DlRect& bounds, DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
startl() << "clipOval("
|
startl() << "clipOval("
|
||||||
<< bounds << ", "
|
<< bounds << ", "
|
||||||
@ -776,7 +776,7 @@ void DisplayListStreamDispatcher::clipOval(const DlRect& bounds, ClipOp clip_op,
|
|||||||
<< ");" << std::endl;
|
<< ");" << std::endl;
|
||||||
}
|
}
|
||||||
void DisplayListStreamDispatcher::clipRoundRect(const DlRoundRect& rrect,
|
void DisplayListStreamDispatcher::clipRoundRect(const DlRoundRect& rrect,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
startl() << "clipRRect("
|
startl() << "clipRRect("
|
||||||
<< rrect << ", "
|
<< rrect << ", "
|
||||||
@ -784,7 +784,7 @@ void DisplayListStreamDispatcher::clipRoundRect(const DlRoundRect& rrect,
|
|||||||
<< "isaa: " << is_aa
|
<< "isaa: " << is_aa
|
||||||
<< ");" << std::endl;
|
<< ");" << std::endl;
|
||||||
}
|
}
|
||||||
void DisplayListStreamDispatcher::clipPath(const DlPath& path, ClipOp clip_op,
|
void DisplayListStreamDispatcher::clipPath(const DlPath& path, DlClipOp clip_op,
|
||||||
bool is_aa) {
|
bool is_aa) {
|
||||||
startl() << "clipPath("
|
startl() << "clipPath("
|
||||||
<< path << ", "
|
<< path << ", "
|
||||||
@ -849,7 +849,7 @@ void DisplayListStreamDispatcher::drawArc(const DlRect& oval_bounds,
|
|||||||
<< "use_center: " << use_center
|
<< "use_center: " << use_center
|
||||||
<< ");" << std::endl;
|
<< ");" << std::endl;
|
||||||
}
|
}
|
||||||
void DisplayListStreamDispatcher::drawPoints(PointMode mode,
|
void DisplayListStreamDispatcher::drawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint points[]) {
|
const DlPoint points[]) {
|
||||||
startl() << "drawPoints(" << mode << ", ";
|
startl() << "drawPoints(" << mode << ", ";
|
||||||
@ -882,7 +882,7 @@ void DisplayListStreamDispatcher::drawImageRect(const sk_sp<DlImage> image,
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
SrcRectConstraint constraint) {
|
DlSrcRectConstraint constraint) {
|
||||||
startl() << "drawImageRect(" << image.get() << "," << std::endl;
|
startl() << "drawImageRect(" << image.get() << "," << std::endl;
|
||||||
startl() << " src: " << src << "," << std::endl;
|
startl() << " src: " << src << "," << std::endl;
|
||||||
startl() << " dst: " << dst << "," << std::endl;
|
startl() << " dst: " << dst << "," << std::endl;
|
||||||
|
@ -46,12 +46,11 @@ extern std::ostream& operator<<(std::ostream& os,
|
|||||||
const flutter::DlPaint& paint);
|
const flutter::DlPaint& paint);
|
||||||
extern std::ostream& operator<<(std::ostream& os,
|
extern std::ostream& operator<<(std::ostream& os,
|
||||||
const flutter::DlBlendMode& mode);
|
const flutter::DlBlendMode& mode);
|
||||||
|
extern std::ostream& operator<<(std::ostream& os, const flutter::DlClipOp& op);
|
||||||
extern std::ostream& operator<<(std::ostream& os,
|
extern std::ostream& operator<<(std::ostream& os,
|
||||||
const flutter::DlCanvas::ClipOp& op);
|
const flutter::DlPointMode& op);
|
||||||
extern std::ostream& operator<<(std::ostream& os,
|
extern std::ostream& operator<<(std::ostream& os,
|
||||||
const flutter::DlCanvas::PointMode& op);
|
const flutter::DlSrcRectConstraint& op);
|
||||||
extern std::ostream& operator<<(std::ostream& os,
|
|
||||||
const flutter::DlCanvas::SrcRectConstraint& op);
|
|
||||||
extern std::ostream& operator<<(std::ostream& os,
|
extern std::ostream& operator<<(std::ostream& os,
|
||||||
const flutter::DlStrokeCap& cap);
|
const flutter::DlStrokeCap& cap);
|
||||||
extern std::ostream& operator<<(std::ostream& os,
|
extern std::ostream& operator<<(std::ostream& os,
|
||||||
@ -131,12 +130,12 @@ class DisplayListStreamDispatcher final : public DlOpReceiver {
|
|||||||
// clang-format on
|
// clang-format on
|
||||||
void transformReset() override;
|
void transformReset() override;
|
||||||
|
|
||||||
void clipRect(const DlRect& rect, ClipOp clip_op, bool is_aa) override;
|
void clipRect(const DlRect& rect, DlClipOp clip_op, bool is_aa) override;
|
||||||
void clipOval(const DlRect& bounds, ClipOp clip_op, bool is_aa) override;
|
void clipOval(const DlRect& bounds, DlClipOp clip_op, bool is_aa) override;
|
||||||
void clipRoundRect(const DlRoundRect& rrect,
|
void clipRoundRect(const DlRoundRect& rrect,
|
||||||
ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) override;
|
bool is_aa) override;
|
||||||
void clipPath(const DlPath& path, ClipOp clip_op, bool is_aa) override;
|
void clipPath(const DlPath& path, DlClipOp clip_op, bool is_aa) override;
|
||||||
|
|
||||||
void drawColor(DlColor color, DlBlendMode mode) override;
|
void drawColor(DlColor color, DlBlendMode mode) override;
|
||||||
void drawPaint() override;
|
void drawPaint() override;
|
||||||
@ -156,7 +155,7 @@ class DisplayListStreamDispatcher final : public DlOpReceiver {
|
|||||||
DlScalar start_degrees,
|
DlScalar start_degrees,
|
||||||
DlScalar sweep_degrees,
|
DlScalar sweep_degrees,
|
||||||
bool use_center) override;
|
bool use_center) override;
|
||||||
void drawPoints(PointMode mode,
|
void drawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint points[]) override;
|
const DlPoint points[]) override;
|
||||||
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
void drawVertices(const std::shared_ptr<DlVertices>& vertices,
|
||||||
@ -170,7 +169,7 @@ class DisplayListStreamDispatcher final : public DlOpReceiver {
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
SrcRectConstraint constraint) override;
|
DlSrcRectConstraint constraint) override;
|
||||||
void drawImageNine(const sk_sp<DlImage> image,
|
void drawImageNine(const sk_sp<DlImage> image,
|
||||||
const DlIRect& center,
|
const DlIRect& center,
|
||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
@ -351,50 +350,44 @@ class DisplayListGeneralReceiver : public DlOpReceiver {
|
|||||||
RecordByType(DisplayListOpType::kTransformReset);
|
RecordByType(DisplayListOpType::kTransformReset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clipRect(const DlRect& rect,
|
void clipRect(const DlRect& rect, DlClipOp clip_op, bool is_aa) override {
|
||||||
DlCanvas::ClipOp clip_op,
|
|
||||||
bool is_aa) override {
|
|
||||||
switch (clip_op) {
|
switch (clip_op) {
|
||||||
case DlCanvas::ClipOp::kIntersect:
|
case DlClipOp::kIntersect:
|
||||||
RecordByType(DisplayListOpType::kClipIntersectRect);
|
RecordByType(DisplayListOpType::kClipIntersectRect);
|
||||||
break;
|
break;
|
||||||
case DlCanvas::ClipOp::kDifference:
|
case DlClipOp::kDifference:
|
||||||
RecordByType(DisplayListOpType::kClipDifferenceRect);
|
RecordByType(DisplayListOpType::kClipDifferenceRect);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void clipOval(const DlRect& bounds,
|
void clipOval(const DlRect& bounds, DlClipOp clip_op, bool is_aa) override {
|
||||||
DlCanvas::ClipOp clip_op,
|
|
||||||
bool is_aa) override {
|
|
||||||
switch (clip_op) {
|
switch (clip_op) {
|
||||||
case DlCanvas::ClipOp::kIntersect:
|
case DlClipOp::kIntersect:
|
||||||
RecordByType(DisplayListOpType::kClipIntersectOval);
|
RecordByType(DisplayListOpType::kClipIntersectOval);
|
||||||
break;
|
break;
|
||||||
case DlCanvas::ClipOp::kDifference:
|
case DlClipOp::kDifference:
|
||||||
RecordByType(DisplayListOpType::kClipDifferenceOval);
|
RecordByType(DisplayListOpType::kClipDifferenceOval);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void clipRoundRect(const DlRoundRect& rrect,
|
void clipRoundRect(const DlRoundRect& rrect,
|
||||||
DlCanvas::ClipOp clip_op,
|
DlClipOp clip_op,
|
||||||
bool is_aa) override {
|
bool is_aa) override {
|
||||||
switch (clip_op) {
|
switch (clip_op) {
|
||||||
case DlCanvas::ClipOp::kIntersect:
|
case DlClipOp::kIntersect:
|
||||||
RecordByType(DisplayListOpType::kClipIntersectRoundRect);
|
RecordByType(DisplayListOpType::kClipIntersectRoundRect);
|
||||||
break;
|
break;
|
||||||
case DlCanvas::ClipOp::kDifference:
|
case DlClipOp::kDifference:
|
||||||
RecordByType(DisplayListOpType::kClipDifferenceRoundRect);
|
RecordByType(DisplayListOpType::kClipDifferenceRoundRect);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void clipPath(const DlPath& path,
|
void clipPath(const DlPath& path, DlClipOp clip_op, bool is_aa) override {
|
||||||
DlCanvas::ClipOp clip_op,
|
|
||||||
bool is_aa) override {
|
|
||||||
switch (clip_op) {
|
switch (clip_op) {
|
||||||
case DlCanvas::ClipOp::kIntersect:
|
case DlClipOp::kIntersect:
|
||||||
RecordByType(DisplayListOpType::kClipIntersectPath);
|
RecordByType(DisplayListOpType::kClipIntersectPath);
|
||||||
break;
|
break;
|
||||||
case DlCanvas::ClipOp::kDifference:
|
case DlClipOp::kDifference:
|
||||||
RecordByType(DisplayListOpType::kClipDifferencePath);
|
RecordByType(DisplayListOpType::kClipDifferencePath);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -451,17 +444,17 @@ class DisplayListGeneralReceiver : public DlOpReceiver {
|
|||||||
bool use_center) override {
|
bool use_center) override {
|
||||||
RecordByType(DisplayListOpType::kDrawArc);
|
RecordByType(DisplayListOpType::kDrawArc);
|
||||||
}
|
}
|
||||||
void drawPoints(DlCanvas::PointMode mode,
|
void drawPoints(DlPointMode mode,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
const DlPoint points[]) override {
|
const DlPoint points[]) override {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case DlCanvas::PointMode::kPoints:
|
case DlPointMode::kPoints:
|
||||||
RecordByType(DisplayListOpType::kDrawPoints);
|
RecordByType(DisplayListOpType::kDrawPoints);
|
||||||
break;
|
break;
|
||||||
case DlCanvas::PointMode::kLines:
|
case DlPointMode::kLines:
|
||||||
RecordByType(DisplayListOpType::kDrawLines);
|
RecordByType(DisplayListOpType::kDrawLines);
|
||||||
break;
|
break;
|
||||||
case DlCanvas::PointMode::kPolygon:
|
case DlPointMode::kPolygon:
|
||||||
RecordByType(DisplayListOpType::kDrawPolygon);
|
RecordByType(DisplayListOpType::kDrawPolygon);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -485,7 +478,7 @@ class DisplayListGeneralReceiver : public DlOpReceiver {
|
|||||||
const DlRect& dst,
|
const DlRect& dst,
|
||||||
DlImageSampling sampling,
|
DlImageSampling sampling,
|
||||||
bool render_with_attributes,
|
bool render_with_attributes,
|
||||||
SrcRectConstraint constraint) override {
|
DlSrcRectConstraint constraint) override {
|
||||||
RecordByType(DisplayListOpType::kDrawImageRect);
|
RecordByType(DisplayListOpType::kDrawImageRect);
|
||||||
}
|
}
|
||||||
void drawImageNine(const sk_sp<DlImage> image,
|
void drawImageNine(const sk_sp<DlImage> image,
|
||||||
|
@ -168,7 +168,7 @@ class DisplayListParagraphPainter : public skt::ParagraphPainter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void clipRect(const SkRect& rect) override {
|
void clipRect(const SkRect& rect) override {
|
||||||
builder_->ClipRect(rect, DlCanvas::ClipOp::kIntersect, false);
|
builder_->ClipRect(rect, DlClipOp::kIntersect, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void translate(SkScalar dx, SkScalar dy) override {
|
void translate(SkScalar dx, SkScalar dy) override {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user