1 /*
2  * Copyright (c) 2020-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 "components/ui_extend_image_view.h"
17 namespace OHOS {
SetSrc(const char * src)18 void UIExtendImageView::SetSrc(const char* src)
19 {
20     UIImageView::SetSrc(src);
21 #if defined(ENABLE_GIF) && (ENABLE_GIF == 1)
22     if (GetGifImageAnimator() != nullptr && this->canvas_ &&
23         this->canvas_->GetViewType() == UI_CANVAS) {
24         this->canvas_->Invalidate();
25     }
26 #endif
27 }
28 
SetSrc(const ImageInfo * src)29 void UIExtendImageView::SetSrc(const ImageInfo* src)
30 {
31     UIImageView::SetSrc(src);
32 #if defined(ENABLE_GIF) && (ENABLE_GIF == 1)
33     if (GetGifImageAnimator() != nullptr && this->canvas_ &&
34         this->canvas_->GetViewType() == UI_CANVAS) {
35         this->canvas_->Invalidate();
36     }
37 #endif
38 }
39 
SetCanvas(UIView * view)40 void UIExtendImageView::SetCanvas(UIView* view)
41 {
42     canvas_ = view;
43 }
44 } // namespace OHOS
45