feat: update EffectDemo and fix some code problems
This commit is contained in:
@@ -62,6 +62,9 @@ public class AeroEffectView extends DoricLayer {
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
if (canvas.getWidth() <= 0 || canvas.getHeight() <= 0) {
|
||||
return;
|
||||
}
|
||||
if (mFullBitmap == null
|
||||
|| mFullBitmap.getWidth() != canvas.getWidth()
|
||||
|| mFullBitmap.getHeight() != canvas.getHeight()) {
|
||||
|
@@ -46,7 +46,7 @@ public class AeroEffectViewNode extends StackNode {
|
||||
if ("effectiveRect".equals(name)) {
|
||||
if (prop.isObject()) {
|
||||
int x = DoricUtils.dp2px(prop.asObject().getProperty("x").asNumber().toFloat());
|
||||
int y = DoricUtils.dp2px(prop.asObject().getProperty("x").asNumber().toFloat());
|
||||
int y = DoricUtils.dp2px(prop.asObject().getProperty("y").asNumber().toFloat());
|
||||
int width = DoricUtils.dp2px(prop.asObject().getProperty("width").asNumber().toFloat());
|
||||
int height = DoricUtils.dp2px(prop.asObject().getProperty("height").asNumber().toFloat());
|
||||
((AeroEffectView) view).setEffectiveRect(new Rect(x, y, x + width, y + height));
|
||||
|
@@ -61,6 +61,9 @@ public class BlurEffectView extends DoricLayer {
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
if (canvas.getWidth() <= 0 || canvas.getHeight() <= 0) {
|
||||
return;
|
||||
}
|
||||
if (mFullBitmap == null
|
||||
|| mFullBitmap.getWidth() != canvas.getWidth()
|
||||
|| mFullBitmap.getHeight() != canvas.getHeight()) {
|
||||
|
@@ -50,7 +50,7 @@ public class BlurEffectViewNode extends StackNode {
|
||||
} else if ("effectiveRect".equals(name)) {
|
||||
if (prop.isObject()) {
|
||||
int x = DoricUtils.dp2px(prop.asObject().getProperty("x").asNumber().toFloat());
|
||||
int y = DoricUtils.dp2px(prop.asObject().getProperty("x").asNumber().toFloat());
|
||||
int y = DoricUtils.dp2px(prop.asObject().getProperty("y").asNumber().toFloat());
|
||||
int width = DoricUtils.dp2px(prop.asObject().getProperty("width").asNumber().toFloat());
|
||||
int height = DoricUtils.dp2px(prop.asObject().getProperty("height").asNumber().toFloat());
|
||||
((BlurEffectView) view).setEffectiveRect(new Rect(x, y, x + width, y + height));
|
||||
|
Reference in New Issue
Block a user