Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: Source/core/platform/graphics/Path.cpp

Issue 19846006: Use const path in SkPathContainsPoint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
3 * 2006 Rob Buis <buis@kde.org> 3 * 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2013 Google Inc. All rights reserved. 5 * Copyright (C) 2013 Google Inc. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return *this; 62 return *this;
63 } 63 }
64 64
65 bool Path::operator==(const Path& other) const 65 bool Path::operator==(const Path& other) const
66 { 66 {
67 return m_path == other.m_path; 67 return m_path == other.m_path;
68 } 68 }
69 69
70 bool Path::contains(const FloatPoint& point, WindRule rule) const 70 bool Path::contains(const FloatPoint& point, WindRule rule) const
71 { 71 {
72 // After crbug.com/236559 is fixed, SkPathContainsPoint should take a const path so this will be unnecessary. 72 return SkPathContainsPoint(m_path, point, rule == RULE_NONZERO ? SkPath::kWi nding_FillType : SkPath::kEvenOdd_FillType);
73 SkPath* path = const_cast<SkPath*>(&m_path);
74 return SkPathContainsPoint(path, point, rule == RULE_NONZERO ? SkPath::kWind ing_FillType : SkPath::kEvenOdd_FillType);
75 } 73 }
76 74
77 bool Path::strokeContains(const FloatPoint& point, const StrokeData& strokeData) const 75 bool Path::strokeContains(const FloatPoint& point, const StrokeData& strokeData) const
78 { 76 {
79 SkPaint paint; 77 SkPaint paint;
80 strokeData.setupPaint(&paint); 78 strokeData.setupPaint(&paint);
81 SkPath strokePath; 79 SkPath strokePath;
82 paint.getFillPath(m_path, &strokePath); 80 paint.getFillPath(m_path, &strokePath);
83 81
84 return SkPathContainsPoint(&strokePath, point, SkPath::kWinding_FillType); 82 return SkPathContainsPoint(strokePath, point, SkPath::kWinding_FillType);
85 } 83 }
86 84
87 FloatRect Path::boundingRect() const 85 FloatRect Path::boundingRect() const
88 { 86 {
89 return m_path.getBounds(); 87 return m_path.getBounds();
90 } 88 }
91 89
92 FloatRect Path::strokeBoundingRect(const StrokeData& strokeData) const 90 FloatRect Path::strokeBoundingRect(const StrokeData& strokeData) const
93 { 91 {
94 SkPaint paint; 92 SkPaint paint;
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 { 414 {
417 m_path.offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(s ize.height())); 415 m_path.offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(s ize.height()));
418 } 416 }
419 417
420 bool Path::unionPath(const Path& other) 418 bool Path::unionPath(const Path& other)
421 { 419 {
422 return Op(m_path, other.m_path, kUnion_PathOp, &m_path); 420 return Op(m_path, other.m_path, kUnion_PathOp, &m_path);
423 } 421 }
424 422
425 } 423 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/platform/graphics/skia/SkiaUtils.h » ('j') | Source/core/platform/graphics/skia/SkiaUtils.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698