diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/core/hle/service/nvflinger/buffer_item.h | 4 | ||||
-rw-r--r-- | src/core/hle/service/nvflinger/buffer_queue_producer.cpp | 8 | ||||
-rw-r--r-- | src/core/hle/service/nvflinger/graphic_buffer_producer.h | 6 | ||||
-rw-r--r-- | src/core/hle/service/nvflinger/ui/rect.h | 75 |
5 files changed, 9 insertions, 85 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index ff8adfc55..6536d0544 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -563,7 +563,6 @@ add_library(core STATIC hle/service/nvflinger/status.h hle/service/nvflinger/ui/fence.h hle/service/nvflinger/ui/graphic_buffer.h - hle/service/nvflinger/ui/rect.h hle/service/nvflinger/window.h hle/service/olsc/olsc.cpp hle/service/olsc/olsc.h diff --git a/src/core/hle/service/nvflinger/buffer_item.h b/src/core/hle/service/nvflinger/buffer_item.h index d60719065..64b82b851 100644 --- a/src/core/hle/service/nvflinger/buffer_item.h +++ b/src/core/hle/service/nvflinger/buffer_item.h @@ -9,8 +9,8 @@ #include <memory> #include "common/common_types.h" +#include "common/math_util.h" #include "core/hle/service/nvflinger/ui/fence.h" -#include "core/hle/service/nvflinger/ui/rect.h" #include "core/hle/service/nvflinger/window.h" namespace Service::android { @@ -23,7 +23,7 @@ public: std::shared_ptr<GraphicBuffer> graphic_buffer; Fence fence; - Rect crop; + Common::Rectangle<s32> crop; NativeWindowTransform transform{}; u32 scaling_mode{}; s64 timestamp{}; diff --git a/src/core/hle/service/nvflinger/buffer_queue_producer.cpp b/src/core/hle/service/nvflinger/buffer_queue_producer.cpp index 99f7ec1ac..5ea48431f 100644 --- a/src/core/hle/service/nvflinger/buffer_queue_producer.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue_producer.cpp @@ -441,7 +441,7 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input, QueueBufferOutput* output) { s64 timestamp{}; bool is_auto_timestamp{}; - Rect crop; + Common::Rectangle<s32> crop; NativeWindowScalingMode scaling_mode{}; NativeWindowTransform transform; u32 sticky_transform_{}; @@ -509,9 +509,9 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input, crop.Bottom(), transform, scaling_mode); const std::shared_ptr<GraphicBuffer>& graphic_buffer(slots[slot].graphic_buffer); - Rect buffer_rect(graphic_buffer->Width(), graphic_buffer->Height()); - Rect cropped_rect; - crop.Intersect(buffer_rect, &cropped_rect); + Common::Rectangle<s32> buffer_rect(graphic_buffer->Width(), graphic_buffer->Height()); + Common::Rectangle<s32> cropped_rect; + [[maybe_unused]] const bool unused = crop.Intersect(buffer_rect, &cropped_rect); if (cropped_rect != crop) { LOG_ERROR(Service_NVFlinger, "crop rect is not contained within the buffer in slot {}", diff --git a/src/core/hle/service/nvflinger/graphic_buffer_producer.h b/src/core/hle/service/nvflinger/graphic_buffer_producer.h index 58763cf08..98d27871c 100644 --- a/src/core/hle/service/nvflinger/graphic_buffer_producer.h +++ b/src/core/hle/service/nvflinger/graphic_buffer_producer.h @@ -8,8 +8,8 @@ #include "common/common_funcs.h" #include "common/common_types.h" +#include "common/math_util.h" #include "core/hle/service/nvflinger/ui/fence.h" -#include "core/hle/service/nvflinger/ui/rect.h" #include "core/hle/service/nvflinger/window.h" namespace Service::android { @@ -20,7 +20,7 @@ class Parcel; struct QueueBufferInput final { explicit QueueBufferInput(Parcel& parcel); - void Deflate(s64* timestamp_, bool* is_auto_timestamp_, Rect* crop_, + void Deflate(s64* timestamp_, bool* is_auto_timestamp_, Common::Rectangle<s32>* crop_, NativeWindowScalingMode* scaling_mode_, NativeWindowTransform* transform_, u32* sticky_transform_, bool* async_, s32* swap_interval_, Fence* fence_) const { *timestamp_ = timestamp; @@ -37,7 +37,7 @@ struct QueueBufferInput final { private: s64 timestamp{}; s32 is_auto_timestamp{}; - Rect crop{}; + Common::Rectangle<s32> crop{}; NativeWindowScalingMode scaling_mode{}; NativeWindowTransform transform{}; u32 sticky_transform{}; diff --git a/src/core/hle/service/nvflinger/ui/rect.h b/src/core/hle/service/nvflinger/ui/rect.h deleted file mode 100644 index c7b5f1815..000000000 --- a/src/core/hle/service/nvflinger/ui/rect.h +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright 2021 yuzu Emulator Project -// Copyright 2006 The Android Open Source Project -// Parts of this implementation were base on: -// https://cs.android.com/android/platform/superproject/+/android-5.1.1_r38:frameworks/native/include/ui/Rect.h - -#pragma once - -#include <cstdint> -#include <utility> - -#include "common/common_types.h" - -namespace Service::android { - -class Rect final { -public: - constexpr Rect() = default; - - constexpr Rect(s32 width_, s32 height_) : right{width_}, bottom{height_} {} - - constexpr s32 Left() const { - return left; - } - - constexpr s32 Top() const { - return top; - } - - constexpr s32 Right() const { - return right; - } - - constexpr s32 Bottom() const { - return bottom; - } - - constexpr bool IsEmpty() const { - return (GetWidth() <= 0) || (GetHeight() <= 0); - } - - constexpr s32 GetWidth() const { - return right - left; - } - - constexpr s32 GetHeight() const { - return bottom - top; - } - - constexpr bool operator==(const Rect& rhs) const { - return (left == rhs.left) && (top == rhs.top) && (right == rhs.right) && - (bottom == rhs.bottom); - } - - constexpr bool operator!=(const Rect& rhs) const { - return !operator==(rhs); - } - - constexpr bool Intersect(const Rect& with, Rect* result) const { - result->left = std::max(left, with.left); - result->top = std::max(top, with.top); - result->right = std::min(right, with.right); - result->bottom = std::min(bottom, with.bottom); - return !result->IsEmpty(); - } - -private: - s32 left{}; - s32 top{}; - s32 right{}; - s32 bottom{}; -}; -static_assert(sizeof(Rect) == 16, "Rect has wrong size"); - -} // namespace Service::android |