const sp<IBinder>& handle, uint64_t frameNumber);
status_t setOverrideScalingMode(const sp<IBinder>& id,
int32_t overrideScalingMode);
- status_t setPositionAppliesWithResize(const sp<IBinder>& id);
+ status_t setGeometryAppliesWithResize(const sp<IBinder>& id);
status_t destroySurface(const sp<IBinder>& id);
status_t setCrop(const Rect& crop);
status_t setFinalCrop(const Rect& crop);
- // If the size changes in this transaction, position updates specified
+ // If the size changes in this transaction, all geometry updates specified
// in this transaction will not complete until a buffer of the new size
- // arrives.
- status_t setPositionAppliesWithResize();
+ // arrives. As some elements normally apply immediately, this enables
+ // freezing the total geometry of a surface until a resize is completed.
+ status_t setGeometryAppliesWithResize();
// Defers applying any changes made in this transaction until the Layer
// identified by handle reaches the given frameNumber
eDeferTransaction = 0x00000200,
eFinalCropChanged = 0x00000400,
eOverrideScalingModeChanged = 0x00000800,
- ePositionAppliesWithResize = 0x00001000,
+ eGeometryAppliesWithResize = 0x00001000,
};
layer_state_t()
uint64_t frameNumber);
status_t setOverrideScalingMode(const sp<SurfaceComposerClient>& client,
const sp<IBinder>& id, int32_t overrideScalingMode);
- status_t setPositionAppliesWithResize(const sp<SurfaceComposerClient>& client,
+ status_t setGeometryAppliesWithResize(const sp<SurfaceComposerClient>& client,
const sp<IBinder>& id);
void setDisplaySurface(const sp<IBinder>& token,
return NO_ERROR;
}
-status_t Composer::setPositionAppliesWithResize(
+status_t Composer::setGeometryAppliesWithResize(
const sp<SurfaceComposerClient>& client,
const sp<IBinder>& id) {
Mutex::Autolock lock(mLock);
if (!s) {
return BAD_INDEX;
}
- s->what |= layer_state_t::ePositionAppliesWithResize;
+ s->what |= layer_state_t::eGeometryAppliesWithResize;
return NO_ERROR;
}
this, id, overrideScalingMode);
}
-status_t SurfaceComposerClient::setPositionAppliesWithResize(
+status_t SurfaceComposerClient::setGeometryAppliesWithResize(
const sp<IBinder>& id) {
- return getComposer().setPositionAppliesWithResize(this, id);
+ return getComposer().setGeometryAppliesWithResize(this, id);
}
// ----------------------------------------------------------------------------
if (err < 0) return err;
return mClient->setPosition(mHandle, x, y);
}
-status_t SurfaceControl::setPositionAppliesWithResize() {
+status_t SurfaceControl::setGeometryAppliesWithResize() {
status_t err = validate();
if (err < 0) return err;
- return mClient->setPositionAppliesWithResize(mHandle);
+ return mClient->setGeometryAppliesWithResize(mHandle);
}
status_t SurfaceControl::setSize(uint32_t w, uint32_t h) {
status_t err = validate();
setTransactionFlags(eTransactionNeeded);
return true;
}
-bool Layer::setCrop(const Rect& crop) {
+
+bool Layer::setCrop(const Rect& crop, bool immediate) {
if (mCurrentState.crop == crop)
return false;
mCurrentState.sequence++;
- mCurrentState.crop = crop;
+ mCurrentState.requestedCrop = crop;
+ if (immediate) {
+ mCurrentState.crop = crop;
+ }
mCurrentState.modified = true;
setTransactionFlags(eTransactionNeeded);
return true;
recomputeVisibleRegions = true;
}
+ if (front.crop != front.requestedCrop) {
+ front.crop = front.requestedCrop;
+ current.crop = front.requestedCrop;
+ recomputeVisibleRegions = true;
+ }
+
return false;
}
};
Transform transform;
inline bool operator ==(const Geometry& rhs) const {
- return (w == rhs.w && h == rhs.h);
+ return (w == rhs.w && h == rhs.h) &&
+ (transform.tx() == rhs.transform.tx()) &&
+ (transform.ty() == rhs.transform.ty());
}
inline bool operator !=(const Geometry& rhs) const {
return !operator ==(rhs);
bool modified;
Rect crop;
+ Rect requestedCrop;
+
Rect finalCrop;
// If set, defers this state update until the Layer identified by handle
bool setMatrix(const layer_state_t::matrix22_t& matrix);
bool setTransparentRegionHint(const Region& transparent);
bool setFlags(uint8_t flags, uint8_t mask);
- bool setCrop(const Rect& crop);
+ bool setCrop(const Rect& crop, bool immediate);
bool setFinalCrop(const Rect& crop);
bool setLayerStack(uint32_t layerStack);
void deferTransactionUntil(const sp<IBinder>& handle, uint64_t frameNumber);
sp<Layer> layer(client->getLayerUser(s.surface));
if (layer != 0) {
const uint32_t what = s.what;
- bool positionAppliesWithResize =
- what & layer_state_t::ePositionAppliesWithResize;
+ bool geometryAppliesWithResize =
+ what & layer_state_t::eGeometryAppliesWithResize;
if (what & layer_state_t::ePositionChanged) {
- if (layer->setPosition(s.x, s.y, !positionAppliesWithResize)) {
+ if (layer->setPosition(s.x, s.y, !geometryAppliesWithResize)) {
flags |= eTraversalNeeded;
}
}
flags |= eTraversalNeeded;
}
if (what & layer_state_t::eCropChanged) {
- if (layer->setCrop(s.crop))
+ if (layer->setCrop(s.crop, !geometryAppliesWithResize))
flags |= eTraversalNeeded;
}
if (what & layer_state_t::eFinalCropChanged) {
sp<Layer> layer(client->getLayerUser(s.surface));
if (layer != 0) {
const uint32_t what = s.what;
- bool positionAppliesWithResize =
- what & layer_state_t::ePositionAppliesWithResize;
+ bool geometryAppliesWithResize =
+ what & layer_state_t::eGeometryAppliesWithResize;
if (what & layer_state_t::ePositionChanged) {
- if (layer->setPosition(s.x, s.y, !positionAppliesWithResize)) {
+ if (layer->setPosition(s.x, s.y, !geometryAppliesWithResize)) {
flags |= eTraversalNeeded;
}
}
flags |= eTraversalNeeded;
}
if (what & layer_state_t::eCropChanged) {
- if (layer->setCrop(s.crop))
+ if (layer->setCrop(s.crop, !geometryAppliesWithResize))
flags |= eTraversalNeeded;
}
if (what & layer_state_t::eFinalCropChanged) {