Skip to content

Commit

Permalink
Ensure View is attached before checking if it is hardware accelerated. (
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrtwhite committed Feb 5, 2020
1 parent 526371f commit ba463f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion coil-base/src/main/java/coil/memory/RequestService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ internal class RequestService {
if (!request.allowHardware) return false

// Prevent hardware bitmaps for non-hardware accelerated targets.
if (request.target.run { this is ViewTarget<*> && !view.isHardwareAccelerated }) return false
val target = request.target
if (target is ViewTarget<*> && target.view.run { isAttachedToWindow && !isHardwareAccelerated }) return false

return true
}
Expand Down

0 comments on commit ba463f6

Please sign in to comment.