Remove useIdentityTransform from DisplayCaptureArgs.
Screenshots do not set useIdentityTransfrom to true with
a rotated display. The default value is false in
SurfaceFlinger and is not relevant for captureLayers,
which is the API that will be used for screenshots going
forward. Rotation flags are no longer relevant in
DisplayRenderArea and rotation values can be simplified
to 0 rotation by default.
Bug: 293445881
Test: atest LayerStateTest
Test: presubmit
Change-Id: Id0cce05458c3daa4078097057f00fd856df1e092
diff --git a/services/surfaceflinger/ScreenCaptureOutput.cpp b/services/surfaceflinger/ScreenCaptureOutput.cpp
index ef9b457..57b0d5e 100644
--- a/services/surfaceflinger/ScreenCaptureOutput.cpp
+++ b/services/surfaceflinger/ScreenCaptureOutput.cpp
@@ -16,6 +16,7 @@
#include "ScreenCaptureOutput.h"
#include "ScreenCaptureRenderSurface.h"
+#include "ui/Rotation.h"
#include <compositionengine/CompositionEngine.h>
#include <compositionengine/DisplayColorProfileCreationArgs.h>
@@ -24,24 +25,6 @@
namespace android {
-namespace {
-
-ui::Size getDisplaySize(ui::Rotation orientation, const Rect& sourceCrop) {
- if (orientation == ui::Rotation::Rotation90 || orientation == ui::Rotation::Rotation270) {
- return {sourceCrop.getHeight(), sourceCrop.getWidth()};
- }
- return {sourceCrop.getWidth(), sourceCrop.getHeight()};
-}
-
-Rect getOrientedDisplaySpaceRect(ui::Rotation orientation, int reqWidth, int reqHeight) {
- if (orientation == ui::Rotation::Rotation90 || orientation == ui::Rotation::Rotation270) {
- return {reqHeight, reqWidth};
- }
- return {reqWidth, reqHeight};
-}
-
-} // namespace
-
std::shared_ptr<ScreenCaptureOutput> createScreenCaptureOutput(ScreenCaptureOutputArgs args) {
std::shared_ptr<ScreenCaptureOutput> output = compositionengine::impl::createOutputTemplated<
ScreenCaptureOutput, compositionengine::CompositionEngine, const RenderArea&,
@@ -62,11 +45,10 @@
.Build()));
const Rect& sourceCrop = args.renderArea.getSourceCrop();
- const ui::Rotation orientation = ui::Transform::toRotation(args.renderArea.getRotationFlags());
- output->setDisplaySize(getDisplaySize(orientation, sourceCrop));
+ const ui::Rotation orientation = ui::ROTATION_0;
+ output->setDisplaySize({sourceCrop.getWidth(), sourceCrop.getHeight()});
output->setProjection(orientation, sourceCrop,
- getOrientedDisplaySpaceRect(orientation, args.renderArea.getReqWidth(),
- args.renderArea.getReqHeight()));
+ {args.renderArea.getReqWidth(), args.renderArea.getReqHeight()});
{
std::string name = args.regionSampling ? "RegionSampling" : "ScreenCaptureOutput";