summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/SurfaceFlinger.h
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-08-10 18:09:09 -0700
committerMathias Agopian <mathias@google.com>2010-08-11 16:05:05 -0700
commit1efba9a61716356014f4c452fd9e099c5ebe9bd0 (patch)
tree92f59d2d9146a58da50cbfe1f1e76221ef44d5c3 /services/surfaceflinger/SurfaceFlinger.h
parentff1d4102882ae9641a61fc4a3937866521bb72dc (diff)
downloadframeworks_base-1efba9a61716356014f4c452fd9e099c5ebe9bd0.zip
frameworks_base-1efba9a61716356014f4c452fd9e099c5ebe9bd0.tar.gz
frameworks_base-1efba9a61716356014f4c452fd9e099c5ebe9bd0.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.h26
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 {