Loading libs/input/SpriteController.cpp +20 −12 Original line number Diff line number Diff line Loading @@ -131,8 +131,9 @@ void SpriteController::doUpdateSprites() { update.state.surfaceHeight = update.state.icon.height(); update.state.surfaceDrawn = false; update.state.surfaceVisible = false; update.state.surfaceControl = obtainSurface( update.state.surfaceWidth, update.state.surfaceHeight); update.state.surfaceControl = obtainSurface(update.state.surfaceWidth, update.state.surfaceHeight, update.state.displayId); if (update.state.surfaceControl != NULL) { update.surfaceChanged = surfaceChanged = true; } Loading Loading @@ -168,8 +169,8 @@ void SpriteController::doUpdateSprites() { } } // If surface is a new one, we have to set right layer stack. if (update.surfaceChanged || update.state.dirty & DIRTY_DISPLAY_ID) { // If surface has changed to a new display, we have to reparent it. if (update.state.dirty & DIRTY_DISPLAY_ID) { t.reparent(update.state.surfaceControl, mParentSurfaceProvider(update.state.displayId)); needApplyTransaction = true; } Loading Loading @@ -330,21 +331,28 @@ void SpriteController::ensureSurfaceComposerClient() { } } sp<SurfaceControl> SpriteController::obtainSurface(int32_t width, int32_t height) { sp<SurfaceControl> SpriteController::obtainSurface(int32_t width, int32_t height, int32_t displayId) { ensureSurfaceComposerClient(); sp<SurfaceControl> surfaceControl = mSurfaceComposerClient->createSurface( String8("Sprite"), width, height, PIXEL_FORMAT_RGBA_8888, const sp<SurfaceControl> parent = mParentSurfaceProvider(displayId); if (parent == nullptr) { ALOGE("Failed to get the parent surface for pointers on display %d", displayId); } const sp<SurfaceControl> surfaceControl = mSurfaceComposerClient->createSurface(String8("Sprite"), width, height, PIXEL_FORMAT_RGBA_8888, ISurfaceComposerClient::eHidden | ISurfaceComposerClient::eCursorWindow); if (surfaceControl == NULL || !surfaceControl->isValid()) { ISurfaceComposerClient::eCursorWindow, parent ? parent->getHandle() : nullptr); if (surfaceControl == nullptr || !surfaceControl->isValid()) { ALOGE("Error creating sprite surface."); return NULL; return nullptr; } return surfaceControl; } // --- SpriteController::SpriteImpl --- SpriteController::SpriteImpl::SpriteImpl(const sp<SpriteController> controller) : Loading libs/input/SpriteController.h +1 −1 Original line number Diff line number Diff line Loading @@ -265,7 +265,7 @@ private: void doDisposeSurfaces(); void ensureSurfaceComposerClient(); sp<SurfaceControl> obtainSurface(int32_t width, int32_t height); sp<SurfaceControl> obtainSurface(int32_t width, int32_t height, int32_t displayId); }; } // namespace android Loading Loading
libs/input/SpriteController.cpp +20 −12 Original line number Diff line number Diff line Loading @@ -131,8 +131,9 @@ void SpriteController::doUpdateSprites() { update.state.surfaceHeight = update.state.icon.height(); update.state.surfaceDrawn = false; update.state.surfaceVisible = false; update.state.surfaceControl = obtainSurface( update.state.surfaceWidth, update.state.surfaceHeight); update.state.surfaceControl = obtainSurface(update.state.surfaceWidth, update.state.surfaceHeight, update.state.displayId); if (update.state.surfaceControl != NULL) { update.surfaceChanged = surfaceChanged = true; } Loading Loading @@ -168,8 +169,8 @@ void SpriteController::doUpdateSprites() { } } // If surface is a new one, we have to set right layer stack. if (update.surfaceChanged || update.state.dirty & DIRTY_DISPLAY_ID) { // If surface has changed to a new display, we have to reparent it. if (update.state.dirty & DIRTY_DISPLAY_ID) { t.reparent(update.state.surfaceControl, mParentSurfaceProvider(update.state.displayId)); needApplyTransaction = true; } Loading Loading @@ -330,21 +331,28 @@ void SpriteController::ensureSurfaceComposerClient() { } } sp<SurfaceControl> SpriteController::obtainSurface(int32_t width, int32_t height) { sp<SurfaceControl> SpriteController::obtainSurface(int32_t width, int32_t height, int32_t displayId) { ensureSurfaceComposerClient(); sp<SurfaceControl> surfaceControl = mSurfaceComposerClient->createSurface( String8("Sprite"), width, height, PIXEL_FORMAT_RGBA_8888, const sp<SurfaceControl> parent = mParentSurfaceProvider(displayId); if (parent == nullptr) { ALOGE("Failed to get the parent surface for pointers on display %d", displayId); } const sp<SurfaceControl> surfaceControl = mSurfaceComposerClient->createSurface(String8("Sprite"), width, height, PIXEL_FORMAT_RGBA_8888, ISurfaceComposerClient::eHidden | ISurfaceComposerClient::eCursorWindow); if (surfaceControl == NULL || !surfaceControl->isValid()) { ISurfaceComposerClient::eCursorWindow, parent ? parent->getHandle() : nullptr); if (surfaceControl == nullptr || !surfaceControl->isValid()) { ALOGE("Error creating sprite surface."); return NULL; return nullptr; } return surfaceControl; } // --- SpriteController::SpriteImpl --- SpriteController::SpriteImpl::SpriteImpl(const sp<SpriteController> controller) : Loading
libs/input/SpriteController.h +1 −1 Original line number Diff line number Diff line Loading @@ -265,7 +265,7 @@ private: void doDisposeSurfaces(); void ensureSurfaceComposerClient(); sp<SurfaceControl> obtainSurface(int32_t width, int32_t height); sp<SurfaceControl> obtainSurface(int32_t width, int32_t height, int32_t displayId); }; } // namespace android Loading