1 /* 2 * Copyright (c) 2021 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 "rosen_render_custom_paint.h" 17 18 namespace OHOS::Ace { Create()19RefPtr<RenderNode> RenderCustomPaint::Create() 20 { 21 if (SystemProperties::GetRosenBackendEnabled()) { 22 #ifdef ENABLE_ROSEN_BACKEND 23 return AceType::MakeRefPtr<RosenRenderCustomPaint>(); 24 #else 25 return nullptr; 26 #endif 27 } else { 28 return nullptr; 29 } 30 } 31 PaintMeasureText(const MeasureContext & context)32double RenderCustomPaint::PaintMeasureText(const MeasureContext& context) 33 { 34 if (SystemProperties::GetRosenBackendEnabled()) { 35 #ifdef ENABLE_ROSEN_BACKEND 36 return RosenRenderCustomPaint::MeasureTextInner(context); 37 #else 38 return 0.0; 39 #endif 40 } else { 41 return 0.0; 42 } 43 } 44 MeasureTextSize(const MeasureContext & context)45Size RenderCustomPaint::MeasureTextSize(const MeasureContext& context) 46 { 47 if (SystemProperties::GetRosenBackendEnabled()) { 48 #ifdef ENABLE_ROSEN_BACKEND 49 return RosenRenderCustomPaint::MeasureTextSizeInner(context); 50 #else 51 return Size(0.0, 0.0); 52 #endif 53 } else { 54 return Size(0.0, 0.0); 55 } 56 } 57 } // namespace OHOS::Ace 58