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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Path.cpp

Issue 1532923002: Add a Path::contains() version that use the Path's winding rule (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forward declare Path in GC.h Created 5 years 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 * Copyright (C) 2013 Intel Corporation. All rights reserved. 6 * Copyright (C) 2013 Intel Corporation. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 { 65 {
66 m_path = other; 66 m_path = other;
67 return *this; 67 return *this;
68 } 68 }
69 69
70 bool Path::operator==(const Path& other) const 70 bool Path::operator==(const Path& other) const
71 { 71 {
72 return m_path == other.m_path; 72 return m_path == other.m_path;
73 } 73 }
74 74
75 bool Path::contains(const FloatPoint& point) const
76 {
77 return SkPathContainsPoint(m_path, point, m_path.getFillType());
78 }
79
75 bool Path::contains(const FloatPoint& point, WindRule rule) const 80 bool Path::contains(const FloatPoint& point, WindRule rule) const
76 { 81 {
77 return SkPathContainsPoint(m_path, point, static_cast<SkPath::FillType>(rule )); 82 return SkPathContainsPoint(m_path, point, WebCoreWindRuleToSkFillType(rule)) ;
78 } 83 }
79 84
80 // FIXME: this method ignores the CTM and may yield inaccurate results for large scales. 85 // FIXME: this method ignores the CTM and may yield inaccurate results for large scales.
81 SkPath Path::strokePath(const StrokeData& strokeData) const 86 SkPath Path::strokePath(const StrokeData& strokeData) const
82 { 87 {
83 SkPaint paint; 88 SkPaint paint;
84 strokeData.setupPaint(&paint); 89 strokeData.setupPaint(&paint);
85 90
86 // Skia stroke resolution scale. This is multiplied by 4 internally 91 // Skia stroke resolution scale. This is multiplied by 4 internally
87 // (i.e. 1.0 corresponds to 1/4 pixel res). 92 // (i.e. 1.0 corresponds to 1/4 pixel res).
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 488
484 #if ENABLE(ASSERT) 489 #if ENABLE(ASSERT)
485 bool ellipseIsRenderable(float startAngle, float endAngle) 490 bool ellipseIsRenderable(float startAngle, float endAngle)
486 { 491 {
487 return (std::abs(endAngle - startAngle) < twoPiFloat) 492 return (std::abs(endAngle - startAngle) < twoPiFloat)
488 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat); 493 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat);
489 } 494 }
490 #endif 495 #endif
491 496
492 } // namespace blink 497 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Path.h ('k') | third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698