diff options
Diffstat (limited to 'libs/gui/SurfaceComposerClient.cpp')
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 80dd6ee..e6b4b21 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -393,6 +393,15 @@ void Composer::setDisplayProjection(const sp<IBinder>& token, mForceSynchronous = true; // TODO: do we actually still need this? } +status_t Composer::setOrientation(int orientation) { + sp<ISurfaceComposer> sm(ComposerService::getComposerService()); + sp<IBinder> token(sm->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain)); + DisplayState& s(getDisplayStateLocked(token)); + s.orientation = orientation; + mForceSynchronous = true; // TODO: do we actually still need this? + return NO_ERROR; +} + // --------------------------------------------------------------------------- SurfaceComposerClient::SurfaceComposerClient() @@ -441,6 +450,30 @@ void SurfaceComposerClient::dispose() { mStatus = NO_INIT; } +/* Create ICS/MR0-compatible constructors */ +extern "C" sp<SurfaceControl> _ZN7android21SurfaceComposerClient13createSurfaceERKNS_7String8Ejjij( + const String8& name, + uint32_t w, + uint32_t h, + PixelFormat format, + uint32_t flags); +extern "C" sp<SurfaceControl> _ZN7android21SurfaceComposerClient13createSurfaceEijjij( + uint32_t display, + uint32_t w, + uint32_t h, + PixelFormat format, + uint32_t flags) +{ + String8 name; + const size_t SIZE = 128; + char buffer[SIZE]; + snprintf(buffer, SIZE, "<pid_%d>", getpid()); + name.append(buffer); + + return _ZN7android21SurfaceComposerClient13createSurfaceERKNS_7String8Ejjij(name, + w, h, format, flags); +} + sp<SurfaceControl> SurfaceComposerClient::createSurface( const String8& name, uint32_t w, @@ -547,6 +580,11 @@ status_t SurfaceComposerClient::setMatrix(SurfaceID id, float dsdx, float dtdx, return getComposer().setMatrix(this, id, dsdx, dtdx, dsdy, dtdy); } +status_t SurfaceComposerClient::setOrientation(int32_t dpy, int orientation, uint32_t flags) +{ + return Composer::getInstance().setOrientation(orientation); +} + // ---------------------------------------------------------------------------- void SurfaceComposerClient::setDisplaySurface(const sp<IBinder>& token, @@ -583,12 +621,49 @@ void SurfaceComposerClient::unblankDisplay(const sp<IBinder>& token) { ComposerService::getComposerService()->unblank(token); } +// TODO: Remove me. Do not use. +// This is a compatibility shim for one product whose drivers are depending on +// this legacy function (when they shouldn't). +status_t SurfaceComposerClient::getDisplayInfo( + int32_t displayId, DisplayInfo* info) +{ + return getDisplayInfo(getBuiltInDisplay(displayId), info); +} + +#if defined(ICS_CAMERA_BLOB) || defined(MR0_CAMERA_BLOB) +ssize_t SurfaceComposerClient::getDisplayWidth(int32_t displayId) { + DisplayInfo info; + getDisplayInfo(getBuiltInDisplay(displayId), &info); + return info.w; +} + +ssize_t SurfaceComposerClient::getDisplayHeight(int32_t displayId) { + DisplayInfo info; + getDisplayInfo(getBuiltInDisplay(displayId), &info); + return info.h; +} + +ssize_t SurfaceComposerClient::getDisplayOrientation(int32_t displayId) { + DisplayInfo info; + getDisplayInfo(getBuiltInDisplay(displayId), &info); + return info.orientation; +} +#endif + // ---------------------------------------------------------------------------- ScreenshotClient::ScreenshotClient() : mWidth(0), mHeight(0), mFormat(PIXEL_FORMAT_NONE) { } +// TODO: Remove me. Do not use. +// This is a compatibility shim for one product whose drivers are depending on +// this legacy function (when they shouldn't). +status_t ScreenshotClient::update() { + sp<ISurfaceComposer> sm(ComposerService::getComposerService()); + return update(sm->getBuiltInDisplay(0)); +} + status_t ScreenshotClient::update(const sp<IBinder>& display) { sp<ISurfaceComposer> s(ComposerService::getComposerService()); if (s == NULL) return NO_INIT; |