*/
#define DEBUG_SCREENSHOTS false
-EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name);
+extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name);
namespace android {
// ---------------------------------------------------------------------------
// Initialize the H/W composer object. There may or may not be an
// actual hardware composer underneath.
- mHwc = new HWComposer(this,
- *static_cast<HWComposer::EventHandler *>(this));
+ mHwc.reset(new HWComposer(this,
+ *static_cast<HWComposer::EventHandler *>(this)));
// get a RenderEngine for the given display / config (can't fail)
mRenderEngine = RenderEngine::create(mEGLDisplay,
const Transform& tr(hw->getTransform());
const Rect bounds(hw->getBounds());
if (hw->isDisplayOn()) {
- computeVisibleRegions(hw->getLayerStack(), dirtyRegion,
- opaqueRegion);
+ computeVisibleRegions(hw, dirtyRegion, opaqueRegion);
mDrawingState.traverseInZOrder([&](Layer* layer) {
if (layer->getLayerStack() == hw->getLayerStack()) {
// TODO: we could cache the transformed region
Region visibleReg;
visibleReg.set(layer->computeScreenBounds());
- invalidateLayerStack(layer->getLayerStack(), visibleReg);
+ invalidateLayerStack(layer, visibleReg);
}
});
}
mTransactionCV.broadcast();
}
-void SurfaceFlinger::computeVisibleRegions(uint32_t layerStack,
+void SurfaceFlinger::computeVisibleRegions(const sp<const DisplayDevice>& displayDevice,
Region& outDirtyRegion, Region& outOpaqueRegion)
{
ATRACE_CALL();
const Layer::State& s(layer->getDrawingState());
// only consider the layers on the given layer stack
- if (layer->getLayerStack() != layerStack)
+ if (layer->getLayerStack() != displayDevice->getLayerStack())
return;
/*
outOpaqueRegion = aboveOpaqueLayers;
}
-void SurfaceFlinger::invalidateLayerStack(uint32_t layerStack,
- const Region& dirty) {
+void SurfaceFlinger::invalidateLayerStack(const sp<const Layer>& layer, const Region& dirty) {
+ uint32_t layerStack = layer->getLayerStack();
for (size_t dpy=0 ; dpy<mDisplays.size() ; dpy++) {
const sp<DisplayDevice>& hw(mDisplays[dpy]);
if (hw->getLayerStack() == layerStack) {
Layer* layer = layersWithQueuedFrames[i];
const Region dirty(layer->latchBuffer(visibleRegions, latchTime));
layer->useSurfaceDamage();
- invalidateLayerStack(layer->getLayerStack(), dirty);
+ invalidateLayerStack(layer, dirty);
}
mVisibleRegionsDirty |= visibleRegions;
return NO_ERROR;
}
+ layer->onRemovedFromCurrentState();
mLayersPendingRemoval.add(layer);
mLayersRemoved = true;
mNumLayers -= 1 + layer->getChildrenCount();