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 "render_service_client/core/modifier/rs_modifier.h" 19 #include "ui/base/utils/utils.h" 20 #include "ui/view/draw/content_modifier.h" 21 #include "ui/view/draw/modifier.h" 22 23 namespace OHOS::Ace::Kit { 24 ContentModifierAdapter(const RefPtr<ContentModifier> & modifier)25ContentModifierAdapter::ContentModifierAdapter(const RefPtr<ContentModifier>& modifier) : modifier_(modifier) {} ~ContentModifierAdapter()26ContentModifierAdapter::~ContentModifierAdapter() {} 27 Draw(Rosen::RSDrawingContext & context) const28void ContentModifierAdapter::Draw(Rosen::RSDrawingContext& context) const 29 { 30 auto modifier = modifier_.Upgrade(); 31 CHECK_NULL_VOID(modifier); 32 DrawingContext drawContext = { .canvas = context.canvas, .width = context.width, .height = context.height}; 33 modifier->OnDraw(drawContext); 34 } 35 AttachRSProperty(const std::shared_ptr<Rosen::RSPropertyBase> & property)36void ContentModifierAdapter::AttachRSProperty(const std::shared_ptr<Rosen::RSPropertyBase>& property) 37 { 38 AttachProperty(property); 39 } 40 41 } // namespace OHOS::Ace::Kit 42