@@ -100,7 +100,7 @@ class DrawList(sharedData: DrawListSharedData?) {
100100 /* * Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping.
101101 * Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) */
102102 fun pushClipRect (rect : Rect , intersectWithCurrentClipRect : Boolean = false) =
103- pushClipRect(rect.min, rect.max, intersectWithCurrentClipRect)
103+ pushClipRect(rect.min, rect.max, intersectWithCurrentClipRect)
104104
105105 fun pushClipRect (crMin : Vec2 , crMax : Vec2 , intersectWithCurrentClipRect : Boolean = false) {
106106
@@ -124,7 +124,7 @@ class DrawList(sharedData: DrawListSharedData?) {
124124
125125 /* * [JVM] */
126126 inline fun withClipRect (rect : Rect , intersectWithCurrentClipRect : Boolean = false, block : DrawList .() -> Unit ) =
127- withClipRect(rect.min, rect.max, intersectWithCurrentClipRect, block)
127+ withClipRect(rect.min, rect.max, intersectWithCurrentClipRect, block)
128128
129129 /* * [JVM] */
130130 inline fun withClipRect (crMin : Vec2 , crMax : Vec2 , intersectWithCurrentClipRect : Boolean = false, block : DrawList .() -> Unit ) {
@@ -732,8 +732,8 @@ class DrawList(sharedData: DrawListSharedData?) {
732732 // -----------------------------------------------------------------------------------------------------------------
733733
734734 fun addImage (
735- userTextureId : TextureID , pMin : Vec2 , pMax : Vec2 ,
736- uvMin : Vec2 = Vec2 (0), uvMax : Vec2 = Vec2 (1), col : Int = COL32_WHITE ,
735+ userTextureId : TextureID , pMin : Vec2 , pMax : Vec2 ,
736+ uvMin : Vec2 = Vec2 (0), uvMax : Vec2 = Vec2 (1), col : Int = COL32_WHITE ,
737737 ) {
738738
739739 if (col hasnt COL32_A_MASK ) return
@@ -748,9 +748,9 @@ class DrawList(sharedData: DrawListSharedData?) {
748748 }
749749
750750 fun addImageQuad (
751- userTextureId : TextureID , p1 : Vec2 , p2 : Vec2 , p3 : Vec2 , p4 : Vec2 ,
752- uv1 : Vec2 = Vec2 (0), uv2 : Vec2 = Vec2 (1, 0),
753- uv3 : Vec2 = Vec2 (1), uv4 : Vec2 = Vec2 (0, 1), col : Int = COL32_WHITE ,
751+ userTextureId : TextureID , p1 : Vec2 , p2 : Vec2 , p3 : Vec2 , p4 : Vec2 ,
752+ uv1 : Vec2 = Vec2 (0), uv2 : Vec2 = Vec2 (1, 0),
753+ uv3 : Vec2 = Vec2 (1), uv4 : Vec2 = Vec2 (0, 1), col : Int = COL32_WHITE ,
754754 ) {
755755
756756 if (col hasnt COL32_A_MASK ) return
@@ -805,7 +805,7 @@ class DrawList(sharedData: DrawListSharedData?) {
805805
806806 /* * rounding_corners_flags: 4 bits corresponding to which corner to round */
807807 fun pathStroke (col : Int , flags : DrawFlags = none, thickness : Float = 1.0f) =
808- addPolyline(_path , col, flags, thickness).also { pathClear() }
808+ addPolyline(_path , col, flags, thickness).also { pathClear() }
809809
810810 /* * @param center must be a new instance */
811811 fun pathArcTo (center : Vec2 , radius : Float , aMin : Float , aMax : Float , numSegments : Int = 0) {
@@ -1295,20 +1295,18 @@ class DrawList(sharedData: DrawListSharedData?) {
12951295 }
12961296
12971297 fun _calcCircleAutoSegmentCount (radius : Float ): Int =
1298- // Automatic segment count
1299- when (val radiusIdx = (radius + 0.999999f ).i) { // ceil to never reduce accuracy
1300- in _data .circleSegmentCounts.indices -> _data .circleSegmentCounts[radiusIdx] // Use cached value
1301- else -> DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC (radius, _data .circleSegmentMaxError)
1302- }
1298+ // Automatic segment count
1299+ when (val radiusIdx = (radius + 0.999999f ).i) { // ceil to never reduce accuracy
1300+ in _data .circleSegmentCounts.indices -> _data .circleSegmentCounts[radiusIdx] // Use cached value
1301+ else -> DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC (radius, _data .circleSegmentMaxError)
1302+ }
13031303
13041304 /* * @center must be a new instance */
1305- fun _pathArcToFastEx (center : Vec2 , radius : Float , aMinSample_ : Int , aMaxSample_ : Int , aStep_ : Int ) {
1305+ fun _pathArcToFastEx (center : Vec2 , radius : Float , aMinSample : Int , aMaxSample : Int , aStep_ : Int ) {
13061306 if (radius < 0.5f ) {
13071307 _path + = center
13081308 return
13091309 }
1310- var aMaxSample = aMaxSample_
1311- var aMinSample = aMinSample_
13121310
13131311 // Calculate arc auto segment step size
13141312 var aStep = when {
@@ -1355,7 +1353,7 @@ class DrawList(sharedData: DrawListSharedData?) {
13551353
13561354 val s = _data .arcFastVtx[sampleIndex]
13571355 _path + = Vec2 (center.x + s.x * radius,
1358- center.y + s.y * radius)
1356+ center.y + s.y * radius)
13591357
13601358 a + = aStep; sampleIndex + = aStep; aStep = aNextStep
13611359 }
@@ -1368,7 +1366,7 @@ class DrawList(sharedData: DrawListSharedData?) {
13681366
13691367 val s = _data .arcFastVtx[sampleIndex]
13701368 _path + = Vec2 (center.x + s.x * radius,
1371- center.y + s.y * radius)
1369+ center.y + s.y * radius)
13721370
13731371 a - = aStep; sampleIndex - = aStep; aStep = aNextStep
13741372 }
@@ -1381,7 +1379,7 @@ class DrawList(sharedData: DrawListSharedData?) {
13811379
13821380 val s = _data .arcFastVtx[normalizedMaxSample]
13831381 _path + = Vec2 (center.x + s.x * radius,
1384- center.y + s.y * radius)
1382+ center.y + s.y * radius)
13851383 }
13861384
13871385 // IM_ASSERT_PARANOID(_Path.Data + _Path.Size == out_ptr)
@@ -1437,13 +1435,14 @@ class DrawList(sharedData: DrawListSharedData?) {
14371435}
14381436
14391437private fun DrawVert_Buffer (size : Int = 0) = DrawVert_Buffer (ByteBuffer (size))
1438+
14401439@JvmInline
14411440value class DrawVert_Buffer (val data : ByteBuffer ) {
14421441
14431442 operator fun get (index : Int ) = DrawVert (
1444- Vec2 (data, index * DrawVert .SIZE ),
1445- Vec2 (data, index * DrawVert .SIZE + DrawVert .OFS_UV ),
1446- data.getInt(index * DrawVert .SIZE + DrawVert .OFS_COL ))
1443+ Vec2 (data, index * DrawVert .SIZE ),
1444+ Vec2 (data, index * DrawVert .SIZE + DrawVert .OFS_UV ),
1445+ data.getInt(index * DrawVert .SIZE + DrawVert .OFS_COL ))
14471446
14481447 operator fun plusAssign (v : Vec2 ) {
14491448 data.putFloat(v.x)
0 commit comments