diff options
-rw-r--r-- | libs/gui/LayerState.cpp | 2 | ||||
-rw-r--r-- | libs/gui/include/gui/DisplayCaptureArgs.h | 1 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayRenderArea.cpp | 33 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayRenderArea.h | 4 | ||||
-rw-r--r-- | services/surfaceflinger/RegionSamplingThread.cpp | 4 | ||||
-rw-r--r-- | services/surfaceflinger/RenderArea.h | 10 | ||||
-rw-r--r-- | services/surfaceflinger/ScreenCaptureOutput.cpp | 26 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 4 | ||||
-rw-r--r-- | services/surfaceflinger/tests/LayerState_test.cpp | 2 |
9 files changed, 12 insertions, 74 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index fd8fc8d123..7dea38e4cc 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -930,7 +930,6 @@ status_t DisplayCaptureArgs::writeToParcel(Parcel* output) const { SAFE_PARCEL(output->writeStrongBinder, displayToken); SAFE_PARCEL(output->writeUint32, width); SAFE_PARCEL(output->writeUint32, height); - SAFE_PARCEL(output->writeBool, useIdentityTransform); return NO_ERROR; } @@ -940,7 +939,6 @@ status_t DisplayCaptureArgs::readFromParcel(const Parcel* input) { SAFE_PARCEL(input->readStrongBinder, &displayToken); SAFE_PARCEL(input->readUint32, &width); SAFE_PARCEL(input->readUint32, &height); - SAFE_PARCEL(input->readBool, &useIdentityTransform); return NO_ERROR; } diff --git a/libs/gui/include/gui/DisplayCaptureArgs.h b/libs/gui/include/gui/DisplayCaptureArgs.h index 2676e0a338..e29ce41bd5 100644 --- a/libs/gui/include/gui/DisplayCaptureArgs.h +++ b/libs/gui/include/gui/DisplayCaptureArgs.h @@ -76,7 +76,6 @@ struct DisplayCaptureArgs : CaptureArgs { sp<IBinder> displayToken; uint32_t width{0}; uint32_t height{0}; - bool useIdentityTransform{false}; status_t writeToParcel(Parcel* output) const override; status_t readFromParcel(const Parcel* input) override; diff --git a/services/surfaceflinger/DisplayRenderArea.cpp b/services/surfaceflinger/DisplayRenderArea.cpp index e55cd3ea42..55b395b458 100644 --- a/services/surfaceflinger/DisplayRenderArea.cpp +++ b/services/surfaceflinger/DisplayRenderArea.cpp @@ -18,41 +18,26 @@ #include "DisplayDevice.h" namespace android { -namespace { - -RenderArea::RotationFlags applyDeviceOrientation(bool useIdentityTransform, - const DisplayDevice& display) { - if (!useIdentityTransform) { - return RenderArea::RotationFlags::ROT_0; - } - - return ui::Transform::toRotationFlags(display.getOrientation()); -} - -} // namespace std::unique_ptr<RenderArea> DisplayRenderArea::create(wp<const DisplayDevice> displayWeak, const Rect& sourceCrop, ui::Size reqSize, ui::Dataspace reqDataSpace, - bool useIdentityTransform, bool hintForSeamlessTransition, bool allowSecureLayers) { if (auto display = displayWeak.promote()) { // Using new to access a private constructor. return std::unique_ptr<DisplayRenderArea>( new DisplayRenderArea(std::move(display), sourceCrop, reqSize, reqDataSpace, - useIdentityTransform, hintForSeamlessTransition, - allowSecureLayers)); + hintForSeamlessTransition, allowSecureLayers)); } return nullptr; } DisplayRenderArea::DisplayRenderArea(sp<const DisplayDevice> display, const Rect& sourceCrop, ui::Size reqSize, ui::Dataspace reqDataSpace, - bool useIdentityTransform, bool hintForSeamlessTransition, - bool allowSecureLayers) + bool hintForSeamlessTransition, bool allowSecureLayers) : RenderArea(reqSize, CaptureFill::OPAQUE, reqDataSpace, hintForSeamlessTransition, - allowSecureLayers, applyDeviceOrientation(useIdentityTransform, *display)), + allowSecureLayers), mDisplay(std::move(display)), mSourceCrop(sourceCrop) {} @@ -73,17 +58,7 @@ Rect DisplayRenderArea::getSourceCrop() const { if (mSourceCrop.isEmpty()) { return mDisplay->getLayerStackSpaceRect(); } - - // Correct for the orientation when the screen capture request contained - // useIdentityTransform. This will cause the rotation flag to be non 0 since - // it needs to rotate based on the screen orientation to allow the screenshot - // to be taken in the ROT_0 orientation - const auto flags = getRotationFlags(); - int width = mDisplay->getLayerStackSpaceRect().getWidth(); - int height = mDisplay->getLayerStackSpaceRect().getHeight(); - ui::Transform rotation; - rotation.set(flags, width, height); - return rotation.transform(mSourceCrop); + return mSourceCrop; } } // namespace android diff --git a/services/surfaceflinger/DisplayRenderArea.h b/services/surfaceflinger/DisplayRenderArea.h index 9a4981c881..4555a9ed66 100644 --- a/services/surfaceflinger/DisplayRenderArea.h +++ b/services/surfaceflinger/DisplayRenderArea.h @@ -29,7 +29,6 @@ class DisplayRenderArea : public RenderArea { public: static std::unique_ptr<RenderArea> create(wp<const DisplayDevice>, const Rect& sourceCrop, ui::Size reqSize, ui::Dataspace, - bool useIdentityTransform, bool hintForSeamlessTransition, bool allowSecureLayers = true); @@ -40,8 +39,7 @@ public: private: DisplayRenderArea(sp<const DisplayDevice>, const Rect& sourceCrop, ui::Size reqSize, - ui::Dataspace, bool useIdentityTransform, bool hintForSeamlessTransition, - bool allowSecureLayers = true); + ui::Dataspace, bool hintForSeamlessTransition, bool allowSecureLayers = true); const sp<const DisplayDevice> mDisplay; const Rect mSourceCrop; diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp index 8f658d5a09..6db39f143f 100644 --- a/services/surfaceflinger/RegionSamplingThread.cpp +++ b/services/surfaceflinger/RegionSamplingThread.cpp @@ -276,13 +276,11 @@ void RegionSamplingThread::captureSample() { } const Rect sampledBounds = sampleRegion.bounds(); - constexpr bool kUseIdentityTransform = false; constexpr bool kHintForSeamlessTransition = false; SurfaceFlinger::RenderAreaFuture renderAreaFuture = ftl::defer([=] { return DisplayRenderArea::create(displayWeak, sampledBounds, sampledBounds.getSize(), - ui::Dataspace::V0_SRGB, kUseIdentityTransform, - kHintForSeamlessTransition); + ui::Dataspace::V0_SRGB, kHintForSeamlessTransition); }); std::unordered_set<sp<IRegionSamplingListener>, SpHash<IRegionSamplingListener>> listeners; diff --git a/services/surfaceflinger/RenderArea.h b/services/surfaceflinger/RenderArea.h index 71b85bd3b2..5de148e3bd 100644 --- a/services/surfaceflinger/RenderArea.h +++ b/services/surfaceflinger/RenderArea.h @@ -18,20 +18,16 @@ class DisplayDevice; // physical render area. class RenderArea { public: - using RotationFlags = ui::Transform::RotationFlags; - enum class CaptureFill {CLEAR, OPAQUE}; static float getCaptureFillValue(CaptureFill captureFill); RenderArea(ui::Size reqSize, CaptureFill captureFill, ui::Dataspace reqDataSpace, - bool hintForSeamlessTransition, bool allowSecureLayers = false, - RotationFlags rotation = ui::Transform::ROT_0) + bool hintForSeamlessTransition, bool allowSecureLayers = false) : mAllowSecureLayers(allowSecureLayers), mReqSize(reqSize), mReqDataSpace(reqDataSpace), mCaptureFill(captureFill), - mRotationFlags(rotation), mHintForSeamlessTransition(hintForSeamlessTransition) {} static std::function<std::vector<std::pair<Layer*, sp<LayerFE>>>()> fromTraverseLayersLambda( @@ -72,9 +68,6 @@ public: // on the display). virtual Rect getSourceCrop() const = 0; - // Returns the rotation of the source crop and the layers. - RotationFlags getRotationFlags() const { return mRotationFlags; } - // Returns the size of the physical render area. int getReqWidth() const { return mReqSize.width; } int getReqHeight() const { return mReqSize.height; } @@ -103,7 +96,6 @@ private: const ui::Size mReqSize; const ui::Dataspace mReqDataSpace; const CaptureFill mCaptureFill; - const RotationFlags mRotationFlags; const bool mHintForSeamlessTransition; }; diff --git a/services/surfaceflinger/ScreenCaptureOutput.cpp b/services/surfaceflinger/ScreenCaptureOutput.cpp index ef9b457fc9..57b0d5e0ea 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 @@ std::shared_ptr<ScreenCaptureOutput> createScreenCaptureOutput(ScreenCaptureOutp .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"; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 644b6ef30e..bd70791c31 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -7559,8 +7559,7 @@ void SurfaceFlinger::captureDisplay(const DisplayCaptureArgs& args, RenderAreaFuture renderAreaFuture = ftl::defer([=] { return DisplayRenderArea::create(displayWeak, args.sourceCrop, reqSize, args.dataspace, - args.useIdentityTransform, args.hintForSeamlessTransition, - args.captureSecureLayers); + args.hintForSeamlessTransition, args.captureSecureLayers); }); GetLayerSnapshotsFunction getLayerSnapshots; @@ -7613,7 +7612,6 @@ void SurfaceFlinger::captureDisplay(DisplayId displayId, const CaptureArgs& args RenderAreaFuture renderAreaFuture = ftl::defer([=] { return DisplayRenderArea::create(displayWeak, Rect(), size, args.dataspace, - false /* useIdentityTransform */, args.hintForSeamlessTransition, false /* captureSecureLayers */); }); diff --git a/services/surfaceflinger/tests/LayerState_test.cpp b/services/surfaceflinger/tests/LayerState_test.cpp index 21813700a2..15a98df275 100644 --- a/services/surfaceflinger/tests/LayerState_test.cpp +++ b/services/surfaceflinger/tests/LayerState_test.cpp @@ -38,7 +38,6 @@ TEST(LayerStateTest, ParcellingDisplayCaptureArgs) { args.displayToken = sp<BBinder>::make(); args.width = 10; args.height = 20; - args.useIdentityTransform = true; args.grayscale = true; Parcel p; @@ -56,7 +55,6 @@ TEST(LayerStateTest, ParcellingDisplayCaptureArgs) { ASSERT_EQ(args.displayToken, args2.displayToken); ASSERT_EQ(args.width, args2.width); ASSERT_EQ(args.height, args2.height); - ASSERT_EQ(args.useIdentityTransform, args2.useIdentityTransform); ASSERT_EQ(args.grayscale, args2.grayscale); } |