Skip to content

Commit

Permalink
use new pathtypes
Browse files Browse the repository at this point in the history
Removes using a legacy skia flag

Bug: skia:9663
Change-Id: I85b728fb987c2304ac51e8a6a7d84da62f625774
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1928209
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Cr-Commit-Position: refs/heads/master@{#718640}
  • Loading branch information
reed-at-google authored and Commit Bot committed Nov 25, 2019
1 parent 82ee2f1 commit 187b7c5
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 36 deletions.
9 changes: 4 additions & 5 deletions ash/laser/laser_pointer_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,14 @@ class LaserSegment {
path_.moveTo(ordered_points[0].x(), ordered_points[0].y());
if (!is_first_segment) {
path_.arcTo(start_radius, start_radius, 180.0f, SkPath::kSmall_ArcSize,
SkPath::kCW_Direction, ordered_points[1].x(),
SkPathDirection::kCW, ordered_points[1].x(),
ordered_points[1].y());
}

path_.lineTo(ordered_points[2].x(), ordered_points[2].y());
path_.arcTo(
end_radius, end_radius, 180.0f, SkPath::kSmall_ArcSize,
is_last_segment ? SkPath::kCW_Direction : SkPath::kCCW_Direction,
ordered_points[3].x(), ordered_points[3].y());
path_.arcTo(end_radius, end_radius, 180.0f, SkPath::kSmall_ArcSize,
is_last_segment ? SkPathDirection::kCW : SkPathDirection::kCCW,
ordered_points[3].x(), ordered_points[3].y());
path_.lineTo(ordered_points[0].x(), ordered_points[0].y());

// Store data to be used by the next segment.
Expand Down
2 changes: 1 addition & 1 deletion ash/public/cpp/default_frame_header.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void TileRoundRect(gfx::Canvas* canvas,
// Extend 1dp to make sure it's fully opaque.
rect.fBottom += 1;
SkPath path;
path.addRoundRect(rect, radii, SkPath::kCW_Direction);
path.addRoundRect(rect, radii, SkPathDirection::kCW);
canvas->DrawPath(path, flags);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ void ArcNotificationContentView::OnPaint(gfx::Canvas* canvas) {

SkPath path;
path.addRoundRect(gfx::RectToSkRect(GetLocalBounds()), radii,
SkPath::kCCW_Direction);
SkPathDirection::kCCW);
canvas->ClipPath(path, false);

if (!surface_ && item_ && !item_->GetSnapshot().isNull()) {
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/views/frame/browser_frame_header_ash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void PaintFrameImagesInRoundRect(gfx::Canvas* canvas,
0}; // bottom-left
SkPath frame_path;
frame_path.addRoundRect(gfx::RectToSkRect(bounds), radii,
SkPath::kCW_Direction);
SkPathDirection::kCW);
bool antialias = corner_radius > 0;

gfx::ScopedCanvas scoped_save(canvas);
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/views/tabs/new_tab_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ SkPath NewTabButton::GetBorderPath(const gfx::Point& origin,
const float diameter = radius * 2;
path.rLineTo(diameter, 0);
path.rLineTo(0, scaled_origin.y() + radius);
path.rArcTo(radius, radius, 0, SkPath::kSmall_ArcSize,
SkPath::kCW_Direction, -diameter, 0);
path.rArcTo(radius, radius, 0, SkPath::kSmall_ArcSize, SkPathDirection::kCW,
-diameter, 0);
path.close();
} else {
path.addCircle(scaled_origin.x() + radius, scaled_origin.y() + radius,
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/views/tabs/tab_group_underline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ SkPath TabGroupUnderline::GetPath() const {

path.moveTo(0, kStrokeThickness);
path.arcTo(kStrokeThickness, kStrokeThickness, 0, SkPath::kSmall_ArcSize,
SkPath::kCW_Direction, kStrokeThickness, 0);
SkPathDirection::kCW, kStrokeThickness, 0);
path.lineTo(width() - kStrokeThickness, 0);
path.arcTo(kStrokeThickness, kStrokeThickness, 0, SkPath::kSmall_ArcSize,
SkPath::kCW_Direction, width(), kStrokeThickness);
SkPathDirection::kCW, width(), kStrokeThickness);
path.close();

return path;
Expand Down
9 changes: 4 additions & 5 deletions chrome/browser/ui/views/tabs/tab_style_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,7 @@ SkPath GM2TabStyle::GetPath(PathType path_type,
} else {
path.lineTo(tab_left - bottom_radius, tab_bottom);
path.arcTo(bottom_radius, bottom_radius, 0, SkPath::kSmall_ArcSize,
SkPath::kCCW_Direction, tab_left,
tab_bottom - bottom_radius);
SkPathDirection::kCCW, tab_left, tab_bottom - bottom_radius);
}
}

Expand All @@ -344,7 +343,7 @@ SkPath GM2TabStyle::GetPath(PathType path_type,
// ┌─╯ ╰─┐
path.lineTo(tab_left, tab_top + top_radius);
path.arcTo(top_radius, top_radius, 0, SkPath::kSmall_ArcSize,
SkPath::kCW_Direction, tab_left + top_radius, tab_top);
SkPathDirection::kCW, tab_left + top_radius, tab_top);
}

// Draw the top crossbar and top-right curve, if present.
Expand All @@ -359,7 +358,7 @@ SkPath GM2TabStyle::GetPath(PathType path_type,
// ┌─╯ ╰─┐
path.lineTo(tab_right - top_radius, tab_top);
path.arcTo(top_radius, top_radius, 0, SkPath::kSmall_ArcSize,
SkPath::kCW_Direction, tab_right, tab_top + top_radius);
SkPathDirection::kCW, tab_right, tab_top + top_radius);
}

if (tab_right != right) {
Expand All @@ -372,7 +371,7 @@ SkPath GM2TabStyle::GetPath(PathType path_type,
} else {
path.lineTo(tab_right, tab_bottom - bottom_radius);
path.arcTo(bottom_radius, bottom_radius, 0, SkPath::kSmall_ArcSize,
SkPath::kCCW_Direction, tab_right + bottom_radius,
SkPathDirection::kCCW, tab_right + bottom_radius,
tab_bottom);
}
if (tab_bottom != extended_bottom)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ void MediaNotificationBackground::Paint(gfx::Canvas* canvas,
bottom_radius, bottom_radius};

SkPath path;
path.addRoundRect(gfx::RectToSkRect(bounds), radii, SkPath::kCW_Direction);
path.addRoundRect(gfx::RectToSkRect(bounds), radii, SkPathDirection::kCW);
canvas->ClipPath(path, true);
}

Expand Down
4 changes: 0 additions & 4 deletions skia/config/SkUserConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,6 @@ SK_API void SkDebugf_FileLine(const char* file,
#define SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS
#endif

#ifndef SK_SUPPORT_LEGACY_PATH_DIRECTION_ENUM
#define SK_SUPPORT_LEGACY_PATH_DIRECTION_ENUM
#endif

// Max. verb count for paths rendered by the edge-AA tessellating path renderer.
#define GR_AA_TESSELLATOR_MAX_VERB_COUNT 100

Expand Down
8 changes: 5 additions & 3 deletions skia/ext/benchmarking_canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,11 @@ std::unique_ptr<base::Value> AsValue(const SkPath& path) {
val->SetString("fill-type", gFillStrings[path.getFillType()]);

static const char* gConvexityStrings[] = { "Unknown", "Convex", "Concave" };
DCHECK_LT(static_cast<size_t>(path.getConvexity()),
SK_ARRAY_COUNT(gConvexityStrings));
val->SetString("convexity", gConvexityStrings[path.getConvexity()]);
DCHECK_LT(static_cast<size_t>(path.getConvexityType()),
SK_ARRAY_COUNT(gConvexityStrings));
val->SetString(
"convexity",
gConvexityStrings[static_cast<size_t>(path.getConvexityType())]);

val->SetBoolean("is-rect", path.isRect(nullptr));
val->Set("bounds", AsValue(path.getBounds()));
Expand Down
10 changes: 5 additions & 5 deletions third_party/blink/renderer/platform/graphics/logging_canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,13 @@ String FillTypeName(SkPath::FillType type) {
};
}

String ConvexityName(SkPath::Convexity convexity) {
String ConvexityName(SkPathConvexityType convexity) {
switch (convexity) {
case SkPath::kUnknown_Convexity:
case SkPathConvexityType::kUnknown:
return "Unknown";
case SkPath::kConvex_Convexity:
case SkPathConvexityType::kConvex:
return "Convex";
case SkPath::kConcave_Convexity:
case SkPathConvexityType::kConcave:
return "Concave";
default:
NOTREACHED();
Expand Down Expand Up @@ -224,7 +224,7 @@ VerbParams SegmentParams(SkPath::Verb verb) {
std::unique_ptr<JSONObject> ObjectForSkPath(const SkPath& path) {
auto path_item = std::make_unique<JSONObject>();
path_item->SetString("fillType", FillTypeName(path.getFillType()));
path_item->SetString("convexity", ConvexityName(path.getConvexity()));
path_item->SetString("convexity", ConvexityName(path.getConvexityType()));
path_item->SetBoolean("isRect", path.isRect(nullptr));
SkPath::Iter iter(path, false);
SkPoint points[4];
Expand Down
8 changes: 4 additions & 4 deletions third_party/blink/renderer/platform/graphics/path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void Path::AddArcTo(const FloatPoint& p,
WebCoreFloatToSkScalar(r.Height()),
WebCoreFloatToSkScalar(x_rotate),
large_arc ? SkPath::kLarge_ArcSize : SkPath::kSmall_ArcSize,
sweep ? SkPath::kCW_Direction : SkPath::kCCW_Direction,
sweep ? SkPathDirection::kCW : SkPathDirection::kCCW,
WebCoreFloatToSkScalar(p.X()), WebCoreFloatToSkScalar(p.Y()));
}

Expand Down Expand Up @@ -399,7 +399,7 @@ void Path::AddArc(const FloatPoint& p,

void Path::AddRect(const FloatRect& rect) {
// Start at upper-left, add clock-wise.
path_.addRect(rect, SkPath::kCW_Direction, 0);
path_.addRect(rect, SkPathDirection::kCW, 0);
}

void Path::AddEllipse(const FloatPoint& p,
Expand Down Expand Up @@ -430,7 +430,7 @@ void Path::AddEllipse(const FloatPoint& p,

void Path::AddEllipse(const FloatRect& rect) {
// Start at 3 o'clock, add clock-wise.
path_.addOval(rect, SkPath::kCW_Direction, 1);
path_.addOval(rect, SkPathDirection::kCW, 1);
}

void Path::AddRoundedRect(const FloatRoundedRect& r) {
Expand Down Expand Up @@ -502,7 +502,7 @@ void Path::AddPathForRoundedRect(const FloatRect& rect,
// Start at upper-left (after corner radii), add clock-wise.
path_.addRRect(FloatRoundedRect(rect, top_left_radius, top_right_radius,
bottom_left_radius, bottom_right_radius),
SkPath::kCW_Direction, 0);
SkPathDirection::kCW, 0);
}

void Path::AddPath(const Path& src, const AffineTransform& transform) {
Expand Down
4 changes: 2 additions & 2 deletions ui/gfx/paint_vector_icon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ void PaintPath(Canvas* canvas,
SkScalar y = arg(6);
SkPath::ArcSize arc_size =
large_arc_flag ? SkPath::kLarge_ArcSize : SkPath::kSmall_ArcSize;
SkPath::Direction direction =
arc_sweep_flag ? SkPath::kCW_Direction : SkPath::kCCW_Direction;
SkPathDirection direction =
arc_sweep_flag ? SkPathDirection::kCW : SkPathDirection::kCCW;

if (command_type == ARC_TO)
path.arcTo(rx, ry, angle, arc_size, direction, x, y);
Expand Down

0 comments on commit 187b7c5

Please sign in to comment.