Skip to content

Commit

Permalink
switch over to new enum SkPathFillType
Browse files Browse the repository at this point in the history
TBR=

Change-Id: I4607f91a8efb87202d68311894f67bc69a8f8e8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948487
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: James Cook <jamescook@chromium.org>
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721177}
  • Loading branch information
reed-at-google authored and Commit Bot committed Dec 3, 2019
1 parent 30c4d44 commit 189060a
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 42 deletions.
2 changes: 1 addition & 1 deletion ash/public/cpp/network_icon_image_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
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_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

Expand Down
6 changes: 3 additions & 3 deletions skia/ext/benchmarking_canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
10 changes: 5 additions & 5 deletions third_party/blink/renderer/core/paint/svg_shape_painter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion third_party/blink/renderer/core/paint/svg_shape_painter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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*,
Expand Down
4 changes: 2 additions & 2 deletions third_party/blink/renderer/platform/graphics/graphics_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
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 @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion third_party/blink/renderer/platform/graphics/path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions third_party/blink/renderer/platform/graphics/skia/skia_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion ui/gfx/paint_vector_icon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
8 changes: 4 additions & 4 deletions ui/gfx/path_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ void ConvertQuadToCubicBezier(NSPoint quad[3], NSPoint cubic[4]) {

// 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;
}
Expand Down
4 changes: 2 additions & 2 deletions ui/gfx/path_mac_unittest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ Rect GetBoundingBox(NSBezierPath* path) {
// 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]);
}
Expand Down
2 changes: 1 addition & 1 deletion ui/views/controls/menu/menu_scroll_view_container.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 189060a

Please sign in to comment.