summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-05-13 20:42:01 -0700
committerJesse Hall <jessehall@google.com>2012-06-14 11:56:55 -0700
commit3e8b853d67c737abdb363f9c978e7d83eac4d888 (patch)
tree7796273778c9b2e8cf8739a58d0d3925e0deeaea /services/surfaceflinger/Layer.cpp
parentfe6102f07cc3fa8cfa2283e2c51e6d19f056ee7c (diff)
downloadframeworks_native-3e8b853d67c737abdb363f9c978e7d83eac4d888.zip
frameworks_native-3e8b853d67c737abdb363f9c978e7d83eac4d888.tar.gz
frameworks_native-3e8b853d67c737abdb363f9c978e7d83eac4d888.tar.bz2
refactor HWComposer to break dependency with the HAL headers
HWComposer must abstract the HWC HAL entirely, so that the HAL can continue to evolve (and break binary compatibility) without breaking SurfaceFlinger. The HWC data structure had leaked outside of HWComposer, this is now fixed. We now have an abstract interface that provide all the needed functionality, HWCompose provides concrete implementations of it based on the the HWC version. Change-Id: I40c4676dc986b682ede5520a1c60efe64037b0bb
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp34
1 files changed, 12 insertions, 22 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 4062340..890bcb4 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -259,16 +259,17 @@ Rect Layer::computeBufferCrop() const {
return crop;
}
-void Layer::setGeometry(hwc_layer_t* hwcl)
+void Layer::setGeometry(HWComposer::HWCLayerInterface& layer)
{
- LayerBaseClient::setGeometry(hwcl);
+ LayerBaseClient::setGeometry(layer);
- hwcl->flags &= ~HWC_SKIP_LAYER;
+ // enable this layer
+ layer.setSkip(false);
// we can't do alpha-fade with the hwc HAL
const State& s(drawingState());
if (s.alpha < 0xFF) {
- hwcl->flags = HWC_SKIP_LAYER;
+ layer.setSkip(true);
}
/*
@@ -288,29 +289,18 @@ void Layer::setGeometry(hwc_layer_t* hwcl)
// we can only handle simple transformation
if (finalTransform & Transform::ROT_INVALID) {
- hwcl->flags = HWC_SKIP_LAYER;
+ layer.setSkip(true);
} else {
- hwcl->transform = finalTransform;
+ layer.setTransform(finalTransform);
}
-
- Rect crop = computeBufferCrop();
- hwcl->sourceCrop.left = crop.left;
- hwcl->sourceCrop.top = crop.top;
- hwcl->sourceCrop.right = crop.right;
- hwcl->sourceCrop.bottom = crop.bottom;
+ layer.setCrop(computeBufferCrop());
}
-void Layer::setPerFrameData(hwc_layer_t* hwcl) {
+void Layer::setPerFrameData(HWComposer::HWCLayerInterface& layer) {
const sp<GraphicBuffer>& buffer(mActiveBuffer);
- if (buffer == NULL) {
- // this can happen if the client never drew into this layer yet,
- // or if we ran out of memory. In that case, don't let
- // HWC handle it.
- hwcl->flags |= HWC_SKIP_LAYER;
- hwcl->handle = NULL;
- } else {
- hwcl->handle = buffer->handle;
- }
+ // NOTE: buffer can be NULL if the client never drew into this
+ // layer yet, or if we ran out of memory
+ layer.setBuffer(buffer);
}
void Layer::onDraw(const Region& clip) const