aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRRect.cpp
Commit message (Collapse)AuthorAge
* flush to zero tiny radiiGravatar Mike Reed2018-06-22
| | | | | | | | | Bug: 850350 Change-Id: If1f8efdb02782d520195a6b66bd159628c89f811 Reviewed-on: https://skia-review.googlesource.com/137220 Reviewed-by: Kevin Lubick <kjlubick@google.com> Auto-Submit: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Stop using SkTSwap.Gravatar Ben Wagner2018-06-19
| | | | | | | | | | | | | Use std::swap instead. It does not appear that any external user specializes SkTSwap, but some may still use it. This removes all use in Skia so that SkTSwap can later be removed in a smaller CL. After that the <utility> include can be removed from SkTypes.h. Change-Id: If03d4ee07dbecda961aa9f0dc34d171ef5168753 Reviewed-on: https://skia-review.googlesource.com/135578 Reviewed-by: Hal Canary <halcanary@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* minor fixes to SkRRectGravatar Cary Clark2018-06-13
| | | | | | | | | | | | | Move methods that are not publicly callable to SkRRectPriv.h. Name params, add a trailing comma to the enum list. R=reed@google.com,bsalomon@google.com Bug: skia:6898 Change-Id: If93f712656dde563567a647624e58ce9a9d74494 Reviewed-on: https://skia-review.googlesource.com/134423 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Cary Clark <caryclark@skia.org>
* fix SkRRect fuzzer assertGravatar Cary Clark2018-04-02
| | | | | | | | | | | | | | | | | | | fuzzer bug triggers an assert in SkRRect::isValid because on radius is zero and the other, while small, is not. The radii are normally both set to zero if one is zero in SkRRect::setRectRadii. However, subsequently scaleRadii may set one to zero when normalizing the pair. Move the clamping code out of setRectRadii so it can be called from scaleRadii as well. R=reed@google.com Bug: skia: Change-Id: Ib9a86da7212567b2f4b83d99a41cf9ba2c30e9b9 Reviewed-on: https://skia-review.googlesource.com/115701 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
* move some RRect methods into privGravatar Mike Reed2018-02-22
| | | | | | | | | | also, return radii by value instead of reference, in possible prep for changing underlying representation Bug: skia:7649 Change-Id: Iff42a49c53cc48171fc63462be366cc3500b2273 Reviewed-on: https://skia-review.googlesource.com/109385 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* make rrect's more self-consistent, check drawable indexGravatar Mike Reed2018-01-19
| | | | | | | | Bug: skia:7403 Change-Id: Ifb8f9ffce2acb1c6f1ebc6c733ad3b6c0865409a Reviewed-on: https://skia-review.googlesource.com/91503 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com>
* Don't canonicalize empty SkRRects. They stroke differently.Gravatar Brian Salomon2017-12-19
| | | | | | | | | | | | Make insetting greater than width or height collapse to a point/line. SkPath::addRRect() doesn't ignore an empty SkRRect. Change-Id: I933a3419a6d75be534f1d8328faa715772045f67 Reviewed-on: https://skia-review.googlesource.com/85680 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
* Disallow negative radii in deserialized SkRRectsGravatar Brian Salomon2017-11-27
| | | | | | | | | bug= chromium:787124 Change-Id: I232ccd6bdfc2c176f97b97e24eabad6a9ce8e5e2 Reviewed-on: https://skia-review.googlesource.com/73901 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
* abort SkRRect::transform() before dst->scaleRadii() assertsGravatar Mike Klein2017-10-12
| | | | | | | | | | | | | | | | If we've got a crazy matrix, we can make dst arbitrarily crazy. This should fix several of Kevin's fuzzes, e.g. Bug: skia:7090 I don't see any uses of SkRRect::transform() that care about the output rrect in case of failure, so I've just removed the guarantee that we don't modify it when failing. Change-Id: I4c81af59a093a984f0a02a0d3dc4bbbb1fb935f2 Reviewed-on: https://skia-review.googlesource.com/58620 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Fix SkRRect validation for negative typesGravatar Adrienne Walker2017-10-02
| | | | | | | | | | | SkRRect::fType is an int, so needs to be checked to see if it's negative. Bug: chromium: 768149 Change-Id: I6a9a019c736806d35dc1bd627fb4ddc735a0ac86 Reviewed-on: https://skia-review.googlesource.com/54024 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Reed <reed@google.com>
* Serialize rrect/oval paths as rrects rather than points and verbs.Gravatar Brian Salomon2017-09-21
| | | | | | | | | This is a step towards not trusting deserialized isoval/isrrect for general paths without losing the performance advantages of knowing that a path is a rrect/oval. Change-Id: I1a8c0608c0f29f4bf7a118dfa1d475e2ab5802ea Reviewed-on: https://skia-review.googlesource.com/49761 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
* Extra safety for SkRRect.Gravatar Brian Salomon2017-09-20
| | | | | | | | | | | | | This moves closer to ensuring that all SkRRects are valid. It also checks for validity of deserialized SkRRects and sets the SkRRect to empty if the serialized data is invalid rather than asserting. It is still possible to use mutators to create invalid SkRRects (e.g. outset() by large number, translate() so that type changes due to fp precision). Bug: skia: Change-Id: Ice5f73a020e99739ef4b3ce362181d3dbb35701c Reviewed-on: https://skia-review.googlesource.com/49220 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
* Validate rrect type in SkRRect::isValidGravatar Adrienne Walker2017-08-23
| | | | | | | | Bug: chromium: 758161 Change-Id: I2472ff59af2fab05d94d88d5effb44828e8a5132 Reviewed-on: https://skia-review.googlesource.com/37800 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
* Circular shadow fixes for Flutter.Gravatar Jim Van Verth2017-04-21
| | | | | | | | | | | | | | * Fix spot shadow placement for SkSpotShadowMaskFilter. * Make sure we don't try to render an oval as a plain RRect due to floating point error. * Use fast path for uncached circles. * Make sure ShadowMaskFilters can handle near-circles. Change-Id: Ia9967a00a6e1c980a1c0a7ba8248f09fde61a3b7 Reviewed-on: https://skia-review.googlesource.com/13969 Reviewed-by: Jim Van Verth <jvanverth@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* simplify SkRRect serializationGravatar Mike Klein2017-04-07
| | | | | | | | | | | | | | | | I think this happens to fix the particular issue in the attached bug. memcpy() is kind of the swiss army knife as far as strict aliasing is concerned... you're always allowed to use it. The generated code for writeToMemory() is unchanged, and readFromMemory() gets a bit better looking. BUG=skia:5105 Change-Id: Ib5bf96600f1138650c004ced2d696e9a4ba83ca7 Reviewed-on: https://skia-review.googlesource.com/11682 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* start removing uses of SkScalarMulGravatar Mike Reed2017-02-06
| | | | | | | | | BUG=skia:6197 Change-Id: Ic444c7ee4ca547f483dc8232dcacd6d4ba87d913 Reviewed-on: https://skia-review.googlesource.com/8041 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Add validation of RRects to SkValidatingReadBufferGravatar Robert Phillips2016-09-23
| | | | | | | | | | | This comes from the Skia fuzzer where it is inverting the RRect's rect which causes trouble down the line. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2591 Change-Id: I5c34105a47369492d2df99d39a4e29116060ad37 Reviewed-on: https://skia-review.googlesource.com/2591 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
* make transformed rrect radii fit rectangleGravatar caryclark2016-02-23
| | | | | | | | | one more case caught by 1M skps R=herb@google.com,reed@google.com BUG=skia:4413 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1722483003 Review URL: https://codereview.chromium.org/1722483003
* Change name from ScaleToSides to SkScaleToSides.Gravatar herb2016-01-22
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1618283004 Review URL: https://codereview.chromium.org/1618283004
* Fix radii calculation code to handle large radii.Gravatar herb2016-01-11
| | | | | | | BUG=472147 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1569403002 Review URL: https://codereview.chromium.org/1569403002
* Revert of Fix handling of radii scaling to force the result to always be ↵Gravatar robertphillips2016-01-07
| | | | | | | | | | | | | | | | | | | | | | | | less (patchset #14 id:250001 of https://codereview.chromium.org/1567723004/ ) Reason for revert: Fear and doubt of NexusPlayer Original issue's description: > Fix handling of radii scaling to force the result to always be less > than a given side. > BUG=472147 > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1567723004 > > Committed: https://skia.googlesource.com/skia/+/f96bf1a2d091a917bb93f9e9a3a8d53bb39d068e TBR=reed@google.com,herb@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=472147 Review URL: https://codereview.chromium.org/1568063002
* Fix handling of radii scaling to force the result to always be lessGravatar herb2016-01-07
| | | | | | | | than a given side. BUG=472147 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1567723004 Review URL: https://codereview.chromium.org/1567723004
* Comments Style: s/skbug.com/bug.skia.org/Gravatar halcanary2015-11-07
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1432503003 Review URL: https://codereview.chromium.org/1432503003
* Handle inverted rects in SkRRect creation methodsGravatar robertphillips2015-09-29
| | | | | | | | An alternative way of addressing this is to alter SkCanvas::drawRoundRect to just reject isEmpty (i.e., un-sorted or truly empty) input rects. BUG=skia:3786 Review URL: https://codereview.chromium.org/1373293002
* Style Change: NULL->nullptrGravatar halcanary2015-08-27
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316233002 Review URL: https://codereview.chromium.org/1316233002
* Revert of Revert of stop calling SkScalarDiv (patchset #1 id:1 of ↵Gravatar reed2015-05-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1138263002/) Reason for revert: android patched, blink has rolled Original issue's description: > Revert of stop calling SkScalarDiv (patchset #4 id:60001 of https://codereview.chromium.org/1135053002/) > > Reason for revert: > need to wait for Blink roll (and patch android) > > Original issue's description: > > stop calling SkScalarDiv > > > > BUG=skia: > > TBR= > > > > Committed: https://skia.googlesource.com/skia/+/67d71c898249a7af3523b16c6a69895a63bfae0a > > TBR= > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/2629697933b5cc975e45d2a45c48f803fc6cbcec TBR= NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1135693003
* Revert of stop calling SkScalarDiv (patchset #4 id:60001 of ↵Gravatar reed2015-05-12
| | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1135053002/) Reason for revert: need to wait for Blink roll (and patch android) Original issue's description: > stop calling SkScalarDiv > > BUG=skia: > TBR= > > Committed: https://skia.googlesource.com/skia/+/67d71c898249a7af3523b16c6a69895a63bfae0a TBR= NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1138263002
* stop calling SkScalarDivGravatar reed2015-05-12
| | | | | | | BUG=skia: TBR= Review URL: https://codereview.chromium.org/1135053002
* Fix bug with very large round rects with large radiiGravatar robertphillips2015-03-13
| | | | | | BUG=463920 Review URL: https://codereview.chromium.org/998903003
* some utils for rect and matrixGravatar reed2015-03-13
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1003813003
* Fix radii scaling bug in SkRRect::setNinePatchGravatar robertphillips2015-02-24
| | | | | | BUG=skia:3466 Review URL: https://codereview.chromium.org/951323004
* fix more tricky-float cases in SkRRect validateGravatar reed2015-02-13
| | | | | | BUG=458524,458522 Review URL: https://codereview.chromium.org/921163003
* check for nonfinites in rrectsGravatar reed2015-02-10
| | | | | | BUG=457128 Review URL: https://codereview.chromium.org/913743002
* Fill SkRRect::fType proactively.Gravatar mtklein2014-12-18
| | | | | | | | | | | I found no external mentions of SkRRect::kUnknown_Type. Motivating race found by TSAN: http://build.chromium.org/p/client.skia/builders/Test-Ubuntu13.10-GCE-NoGPU-x86_64-Release-TSAN-Trybot/builds/48/steps/dm/logs/stdio BUG=skia: Review URL: https://codereview.chromium.org/801693003
* Fix rrects that are large enough that we lose/gain a bit when we add the ↵Gravatar reed2014-12-15
| | | | | | | | | | radius to a bounds coordinate. add test that triggers assert in addRRect BUG=skia:3239 Review URL: https://codereview.chromium.org/803153003
* add dumpHex option to rect and rrect, to match pathGravatar reed2014-12-15
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/801383002
* Fix RRect tranform bugGravatar robertphillips2014-06-27
| | | | | | | | | | | When a RRect is an oval transforming the rectangle and the radii separately can result in a non-oval result (i.e., due to numerical issues some tiny straight edges may creep in). This CL remedies the situation by computing the new radii directly from the transformed rect. BUG=skia:2696 R=caryclark@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/354913004
* Add dump() to SkClipStack to help with debugging.Gravatar bsalomon2014-06-09
| | | | | | | | R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/311263015
* Fix SkRRect isEmpty assertGravatar commit-bot@chromium.org2014-04-03
| | | | | | | | | | | | | | | | The rectangle could be empty but not all zeroes. BUG=skia:2379 Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> R=robertphillips@google.com Author: siglesias@igalia.com Review URL: https://codereview.chromium.org/223213005 git-svn-id: http://skia.googlecode.com/svn/trunk@14041 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add nine patch type to SkRRect.Gravatar commit-bot@chromium.org2014-03-17
| | | | | | | | | | | | | | BUG=skia:2181 Committed: http://code.google.com/p/skia/source/detail?r=13833 R=robertphillips@google.com, reed@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/196343015 git-svn-id: http://skia.googlecode.com/svn/trunk@13839 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert of Add nine patch type to SkRRect. ↵Gravatar commit-bot@chromium.org2014-03-17
| | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/196343015/) Reason for revert: causes tests to have infinite loop Original issue's description: > Add nine patch type to SkRRect. > > BUG=skia:2181 > > Committed: http://code.google.com/p/skia/source/detail?r=13833 R=robertphillips@google.com, reed@google.com TBR=reed@google.com, robertphillips@google.com NOTREECHECKS=true NOTRY=true BUG=skia:2181 Author: bsalomon@google.com Review URL: https://codereview.chromium.org/202163004 git-svn-id: http://skia.googlecode.com/svn/trunk@13837 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add nine patch type to SkRRect.Gravatar commit-bot@chromium.org2014-03-17
| | | | | | | | | | | BUG=skia:2181 R=robertphillips@google.com, reed@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/196343015 git-svn-id: http://skia.googlecode.com/svn/trunk@13833 2bbb7eff-a529-9590-31e7-b0007b416f81
* plumbing for GPU fast blurGravatar commit-bot@chromium.org2014-03-10
| | | | | | | | | | | BUG=skia:2281 R=bsalomon@google.com Author: humper@google.com Review URL: https://codereview.chromium.org/193193002 git-svn-id: http://skia.googlecode.com/svn/trunk@13735 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add SkRRect::transform.Gravatar scroggo@google.com2013-11-05
| | | | | | | | | | | | | | | | | | Much like SkPath::transform, it transforms an SkRRect based on an SkMatrix. Unlike SkPath::transform, it will fail for matrices that contain perspective or skewing. Required by a future change (https://codereview.chromium.org/48623006) to speed up drawing large blurry rounded rectangles by using ninepatches. TODO: This could easily support 90 degree rotations, if desired. BUG=https://b.corp.google.com/issue?id=11174385 R=reed@google.com, robertphillips@google.com Review URL: https://codereview.chromium.org/52703003 git-svn-id: http://skia.googlecode.com/svn/trunk@12132 2bbb7eff-a529-9590-31e7-b0007b416f81
* Checking structure sizes before reading them from memory to avoid ↵Gravatar commit-bot@chromium.org2013-11-05
| | | | | | | | | | | | | | | | | overflowing the buffer's stream. BUG= R=reed@google.com, mtklein@google.com, senorblanco@chromium.org Committed: https://code.google.com/p/skia/source/detail?r=12114 Committed: https://code.google.com/p/skia/source/detail?r=12119 Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/41253002 git-svn-id: http://skia.googlecode.com/svn/trunk@12130 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert "Checking structure sizes before reading them from memory to avoid ↵Gravatar reed@google.com2013-11-04
| | | | | | | | overflowing the buffer's stream." This reverts commit 6bc22e8ef1ea70a1b58409aa21254358c50f149a. git-svn-id: http://skia.googlecode.com/svn/trunk@12124 2bbb7eff-a529-9590-31e7-b0007b416f81
* Checking structure sizes before reading them from memory to avoid ↵Gravatar sugoi@google.com2013-11-04
| | | | | | | | | | | | | overflowing the buffer's stream. BUG= R=reed@google.com Committed: https://code.google.com/p/skia/source/detail?r=12114 Review URL: https://codereview.chromium.org/41253002 git-svn-id: http://skia.googlecode.com/svn/trunk@12119 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert r12114 due to https://code.google.com/p/skia/issues/detail?id=1794 ↵Gravatar epoger@google.com2013-11-04
| | | | | | ('Assertion failures on various buildbots as of r12114') git-svn-id: http://skia.googlecode.com/svn/trunk@12115 2bbb7eff-a529-9590-31e7-b0007b416f81
* Checking structure sizes before reading them from memory to avoid ↵Gravatar sugoi@google.com2013-11-04
| | | | | | | | | | | overflowing the buffer's stream. BUG= R=reed@google.com Review URL: https://codereview.chromium.org/41253002 git-svn-id: http://skia.googlecode.com/svn/trunk@12114 2bbb7eff-a529-9590-31e7-b0007b416f81
* remove contains(x,y) for rects and rrects ... not well defined, and unusedGravatar reed@google.com2013-10-30
| | | | | | | | | BUG= R=robertphillips@google.com Review URL: https://codereview.chromium.org/51953003 git-svn-id: http://skia.googlecode.com/svn/trunk@12022 2bbb7eff-a529-9590-31e7-b0007b416f81