diff options
author | Mathias Agopian <mathias@google.com> | 2010-08-10 18:09:09 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-08-11 16:05:05 -0700 |
commit | f6679fc6f70939643901f29a9a69e40c603e6e5f (patch) | |
tree | ff0b67f2e1a95d48514e5363d2e0870ec3adb911 /services/surfaceflinger/SurfaceFlinger.h | |
parent | 4da751999358fffa4cefc4c8046dab72045925f6 (diff) | |
download | frameworks_native-f6679fc6f70939643901f29a9a69e40c603e6e5f.zip frameworks_native-f6679fc6f70939643901f29a9a69e40c603e6e5f.tar.gz frameworks_native-f6679fc6f70939643901f29a9a69e40c603e6e5f.tar.bz2 |
get rid of our LayerVector implementation
we now use SortedVector<> with a special compare implementation.
Change-Id: I910459cf3b3c8993b55ad0786a8c348369262de5
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.h')
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index c8b9512..8ecfc01 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -243,21 +243,19 @@ private: status_t setClientState(const sp<Client>& client, int32_t count, const layer_state_t* states); - - class LayerVector { + class LayerVector : public SortedVector< sp<LayerBase> > { public: - inline LayerVector() { } - LayerVector(const LayerVector&); - inline size_t size() const { return layers.size(); } - inline sp<LayerBase> const* array() const { return layers.array(); } - ssize_t add(const sp<LayerBase>&, Vector< sp<LayerBase> >::compar_t); - ssize_t remove(const sp<LayerBase>&); - ssize_t reorder(const sp<LayerBase>&, Vector< sp<LayerBase> >::compar_t); - ssize_t indexOf(const sp<LayerBase>& key, size_t guess=0) const; - inline sp<LayerBase> operator [] (size_t i) const { return layers[i]; } - private: - KeyedVector< sp<LayerBase> , size_t> lookup; - Vector< sp<LayerBase> > layers; + LayerVector() { } + LayerVector(const LayerVector& rhs) : SortedVector< sp<LayerBase> >(rhs) { } + virtual int do_compare(const void* lhs, const void* rhs) const { + const sp<LayerBase>& l(*reinterpret_cast<const sp<LayerBase>*>(lhs)); + const sp<LayerBase>& r(*reinterpret_cast<const sp<LayerBase>*>(rhs)); + // sort layers by Z order + uint32_t lz = l->currentState().z; + uint32_t rz = r->currentState().z; + // then by sequence, so we get a stable ordering + return (lz != rz) ? (lz - rz) : (l->sequence - r->sequence); + } }; struct State { |