1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FOUNDATION_ARKUI_ACE_ENGINE_ADAPTER_OHOS_ENTRANCE_ACE_VIEWPORT_CONFIG_H
17 #define FOUNDATION_ARKUI_ACE_ENGINE_ADAPTER_OHOS_ENTRANCE_ACE_VIEWPORT_CONFIG_H
18 
19 #include "wm/window.h"
20 #include "interfaces/inner_api/ace/viewport_config.h"
21 
22 namespace OHOS::Ace {
23 struct AceViewportConfig {
24     AceViewportConfig() = default;
AceViewportConfigAceViewportConfig25     AceViewportConfig(ViewportConfig cfg, OHOS::Rosen::WindowSizeChangeReason reason,
26         std::shared_ptr<OHOS::Rosen::RSTransaction> rsTransaction)
27         : config_(cfg), reason_(reason), rsTransaction_(rsTransaction) {}
28 
29     bool operator==(const AceViewportConfig &other) const
30     {
31         return config_.Width() == other.config_.Width() &&
32                config_.Height() == other.config_.Height() &&
33                config_.Left() == other.config_.Left() &&
34                config_.Top() == other.config_.Top() &&
35                config_.Density() == other.config_.Density() &&
36                config_.Orientation() == other.config_.Orientation() &&
37                reason_ == other.reason_ &&
38                rsTransaction_ == other.rsTransaction_;
39     }
40 
41     bool operator!=(const AceViewportConfig &other) const
42     {
43         return config_.Width() != other.config_.Width() ||
44                config_.Height() != other.config_.Height() ||
45                config_.Left() != other.config_.Left() ||
46                config_.Top() != other.config_.Top() ||
47                config_.Density() != other.config_.Density() ||
48                config_.Orientation() != other.config_.Orientation() ||
49                reason_ != other.reason_ ||
50                rsTransaction_ != other.rsTransaction_;
51     }
52 
53     ViewportConfig config_;
54     OHOS::Rosen::WindowSizeChangeReason reason_;
55     std::shared_ptr<OHOS::Rosen::RSTransaction> rsTransaction_;
56 }; // AceViewportConfig
57 
58 } // OHOS::Ace
59 #endif // FOUNDATION_ARKUI_ACE_ENGINE_ADAPTER_OHOS_ENTRANCE_ACE_VIEWPORT_CONFIG_H
60