Skip to content

Commit 11f19ef

Browse files
committed
Make antiAlias defaults to true.
reuse drawFilter.
1 parent 6e83461 commit 11f19ef

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

library/src/main/java/com/opensource/svgaplayer/SVGACanvasDrawer.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import android.widget.ImageView
88
* Created by cuiminghui on 2017/3/29.
99
*/
1010

11+
private var sharedDrawFilter = PaintFlagsDrawFilter(0, Paint.FILTER_BITMAP_FLAG or Paint.ANTI_ALIAS_FLAG)
12+
1113
class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVGADynamicEntity) : SGVADrawer(videoItem) {
1214

1315
var canvas: Canvas? = null
@@ -23,7 +25,7 @@ class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVGADynamicE
2325
var originalFilter: DrawFilter? = null
2426
if (videoItem.antiAlias) {
2527
originalFilter = this.canvas?.drawFilter
26-
this.canvas?.drawFilter = PaintFlagsDrawFilter(0, Paint.FILTER_BITMAP_FLAG or Paint.ANTI_ALIAS_FLAG)
28+
this.canvas?.drawFilter = sharedDrawFilter
2729
}
2830
val sprites = requestFrameSprites(frameIndex)
2931
sprites.forEach {

library/src/main/java/com/opensource/svgaplayer/SVGAImageView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ open class SVGAImageView : ImageView {
125125
val typedArray = context.theme.obtainStyledAttributes(attrs, R.styleable.SVGAImageView, 0, 0)
126126
loops = typedArray.getInt(R.styleable.SVGAImageView_loopCount, 0)
127127
clearsAfterStop = typedArray.getBoolean(R.styleable.SVGAImageView_clearsAfterStop, true)
128-
val antiAlias = typedArray.getBoolean(R.styleable.SVGAImageView_antiAlias, false)
128+
val antiAlias = typedArray.getBoolean(R.styleable.SVGAImageView_antiAlias, true)
129129
typedArray.getString(R.styleable.SVGAImageView_source)?.let {
130130
val parser = SVGAParser(context)
131131
Thread({

library/src/main/java/com/opensource/svgaplayer/SVGAVideoEntity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import java.util.*
1212
*/
1313
class SVGAVideoEntity {
1414

15-
var antiAlias = false
15+
var antiAlias = true
1616

1717
var videoSize = SVGARect(0.0, 0.0, 0.0, 0.0)
1818
private set

0 commit comments

Comments
 (0)