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 "engines/gfx/hi3516/hi3516_engine.h"
17 #include "draw/draw_utils.h"
18 #include "hals/gfx_engines.h"
19 #include "lite_wm_type.h"
20
21 namespace OHOS {
22 const int16_t HARDWARE_ACC_SIZE_LIMIT = 50 * 50;
23
RegisterHi3516GfxEngine()24 __attribute__((constructor)) void RegisterHi3516GfxEngine()
25 {
26 BaseGfxEngine::InitGfxEngine(new Hi3516GfxEngine());
27 }
28
Fill(BufferInfo & dst,const Rect & fillArea,const ColorType color,const OpacityType opacity)29 void Hi3516GfxEngine::Fill(BufferInfo& dst,
30 const Rect& fillArea,
31 const ColorType color,
32 const OpacityType opacity)
33 {
34 #if ENABLE_GFX_ENGINES
35 if ((opacity != OPA_OPAQUE) && (fillArea.GetSize() >= HARDWARE_ACC_SIZE_LIMIT)) {
36 LiteSurfaceData data;
37 data.phyAddr = static_cast<uint8_t *>(dst.phyAddr);
38 data.width = dst.width;
39 data.height = dst.height;
40 data.stride = dst.stride;
41 data.pixelFormat = IMAGE_PIXEL_FORMAT_ARGB8888;
42 if (GfxEngines::GetInstance()->GfxFillArea(data, fillArea, color, opacity)) {
43 return;
44 }
45 }
46 #endif
47 SoftEngine::Fill(dst, fillArea, color, opacity);
48 }
49 }
50