@@ -77,7 +77,7 @@ open class Fill {
7777 }
7878
7979 fun fillRect (
80- c : Canvas , paint : Paint ,
80+ canvas : Canvas , paint : Paint ,
8181 left : Float , top : Float , right : Float , bottom : Float ,
8282 gradientDirection : Direction ? , mRoundedBarRadius : Float
8383 ) {
@@ -90,12 +90,12 @@ open class Fill {
9090 }
9191
9292 if (this .isClipPathSupported) {
93- val save = c .save()
93+ val save = canvas .save()
9494
95- c .clipRect(left, top, right, bottom)
96- c .drawColor(mFinalColor!! )
95+ canvas .clipRect(left, top, right, bottom)
96+ canvas .drawColor(mFinalColor!! )
9797
98- c .restoreToCount(save)
98+ canvas .restoreToCount(save)
9999 } else {
100100 // save
101101 val previous = paint.style
@@ -105,7 +105,7 @@ open class Fill {
105105 paint.style = Paint .Style .FILL
106106 paint.color = mFinalColor!!
107107
108- c .drawRoundRect(RectF (left, top, right, bottom), mRoundedBarRadius, mRoundedBarRadius, paint)
108+ canvas .drawRoundRect(RectF (left, top, right, bottom), mRoundedBarRadius, mRoundedBarRadius, paint)
109109
110110 // restore
111111 paint.color = previousColor
@@ -142,7 +142,7 @@ open class Fill {
142142
143143 paint.shader = gradient
144144
145- c .drawRoundRect(RectF (left, top, right, bottom), mRoundedBarRadius, mRoundedBarRadius, paint)
145+ canvas .drawRoundRect(RectF (left, top, right, bottom), mRoundedBarRadius, mRoundedBarRadius, paint)
146146 }
147147
148148 Type .DRAWABLE -> {
@@ -151,13 +151,15 @@ open class Fill {
151151 }
152152
153153 drawable!! .setBounds(left.toInt(), top.toInt(), right.toInt(), bottom.toInt())
154- drawable!! .draw(c )
154+ drawable!! .draw(canvas )
155155 }
156156 }
157157 }
158158
159159 fun fillPath (
160- c : Canvas , path : Path , paint : Paint ,
160+ canvas : Canvas ,
161+ path : Path ,
162+ paint : Paint ,
161163 clipRect : RectF ?
162164 ) {
163165 when (this .type) {
@@ -169,12 +171,12 @@ open class Fill {
169171 }
170172
171173 if (clipRect != null && this .isClipPathSupported) {
172- val save = c .save()
174+ val save = canvas .save()
173175
174- c .clipPath(path)
175- c .drawColor(mFinalColor!! )
176+ canvas .clipPath(path)
177+ canvas .drawColor(mFinalColor!! )
176178
177- c .restoreToCount(save)
179+ canvas .restoreToCount(save)
178180 } else {
179181 // save
180182 val previous = paint.style
@@ -184,7 +186,7 @@ open class Fill {
184186 paint.style = Paint .Style .FILL
185187 paint.color = mFinalColor!!
186188
187- c .drawPath(path, paint)
189+ canvas .drawPath(path, paint)
188190
189191 // restore
190192 paint.color = previousColor
@@ -196,16 +198,16 @@ open class Fill {
196198 val gradient = LinearGradient (
197199 0f ,
198200 0f ,
199- c .width.toFloat(),
200- c .height.toFloat(),
201+ canvas .width.toFloat(),
202+ canvas .height.toFloat(),
201203 this .gradientColors!! ,
202204 this .gradientPositions,
203205 Shader .TileMode .MIRROR
204206 )
205207
206208 paint.shader = gradient
207209
208- c .drawPath(path, paint)
210+ canvas .drawPath(path, paint)
209211 }
210212
211213 Type .DRAWABLE -> {
@@ -215,18 +217,18 @@ open class Fill {
215217
216218 ensureClipPathSupported()
217219
218- val save = c .save()
219- c .clipPath(path)
220+ val save = canvas .save()
221+ canvas .clipPath(path)
220222
221223 drawable!! .setBounds(
222224 if (clipRect == null ) 0 else clipRect.left.toInt(),
223225 if (clipRect == null ) 0 else clipRect.top.toInt(),
224- if (clipRect == null ) c .width else clipRect.right.toInt(),
225- if (clipRect == null ) c .height else clipRect.bottom.toInt()
226+ if (clipRect == null ) canvas .width else clipRect.right.toInt(),
227+ if (clipRect == null ) canvas .height else clipRect.bottom.toInt()
226228 )
227- drawable!! .draw(c )
229+ drawable!! .draw(canvas )
228230
229- c .restoreToCount(save)
231+ canvas .restoreToCount(save)
230232 }
231233 }
232234 }
0 commit comments