diff options
author | 2024-01-29 12:47:18 -0800 | |
---|---|---|
committer | 2024-01-29 12:47:18 -0800 | |
commit | 2d701e14093b2e699d7dca00db3d7d66d0c96e29 (patch) | |
tree | c1b5916d12ac356ec1732e50293b335475ea83d0 /services/surfaceflinger/ScreenCaptureOutput.cpp | |
parent | c6e22d8533cee1d044b88f2eb4a94a8b6c041761 (diff) | |
parent | b507b71cc52f9203657f221808eef04d58dd6398 (diff) |
Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529
Merged-In: I264e728c49f0500f2f868c3a25b0910d0d527340
Change-Id: I0de5ae0000a29e4b9735e6c4f381f680eb0723cd
Diffstat (limited to 'services/surfaceflinger/ScreenCaptureOutput.cpp')
-rw-r--r-- | services/surfaceflinger/ScreenCaptureOutput.cpp | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/services/surfaceflinger/ScreenCaptureOutput.cpp b/services/surfaceflinger/ScreenCaptureOutput.cpp index ef9b457fc9..dd03366bcc 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&, @@ -49,6 +32,7 @@ std::shared_ptr<ScreenCaptureOutput> createScreenCaptureOutput(ScreenCaptureOutp bool>(args.compositionEngine, args.renderArea, args.colorProfile, args.regionSampling, args.dimInGammaSpaceForEnhancedScreenshots); output->editState().isSecure = args.renderArea.isSecure(); + output->editState().isProtected = args.isProtected; output->setCompositionEnabled(true); output->setLayerFilter({args.layerStack}); output->setRenderSurface(std::make_unique<ScreenCaptureRenderSurface>(std::move(args.buffer))); @@ -62,11 +46,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"; @@ -92,10 +75,10 @@ void ScreenCaptureOutput::updateColorProfile(const compositionengine::Compositio outputState.renderIntent = mColorProfile.renderIntent; } -renderengine::DisplaySettings ScreenCaptureOutput::generateClientCompositionDisplaySettings() - const { +renderengine::DisplaySettings ScreenCaptureOutput::generateClientCompositionDisplaySettings( + const std::shared_ptr<renderengine::ExternalTexture>& buffer) const { auto clientCompositionDisplay = - compositionengine::impl::Output::generateClientCompositionDisplaySettings(); + compositionengine::impl::Output::generateClientCompositionDisplaySettings(buffer); clientCompositionDisplay.clip = mRenderArea.getSourceCrop(); auto renderIntent = static_cast<ui::RenderIntent>(clientCompositionDisplay.renderIntent); |