• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 
16 #include "rs_round_corner_display.h"
17 
18 #include "common/rs_optional_trace.h"
19 #include "common/rs_singleton.h"
20 #include "platform/common/rs_system_properties.h"
21 #include "feature/round_corner_display/rs_message_bus.h"
22 #include "rs_trace.h"
23 
24 namespace OHOS {
25 namespace Rosen {
RoundCornerDisplay(NodeId id)26 RoundCornerDisplay::RoundCornerDisplay(NodeId id) : renderTargetId_{id}
27 {
28     RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] Created with render target %{public}" PRIu64 " \n", __func__,
29         renderTargetId_);
30 }
31 
~RoundCornerDisplay()32 RoundCornerDisplay::~RoundCornerDisplay()
33 {
34     RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] Destroy for render target %{public}" PRIu64 " \n", __func__,
35         renderTargetId_);
36 }
37 
Init()38 bool RoundCornerDisplay::Init()
39 {
40     std::unique_lock<std::shared_mutex> lock(resourceMut_);
41     LoadConfigFile();
42     SeletedLcdModel(rs_rcd::ATTR_DEFAULT);
43     LoadImgsbyResolution(displayRect_.GetWidth(), displayRect_.GetHeight());
44     RS_LOGI("[%{public}s] RoundCornerDisplay init \n", __func__);
45     return true;
46 }
47 
InitOnce()48 void RoundCornerDisplay::InitOnce()
49 {
50     if (!isInit) {
51         Init();
52         isInit = true;
53     }
54 }
55 
SeletedLcdModel(const char * lcdModelName)56 bool RoundCornerDisplay::SeletedLcdModel(const char* lcdModelName)
57 {
58     auto& rcdCfg = RSSingleton<rs_rcd::RCDConfig>::GetInstance();
59     lcdModel_ = rcdCfg.GetLcdModel(std::string(lcdModelName));
60     if (lcdModel_ == nullptr) {
61         RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] No lcdModel found in config file with name %{public}s \n", __func__,
62             lcdModelName);
63         return false;
64     }
65     supportTopSurface_ = lcdModel_->surfaceConfig.topSurface.support;
66     supportBottomSurface_ = lcdModel_->surfaceConfig.bottomSurface.support;
67     supportHardware_ = lcdModel_->hardwareConfig.hardwareComposer.support;
68     RS_LOGI("[%{public}s] Selected model: %{public}s, supported: top->%{public}d, bottom->%{public}d,"
69         "hardware->%{public}d \n", __func__, lcdModelName, static_cast<int>(supportTopSurface_),
70         static_cast<int>(supportBottomSurface_), static_cast<int>(supportHardware_));
71     return true;
72 }
73 
LoadConfigFile()74 bool RoundCornerDisplay::LoadConfigFile()
75 {
76     RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] LoadConfigFile \n", __func__);
77     auto& rcdCfg = RSSingleton<rs_rcd::RCDConfig>::GetInstance();
78     return rcdCfg.Load(std::string(rs_rcd::PATH_CONFIG_FILE));
79 }
80 
LoadImg(const char * path,std::shared_ptr<Drawing::Image> & img)81 bool RoundCornerDisplay::LoadImg(const char* path, std::shared_ptr<Drawing::Image>& img)
82 {
83     std::string filePath = std::string(rs_rcd::PATH_CONFIG_DIR) + "/" + path;
84     RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] Read Img(%{public}s) \n", __func__, filePath.c_str());
85     std::shared_ptr<Drawing::Data> drData = Drawing::Data::MakeFromFileName(filePath.c_str());
86     if (drData == nullptr) {
87         RS_LOGE("[%{public}s] Open picture file failed! \n", __func__);
88         return false;
89     }
90     img = std::make_shared<Drawing::Image>();
91     if (!img->MakeFromEncoded(drData)) {
92         img = nullptr;
93         RS_LOGE("[%{public}s] Decode picture file failed! \n", __func__);
94         return false;
95     }
96     return true;
97 }
98 
DecodeBitmap(std::shared_ptr<Drawing::Image> image,std::shared_ptr<Drawing::Bitmap> & bitmap)99 bool RoundCornerDisplay::DecodeBitmap(std::shared_ptr<Drawing::Image> image, std::shared_ptr<Drawing::Bitmap>& bitmap)
100 {
101     if (image == nullptr) {
102         RS_LOGE("[%{public}s] No image found \n", __func__);
103         return false;
104     }
105     bitmap = std::make_shared<Drawing::Bitmap>();
106     if (!image->AsLegacyBitmap(*bitmap)) {
107         RS_LOGE("[%{public}s] Create bitmap from drImage failed \n", __func__);
108         return false;
109     }
110     return true;
111 }
112 
SetHardwareLayerSize()113 bool RoundCornerDisplay::SetHardwareLayerSize()
114 {
115     if (hardInfo_.topLayer == nullptr) {
116         RS_LOGE("[%{public}s] No topLayer found in hardInfo \n", __func__);
117         return false;
118     }
119     if (hardInfo_.bottomLayer == nullptr) {
120         RS_LOGE("[%{public}s] No bottomLayer found in hardInfo \n", __func__);
121         return false;
122     }
123     hardInfo_.displayRect = displayRect_;
124     return true;
125 }
126 
GetTopSurfaceSource()127 bool RoundCornerDisplay::GetTopSurfaceSource()
128 {
129     RS_TRACE_NAME("RoundCornerDisplay::GetTopSurfaceSource");
130     if (rog_ == nullptr) {
131         RS_LOGE("[%{public}s] No rog found in config file \n", __func__);
132         return false;
133     }
134     rs_rcd::RCDConfig::PrintParseRog(rog_);
135 
136     auto portrait = rog_->GetPortrait(std::string(rs_rcd::NODE_PORTRAIT));
137     if (portrait == std::nullopt) {
138         RS_LOGE("[%{public}s] PORTRAIT layerUp do not configured \n", __func__);
139         return false;
140     }
141     LoadImg(portrait->layerUp.fileName.c_str(), imgTopPortrait_);
142     LoadImg(portrait->layerHide.fileName.c_str(), imgTopHidden_);
143 
144     auto landscape = rog_->GetLandscape(std::string(rs_rcd::NODE_LANDSCAPE));
145     if (landscape == std::nullopt) {
146         RS_LOGE("[%{public}s] LANDSACPE layerUp do not configured \n", __func__);
147         return false;
148     }
149     LoadImg(landscape->layerUp.fileName.c_str(), imgTopLadsOrit_);
150 
151     if (supportHardware_) {
152         DecodeBitmap(imgTopPortrait_, bitmapTopPortrait_);
153         DecodeBitmap(imgTopLadsOrit_, bitmapTopLadsOrit_);
154         DecodeBitmap(imgTopHidden_, bitmapTopHidden_);
155     }
156     return true;
157 }
158 
GetBottomSurfaceSource()159 bool RoundCornerDisplay::GetBottomSurfaceSource()
160 {
161     RS_TRACE_NAME("RoundCornerDisplay::GetBottomSurfaceSource");
162     if (rog_ == nullptr) {
163         RS_LOGE("[%{public}s] No rog found in config file \n", __func__);
164         return false;
165     }
166     auto portrait = rog_->GetPortrait(std::string(rs_rcd::NODE_PORTRAIT));
167     if (portrait == std::nullopt) {
168         RS_LOGE("[%{public}s] PORTRAIT layerDown do not configured \n", __func__);
169         return false;
170     }
171     LoadImg(portrait->layerDown.fileName.c_str(), imgBottomPortrait_);
172     if (supportHardware_) {
173         DecodeBitmap(imgBottomPortrait_, bitmapBottomPortrait_);
174     }
175     return true;
176 }
177 
HandleTopRcdDirty(RectI & dirtyRect)178 bool RoundCornerDisplay::HandleTopRcdDirty(RectI& dirtyRect)
179 {
180     if ((static_cast<uint8_t>(rcdDirtyType_) & static_cast<uint8_t>(RoundCornerDirtyType::RCD_DIRTY_TOP)) !=
181         static_cast<uint8_t>(RoundCornerDirtyType::RCD_DIRTY_TOP)) {
182         return false;
183     }
184     if (curTop_ != nullptr) {
185         dirtyRect = dirtyRect.JoinRect(RectI(displayRect_.GetLeft(), displayRect_.GetTop(),
186             curTop_->GetWidth(), curTop_->GetHeight()));
187     }
188     std::shared_lock<std::shared_mutex> lock(resourceMut_);
189     if (!hardInfo_.resourceChanged) {
190         rcdDirtyType_ = static_cast<RoundCornerDirtyType>(
191             (~static_cast<uint8_t>(RoundCornerDirtyType::RCD_DIRTY_TOP)) & static_cast<uint8_t>(rcdDirtyType_));
192     }
193     return true;
194 }
195 
HandleBottomRcdDirty(RectI & dirtyRect)196 bool RoundCornerDisplay::HandleBottomRcdDirty(RectI& dirtyRect)
197 {
198     if ((static_cast<uint8_t>(rcdDirtyType_) & static_cast<uint8_t>(RoundCornerDirtyType::RCD_DIRTY_BOTTOM)) !=
199         static_cast<uint8_t>(RoundCornerDirtyType::RCD_DIRTY_BOTTOM)) {
200         return false;
201     }
202     if (curBottom_ != nullptr) {
203         dirtyRect = dirtyRect.JoinRect(
204             RectI(displayRect_.GetLeft(), displayRect_.GetHeight() - curBottom_->GetHeight() + displayRect_.GetTop(),
205             curBottom_->GetWidth(), curBottom_->GetHeight()));
206     }
207     std::shared_lock<std::shared_mutex> lock(resourceMut_);
208     if (!hardInfo_.resourceChanged) {
209         rcdDirtyType_ = static_cast<RoundCornerDirtyType>(
210             (~static_cast<uint8_t>(RoundCornerDirtyType::RCD_DIRTY_BOTTOM)) & static_cast<uint8_t>(rcdDirtyType_));
211     }
212     return true;
213 }
214 
LoadImgsbyResolution(uint32_t width,uint32_t height)215 bool RoundCornerDisplay::LoadImgsbyResolution(uint32_t width, uint32_t height)
216 {
217     RS_TRACE_NAME("RoundCornerDisplay::LoadImgsbyResolution");
218 
219     if (lcdModel_ == nullptr) {
220         RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] No lcdModel selected in config file \n", __func__);
221         return false;
222     }
223     auto rog = lcdModel_->GetRog(width, height);
224     if (rog == nullptr) {
225         RS_LOGE_IF(DEBUG_PIPELINE, "[%{public}s] Can't find resolution (%{public}u x %{public}u) in config file \n",
226             __func__, width, height);
227         return false;
228     }
229     rog_ = rog;
230     RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] Get rog resolution (%{public}u x %{public}u) in config file \n", __func__,
231         width, height);
232     if (supportTopSurface_ && supportHardware_) {
233         if (!GetTopSurfaceSource()) {
234             RS_LOGE("[%{public}s] Top surface support configured, but resources is missing! \n", __func__);
235             return false;
236         }
237     }
238     if (supportBottomSurface_ && supportHardware_) {
239         if (!GetBottomSurfaceSource()) {
240             RS_LOGE("[%{public}s] Bottom surface support configured, but resources is missing! \n", __func__);
241             return false;
242         }
243     }
244     return true;
245 }
246 
UpdateDisplayParameter(uint32_t left,uint32_t top,uint32_t width,uint32_t height)247 void RoundCornerDisplay::UpdateDisplayParameter(uint32_t left, uint32_t top, uint32_t width, uint32_t height)
248 {
249     std::unique_lock<std::shared_mutex> lock(resourceMut_);
250     RectU displayRect(left, top, width, height);
251     if (displayRect != lastRcvDisplayRect_) {
252         RS_LOGI("[%{public}s] rcd last rect %{public}u, %{public}u, %{public}u, %{public}u"
253             "rcv rect %{public}u, %{public}u, %{public}u, %{public}u \n", __func__,
254             lastRcvDisplayRect_.GetLeft(), lastRcvDisplayRect_.GetTop(),
255             lastRcvDisplayRect_.GetWidth(), lastRcvDisplayRect_.GetHeight(),
256             displayRect.GetLeft(), displayRect.GetTop(), displayRect.GetWidth(), displayRect.GetHeight());
257         lastRcvDisplayRect_ = displayRect;
258         PrintRCDInfo();
259     } else {
260         RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] DisplayParameter do not change \n", __func__);
261         return;
262     }
263     if (LoadImgsbyResolution(displayRect.GetWidth(), displayRect.GetHeight())) {
264         rcdDirtyType_ = static_cast<RoundCornerDirtyType>(
265             static_cast<uint8_t>(RoundCornerDirtyType::RCD_DIRTY_ALL) | static_cast<uint8_t>(rcdDirtyType_));
266         updateFlag_["display"] = true;
267         displayRect_ = displayRect;
268     }
269 }
270 
UpdateNotchStatus(int status)271 void RoundCornerDisplay::UpdateNotchStatus(int status)
272 {
273     std::unique_lock<std::shared_mutex> lock(resourceMut_);
274     // Update surface when surface status changed
275     if (status < 0 || status > 1) {
276         RS_LOGE("[%{public}s] notchStatus won't be over 1 or below 0 \n", __func__);
277         return;
278     }
279     if (notchStatus_ == status) {
280         RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] NotchStatus do not change \n", __func__);
281         return;
282     }
283     RS_LOGI("[%{public}s] rcd notchStatus change from %{public}d to %{public}d \n", __func__,
284         notchStatus_, status);
285     PrintRCDInfo();
286     notchStatus_ = status;
287     rcdDirtyType_ = static_cast<RoundCornerDirtyType>(
288         static_cast<uint8_t>(RoundCornerDirtyType::RCD_DIRTY_TOP) | static_cast<uint8_t>(rcdDirtyType_));
289     updateFlag_["notch"] = true;
290 }
291 
UpdateOrientationStatus(ScreenRotation orientation)292 void RoundCornerDisplay::UpdateOrientationStatus(ScreenRotation orientation)
293 {
294     std::unique_lock<std::shared_mutex> lock(resourceMut_);
295     if (orientation == curOrientation_) {
296         RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] OrientationStatus do not change \n", __func__);
297         return;
298     }
299     RS_LOGI("[%{public}s] rcd Orientation change from %{public}d to %{public}d \n", __func__,
300         curOrientation_, orientation);
301     PrintRCDInfo();
302     lastOrientation_ = curOrientation_;
303     curOrientation_ = orientation;
304     rcdDirtyType_ = static_cast<RoundCornerDirtyType>(
305         static_cast<uint8_t>(RoundCornerDirtyType::RCD_DIRTY_TOP) | static_cast<uint8_t>(rcdDirtyType_));
306     updateFlag_["orientation"] = true;
307 }
308 
UpdateHardwareResourcePrepared(bool prepared)309 void RoundCornerDisplay::UpdateHardwareResourcePrepared(bool prepared)
310 {
311     std::unique_lock<std::shared_mutex> lock(resourceMut_);
312     if (hardInfo_.resourcePreparing) {
313         hardInfo_.resourcePreparing = false;
314         hardInfo_.resourceChanged = !prepared;
315     }
316 }
317 
RefreshFlagAndUpdateResource()318 void RoundCornerDisplay::RefreshFlagAndUpdateResource()
319 {
320     UpdateParameter(updateFlag_);
321 }
322 
UpdateParameter(std::map<std::string,bool> & updateFlag)323 void RoundCornerDisplay::UpdateParameter(std::map<std::string, bool>& updateFlag)
324 {
325     RS_TRACE_BEGIN("RCD::UpdateParameter");
326     std::unique_lock<std::shared_mutex> lock(resourceMut_);
327     for (auto item = updateFlag.begin(); item != updateFlag.end(); item++) {
328         if (item->second == true) {
329             resourceChanged = true;
330             item->second = false; // reset
331         }
332     }
333     if (resourceChanged) {
334         RcdChooseTopResourceType();
335         RcdChooseRSResource();
336         if (supportHardware_) {
337             RcdChooseHardwareResource();
338             SetHardwareLayerSize();
339         }
340         hardInfo_.resourceChanged = resourceChanged; // output
341         hardInfo_.resourcePreparing = false; // output
342         resourceChanged = false; // reset
343     } else {
344         RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] Status is not changed \n", __func__);
345     }
346     RS_TRACE_END();
347 }
348 
349 // Choose the approriate resource type according to orientation and notch status
RcdChooseTopResourceType()350 void RoundCornerDisplay::RcdChooseTopResourceType()
351 {
352     RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] Choose surface \n", __func__);
353     RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] curOrientation is %{public}d \n", __func__, curOrientation_);
354     RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] notchStatus is %{public}d \n", __func__, notchStatus_);
355     switch (curOrientation_) {
356         case ScreenRotation::ROTATION_0:
357         case ScreenRotation::ROTATION_180:
358             if (notchStatus_ == WINDOW_NOTCH_HIDDEN) {
359                 RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] prepare TOP_HIDDEN show resource \n", __func__);
360                 showResourceType_ = TOP_HIDDEN;
361             } else {
362                 RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] prepare TOP_PORTRAIT show resource \n", __func__);
363                 showResourceType_ = TOP_PORTRAIT;
364             }
365             break;
366         case ScreenRotation::ROTATION_90:
367         case ScreenRotation::ROTATION_270:
368             if (notchStatus_ == WINDOW_NOTCH_HIDDEN) {
369                 RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] prepare TOP_LADS_ORIT show resource \n", __func__);
370                 showResourceType_ = TOP_LADS_ORIT;
371             } else {
372                 RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] prepare TOP_PORTRAIT show resource \n", __func__);
373                 showResourceType_ = TOP_PORTRAIT;
374             }
375             break;
376         default:
377             RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] Unknow orientation, use default type \n", __func__);
378             showResourceType_ = TOP_PORTRAIT;
379             break;
380     }
381 }
382 
RcdChooseRSResource()383 void RoundCornerDisplay::RcdChooseRSResource()
384 {
385     switch (showResourceType_) {
386         case TOP_PORTRAIT:
387             curTop_ = imgTopPortrait_;
388             RS_LOGD_IF(DEBUG_PIPELINE, "prepare imgTopPortrait_ resource \n");
389             break;
390         case TOP_HIDDEN:
391             curTop_ = imgTopHidden_;
392             RS_LOGD_IF(DEBUG_PIPELINE, "prepare imgTopHidden_ resource \n");
393             break;
394         case TOP_LADS_ORIT:
395             curTop_ = imgTopLadsOrit_;
396             RS_LOGD_IF(DEBUG_PIPELINE, "prepare imgTopLadsOrit_ resource \n");
397             break;
398         default:
399             RS_LOGE("[%{public}s] No showResourceType found with type %{public}d \n", __func__, showResourceType_);
400             break;
401     }
402     curBottom_ = imgBottomPortrait_;
403 }
404 
RcdChooseHardwareResource()405 void RoundCornerDisplay::RcdChooseHardwareResource()
406 {
407     if (rog_ == nullptr) {
408         RS_LOGE_IF(DEBUG_PIPELINE, "[%{public}s] No rog info \n", __func__);
409         return;
410     }
411     auto portrait = rog_->GetPortrait(std::string(rs_rcd::NODE_PORTRAIT));
412     auto landscape = rog_->GetLandscape(std::string(rs_rcd::NODE_LANDSCAPE));
413     switch (showResourceType_) {
414         case TOP_PORTRAIT:
415             if (portrait == std::nullopt) {
416                 break;
417             }
418             hardInfo_.topLayer = std::make_shared<rs_rcd::RoundCornerLayer>(portrait->layerUp);
419             hardInfo_.topLayer->curBitmap = bitmapTopPortrait_;
420             break;
421         case TOP_HIDDEN:
422             if (portrait == std::nullopt) {
423                 break;
424             }
425             hardInfo_.topLayer = std::make_shared<rs_rcd::RoundCornerLayer>(portrait->layerHide);
426             hardInfo_.topLayer->curBitmap = bitmapTopHidden_;
427             break;
428         case TOP_LADS_ORIT:
429             if (landscape == std::nullopt) {
430                 break;
431             }
432             hardInfo_.topLayer = std::make_shared<rs_rcd::RoundCornerLayer>(landscape->layerUp);
433             hardInfo_.topLayer->curBitmap = bitmapTopLadsOrit_;
434             break;
435         default:
436             RS_LOGE("[%{public}s] No showResourceType found with type %{public}d \n", __func__, showResourceType_);
437             break;
438     }
439     if (portrait == std::nullopt) {
440         return;
441     }
442     hardInfo_.bottomLayer = std::make_shared<rs_rcd::RoundCornerLayer>(portrait->layerDown);
443     hardInfo_.bottomLayer->curBitmap = bitmapBottomPortrait_;
444 }
445 
DrawOneRoundCorner(RSPaintFilterCanvas * canvas,int surfaceType)446 void RoundCornerDisplay::DrawOneRoundCorner(RSPaintFilterCanvas* canvas, int surfaceType)
447 {
448     RS_TRACE_BEGIN("RCD::DrawOneRoundCorner : surfaceType" + std::to_string(surfaceType));
449     if (canvas == nullptr) {
450         RS_LOGE("[%{public}s] Canvas is null \n", __func__);
451         RS_TRACE_END();
452         return;
453     }
454     UpdateParameter(updateFlag_);
455     if (surfaceType == TOP_SURFACE) {
456         RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] draw TopSurface start  \n", __func__);
457         if (curTop_ != nullptr) {
458             Drawing::Brush brush;
459             canvas->AttachBrush(brush);
460             canvas->DrawImage(*curTop_, displayRect_.GetLeft(), displayRect_.GetTop(), Drawing::SamplingOptions());
461             canvas->DetachBrush();
462             RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] Draw top \n", __func__);
463         }
464     } else if (surfaceType == BOTTOM_SURFACE) {
465         RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] BottomSurface supported \n", __func__);
466         if (curBottom_ != nullptr) {
467             Drawing::Brush brush;
468             canvas->AttachBrush(brush);
469             canvas->DrawImage(*curBottom_, displayRect_.GetLeft(), displayRect_.GetHeight() - curBottom_->GetHeight() +
470                 displayRect_.GetTop(), Drawing::SamplingOptions());
471             canvas->DetachBrush();
472             RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] Draw Bottom \n", __func__);
473         }
474     } else {
475         RS_LOGD_IF(DEBUG_PIPELINE, "[%{public}s] Surface Type is not valid \n", __func__);
476     }
477     RS_TRACE_END();
478 }
479 
DrawTopRoundCorner(RSPaintFilterCanvas * canvas)480 void RoundCornerDisplay::DrawTopRoundCorner(RSPaintFilterCanvas* canvas)
481 {
482     DrawOneRoundCorner(canvas, TOP_SURFACE);
483 }
484 
DrawBottomRoundCorner(RSPaintFilterCanvas * canvas)485 void RoundCornerDisplay::DrawBottomRoundCorner(RSPaintFilterCanvas* canvas)
486 {
487     DrawOneRoundCorner(canvas, BOTTOM_SURFACE);
488 }
489 
PrintRCDInfo()490 void RoundCornerDisplay::PrintRCDInfo()
491 {
492     RS_LOGD("[%{public}s] begin \n", __func__);
493     if (lcdModel_ != nullptr) {
494         RS_LOGI("[%{public}s] Selected model: %{public}s, supported: top->%{public}d, bottom->%{public}d,"
495             "hardware->%{public}d rogListSize %{public}d\n", __func__, lcdModel_->name.c_str(),
496             static_cast<int>(supportTopSurface_), static_cast<int>(supportBottomSurface_),
497             static_cast<int>(supportHardware_),
498             static_cast<int>(lcdModel_->rogs.size()));
499     }
500     if (rog_ != nullptr) {
501         RS_LOGI("[%{public}s] rog info : \n", __func__);
502         rs_rcd::RCDConfig::PrintParseRog(rog_);
503     }
504     RS_LOGI("[%{public}s] render target id: %{public}" PRIu64
505             ", display rect: (%{public}u, %{public}u, %{public}u, %{public}u), notch: %{public}d, resource tag: "
506             "%{public}d , %{public}d\n",
507         __func__,
508         renderTargetId_,
509         displayRect_.GetLeft(),
510         displayRect_.GetTop(),
511         displayRect_.GetWidth(),
512         displayRect_.GetHeight(),
513         notchStatus_,
514         hardInfo_.resourceChanged,
515         hardInfo_.resourcePreparing);
516     if (hardInfo_.topLayer != nullptr) {
517         RS_LOGW("[%{public}s] current hardware Info toplayer w h : %{public}u , %{public}u\n", __func__,
518             hardInfo_.topLayer->cldWidth, hardInfo_.topLayer->cldHeight);
519     }
520     if (hardInfo_.bottomLayer != nullptr) {
521         RS_LOGW("[%{public}s] current hardware Info bottomlayer w h : %{public}u , %{public}u\n", __func__,
522             hardInfo_.bottomLayer->cldWidth, hardInfo_.bottomLayer->cldHeight);
523     }
524     RS_LOGD("[%{public}s] end \n", __func__);
525 }
526 } // namespace Rosen
527 } // namespace OHOS
528