| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkDisplayEvents.h" | 10 #include "SkDisplayEvents.h" |
| 11 #include "SkAnimateMaker.h" | 11 #include "SkAnimateMaker.h" |
| 12 #include "SkAnimator.h" | 12 #include "SkAnimator.h" |
| 13 #include "SkDisplayEvent.h" | 13 #include "SkDisplayEvent.h" |
| 14 #include "SkDisplayMovie.h" | 14 #include "SkDisplayMovie.h" |
| 15 #include "SkDrawable.h" | 15 #include "SkADrawable.h" |
| 16 #ifdef SK_DEBUG | 16 #ifdef SK_DEBUG |
| 17 #include "SkDump.h" | 17 #include "SkDump.h" |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 SkEventState::SkEventState() : fCode(0), fDisable(false), fDisplayable(0), fX(0)
, fY(0) { | 20 SkEventState::SkEventState() : fCode(0), fDisable(false), fDisplayable(0), fX(0)
, fY(0) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 SkEvents::SkEvents() { | 23 SkEvents::SkEvents() { |
| 24 } | 24 } |
| 25 | 25 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 75 } |
| 76 return handled; | 76 return handled; |
| 77 } | 77 } |
| 78 | 78 |
| 79 #ifdef SK_DUMP_ENABLED | 79 #ifdef SK_DUMP_ENABLED |
| 80 void SkEvents::dump(SkAnimateMaker& maker) { | 80 void SkEvents::dump(SkAnimateMaker& maker) { |
| 81 int index; | 81 int index; |
| 82 SkTDDrawableArray& drawArray = maker.fDisplayList.fDrawList; | 82 SkTDDrawableArray& drawArray = maker.fDisplayList.fDrawList; |
| 83 int count = drawArray.count(); | 83 int count = drawArray.count(); |
| 84 for (index = 0; index < count; index++) { | 84 for (index = 0; index < count; index++) { |
| 85 SkDrawable* drawable = drawArray[index]; | 85 SkADrawable* drawable = drawArray[index]; |
| 86 drawable->dumpEvents(); | 86 drawable->dumpEvents(); |
| 87 } | 87 } |
| 88 count = fEvents.count(); | 88 count = fEvents.count(); |
| 89 for (index = 0; index < count; index++) { | 89 for (index = 0; index < count; index++) { |
| 90 SkDisplayEvent* evt = fEvents[index]; | 90 SkDisplayEvent* evt = fEvents[index]; |
| 91 evt->dumpEvent(&maker); | 91 evt->dumpEvent(&maker); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 #endif | 94 #endif |
| 95 | 95 |
| 96 // currently this only removes onLoad events | 96 // currently this only removes onLoad events |
| 97 void SkEvents::removeEvent(SkDisplayEvent::Kind kind, SkEventState* state) { | 97 void SkEvents::removeEvent(SkDisplayEvent::Kind kind, SkEventState* state) { |
| 98 int keyCode = state ? state->fCode : 0; | 98 int keyCode = state ? state->fCode : 0; |
| 99 SkDisplayable* displayable = state ? state->fDisplayable : NULL; | 99 SkDisplayable* displayable = state ? state->fDisplayable : NULL; |
| 100 for (SkDisplayEvent** evtPtr = fEvents.begin(); evtPtr < fEvents.end(); evtP
tr++) { | 100 for (SkDisplayEvent** evtPtr = fEvents.begin(); evtPtr < fEvents.end(); evtP
tr++) { |
| 101 SkDisplayEvent* evt = *evtPtr; | 101 SkDisplayEvent* evt = *evtPtr; |
| 102 if (evt->kind != kind) | 102 if (evt->kind != kind) |
| 103 continue; | 103 continue; |
| 104 if (evt->code != (SkKey) -1) { | 104 if (evt->code != (SkKey) -1) { |
| 105 if ((int) evt->code > keyCode || (int) (evt->fMax != (SkKey) -1 ? ev
t->fMax : evt->code) < keyCode) | 105 if ((int) evt->code > keyCode || (int) (evt->fMax != (SkKey) -1 ? ev
t->fMax : evt->code) < keyCode) |
| 106 continue; | 106 continue; |
| 107 } | 107 } |
| 108 if (evt->fTarget != NULL && evt->fTarget != displayable) | 108 if (evt->fTarget != NULL && evt->fTarget != displayable) |
| 109 continue; | 109 continue; |
| 110 int index = fEvents.find(evt); | 110 int index = fEvents.find(evt); |
| 111 fEvents.remove(index); | 111 fEvents.remove(index); |
| 112 } | 112 } |
| 113 } | 113 } |
| OLD | NEW |