summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2014-02-14 15:03:43 -0800
committerDan Stoza <stoza@google.com>2014-02-14 23:10:42 +0000
commitc701401f8cec2e5309f8b57e2b97baced5093274 (patch)
treee79551fa95d634d1d83beda68a431e53adde43d4 /services/surfaceflinger/Layer.cpp
parent87c01edaf6921bcf39537418fa146dafd927b74b (diff)
downloadframeworks_native-c701401f8cec2e5309f8b57e2b97baced5093274.zip
frameworks_native-c701401f8cec2e5309f8b57e2b97baced5093274.tar.gz
frameworks_native-c701401f8cec2e5309f8b57e2b97baced5093274.tar.bz2
Allow disabling layer rotation during screenshots
Add the ability to ignore layers' transformation matrices during screenshot capture, which will allow the window manager to capture unrotated images for recents during the device rotation animation. Bug: 11805195 Change-Id: I854d87bc84ca06ef9a054a454af1c080ee66fbb8
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp39
1 files changed, 24 insertions, 15 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index fcc9d78..465d376 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -145,7 +145,7 @@ Layer::~Layer() {
// callbacks
// ---------------------------------------------------------------------------
-void Layer::onLayerDisplayed(const sp<const DisplayDevice>& hw,
+void Layer::onLayerDisplayed(const sp<const DisplayDevice>& /* hw */,
HWComposer::HWCLayerInterface* layer) {
if (layer) {
layer->onDisplayed();
@@ -418,7 +418,7 @@ void Layer::setPerFrameData(const sp<const DisplayDevice>& hw,
layer.setBuffer(mActiveBuffer);
}
-void Layer::setAcquireFence(const sp<const DisplayDevice>& hw,
+void Layer::setAcquireFence(const sp<const DisplayDevice>& /* hw */,
HWComposer::HWCLayerInterface& layer) {
int fenceFd = -1;
@@ -442,14 +442,20 @@ void Layer::setAcquireFence(const sp<const DisplayDevice>& hw,
// ---------------------------------------------------------------------------
void Layer::draw(const sp<const DisplayDevice>& hw, const Region& clip) const {
- onDraw(hw, clip);
+ onDraw(hw, clip, false);
}
-void Layer::draw(const sp<const DisplayDevice>& hw) {
- onDraw( hw, Region(hw->bounds()) );
+void Layer::draw(const sp<const DisplayDevice>& hw,
+ bool useIdentityTransform) const {
+ onDraw(hw, Region(hw->bounds()), useIdentityTransform);
}
-void Layer::onDraw(const sp<const DisplayDevice>& hw, const Region& clip) const
+void Layer::draw(const sp<const DisplayDevice>& hw) const {
+ onDraw(hw, Region(hw->bounds()), false);
+}
+
+void Layer::onDraw(const sp<const DisplayDevice>& hw, const Region& clip,
+ bool useIdentityTransform) const
{
ATRACE_CALL();
@@ -540,16 +546,17 @@ void Layer::onDraw(const sp<const DisplayDevice>& hw, const Region& clip) const
} else {
engine.setupLayerBlackedOut();
}
- drawWithOpenGL(hw, clip);
+ drawWithOpenGL(hw, clip, useIdentityTransform);
engine.disableTexturing();
}
-void Layer::clearWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip,
- float red, float green, float blue, float alpha) const
+void Layer::clearWithOpenGL(const sp<const DisplayDevice>& hw,
+ const Region& /* clip */, float red, float green, float blue,
+ float alpha) const
{
RenderEngine& engine(mFlinger->getRenderEngine());
- computeGeometry(hw, mMesh);
+ computeGeometry(hw, mMesh, false);
engine.setupFillWithColor(red, green, blue, alpha);
engine.drawMesh(mMesh);
}
@@ -559,12 +566,12 @@ void Layer::clearWithOpenGL(
clearWithOpenGL(hw, clip, 0,0,0,0);
}
-void Layer::drawWithOpenGL(
- const sp<const DisplayDevice>& hw, const Region& clip) const {
+void Layer::drawWithOpenGL(const sp<const DisplayDevice>& hw,
+ const Region& /* clip */, bool useIdentityTransform) const {
const uint32_t fbHeight = hw->getHeight();
const State& s(getDrawingState());
- computeGeometry(hw, mMesh);
+ computeGeometry(hw, mMesh, useIdentityTransform);
/*
* NOTE: the way we compute the texture coordinates here produces
@@ -634,10 +641,12 @@ bool Layer::getOpacityForFormat(uint32_t format) {
// local state
// ----------------------------------------------------------------------------
-void Layer::computeGeometry(const sp<const DisplayDevice>& hw, Mesh& mesh) const
+void Layer::computeGeometry(const sp<const DisplayDevice>& hw, Mesh& mesh,
+ bool useIdentityTransform) const
{
const Layer::State& s(getDrawingState());
- const Transform tr(hw->getTransform() * s.transform);
+ const Transform tr(useIdentityTransform ?
+ hw->getTransform() : hw->getTransform() * s.transform);
const uint32_t hw_h = hw->getHeight();
Rect win(s.active.w, s.active.h);
if (!s.active.crop.isEmpty()) {