1 /* 2 * Copyright (c) 2025 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 "interfaces/inner_api/ace_kit/src/view/draw/modifier_adapter.h" 17 18 #include "ui/base/utils/utils.h" 19 #include "ui/view/draw/content_modifier.h" 20 #include "ui/view/draw/modifier.h" 21 22 namespace OHOS::Ace::Kit { 23 ContentModifierAdapter(const RefPtr<ContentModifier> & modifier)24ContentModifierAdapter::ContentModifierAdapter(const RefPtr<ContentModifier>& modifier) : modifier_(modifier) {} ~ContentModifierAdapter()25ContentModifierAdapter::~ContentModifierAdapter() {} 26 Draw(RSDrawingContext & context) const27void ContentModifierAdapter::Draw(RSDrawingContext& context) const 28 { 29 auto modifier = modifier_.Upgrade(); 30 CHECK_NULL_VOID(modifier); 31 DrawingContext drawContext = { .canvas = context.canvas, .width = context.width, .height = context.height }; 32 modifier->OnDraw(drawContext); 33 } 34 AttachRSProperty(const std::shared_ptr<Rosen::RSPropertyBase> & property)35void ContentModifierAdapter::AttachRSProperty(const std::shared_ptr<Rosen::RSPropertyBase>& property) 36 { 37 AttachProperty(property); 38 } 39 } // namespace OHOS::Ace::Kit 40