| 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" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 #endif*/ | 41 #endif*/ |
| 42 bool handled = false; | 42 bool handled = false; |
| 43 SkDisplayable** firstMovie = maker.fMovies.begin(); | 43 SkDisplayable** firstMovie = maker.fMovies.begin(); |
| 44 SkDisplayable** endMovie = maker.fMovies.end(); | 44 SkDisplayable** endMovie = maker.fMovies.end(); |
| 45 for (SkDisplayable** ptr = firstMovie; ptr < endMovie; ptr++) { | 45 for (SkDisplayable** ptr = firstMovie; ptr < endMovie; ptr++) { |
| 46 SkDisplayMovie* movie = (SkDisplayMovie*) *ptr; | 46 SkDisplayMovie* movie = (SkDisplayMovie*) *ptr; |
| 47 if (kind != SkDisplayEvent::kOnload) | 47 if (kind != SkDisplayEvent::kOnload) |
| 48 movie->doEvent(kind, state); | 48 movie->doEvent(kind, state); |
| 49 } | 49 } |
| 50 SkDisplayable* displayable = state ? state->fDisplayable : NULL; | 50 SkDisplayable* displayable = state ? state->fDisplayable : nullptr; |
| 51 int keyCode = state ? state->fCode : 0; | 51 int keyCode = state ? state->fCode : 0; |
| 52 int count = fEvents.count(); | 52 int count = fEvents.count(); |
| 53 for (int index = 0; index < count; index++) { | 53 for (int index = 0; index < count; index++) { |
| 54 SkDisplayEvent* evt = fEvents[index]; | 54 SkDisplayEvent* evt = fEvents[index]; |
| 55 if (evt->disable) | 55 if (evt->disable) |
| 56 continue; | 56 continue; |
| 57 if (evt->kind != kind) | 57 if (evt->kind != kind) |
| 58 continue; | 58 continue; |
| 59 if (evt->code != (SkKey) -1) { | 59 if (evt->code != (SkKey) -1) { |
| 60 if ((int) evt->code > keyCode || (int) (evt->fMax != (SkKey) -1 ? ev
t->fMax : evt->code) < keyCode) | 60 if ((int) evt->code > keyCode || (int) (evt->fMax != (SkKey) -1 ? ev
t->fMax : evt->code) < keyCode) |
| 61 continue; | 61 continue; |
| 62 evt->fLastCode = (SkKey) keyCode; | 62 evt->fLastCode = (SkKey) keyCode; |
| 63 } | 63 } |
| 64 if (evt->fTarget != NULL && evt->fTarget != displayable) | 64 if (evt->fTarget != nullptr && evt->fTarget != displayable) |
| 65 continue; | 65 continue; |
| 66 if (state == NULL || state->fDisable == 0) { | 66 if (state == nullptr || state->fDisable == 0) { |
| 67 if (kind >= SkDisplayEvent::kMouseDown && kind <= SkDisplayEvent::kM
ouseUp) { | 67 if (kind >= SkDisplayEvent::kMouseDown && kind <= SkDisplayEvent::kM
ouseUp) { |
| 68 evt->x = state->fX; | 68 evt->x = state->fX; |
| 69 evt->y = state->fY; | 69 evt->y = state->fY; |
| 70 } | 70 } |
| 71 if (evt->enableEvent(maker)) | 71 if (evt->enableEvent(maker)) |
| 72 fError = true; | 72 fError = true; |
| 73 } | 73 } |
| 74 handled = true; | 74 handled = true; |
| 75 } | 75 } |
| 76 return handled; | 76 return handled; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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 : nullptr; |
| 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 != nullptr && 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 |