libgui includes refactoring
Change-Id: I1d24ec17f5003ec2abab5f7472daaff4cc4cc2d3
This commit is contained in:
parent
1e26087493
commit
3165cc21cf
|
@ -39,54 +39,13 @@ class DisplayInfo;
|
|||
class IDisplayEventConnection;
|
||||
class IMemoryHeap;
|
||||
|
||||
class ISurfaceComposer : public IInterface
|
||||
{
|
||||
class ISurfaceComposer: public IInterface {
|
||||
public:
|
||||
DECLARE_META_INTERFACE(SurfaceComposer);
|
||||
|
||||
enum { // (keep in sync with Surface.java)
|
||||
eHidden = 0x00000004,
|
||||
eDestroyBackbuffer = 0x00000020,
|
||||
eSecure = 0x00000080,
|
||||
eNonPremultiplied = 0x00000100,
|
||||
eOpaque = 0x00000400,
|
||||
eProtectedByApp = 0x00000800,
|
||||
eProtectedByDRM = 0x00001000,
|
||||
|
||||
eFXSurfaceNormal = 0x00000000,
|
||||
eFXSurfaceBlur = 0x00010000,
|
||||
eFXSurfaceDim = 0x00020000,
|
||||
eFXSurfaceScreenshot= 0x00030000,
|
||||
eFXSurfaceMask = 0x000F0000,
|
||||
};
|
||||
|
||||
// flags for setTransactionState()
|
||||
enum {
|
||||
ePositionChanged = 0x00000001,
|
||||
eLayerChanged = 0x00000002,
|
||||
eSizeChanged = 0x00000004,
|
||||
eAlphaChanged = 0x00000008,
|
||||
eMatrixChanged = 0x00000010,
|
||||
eTransparentRegionChanged = 0x00000020,
|
||||
eVisibilityChanged = 0x00000040,
|
||||
eLayerStackChanged = 0x00000080,
|
||||
eCropChanged = 0x00000100,
|
||||
};
|
||||
|
||||
enum {
|
||||
eLayerHidden = 0x01,
|
||||
};
|
||||
|
||||
enum {
|
||||
eOrientationDefault = 0,
|
||||
eOrientation90 = 1,
|
||||
eOrientation180 = 2,
|
||||
eOrientation270 = 3,
|
||||
eOrientationUnchanged = 4,
|
||||
eOrientationSwapMask = 0x01
|
||||
};
|
||||
|
||||
enum {
|
||||
eSynchronous = 0x01,
|
||||
eSynchronous = 0x01,
|
||||
};
|
||||
|
||||
/* create connection with surface flinger, requires
|
||||
|
@ -99,10 +58,8 @@ public:
|
|||
virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc() = 0;
|
||||
|
||||
/* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
|
||||
virtual void setTransactionState(
|
||||
const Vector<ComposerState>& state,
|
||||
const Vector<DisplayState>& displays,
|
||||
uint32_t flags) = 0;
|
||||
virtual void setTransactionState(const Vector<ComposerState>& state,
|
||||
const Vector<DisplayState>& displays, uint32_t flags) = 0;
|
||||
|
||||
/* signal that we're done booting.
|
||||
* Requires ACCESS_SURFACE_FLINGER permission
|
||||
|
@ -112,11 +69,10 @@ public:
|
|||
/* Capture the specified screen. requires READ_FRAME_BUFFER permission
|
||||
* This function will fail if there is a secure window on screen.
|
||||
*/
|
||||
virtual status_t captureScreen(DisplayID dpy,
|
||||
sp<IMemoryHeap>* heap,
|
||||
virtual status_t captureScreen(DisplayID dpy, sp<IMemoryHeap>* heap,
|
||||
uint32_t* width, uint32_t* height, PixelFormat* format,
|
||||
uint32_t reqWidth, uint32_t reqHeight,
|
||||
uint32_t minLayerZ, uint32_t maxLayerZ) = 0;
|
||||
uint32_t reqWidth, uint32_t reqHeight, uint32_t minLayerZ,
|
||||
uint32_t maxLayerZ) = 0;
|
||||
|
||||
/* verify that an ISurfaceTexture was created by SurfaceFlinger.
|
||||
*/
|
||||
|
@ -142,8 +98,7 @@ public:
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class BnSurfaceComposer : public BnInterface<ISurfaceComposer>
|
||||
{
|
||||
class BnSurfaceComposer: public BnInterface<ISurfaceComposer> {
|
||||
public:
|
||||
enum {
|
||||
// Note: BOOT_FINISHED must remain this value, it is called from
|
||||
|
@ -153,7 +108,6 @@ public:
|
|||
CREATE_GRAPHIC_BUFFER_ALLOC,
|
||||
GET_DISPLAY_INFO,
|
||||
SET_TRANSACTION_STATE,
|
||||
SET_ORIENTATION,
|
||||
CAPTURE_SCREEN,
|
||||
AUTHENTICATE_SURFACE,
|
||||
CREATE_DISPLAY_EVENT_CONNECTION,
|
||||
|
@ -162,10 +116,8 @@ public:
|
|||
CONNECT_DISPLAY,
|
||||
};
|
||||
|
||||
virtual status_t onTransact( uint32_t code,
|
||||
const Parcel& data,
|
||||
Parcel* reply,
|
||||
uint32_t flags = 0);
|
||||
virtual status_t onTransact(uint32_t code, const Parcel& data,
|
||||
Parcel* reply, uint32_t flags = 0);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
@ -42,9 +42,26 @@ class ISurfaceComposerClient : public IInterface
|
|||
public:
|
||||
DECLARE_META_INTERFACE(SurfaceComposerClient);
|
||||
|
||||
// flags for createSurface()
|
||||
enum { // (keep in sync with Surface.java)
|
||||
eHidden = 0x00000004,
|
||||
eDestroyBackbuffer = 0x00000020,
|
||||
eSecure = 0x00000080,
|
||||
eNonPremultiplied = 0x00000100,
|
||||
eOpaque = 0x00000400,
|
||||
eProtectedByApp = 0x00000800,
|
||||
eProtectedByDRM = 0x00001000,
|
||||
|
||||
eFXSurfaceNormal = 0x00000000,
|
||||
eFXSurfaceBlur = 0x00010000, // deprecated, same as Dim
|
||||
eFXSurfaceDim = 0x00020000,
|
||||
eFXSurfaceScreenshot= 0x00030000,
|
||||
eFXSurfaceMask = 0x000F0000,
|
||||
};
|
||||
|
||||
struct surface_data_t {
|
||||
int32_t token;
|
||||
int32_t identity;
|
||||
int32_t token;
|
||||
int32_t identity;
|
||||
status_t readFromParcel(const Parcel& parcel);
|
||||
status_t writeToParcel(Parcel* parcel) const;
|
||||
};
|
||||
|
@ -52,29 +69,22 @@ public:
|
|||
/*
|
||||
* Requires ACCESS_SURFACE_FLINGER permission
|
||||
*/
|
||||
virtual sp<ISurface> createSurface( surface_data_t* data,
|
||||
const String8& name,
|
||||
DisplayID display,
|
||||
uint32_t w,
|
||||
uint32_t h,
|
||||
PixelFormat format,
|
||||
uint32_t flags) = 0;
|
||||
virtual sp<ISurface> createSurface(surface_data_t* data,
|
||||
const String8& name, DisplayID display, uint32_t w, uint32_t h,
|
||||
PixelFormat format, uint32_t flags) = 0;
|
||||
|
||||
/*
|
||||
* Requires ACCESS_SURFACE_FLINGER permission
|
||||
*/
|
||||
virtual status_t destroySurface(SurfaceID sid) = 0;
|
||||
virtual status_t destroySurface(SurfaceID sid) = 0;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class BnSurfaceComposerClient : public BnInterface<ISurfaceComposerClient>
|
||||
{
|
||||
class BnSurfaceComposerClient: public BnInterface<ISurfaceComposerClient> {
|
||||
public:
|
||||
virtual status_t onTransact( uint32_t code,
|
||||
const Parcel& data,
|
||||
Parcel* reply,
|
||||
uint32_t flags = 0);
|
||||
virtual status_t onTransact(uint32_t code, const Parcel& data,
|
||||
Parcel* reply, uint32_t flags = 0);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
@ -33,6 +33,23 @@ class ISurfaceComposerClient;
|
|||
|
||||
struct layer_state_t {
|
||||
|
||||
|
||||
enum {
|
||||
eLayerHidden = 0x01,
|
||||
};
|
||||
|
||||
enum {
|
||||
ePositionChanged = 0x00000001,
|
||||
eLayerChanged = 0x00000002,
|
||||
eSizeChanged = 0x00000004,
|
||||
eAlphaChanged = 0x00000008,
|
||||
eMatrixChanged = 0x00000010,
|
||||
eTransparentRegionChanged = 0x00000020,
|
||||
eVisibilityChanged = 0x00000040,
|
||||
eLayerStackChanged = 0x00000080,
|
||||
eCropChanged = 0x00000100,
|
||||
};
|
||||
|
||||
layer_state_t()
|
||||
: surface(0), what(0),
|
||||
x(0), y(0), z(0), w(0), h(0), layerStack(0),
|
||||
|
@ -79,6 +96,16 @@ struct ComposerState {
|
|||
};
|
||||
|
||||
struct DisplayState {
|
||||
|
||||
enum {
|
||||
eOrientationDefault = 0,
|
||||
eOrientation90 = 1,
|
||||
eOrientation180 = 2,
|
||||
eOrientation270 = 3,
|
||||
eOrientationUnchanged = 4,
|
||||
eOrientationSwapMask = 0x01
|
||||
};
|
||||
|
||||
int32_t displayId;
|
||||
sp<ISurfaceTexture> surface;
|
||||
uint32_t layerStack;
|
||||
|
|
|
@ -83,7 +83,7 @@ class Composer : public Singleton<Composer>
|
|||
uint32_t mForceSynchronous;
|
||||
|
||||
Composer() : Singleton<Composer>(),
|
||||
mOrientation(ISurfaceComposer::eOrientationUnchanged),
|
||||
mOrientation(DisplayState::eOrientationUnchanged),
|
||||
mForceSynchronous(0)
|
||||
{ }
|
||||
|
||||
|
@ -141,7 +141,7 @@ void Composer::closeGlobalTransactionImpl(bool synchronous) {
|
|||
item.orientation = mOrientation;
|
||||
displayTransaction.add(item);
|
||||
|
||||
mOrientation = ISurfaceComposer::eOrientationUnchanged;
|
||||
mOrientation = DisplayState::eOrientationUnchanged;
|
||||
|
||||
if (synchronous || mForceSynchronous) {
|
||||
flags |= ISurfaceComposer::eSynchronous;
|
||||
|
@ -175,7 +175,7 @@ status_t Composer::setPosition(const sp<SurfaceComposerClient>& client,
|
|||
layer_state_t* s = getLayerStateLocked(client, id);
|
||||
if (!s)
|
||||
return BAD_INDEX;
|
||||
s->what |= ISurfaceComposer::ePositionChanged;
|
||||
s->what |= layer_state_t::ePositionChanged;
|
||||
s->x = x;
|
||||
s->y = y;
|
||||
return NO_ERROR;
|
||||
|
@ -187,7 +187,7 @@ status_t Composer::setSize(const sp<SurfaceComposerClient>& client,
|
|||
layer_state_t* s = getLayerStateLocked(client, id);
|
||||
if (!s)
|
||||
return BAD_INDEX;
|
||||
s->what |= ISurfaceComposer::eSizeChanged;
|
||||
s->what |= layer_state_t::eSizeChanged;
|
||||
s->w = w;
|
||||
s->h = h;
|
||||
|
||||
|
@ -203,7 +203,7 @@ status_t Composer::setLayer(const sp<SurfaceComposerClient>& client,
|
|||
layer_state_t* s = getLayerStateLocked(client, id);
|
||||
if (!s)
|
||||
return BAD_INDEX;
|
||||
s->what |= ISurfaceComposer::eLayerChanged;
|
||||
s->what |= layer_state_t::eLayerChanged;
|
||||
s->z = z;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ status_t Composer::setFlags(const sp<SurfaceComposerClient>& client,
|
|||
layer_state_t* s = getLayerStateLocked(client, id);
|
||||
if (!s)
|
||||
return BAD_INDEX;
|
||||
s->what |= ISurfaceComposer::eVisibilityChanged;
|
||||
s->what |= layer_state_t::eVisibilityChanged;
|
||||
s->flags &= ~mask;
|
||||
s->flags |= (flags & mask);
|
||||
s->mask |= mask;
|
||||
|
@ -229,7 +229,7 @@ status_t Composer::setTransparentRegionHint(
|
|||
layer_state_t* s = getLayerStateLocked(client, id);
|
||||
if (!s)
|
||||
return BAD_INDEX;
|
||||
s->what |= ISurfaceComposer::eTransparentRegionChanged;
|
||||
s->what |= layer_state_t::eTransparentRegionChanged;
|
||||
s->transparentRegion = transparentRegion;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ status_t Composer::setAlpha(const sp<SurfaceComposerClient>& client,
|
|||
layer_state_t* s = getLayerStateLocked(client, id);
|
||||
if (!s)
|
||||
return BAD_INDEX;
|
||||
s->what |= ISurfaceComposer::eAlphaChanged;
|
||||
s->what |= layer_state_t::eAlphaChanged;
|
||||
s->alpha = alpha;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ status_t Composer::setLayerStack(const sp<SurfaceComposerClient>& client,
|
|||
layer_state_t* s = getLayerStateLocked(client, id);
|
||||
if (!s)
|
||||
return BAD_INDEX;
|
||||
s->what |= ISurfaceComposer::eLayerStackChanged;
|
||||
s->what |= layer_state_t::eLayerStackChanged;
|
||||
s->layerStack = layerStack;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ status_t Composer::setMatrix(const sp<SurfaceComposerClient>& client,
|
|||
layer_state_t* s = getLayerStateLocked(client, id);
|
||||
if (!s)
|
||||
return BAD_INDEX;
|
||||
s->what |= ISurfaceComposer::eMatrixChanged;
|
||||
s->what |= layer_state_t::eMatrixChanged;
|
||||
layer_state_t::matrix22_t matrix;
|
||||
matrix.dsdx = dsdx;
|
||||
matrix.dtdx = dtdx;
|
||||
|
@ -289,7 +289,7 @@ status_t Composer::setCrop(const sp<SurfaceComposerClient>& client,
|
|||
layer_state_t* s = getLayerStateLocked(client, id);
|
||||
if (!s)
|
||||
return BAD_INDEX;
|
||||
s->what |= ISurfaceComposer::eCropChanged;
|
||||
s->what |= layer_state_t::eCropChanged;
|
||||
s->crop = crop;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
@ -420,14 +420,14 @@ status_t SurfaceComposerClient::setLayer(SurfaceID id, int32_t z) {
|
|||
|
||||
status_t SurfaceComposerClient::hide(SurfaceID id) {
|
||||
return getComposer().setFlags(this, id,
|
||||
ISurfaceComposer::eLayerHidden,
|
||||
ISurfaceComposer::eLayerHidden);
|
||||
layer_state_t::eLayerHidden,
|
||||
layer_state_t::eLayerHidden);
|
||||
}
|
||||
|
||||
status_t SurfaceComposerClient::show(SurfaceID id, int32_t) {
|
||||
return getComposer().setFlags(this, id,
|
||||
0,
|
||||
ISurfaceComposer::eLayerHidden);
|
||||
layer_state_t::eLayerHidden);
|
||||
}
|
||||
|
||||
status_t SurfaceComposerClient::setFlags(SurfaceID id, uint32_t flags,
|
||||
|
|
|
@ -59,39 +59,6 @@ void checkGLErrors()
|
|||
} while(true);
|
||||
}
|
||||
|
||||
static __attribute__((noinline))
|
||||
void checkEGLErrors(const char* token)
|
||||
{
|
||||
struct EGLUtils {
|
||||
static const char *strerror(EGLint err) {
|
||||
switch (err){
|
||||
case EGL_SUCCESS: return "EGL_SUCCESS";
|
||||
case EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED";
|
||||
case EGL_BAD_ACCESS: return "EGL_BAD_ACCESS";
|
||||
case EGL_BAD_ALLOC: return "EGL_BAD_ALLOC";
|
||||
case EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE";
|
||||
case EGL_BAD_CONFIG: return "EGL_BAD_CONFIG";
|
||||
case EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT";
|
||||
case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE";
|
||||
case EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY";
|
||||
case EGL_BAD_MATCH: return "EGL_BAD_MATCH";
|
||||
case EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP";
|
||||
case EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW";
|
||||
case EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER";
|
||||
case EGL_BAD_SURFACE: return "EGL_BAD_SURFACE";
|
||||
case EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST";
|
||||
default: return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
EGLint error = eglGetError();
|
||||
if (error && error != EGL_SUCCESS) {
|
||||
ALOGE("%s: EGL error 0x%04x (%s)",
|
||||
token, int(error), EGLUtils::strerror(error));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
|
@ -220,7 +187,7 @@ void DisplayDevice::init(EGLConfig config)
|
|||
mPageFlipCount = 0;
|
||||
|
||||
// initialize the display orientation transform.
|
||||
DisplayDevice::setOrientation(ISurfaceComposer::eOrientationDefault);
|
||||
DisplayDevice::setOrientation(DisplayState::eOrientationDefault);
|
||||
}
|
||||
|
||||
uint32_t DisplayDevice::getPageFlipCount() const {
|
||||
|
@ -325,16 +292,16 @@ status_t DisplayDevice::orientationToTransfrom(
|
|||
{
|
||||
uint32_t flags = 0;
|
||||
switch (orientation) {
|
||||
case ISurfaceComposer::eOrientationDefault:
|
||||
case DisplayState::eOrientationDefault:
|
||||
flags = Transform::ROT_0;
|
||||
break;
|
||||
case ISurfaceComposer::eOrientation90:
|
||||
case DisplayState::eOrientation90:
|
||||
flags = Transform::ROT_90;
|
||||
break;
|
||||
case ISurfaceComposer::eOrientation180:
|
||||
case DisplayState::eOrientation180:
|
||||
flags = Transform::ROT_180;
|
||||
break;
|
||||
case ISurfaceComposer::eOrientation270:
|
||||
case DisplayState::eOrientation270:
|
||||
flags = Transform::ROT_270;
|
||||
break;
|
||||
default:
|
||||
|
@ -350,7 +317,7 @@ status_t DisplayDevice::setOrientation(int orientation) {
|
|||
|
||||
DisplayDevice::orientationToTransfrom(
|
||||
orientation, w, h, &mGlobalTransform);
|
||||
if (orientation & ISurfaceComposer::eOrientationSwapMask) {
|
||||
if (orientation & DisplayState::eOrientationSwapMask) {
|
||||
int tmp = w;
|
||||
w = h;
|
||||
h = tmp;
|
||||
|
|
|
@ -182,9 +182,9 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h,
|
|||
|
||||
mFormat = format;
|
||||
|
||||
mSecure = (flags & ISurfaceComposer::eSecure) ? true : false;
|
||||
mProtectedByApp = (flags & ISurfaceComposer::eProtectedByApp) ? true : false;
|
||||
mOpaqueLayer = (flags & ISurfaceComposer::eOpaque);
|
||||
mSecure = (flags & ISurfaceComposerClient::eSecure) ? true : false;
|
||||
mProtectedByApp = (flags & ISurfaceComposerClient::eProtectedByApp) ? true : false;
|
||||
mOpaqueLayer = (flags & ISurfaceComposerClient::eOpaque);
|
||||
mCurrentOpacity = getOpacityForFormat(format);
|
||||
|
||||
mSurfaceTexture->setDefaultBufferSize(w, h);
|
||||
|
|
|
@ -66,10 +66,10 @@ String8 LayerBase::getName() const {
|
|||
void LayerBase::initStates(uint32_t w, uint32_t h, uint32_t flags)
|
||||
{
|
||||
uint32_t layerFlags = 0;
|
||||
if (flags & ISurfaceComposer::eHidden)
|
||||
layerFlags = ISurfaceComposer::eLayerHidden;
|
||||
if (flags & ISurfaceComposerClient::eHidden)
|
||||
layerFlags = layer_state_t::eLayerHidden;
|
||||
|
||||
if (flags & ISurfaceComposer::eNonPremultiplied)
|
||||
if (flags & ISurfaceComposerClient::eNonPremultiplied)
|
||||
mPremultipliedAlpha = false;
|
||||
|
||||
mCurrentState.active.w = w;
|
||||
|
|
|
@ -80,7 +80,7 @@ void LayerScreenshot::initTexture(GLfloat u, GLfloat v) {
|
|||
|
||||
void LayerScreenshot::initStates(uint32_t w, uint32_t h, uint32_t flags) {
|
||||
LayerBaseClient::initStates(w, h, flags);
|
||||
if (!(flags & ISurfaceComposer::eHidden)) {
|
||||
if (!(flags & ISurfaceComposerClient::eHidden)) {
|
||||
capture();
|
||||
}
|
||||
}
|
||||
|
@ -90,15 +90,15 @@ uint32_t LayerScreenshot::doTransaction(uint32_t flags)
|
|||
const LayerBase::State& draw(drawingState());
|
||||
const LayerBase::State& curr(currentState());
|
||||
|
||||
if (draw.flags & ISurfaceComposer::eLayerHidden) {
|
||||
if (!(curr.flags & ISurfaceComposer::eLayerHidden)) {
|
||||
if (draw.flags & layer_state_t::eLayerHidden) {
|
||||
if (!(curr.flags & layer_state_t::eLayerHidden)) {
|
||||
// we're going from hidden to visible
|
||||
status_t err = captureLocked();
|
||||
if (err != NO_ERROR) {
|
||||
ALOGW("createScreenshotSurface failed (%s)", strerror(-err));
|
||||
}
|
||||
}
|
||||
} else if (curr.flags & ISurfaceComposer::eLayerHidden) {
|
||||
} else if (curr.flags & layer_state_t::eLayerHidden) {
|
||||
// we're going from visible to hidden
|
||||
if (mTextureName) {
|
||||
glDeleteTextures(1, &mTextureName);
|
||||
|
|
|
@ -142,7 +142,7 @@ void SurfaceFlinger::binderDied(const wp<IBinder>& who)
|
|||
Vector<ComposerState> state;
|
||||
Vector<DisplayState> displays;
|
||||
DisplayState d;
|
||||
d.orientation = eOrientationDefault;
|
||||
d.orientation = DisplayState::eOrientationDefault;
|
||||
displays.add(d);
|
||||
setTransactionState(state, displays, 0);
|
||||
|
||||
|
@ -970,7 +970,7 @@ void SurfaceFlinger::computeVisibleRegions(
|
|||
|
||||
|
||||
// handle hidden surfaces by setting the visible region to empty
|
||||
if (CC_LIKELY(!(s.flags & ISurfaceComposer::eLayerHidden) && s.alpha)) {
|
||||
if (CC_LIKELY(!(s.flags & layer_state_t::eLayerHidden) && s.alpha)) {
|
||||
const bool translucent = !layer->isOpaque();
|
||||
Rect bounds(layer->computeBounds());
|
||||
visibleRegion.set(bounds);
|
||||
|
@ -1366,7 +1366,7 @@ void SurfaceFlinger::setTransactionState(
|
|||
{
|
||||
Mutex::Autolock _l(mStateLock);
|
||||
|
||||
int orientation = eOrientationUnchanged;
|
||||
int orientation = DisplayState::eOrientationUnchanged;
|
||||
if (displays.size()) {
|
||||
// TODO: handle all displays
|
||||
orientation = displays[0].orientation;
|
||||
|
@ -1375,10 +1375,10 @@ void SurfaceFlinger::setTransactionState(
|
|||
uint32_t transactionFlags = 0;
|
||||
// FIXME: don't hardcode display id here
|
||||
if (mCurrentState.displays.valueFor(0).orientation != orientation) {
|
||||
if (uint32_t(orientation)<=eOrientation270 || orientation==42) {
|
||||
if (uint32_t(orientation) <= DisplayState::eOrientation270) {
|
||||
mCurrentState.displays.editValueFor(0).orientation = orientation;
|
||||
transactionFlags |= eTransactionNeeded;
|
||||
} else if (orientation != eOrientationUnchanged) {
|
||||
} else if (orientation != DisplayState::eOrientationUnchanged) {
|
||||
ALOGW("setTransactionState: ignoring unrecognized orientation: %d",
|
||||
orientation);
|
||||
}
|
||||
|
@ -1430,17 +1430,15 @@ sp<ISurface> SurfaceFlinger::createLayer(
|
|||
}
|
||||
|
||||
//ALOGD("createLayer for (%d x %d), name=%s", w, h, name.string());
|
||||
switch (flags & eFXSurfaceMask) {
|
||||
case eFXSurfaceNormal:
|
||||
switch (flags & ISurfaceComposerClient::eFXSurfaceMask) {
|
||||
case ISurfaceComposerClient::eFXSurfaceNormal:
|
||||
layer = createNormalLayer(client, d, w, h, flags, format);
|
||||
break;
|
||||
case eFXSurfaceBlur:
|
||||
// for now we treat Blur as Dim, until we can implement it
|
||||
// efficiently.
|
||||
case eFXSurfaceDim:
|
||||
case ISurfaceComposerClient::eFXSurfaceBlur:
|
||||
case ISurfaceComposerClient::eFXSurfaceDim:
|
||||
layer = createDimLayer(client, d, w, h, flags);
|
||||
break;
|
||||
case eFXSurfaceScreenshot:
|
||||
case ISurfaceComposerClient::eFXSurfaceScreenshot:
|
||||
layer = createScreenshotLayer(client, d, w, h, flags);
|
||||
break;
|
||||
}
|
||||
|
@ -1564,11 +1562,11 @@ uint32_t SurfaceFlinger::setClientStateLocked(
|
|||
sp<LayerBaseClient> layer(client->getLayerUser(s.surface));
|
||||
if (layer != 0) {
|
||||
const uint32_t what = s.what;
|
||||
if (what & ePositionChanged) {
|
||||
if (what & layer_state_t::ePositionChanged) {
|
||||
if (layer->setPosition(s.x, s.y))
|
||||
flags |= eTraversalNeeded;
|
||||
}
|
||||
if (what & eLayerChanged) {
|
||||
if (what & layer_state_t::eLayerChanged) {
|
||||
// NOTE: index needs to be calculated before we update the state
|
||||
ssize_t idx = mCurrentState.layersSortedByZ.indexOf(layer);
|
||||
if (layer->setLayer(s.z)) {
|
||||
|
@ -1579,32 +1577,32 @@ uint32_t SurfaceFlinger::setClientStateLocked(
|
|||
flags |= eTransactionNeeded|eTraversalNeeded;
|
||||
}
|
||||
}
|
||||
if (what & eSizeChanged) {
|
||||
if (what & layer_state_t::eSizeChanged) {
|
||||
if (layer->setSize(s.w, s.h)) {
|
||||
flags |= eTraversalNeeded;
|
||||
}
|
||||
}
|
||||
if (what & eAlphaChanged) {
|
||||
if (what & layer_state_t::eAlphaChanged) {
|
||||
if (layer->setAlpha(uint8_t(255.0f*s.alpha+0.5f)))
|
||||
flags |= eTraversalNeeded;
|
||||
}
|
||||
if (what & eMatrixChanged) {
|
||||
if (what & layer_state_t::eMatrixChanged) {
|
||||
if (layer->setMatrix(s.matrix))
|
||||
flags |= eTraversalNeeded;
|
||||
}
|
||||
if (what & eTransparentRegionChanged) {
|
||||
if (what & layer_state_t::eTransparentRegionChanged) {
|
||||
if (layer->setTransparentRegionHint(s.transparentRegion))
|
||||
flags |= eTraversalNeeded;
|
||||
}
|
||||
if (what & eVisibilityChanged) {
|
||||
if (what & layer_state_t::eVisibilityChanged) {
|
||||
if (layer->setFlags(s.flags, s.mask))
|
||||
flags |= eTraversalNeeded;
|
||||
}
|
||||
if (what & eCropChanged) {
|
||||
if (what & layer_state_t::eCropChanged) {
|
||||
if (layer->setCrop(s.crop))
|
||||
flags |= eTraversalNeeded;
|
||||
}
|
||||
if (what & eLayerStackChanged) {
|
||||
if (what & layer_state_t::eLayerStackChanged) {
|
||||
// NOTE: index needs to be calculated before we update the state
|
||||
ssize_t idx = mCurrentState.layersSortedByZ.indexOf(layer);
|
||||
if (layer->setLayerStack(s.layerStack)) {
|
||||
|
@ -1907,7 +1905,6 @@ status_t SurfaceFlinger::onTransact(
|
|||
switch (code) {
|
||||
case CREATE_CONNECTION:
|
||||
case SET_TRANSACTION_STATE:
|
||||
case SET_ORIENTATION:
|
||||
case BOOT_FINISHED:
|
||||
case BLANK:
|
||||
case UNBLANK:
|
||||
|
@ -2162,7 +2159,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy,
|
|||
for (size_t i=0 ; i<count ; ++i) {
|
||||
const sp<LayerBase>& layer(layers[i]);
|
||||
const uint32_t flags = layer->drawingState().flags;
|
||||
if (!(flags & ISurfaceComposer::eLayerHidden)) {
|
||||
if (!(flags & layer_state_t::eLayerHidden)) {
|
||||
const uint32_t z = layer->drawingState().z;
|
||||
if (z >= minLayerZ && z <= maxLayerZ) {
|
||||
if (filtering) layer->setFiltering(true);
|
||||
|
|
Loading…
Reference in New Issue