MCPcopy Create free account
hub / github.com/Snapchat/Valdi / drawViewInCanvas

Method drawViewInCanvas

valdi/src/java/com/snap/valdi/ViewRef.kt:220–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218 }
219
220 private fun drawViewInCanvas(canvas: Canvas, bitmap: Bitmap, view: View, transform: Matrix?, shouldScale: Boolean) {
221 val bitmapWidth = bitmap.width
222 val bitmapHeight = bitmap.height
223 val viewWidth = view.width
224 val viewHeight = view.height
225
226 canvas.setBitmap(bitmap)
227
228 if (transform != null) {
229 canvas.concat(transform)
230 }
231
232 if (shouldScale) {
233 canvas.scale(bitmapWidth.toFloat() / viewWidth.toFloat(), bitmapHeight.toFloat() / viewHeight.toFloat())
234 }
235
236 view.draw(canvas)
237
238 canvas.setBitmap(null)
239 }
240
241 @Keep
242 fun raster(bitmap: Any?, left: Int, top: Int, right: Int, bottom: Int, rasterScaleX: Float, rasterScaleY: Float, transform: Any?): String? {

Callers

nothing calls this directly

Calls 4

scaleMethod · 0.80
toFloatMethod · 0.80
drawMethod · 0.65
concatMethod · 0.45

Tested by

no test coverage detected