提交 b73e710b 编写于 作者: H huangziwei

fix bugs: can't delete item when optimizing drawing

上级 99dfba43
...@@ -381,6 +381,7 @@ public class DoodleView extends FrameLayout implements IDoodle { ...@@ -381,6 +381,7 @@ public class DoodleView extends FrameLayout implements IDoodle {
clearFlag(FLAG_DRAW_PENDINGS_TO_BACKGROUND); clearFlag(FLAG_DRAW_PENDINGS_TO_BACKGROUND);
clearFlag(FLAG_REFRESH_BACKGROUND); clearFlag(FLAG_REFRESH_BACKGROUND);
refreshDoodleBitmap(false); refreshDoodleBitmap(false);
mPendingItemsDrawToBitmap.clear();
mBackgroundView.invalidate(); mBackgroundView.invalidate();
} else if (hasFlag(FLAG_DRAW_PENDINGS_TO_BACKGROUND)) { } else if (hasFlag(FLAG_DRAW_PENDINGS_TO_BACKGROUND)) {
LogUtil.d(TAG, "FLAG_DRAW_PENDINGS_TO_BACKGROUND"); LogUtil.d(TAG, "FLAG_DRAW_PENDINGS_TO_BACKGROUND");
...@@ -751,8 +752,6 @@ public class DoodleView extends FrameLayout implements IDoodle { ...@@ -751,8 +752,6 @@ public class DoodleView extends FrameLayout implements IDoodle {
addFlag(FLAG_RESET_BACKGROUND); addFlag(FLAG_RESET_BACKGROUND);
} else { } else {
addItem(item); addItem(item);
mPendingItemsDrawToBitmap.add(item);
addFlag(FLAG_DRAW_PENDINGS_TO_BACKGROUND);
} }
} }
...@@ -818,6 +817,8 @@ public class DoodleView extends FrameLayout implements IDoodle { ...@@ -818,6 +817,8 @@ public class DoodleView extends FrameLayout implements IDoodle {
item.onRemove(); item.onRemove();
} }
mItemStack.clear(); mItemStack.clear();
mItemStackOnViewCanvas.clear();
mPendingItemsDrawToBitmap.clear();
addFlag(FLAG_RESET_BACKGROUND); addFlag(FLAG_RESET_BACKGROUND);
...@@ -1145,6 +1146,7 @@ public class DoodleView extends FrameLayout implements IDoodle { ...@@ -1145,6 +1146,7 @@ public class DoodleView extends FrameLayout implements IDoodle {
if (mItemStack.contains(item)) { if (mItemStack.contains(item)) {
throw new RuntimeException("the item has been added"); throw new RuntimeException("the item has been added");
} }
mItemStack.add(item); mItemStack.add(item);
item.onAdd(); item.onAdd();
...@@ -1159,6 +1161,9 @@ public class DoodleView extends FrameLayout implements IDoodle { ...@@ -1159,6 +1161,9 @@ public class DoodleView extends FrameLayout implements IDoodle {
if (!mItemStack.remove(doodleItem)) { if (!mItemStack.remove(doodleItem)) {
return; return;
} }
mItemStackOnViewCanvas.remove(doodleItem);
mPendingItemsDrawToBitmap.remove(doodleItem);
doodleItem.onRemove(); doodleItem.onRemove();
addFlag(FLAG_RESET_BACKGROUND); addFlag(FLAG_RESET_BACKGROUND);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册