Skip to content

Commit

Permalink
Add a toggle for overridden data class behaviour of CircularBitmapTra…
Browse files Browse the repository at this point in the history
…nsformation

Reviewed By: oprisnik

Differential Revision: D48114156

fbshipit-source-id: c926bb9b698f6289ff1efa8bd14c4dbb86dca8a3
  • Loading branch information
steelrooter authored and facebook-github-bot committed Aug 11, 2023
1 parent c1f5262 commit 1cdb8d8
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.facebook.imagepipeline.nativecode.NativeRoundingFilter
import com.facebook.imagepipeline.transformation.BitmapTransformation
import com.facebook.imagepipeline.transformation.CircularTransformation

@Suppress("KtDataClass")
data class CircularBitmapTransformation(
val isAntiAliased: Boolean = true,
private val useFastNativeRounding: Boolean = false
Expand All @@ -26,4 +27,36 @@ data class CircularBitmapTransformation(
}

override fun modifiesTransparency(): Boolean = true

override fun equals(other: Any?): Boolean {
if (doNotUseOverriddenDataClassMembers) {
return super.equals(other)
}

if (this === other) {
return true
}
if (javaClass != other?.javaClass) {
return false
}

val otherTransformation: CircularBitmapTransformation = other as CircularBitmapTransformation

return isAntiAliased == otherTransformation.isAntiAliased &&
useFastNativeRounding == otherTransformation.useFastNativeRounding
}

override fun hashCode(): Int {
if (doNotUseOverriddenDataClassMembers) {
return super.hashCode()
}

var result = isAntiAliased.hashCode()
result = 31 * result + useFastNativeRounding.hashCode()
return result
}

companion object {
var doNotUseOverriddenDataClassMembers: Boolean = false
}
}

0 comments on commit 1cdb8d8

Please sign in to comment.