Skip to content

Commit

Permalink
Disable ktlint rules (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
twyatt authored Sep 16, 2024
1 parent db87373 commit 83f0f02
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true

ktlint_standard_chain-method-continuation = disabled
ktlint_standard_class-signature = disabled
ktlint_standard_function-literal = disabled
ktlint_standard_function-naming = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_no-blank-line-in-list = disabled
Expand Down
24 changes: 11 additions & 13 deletions kanvas/src/appleMain/kotlin/IsPointInCGPath.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ import platform.CoreGraphics.CGPointMake

public object IsPointInCGPath : IsPointInPath {

override fun isPointInPath(transform: Transform, path: Path, x: Float, y: Float): Boolean {
return path.withCGPath { cgPath ->
// Krayon passes the path transformation here, but CGPathContainsPoint can transform
// just the point and it's actually cheaper than transforming a whole path.
// TODO: Investigate propagating this optimization to other platforms.
val pointTransform = CGAffineTransformInvert(transform.asCGAffineTransform())
CGPathContainsPoint(
cgPath,
m = pointTransform,
point = CGPointMake(x.toDouble(), y.toDouble()),
eoFill = false,
)
}
override fun isPointInPath(transform: Transform, path: Path, x: Float, y: Float): Boolean = path.withCGPath { cgPath ->
// Krayon passes the path transformation here, but CGPathContainsPoint can transform
// just the point and it's actually cheaper than transforming a whole path.
// TODO: Investigate propagating this optimization to other platforms.
val pointTransform = CGAffineTransformInvert(transform.asCGAffineTransform())
CGPathContainsPoint(
cgPath,
m = pointTransform,
point = CGPointMake(x.toDouble(), y.toDouble()),
eoFill = false,
)
}
}
28 changes: 15 additions & 13 deletions kanvas/src/commonMain/kotlin/SegmentedPath.kt
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,21 @@ internal data class SegmentedPath(
) {
fun <P> rebuildWith(builder: PathBuilder<P>): P {
builder.reset()
for (segment in segments) with(segment) {
when (this) {
is MoveTo -> builder.moveTo(x, y)
is RelativeMoveTo -> builder.relativeMoveTo(x, y)
is LineTo -> builder.lineTo(x, y)
is RelativeLineTo -> builder.relativeLineTo(x, y)
is ArcTo -> builder.arcTo(left, top, right, bottom, startAngle, sweepAngle, forceMoveTo)
is QuadraticTo -> builder.quadraticTo(controlX, controlY, endX, endY)
is RelativeQuadraticTo -> builder.relativeQuadraticTo(controlX, controlY, endX, endY)
is CubicTo -> builder.cubicTo(beginControlX, beginControlY, endControlX, endControlY, endX, endY)
is RelativeCubicTo -> builder.relativeCubicTo(beginControlX, beginControlY, endControlX, endControlY, endX, endY)
is Close -> builder.close()
else -> error("Unreachable.")
for (segment in segments) {
with(segment) {
when (this) {
is MoveTo -> builder.moveTo(x, y)
is RelativeMoveTo -> builder.relativeMoveTo(x, y)
is LineTo -> builder.lineTo(x, y)
is RelativeLineTo -> builder.relativeLineTo(x, y)
is ArcTo -> builder.arcTo(left, top, right, bottom, startAngle, sweepAngle, forceMoveTo)
is QuadraticTo -> builder.quadraticTo(controlX, controlY, endX, endY)
is RelativeQuadraticTo -> builder.relativeQuadraticTo(controlX, controlY, endX, endY)
is CubicTo -> builder.cubicTo(beginControlX, beginControlY, endControlX, endControlY, endX, endY)
is RelativeCubicTo -> builder.relativeCubicTo(beginControlX, beginControlY, endControlX, endControlY, endX, endY)
is Close -> builder.close()
else -> error("Unreachable.")
}
}
}
return builder.build()
Expand Down

0 comments on commit 83f0f02

Please sign in to comment.