• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 #ifndef RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_RENDER_FRAME_RATE_LINKER_H
16 #define RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_RENDER_FRAME_RATE_LINKER_H
17 
18 #include <refbase.h>
19 
20 #include "animation/rs_frame_rate_range.h"
21 #include "common/rs_common_def.h"
22 #include "common/rs_macros.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 class RSB_EXPORT RSRenderFrameRateLinker : public std::enable_shared_from_this<RSRenderFrameRateLinker> {
27 public:
28     explicit RSRenderFrameRateLinker(FrameRateLinkerId id);
29     explicit RSRenderFrameRateLinker();
30 
31     RSRenderFrameRateLinker(const RSRenderFrameRateLinker&) = delete;
32     RSRenderFrameRateLinker(const RSRenderFrameRateLinker&&) = delete;
33     RSRenderFrameRateLinker& operator=(const RSRenderFrameRateLinker&) = delete;
34     RSRenderFrameRateLinker& operator=(const RSRenderFrameRateLinker&&) = delete;
35     ~RSRenderFrameRateLinker() = default;
36 
GetId()37     inline FrameRateLinkerId GetId() const
38     {
39         return id_;
40     }
41 
42     void SetExpectedRange(const FrameRateRange& range);
43     const FrameRateRange& GetExpectedRange() const;
44     void SetFrameRate(uint32_t rate);
45     uint32_t GetFrameRate() const;
46     void SyncFrameRateRange(const FrameRateRange& range);
47 private:
48     static FrameRateLinkerId GenerateId();
49     FrameRateLinkerId id_ = 0;
50     FrameRateRange expectedRange_;
51     uint32_t frameRate_ = 0;
52 };
53 } // namespace Rosen
54 } // namespace OHOS
55 
56 #endif // RENDER_SERVICE_CLIENT_CORE_PIPELINE_RS_RENDER_FRAME_RATE_LINKER_H
57