Commit 189060aa authored by Mike Reed's avatar Mike Reed Committed by Commit Bot

switch over to new enum SkPathFillType

TBR=

Change-Id: I4607f91a8efb87202d68311894f67bc69a8f8e8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948487
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: default avatarFlorin Malita <fmalita@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721177}
parent 30c4d443
......@@ -29,7 +29,7 @@ constexpr int kSignalStrengthImageBgAlpha = 0x4D;
SkPath CreateArcPath(gfx::RectF oval, float start_angle, float sweep_angle) {
SkPath path;
path.setIsVolatile(true);
path.setFillType(SkPath::kWinding_FillType);
path.setFillType(SkPathFillType::kWinding);
path.moveTo(oval.CenterPoint().x(), oval.CenterPoint().y());
path.arcTo(gfx::RectFToSkRect(oval), start_angle, sweep_angle, false);
path.close();
......
......@@ -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_FILLTYPE_ENUM
#define SK_SUPPORT_LEGACY_PATH_FILLTYPE_ENUM
#endif
// Max. verb count for paths rendered by the edge-AA tessellating path renderer.
#define GR_AA_TESSELLATOR_MAX_VERB_COUNT 100
......
......@@ -267,9 +267,9 @@ std::unique_ptr<base::Value> AsValue(const SkPath& path) {
static const char* gFillStrings[] =
{ "winding", "even-odd", "inverse-winding", "inverse-even-odd" };
DCHECK_LT(static_cast<size_t>(path.getFillType()),
SK_ARRAY_COUNT(gFillStrings));
val->SetString("fill-type", gFillStrings[path.getFillType()]);
size_t index = static_cast<size_t>(path.getFillType());
DCHECK_LT(index, SK_ARRAY_COUNT(gFillStrings));
val->SetString("fill-type", gFillStrings[index]);
static const char* gConvexityStrings[] = { "Unknown", "Convex", "Concave" };
DCHECK_LT(static_cast<size_t>(path.getConvexityType()),
......
......@@ -330,7 +330,7 @@ void DrawBleedAdjustedDRRect(GraphicsContext& context,
// int rect for the clip, in device space).
SkPath path;
path.addRRect(inner);
path.setFillType(SkPath::kInverseWinding_FillType);
path.setFillType(SkPathFillType::kInverseWinding);
PaintFlags flags;
flags.setColor(color.Rgb());
......
......@@ -34,8 +34,8 @@ static bool SetupNonScalingStrokeContext(
return true;
}
static SkPath::FillType FillRuleFromStyle(const PaintInfo& paint_info,
const SVGComputedStyle& svg_style) {
static SkPathFillType FillRuleFromStyle(const PaintInfo& paint_info,
const SVGComputedStyle& svg_style) {
return WebCoreWindRuleToSkFillType(paint_info.IsRenderingClipPathAsMaskImage()
? svg_style.ClipRule()
: svg_style.FillRule());
......@@ -145,7 +145,7 @@ void SVGShapePainter::Paint(const PaintInfo& paint_info) {
class PathWithTemporaryWindingRule {
public:
PathWithTemporaryWindingRule(Path& path, SkPath::FillType fill_type)
PathWithTemporaryWindingRule(Path& path, SkPathFillType fill_type)
: path_(const_cast<SkPath&>(path.GetSkPath())) {
saved_fill_type_ = path_.getFillType();
path_.setFillType(fill_type);
......@@ -156,12 +156,12 @@ class PathWithTemporaryWindingRule {
private:
SkPath& path_;
SkPath::FillType saved_fill_type_;
SkPathFillType saved_fill_type_;
};
void SVGShapePainter::FillShape(GraphicsContext& context,
const PaintFlags& flags,
SkPath::FillType fill_type) {
SkPathFillType fill_type) {
switch (layout_svg_shape_.GeometryCodePath()) {
case kRectGeometryFastPath:
context.DrawRect(layout_svg_shape_.ObjectBoundingBox(), flags,
......
......@@ -28,7 +28,7 @@ class SVGShapePainter {
void Paint(const PaintInfo&);
private:
void FillShape(GraphicsContext&, const PaintFlags&, SkPath::FillType);
void FillShape(GraphicsContext&, const PaintFlags&, SkPathFillType);
void StrokeShape(GraphicsContext&, const PaintFlags&);
void PaintMarkers(const PaintInfo&, const FloatRect& bounding_box);
......
......@@ -609,7 +609,7 @@ bool BaseRenderingContext2D::IsFullCanvasCompositeMode(SkBlendMode op) {
void BaseRenderingContext2D::DrawPathInternal(
const Path& path,
CanvasRenderingContext2DState::PaintType paint_type,
SkPath::FillType fill_type) {
SkPathFillType fill_type) {
if (path.IsEmpty())
return;
......@@ -633,14 +633,14 @@ void BaseRenderingContext2D::DrawPathInternal(
bounds, paint_type);
}
static SkPath::FillType ParseWinding(const String& winding_rule_string) {
static SkPathFillType ParseWinding(const String& winding_rule_string) {
if (winding_rule_string == "nonzero")
return SkPath::kWinding_FillType;
return SkPathFillType::kWinding;
if (winding_rule_string == "evenodd")
return SkPath::kEvenOdd_FillType;
return SkPathFillType::kEvenOdd;
NOTREACHED();
return SkPath::kEvenOdd_FillType;
return SkPathFillType::kEvenOdd;
}
void BaseRenderingContext2D::fill(const String& winding_rule_string) {
......
......@@ -386,7 +386,7 @@ class MODULES_EXPORT BaseRenderingContext2D : public GarbageCollectedMixin,
void DrawPathInternal(const Path&,
CanvasRenderingContext2DState::PaintType,
SkPath::FillType = SkPath::kWinding_FillType);
SkPathFillType = SkPathFillType::kWinding);
void DrawImageInternal(cc::PaintCanvas*,
CanvasImageSource*,
Image*,
......
......@@ -197,8 +197,8 @@ enum ColorFilter {
};
enum WindRule {
RULE_NONZERO = SkPath::kWinding_FillType,
RULE_EVENODD = SkPath::kEvenOdd_FillType
RULE_NONZERO = static_cast<int>(SkPathFillType::kWinding),
RULE_EVENODD = static_cast<int>(SkPathFillType::kEvenOdd)
};
PLATFORM_EXPORT String CompositeOperatorName(CompositeOperator, BlendMode);
......
......@@ -169,15 +169,15 @@ std::unique_ptr<JSONObject> ObjectForSkRRect(const SkRRect& rrect) {
return rrect_item;
}
String FillTypeName(SkPath::FillType type) {
String FillTypeName(SkPathFillType type) {
switch (type) {
case SkPath::kWinding_FillType:
case SkPathFillType::kWinding:
return "Winding";
case SkPath::kEvenOdd_FillType:
case SkPathFillType::kEvenOdd:
return "EvenOdd";
case SkPath::kInverseWinding_FillType:
case SkPathFillType::kInverseWinding:
return "InverseWinding";
case SkPath::kInverseEvenOdd_FillType:
case SkPathFillType::kInverseEvenOdd:
return "InverseEvenOdd";
default:
NOTREACHED();
......
......@@ -73,7 +73,7 @@ bool Path::Contains(const FloatPoint& point, WindRule rule) const {
return false;
SkScalar x = point.X();
SkScalar y = point.Y();
SkPath::FillType fill_type = WebCoreWindRuleToSkFillType(rule);
SkPathFillType fill_type = WebCoreWindRuleToSkFillType(rule);
if (path_.getFillType() != fill_type) {
SkPath tmp(path_);
tmp.setFillType(fill_type);
......
......@@ -95,14 +95,14 @@ inline bool WebCoreFloatNearlyEqual(float a, float b) {
WebCoreFloatToSkScalar(b));
}
inline SkPath::FillType WebCoreWindRuleToSkFillType(WindRule rule) {
return static_cast<SkPath::FillType>(rule);
inline SkPathFillType WebCoreWindRuleToSkFillType(WindRule rule) {
return static_cast<SkPathFillType>(rule);
}
inline WindRule SkFillTypeToWindRule(SkPath::FillType fill_type) {
inline WindRule SkFillTypeToWindRule(SkPathFillType fill_type) {
switch (fill_type) {
case SkPath::kWinding_FillType:
case SkPath::kEvenOdd_FillType:
case SkPathFillType::kWinding:
case SkPathFillType::kEvenOdd:
return static_cast<WindRule>(fill_type);
default:
NOTREACHED();
......
......@@ -234,7 +234,7 @@ void PaintPath(Canvas* canvas,
const CommandType command_type = parser.CurrentCommand();
auto start_new_path = [&paths]() {
paths.push_back(SkPath());
paths.back().setFillType(SkPath::kEvenOdd_FillType);
paths.back().setFillType(SkPathFillType::kEvenOdd);
};
auto start_new_flags = [&flags_array, &color]() {
flags_array.push_back(cc::PaintFlags());
......
......@@ -108,14 +108,14 @@ NSBezierPath* CreateNSBezierPathFromSkPath(const SkPath& path) {
// Set up the fill type.
switch (path.getFillType()) {
case SkPath::kWinding_FillType:
case SkPathFillType::kWinding:
[result setWindingRule:NSNonZeroWindingRule];
break;
case SkPath::kEvenOdd_FillType:
case SkPathFillType::kEvenOdd:
[result setWindingRule:NSEvenOddWindingRule];
break;
case SkPath::kInverseWinding_FillType:
case SkPath::kInverseEvenOdd_FillType:
case SkPathFillType::kInverseWinding:
case SkPathFillType::kInverseEvenOdd:
NOTREACHED() << "NSBezierCurve does not support inverse fill types.";
break;
}
......
......@@ -97,11 +97,11 @@ TEST(CreateNSBezierPathFromSkPathTest, EmptyPath) {
// Check that the returned NSBezierPath has the correct winding rule.
TEST(CreateNSBezierPathFromSkPathTest, FillType) {
SkPath path;
path.setFillType(SkPath::kWinding_FillType);
path.setFillType(SkPathFillType::kWinding);
NSBezierPath* result = CreateNSBezierPathFromSkPath(path);
EXPECT_EQ(NSNonZeroWindingRule, [result windingRule]);
path.setFillType(SkPath::kEvenOdd_FillType);
path.setFillType(SkPathFillType::kEvenOdd);
result = CreateNSBezierPathFromSkPath(path);
EXPECT_EQ(NSEvenOddWindingRule, [result windingRule]);
}
......
......@@ -98,7 +98,7 @@ class MenuScrollButton : public View {
y_bottom = y + config.scroll_arrow_height;
}
SkPath path;
path.setFillType(SkPath::kWinding_FillType);
path.setFillType(SkPathFillType::kWinding);
path.moveTo(SkIntToScalar(x), SkIntToScalar(y));
path.lineTo(SkIntToScalar(x_left), SkIntToScalar(y_bottom));
path.lineTo(SkIntToScalar(x_right), SkIntToScalar(y_bottom));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment