aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPath.cpp
Commit message (Collapse)AuthorAge
* Fix the problem of rendering closePath not properly after a moveTo call inGravatar schenney@chromium.org2012-06-13
| | | | | | | | | | | | | | | | | | | | canvas 2D interface. If there is a polyline, followed by a moveTo and a closePath, both the moveTo and the closePath should be ignored for the purposes of drawing, and the polyline should not be closed (unless force closed is true (for filling, for instance). Tested for path with both valid and degenerate content, when asked to consume degenerates and not, force closed and not. This patch also includes a uni test refactoring to reduce the amount of code to test path iteration and zero length paths. BUG=6297049 TEST=tests/PathTest.cpp, testIter method. Review URL: https://codereview.appspot.com/6300086 git-svn-id: http://skia.googlecode.com/svn/trunk@4247 2bbb7eff-a529-9590-31e7-b0007b416f81
* remove SK_CAN_USE_FLOAT (deprecated)Gravatar reed@google.com2012-06-11
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@4232 2bbb7eff-a529-9590-31e7-b0007b416f81
* Rename the existing flatten(void*) methods.Gravatar djsollen@google.com2012-06-08
| | | | | | | | This change avoids naminc confusion with the SkFlattenable flatten methods and also changes SkPath to use the void* model instead of taking a SkReader32. Review URL: https://codereview.appspot.com/6299062 git-svn-id: http://skia.googlecode.com/svn/trunk@4215 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add SkPath::getVerbs/countVerbsGravatar bsalomon@google.com2012-06-07
| | | | | | | Review URL: http://codereview.appspot.com/6306053/ git-svn-id: http://skia.googlecode.com/svn/trunk@4209 2bbb7eff-a529-9590-31e7-b0007b416f81
* Make SkPath::RawIter require a non-NULL pts pointer.Gravatar bsalomon@google.com2012-06-07
| | | | | | | | Review URL: http://codereview.appspot.com/6301060/ git-svn-id: http://skia.googlecode.com/svn/trunk@4206 2bbb7eff-a529-9590-31e7-b0007b416f81
* fix warnings on Mac in src/coreGravatar caryclark@google.com2012-06-06
| | | | | | | | | | | | | | | | | | Fix these class of warnings: - unused functions - unused locals - sign mismatch - missing function prototypes - missing newline at end of file - 64 to 32 bit truncation The changes prefer to link in dead code in the debug build with 'if (false)' than to comment it out, but trivial cases are commented out or sometimes deleted if it appears to be a copy/paste error. Review URL: https://codereview.appspot.com/6301046 git-svn-id: http://skia.googlecode.com/svn/trunk@4182 2bbb7eff-a529-9590-31e7-b0007b416f81
* addPoly() entry-point, to quickly add MoveTo+N*LineTo (useful in dashing)Gravatar reed@google.com2012-05-29
| | | | | | Review URL: https://codereview.appspot.com/6256063 git-svn-id: http://skia.googlecode.com/svn/trunk@4061 2bbb7eff-a529-9590-31e7-b0007b416f81
* Iter::next takes a bool (defaults to true for now) if we want to consume ↵Gravatar reed@google.com2012-05-16
| | | | | | | | | | degenerates. path-filling and stroking pass false, as they already are written to handle small segments (and it makes next() run 2x faster if you pass false). Review URL: https://codereview.appspot.com/6214049 git-svn-id: http://skia.googlecode.com/svn/trunk@3974 2bbb7eff-a529-9590-31e7-b0007b416f81
* remove null-check in SKPath::Iter::next() -- not needed, and slows us down a ↵Gravatar reed@google.com2012-05-15
| | | | | | little git-svn-id: http://skia.googlecode.com/svn/trunk@3944 2bbb7eff-a529-9590-31e7-b0007b416f81
* add SkPath::isLine(), similar to isRect()Gravatar reed@google.com2012-05-10
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@3892 2bbb7eff-a529-9590-31e7-b0007b416f81
* Track oval in SkPathGravatar bsalomon@google.com2012-04-18
| | | | | | | | | | Committed on behalf of Guanqun.Lu@gmail.com Review URL:http://codereview.appspot.com/6012047/ git-svn-id: http://skia.googlecode.com/svn/trunk@3716 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert r3705 for fixed pt failures. Gravatar bsalomon@google.com2012-04-17
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@3706 2bbb7eff-a529-9590-31e7-b0007b416f81
* track oval in SkPathGravatar bsalomon@google.com2012-04-17
| | | | | | | | | | Committed on behalf of Guanqun.Lu@gmail.com Review URL: http://codereview.appspot.com/6012047/ git-svn-id: http://skia.googlecode.com/svn/trunk@3705 2bbb7eff-a529-9590-31e7-b0007b416f81
* Upstream changes from Android repository.Gravatar djsollen@google.com2012-03-21
| | | | | | Review URL: https://codereview.appspot.com/5752055 git-svn-id: http://skia.googlecode.com/svn/trunk@3449 2bbb7eff-a529-9590-31e7-b0007b416f81
* Make cross_prod used in SkPath::cheapComputeDirection fallback to double ↵Gravatar bsalomon@google.com2012-02-17
| | | | | | computation when result is 0. Verbal LGTM from reed. git-svn-id: http://skia.googlecode.com/svn/trunk@3216 2bbb7eff-a529-9590-31e7-b0007b416f81
* Don't change convexity status of a path after a moveToGravatar bsalomon@google.com2012-02-02
| | | | | | | Review URL: http://codereview.appspot.com/5581048/ git-svn-id: http://skia.googlecode.com/svn/trunk@3127 2bbb7eff-a529-9590-31e7-b0007b416f81
* When adding a convex shape to a path, mark path as convex if path is ↵Gravatar bsalomon@google.com2012-01-31
| | | | | | | | | | initially degenerate. Review URL: http://codereview.appspot.com/5504073/ git-svn-id: http://skia.googlecode.com/svn/trunk@3124 2bbb7eff-a529-9590-31e7-b0007b416f81
* fall through to cross-product if the y-max-baseline returns a degenerate lineGravatar reed@google.com2012-01-31
| | | | | | | | (i.e. maxIndex == minIndex) git-svn-id: http://skia.googlecode.com/svn/trunk@3119 2bbb7eff-a529-9590-31e7-b0007b416f81
* handle multiple points all at the y-max when computing directionGravatar reed@google.com2012-01-31
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@3116 2bbb7eff-a529-9590-31e7-b0007b416f81
* use contour with global ymax to determine directionGravatar reed@google.com2012-01-30
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@3110 2bbb7eff-a529-9590-31e7-b0007b416f81
* Cleanup of SkPath code to remove SK_OLD_EMPTY_PATH_BEHAVIOR and otherGravatar schenney@chromium.org2012-01-19
| | | | | | | | | | | | | | dead code. The patch also renames kAfterClose_SegmentState for the SkPath::Iter class, to kEmptyContour_SegmentState which more accurately reflects the meaning of the state. The Iter can be in that state initially, before anything has been seen, let alone a close. BUG=445 TEST=Covered by existing tests. Review URL: https://codereview.appspot.com/5532091 git-svn-id: http://skia.googlecode.com/svn/trunk@3074 2bbb7eff-a529-9590-31e7-b0007b416f81
* if the y-max has neighbors (prev and next) with the same Y values, then theGravatar reed@google.com2012-01-17
| | | | | | | | | | | cross will be 0, but we can still know the direction by looking at the change in X Fixes the hypen in #7 of this bug http://code.google.com/p/chromium/issues/detail?id=109370 git-svn-id: http://skia.googlecode.com/svn/trunk@3049 2bbb7eff-a529-9590-31e7-b0007b416f81
* automatically inject a moveTo if we see a close followed by a line/quad/cubicGravatar reed@google.com2012-01-12
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@3027 2bbb7eff-a529-9590-31e7-b0007b416f81
* reenable direction test, fix handling of degenerate segments in the ↵Gravatar reed@google.com2012-01-11
| | | | | | non-convex case git-svn-id: http://skia.googlecode.com/svn/trunk@3021 2bbb7eff-a529-9590-31e7-b0007b416f81
* fix cheapComputeDirection() in the non-convex case to pivot on the y-max pointGravatar reed@google.com2012-01-11
| | | | | | | | | rather than pivoting on the next. Also remove the loop, as it is just logically wrong to think we can use this trick only a non-extrema pt. git-svn-id: http://skia.googlecode.com/svn/trunk@3014 2bbb7eff-a529-9590-31e7-b0007b416f81
* restore (debugged) cheapComputeDirectionGravatar reed@google.com2012-01-10
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@3000 2bbb7eff-a529-9590-31e7-b0007b416f81
* add SkPath::cheapComputeDirection() plus unittestsGravatar reed@google.com2012-01-10
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@2996 2bbb7eff-a529-9590-31e7-b0007b416f81
* add SkPath::reverseAddPath()Gravatar reed@google.com2012-01-10
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@2995 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add the ability to iterate through a path without modification. This change isGravatar schenney@chromium.org2012-01-04
| | | | | | | | | | required by WebKit SVG in order to correctly draw markers and endcaps. BUG=415 TEST=TestPath in the unit tests Review URL: http://codereview.appspot.com/5505097 git-svn-id: http://skia.googlecode.com/svn/trunk@2962 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix problems with SampleApp Fuzzer due to issues in iterating over ↵Gravatar schenney@chromium.org2011-12-29
| | | | | | | | | | | | | | degenerate paths. The fuzzer gets my vote as best test tool ever. There are several issues outstanding: crashes in FixedPoint and a crash in the path filling code that is most likely due to clipping problems (but maybe not). BUG=425 Review URL: http://codereview.appspot.com/5503080 git-svn-id: http://skia.googlecode.com/svn/trunk@2936 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add SkDEBUGFAIL to clean up use of SkASSERT(!"text");Gravatar tomhudson@google.com2011-12-28
| | | | | | | | | | catch a couple of latent SkASSERT("text") bugs. http://codereview.appspot.com/5504090/ git-svn-id: http://skia.googlecode.com/svn/trunk@2926 2bbb7eff-a529-9590-31e7-b0007b416f81
* Protecting changes to the SkPath iteration with an ifdef for Chromium.Gravatar schenney@chromium.org2011-12-21
| | | | | | | | Something is broken, and this will protect us while we sort it out. Unreviewed. git-svn-id: http://skia.googlecode.com/svn/trunk@2922 2bbb7eff-a529-9590-31e7-b0007b416f81
* Unreviewed. Adding a define to enable the old bahevior for SkPath::isEmpty.Gravatar schenney@chromium.org2011-12-21
| | | | | | Should be undone at some point, when WebKit no longer needs it. git-svn-id: http://skia.googlecode.com/svn/trunk@2918 2bbb7eff-a529-9590-31e7-b0007b416f81
* Modifying SkPath to store all verbs provided by the user, and to giveGravatar schenney@chromium.org2011-12-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | correct results for all stroke and fill modes even on the various types of degenerate paths. The goals of this patch include: 1. Have Skia store all of the verbs implied by path construction methods, even if those define degenerate paths. The SVG implementation in WebKit, which is backed by Skia, needs to know about all elements of the path, even degenerate ones, for the correct drawing of markers and line caps. For example, in SVG you should be able to draw a scatter plot by specifying a marker for vertices and then giving a sequence of moveTo commands. Skia will not store the moveTos, requiring a different storage mechanism. 2. Assuming 1, maintain the current Skia behavior. That is, make Skia robust to degenerate paths. 3. Fix an existing bug in Skia where a degenerate moveTo-lineTo pair spits out warnings from rasterization and produces incorrect results in inverse-fill renderings. 4. Adds extensive testing for degenerate paths and path rendering in general. To meet these goals, the patch I am proposing will result in minor additional storage for degenerate paths (a few bytes per degenerate path, only if the user defines such paths). There is also some additional overhead in the iteration code, with the path now cleaned to remove degenerate segments as part of the iteration process. I suspect this will also fix issues with computing normal vectors to degenerate segments. Benchmarking suggests that this change may result in slightly (< 1%) slower path drawing due to the checks for degeneracy. This overhead could be removed (in fact, a significant speedup could occur) if the results of iterating to clean up the path were cached. This would cost memory, of course, and quite a bit of it. BUG=398 TEST=tests/PathTest.cpp gm/cubicpaths.cpp gm/degeneratesegments.cpp gm/movepaths.cpp gm/linepaths.cpp gm/quadpaths.cpp Review URL: http://codereview.appspot.com/5482051 git-svn-id: http://skia.googlecode.com/svn/trunk@2901 2bbb7eff-a529-9590-31e7-b0007b416f81
* fix autobounds dude to call a custom version of rect.join that doesn't ignoreGravatar reed@google.com2011-11-14
| | | | | | | | | empty rects (since path.bounds must be the bounds of its control-pts, including empty subcontours) git-svn-id: http://skia.googlecode.com/svn/trunk@2679 2bbb7eff-a529-9590-31e7-b0007b416f81
* improve validate to check for empty rects, since contains always returns falseGravatar reed@google.com2011-11-14
| | | | | | | | if either rect is empty. git-svn-id: http://skia.googlecode.com/svn/trunk@2676 2bbb7eff-a529-9590-31e7-b0007b416f81
* Update files to use SK_BUILD_FOR_ANDROID.Gravatar djsollen@google.com2011-11-08
| | | | | | | | This CL also removes any unecessary references to the ANDROID definition. Review URL: http://codereview.appspot.com/5354049 git-svn-id: http://skia.googlecode.com/svn/trunk@2629 2bbb7eff-a529-9590-31e7-b0007b416f81
* remember our convexity when we're transformed (when not perspective)Gravatar reed@google.com2011-10-25
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@2526 2bbb7eff-a529-9590-31e7-b0007b416f81
* change getLastPt to return a boolGravatar reed@google.com2011-10-11
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@2453 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix some warningsGravatar bsalomon@google.com2011-09-21
| | | | | | | | Review URL: http://codereview.appspot.com/5075049/ git-svn-id: http://skia.googlecode.com/svn/trunk@2304 2bbb7eff-a529-9590-31e7-b0007b416f81
* flatten/unflatten fSegmentMaskGravatar reed@google.com2011-09-21
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@2300 2bbb7eff-a529-9590-31e7-b0007b416f81
* update fSegmentMask inside ::transform() (thank you validate!)Gravatar reed@google.com2011-09-21
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@2293 2bbb7eff-a529-9590-31e7-b0007b416f81
* add segment types query to SkPath (i.e. does it have any quads)Gravatar reed@google.com2011-09-21
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@2292 2bbb7eff-a529-9590-31e7-b0007b416f81
* Core skia changes to prepare for Gr AA Hairline rendererGravatar bsalomon@google.com2011-08-23
| | | | | | | | Review URL: http://codereview.appspot.com/4940045/ git-svn-id: http://skia.googlecode.com/svn/trunk@2160 2bbb7eff-a529-9590-31e7-b0007b416f81
* More variable initializations and curly braces to avoid Linux compilerGravatar tomhudson@google.com2011-07-29
| | | | | | | | warnings. git-svn-id: http://skia.googlecode.com/svn/trunk@1993 2bbb7eff-a529-9590-31e7-b0007b416f81
* Automatic update of all copyright notices to reflect new license terms.Gravatar epoger@google.com2011-07-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have manually examined all of these diffs and restored a few files that seem to require manual adjustment. The following files still need to be modified manually, in a separate CL: android_sample/SampleApp/AndroidManifest.xml android_sample/SampleApp/res/layout/layout.xml android_sample/SampleApp/res/menu/sample.xml android_sample/SampleApp/res/values/strings.xml android_sample/SampleApp/src/com/skia/sampleapp/SampleApp.java android_sample/SampleApp/src/com/skia/sampleapp/SampleView.java experimental/CiCarbonSampleMain.c experimental/CocoaDebugger/main.m experimental/FileReaderApp/main.m experimental/SimpleCocoaApp/main.m experimental/iOSSampleApp/Shared/SkAlertPrompt.h experimental/iOSSampleApp/Shared/SkAlertPrompt.m experimental/iOSSampleApp/SkiOSSampleApp-Base.xcconfig experimental/iOSSampleApp/SkiOSSampleApp-Debug.xcconfig experimental/iOSSampleApp/SkiOSSampleApp-Release.xcconfig gpu/src/android/GrGLDefaultInterface_android.cpp gyp/common.gypi gyp_skia include/ports/SkHarfBuzzFont.h include/views/SkOSWindow_wxwidgets.h make.bat make.py src/opts/memset.arm.S src/opts/memset16_neon.S src/opts/memset32_neon.S src/opts/opts_check_arm.cpp src/ports/SkDebug_brew.cpp src/ports/SkMemory_brew.cpp src/ports/SkOSFile_brew.cpp src/ports/SkXMLParser_empty.cpp src/utils/ios/SkImageDecoder_iOS.mm src/utils/ios/SkOSFile_iOS.mm src/utils/ios/SkStream_NSData.mm tests/FillPathTest.cpp Review URL: http://codereview.appspot.com/4816058 git-svn-id: http://skia.googlecode.com/svn/trunk@1982 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add functionality for isRect() to SkPath.Gravatar caryclark@google.com2011-07-26
| | | | | | | | | | | http://codereview.appspot.com/4807052/ M src/core/SkPath.cpp M tests/PathTest.cpp git-svn-id: http://skia.googlecode.com/svn/trunk@1964 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix path iter returned pt on close, test path close pt in unit test.Gravatar bsalomon@google.com2011-07-13
| | | | | | | | Review URL: http://codereview.appspot.com/4715044/ git-svn-id: http://skia.googlecode.com/svn/trunk@1849 2bbb7eff-a529-9590-31e7-b0007b416f81
* remove unused and untested SkPath::subdivide()Gravatar reed@google.com2011-06-28
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@1732 2bbb7eff-a529-9590-31e7-b0007b416f81
* fix exceeds_dist: don't double the loop counter (the caller has done that)Gravatar reed@google.com2011-06-28
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@1731 2bbb7eff-a529-9590-31e7-b0007b416f81