Skip to content

Commit ae3075b

Browse files
author
therealbluepandabear
committed
Accept internal Skia bug for the time being (2) + remove redundant comments.
1 parent 264a83b commit ae3075b

File tree

4 files changed

+6
-38
lines changed

4 files changed

+6
-38
lines changed

app/src/main/java/com/therealbluepandabear/pixapencil/activities/canvas/canvashelpers/CanvasActivity+drawPixelGridViewBitmap.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,8 @@ package com.therealbluepandabear.pixapencil.activities.canvas.canvashelpers
2121
import android.graphics.Bitmap
2222
import com.therealbluepandabear.pixapencil.activities.canvas.CanvasActivity
2323
import com.therealbluepandabear.pixapencil.extensions.rotate
24-
import kotlin.math.abs
25-
import kotlin.math.ceil
26-
27-
/**
28-
* We are using 'ceil' to ensure that there is no crooked rotation effect, as when the user
29-
* selects '180 degrees', they are actually rotating the canvas by 179.9 degrees, I made this the behavior due to a
30-
* bug in the SDK in which when you rotate the canvas 180 degrees, the drop shadow is lost.
31-
* Thus, if we had no 'ceil', the resulting bitmap would be crooked as for some reason it rounds it down in this situation.
32-
*/
3324

3425
fun CanvasActivity.drawPixelGridViewBitmap(): Bitmap {
3526
return binding.activityCanvasPixelGridView.pixelGridViewBitmap
36-
.rotate(ceil(abs(binding.activityCanvasCardView.rotation)).toInt(), viewModel.flipMatrix)
27+
.rotate(binding.activityCanvasCardView.rotation.toInt(), viewModel.flipMatrix)
3728
}

app/src/main/java/com/therealbluepandabear/pixapencil/activities/canvas/canvashelpers/CanvasActivity+drawTransparentBackgroundViewBitmap.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,8 @@ package com.therealbluepandabear.pixapencil.activities.canvas.canvashelpers
2121
import android.graphics.Bitmap
2222
import com.therealbluepandabear.pixapencil.activities.canvas.CanvasActivity
2323
import com.therealbluepandabear.pixapencil.extensions.rotate
24-
import kotlin.math.abs
25-
import kotlin.math.ceil
26-
27-
/**
28-
* We are using 'ceil' to ensure that there is no crooked rotation effect, as when the user
29-
* selects '180 degrees', they are actually rotating the canvas by 179.9 degrees, I made this the behavior due to a
30-
* bug in the SDK in which when you rotate the canvas 180 degrees, the drop shadow is lost.
31-
* Thus, if we had no 'ceil', the resulting bitmap would be crooked as for some reason it rounds it down in this situation.
32-
*/
3324

3425
fun CanvasActivity.drawTransparentBackgroundViewBitmap(): Bitmap {
3526
return binding.activityCanvasTransparentBackgroundView.transparentBackgroundViewBitmap
36-
.rotate(ceil(abs(binding.activityCanvasCardView.rotation)).toInt(), viewModel.flipMatrix)
27+
.rotate(binding.activityCanvasCardView.rotation.toInt(), viewModel.flipMatrix)
3728
}

app/src/main/java/com/therealbluepandabear/pixapencil/activities/canvas/canvashelpers/CanvasActivity+flip.kt

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,24 @@ package com.therealbluepandabear.pixapencil.activities.canvas.canvashelpers
2121
import com.therealbluepandabear.pixapencil.activities.canvas.CanvasActivity
2222
import com.therealbluepandabear.pixapencil.enums.FlipValue
2323

24-
/**
25-
* There is a bug in which when you rotate a view 180 degrees, its drop shadow disappears.
26-
* This has been reported to Google but it hasn't been fixed in some compat libraries.
27-
* Hopefully it gets fixed in other libraries soon, but for now we can simply rotate it by 179.9 degrees and it seems to fix it.
28-
* The difference isn't noticeable.
29-
*/
30-
3124
fun CanvasActivity.flip(flipValue: FlipValue) {
3225
if (viewModel.flipMatrix.isEmpty() || viewModel.flipMatrix.last() != flipValue) {
3326
viewModel.flipMatrix.add(flipValue)
3427
}
3528

3629
if (flipValue == FlipValue.Horizontal) {
37-
if (binding.activityCanvasCardView.rotationY == 179.9f) {
30+
if (binding.activityCanvasCardView.rotationY == 180f) {
3831
binding.activityCanvasCardView.rotationY = 0f
3932
viewModel.flipMatrix.removeLast()
4033
} else {
41-
binding.activityCanvasCardView.rotationY = 179.9f
34+
binding.activityCanvasCardView.rotationY = 180f
4235
}
4336
} else {
44-
if (binding.activityCanvasCardView.rotationX == 179.9f) {
37+
if (binding.activityCanvasCardView.rotationX == 180f) {
4538
binding.activityCanvasCardView.rotationX = 0f
4639
viewModel.flipMatrix.removeLast()
4740
} else {
48-
binding.activityCanvasCardView.rotationX = 179.9f
41+
binding.activityCanvasCardView.rotationX = 180f
4942
}
5043
}
5144
}

app/src/main/java/com/therealbluepandabear/pixapencil/enums/RotationValue.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@
1818

1919
package com.therealbluepandabear.pixapencil.enums
2020

21-
/**
22-
* There is a bug in which when you rotate a view 180 degrees, its drop shadow disappears.
23-
* This has been reported to Google but it hasn't been fixed in some compat libraries.
24-
* Hopefully it gets fixed in other libraries soon, but for now we can simply rotate it by 179.9 degrees and it seems to fix it.
25-
* The difference isn't noticeable.
26-
*/
27-
2821
enum class RotationValue(val degrees: Float, val clockwise: Boolean = false) {
2922
NinetyAntiClockwise(90f),
3023
NinetyClockwise(90f, true),

0 commit comments

Comments
 (0)