Merge branch 'master' of gitee.com:openharmony/graphic_graphic_2d into master

Signed-off-by: 王禹臻 <wangyuzhen5@huawei.com>
This commit is contained in:
王禹臻 2024-08-02 10:26:42 +00:00 committed by Gitee
commit 18a4113662
263 changed files with 3637 additions and 1172 deletions

View File

@ -34,7 +34,7 @@ group("graphic_common_test") {
"frameworks/bootanimation/test:test", "frameworks/bootanimation/test:test",
"frameworks/opengl_wrapper/test:test", "frameworks/opengl_wrapper/test:test",
"frameworks/vulkan_layers/test:test", "frameworks/vulkan_layers/test:test",
"rosen/graphic_test:test", "graphic_test:test",
"rosen/modules/composer:test", "rosen/modules/composer:test",
"rosen/modules/create_pixelmap_surface:test", "rosen/modules/create_pixelmap_surface:test",
"rosen/modules/effect/test/unittest:test", "rosen/modules/effect/test/unittest:test",

View File

@ -14,19 +14,34 @@
import("//build/test.gni") import("//build/test.gni")
import("//foundation/graphic/graphic_2d/graphic_config.gni") import("//foundation/graphic/graphic_2d/graphic_config.gni")
module_output_path = "graphic_2d/rosen/graphic_test/graphic_test" module_output_path = "graphic_2d/graphic_test/graphic_test"
group("unittest") { drawing_engine_sources = []
hardware_manager_sources = []
open_capability_sources = []
rs_display_effect_sources = []
rs_framework_sources = []
rs_func_feature_sources = []
rs_perform_feature_sources = []
group("test") {
testonly = true testonly = true
deps = [ ":RSGraphicTestTemplateTest" ] deps = [ ":RSGraphicTest" ]
} }
## Build RSGraphicTestTemplateTest ## Build RSGraphicTest
ohos_unittest("RSGraphicTestTemplateTest") { ohos_unittest("RSGraphicTest") {
module_out_path = module_output_path module_out_path = module_output_path
sources = [ "test_template.cpp" ] sources = []
sources += drawing_engine_sources
sources += hardware_manager_sources
sources += open_capability_sources
sources += rs_display_effect_sources
sources += rs_framework_sources
sources += rs_func_feature_sources
sources += rs_perform_feature_sources
deps = [ "$graphic_2d_root/rosen/graphic_test/graphic_test_framework:rs_graphic_test_main" ] deps = [ "$graphic_2d_root/graphic_test/graphic_test_framework:rs_graphic_test_main" ]
defines = [] defines = []
external_deps = [ external_deps = [

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

View File

@ -27,6 +27,7 @@ public:
auto size = GetScreenSize(); auto size = GetScreenSize();
SetSurfaceBounds({0, 0, size.x_ / 2.0f, size.y_ / 2.0f}); SetSurfaceBounds({0, 0, size.x_ / 2.0f, size.y_ / 2.0f});
SetSurfaceColor(RSColor(0xffff0000)); SetSurfaceColor(RSColor(0xffff0000));
SetImageSavePath("/data/local/graphic_test/test_template/");
} }
// called after each tests // called after each tests

View File

@ -13,7 +13,7 @@
import("//build/test.gni") import("//build/test.gni")
import("//foundation/graphic/graphic_2d/graphic_config.gni") import("//foundation/graphic/graphic_2d/graphic_config.gni")
import("../../modules/render_service_base/config.gni") import("${graphic_2d_root}/rosen/modules/render_service_base/config.gni")
config("rs_graphic_test_config") { config("rs_graphic_test_config") {
include_dirs = [ include_dirs = [

View File

@ -33,6 +33,7 @@ public:
void SetSurfaceBounds(const Vector4f& bounds); void SetSurfaceBounds(const Vector4f& bounds);
void SetSurfaceColor(const RSColor& color); void SetSurfaceColor(const RSColor& color);
void RegisterNode(std::shared_ptr<RSNode> node); void RegisterNode(std::shared_ptr<RSNode> node);
void SetImageSavePath(const std::string path);
// overrides gtest functions // overrides gtest functions
static void SetUpTestCase(); static void SetUpTestCase();
@ -49,6 +50,7 @@ private:
Vector4f surfaceBounds_; Vector4f surfaceBounds_;
std::vector<std::shared_ptr<RSNode>> nodes_; std::vector<std::shared_ptr<RSNode>> nodes_;
static uint32_t imageWriteId_; static uint32_t imageWriteId_;
std::string imageSavePath_ = "";
}; };
} // namespace Rosen } // namespace Rosen
} // namespace OHOS } // namespace OHOS

View File

@ -112,6 +112,9 @@ void RSGraphicTest::TearDown()
RSParameterParse::Instance().surfaceCaptureWaitTime); RSParameterParse::Instance().surfaceCaptureWaitTime);
if (pixelMap) { if (pixelMap) {
std::string filename = RSParameterParse::Instance().imageSavePath; std::string filename = RSParameterParse::Instance().imageSavePath;
if (imageSavePath_ != "") {
filename = imageSavePath_;
}
filename += testInfo->test_case_name() + std::string("_"); filename += testInfo->test_case_name() + std::string("_");
filename += testInfo->name() + std::string(".png"); filename += testInfo->name() + std::string(".png");
if (std::filesystem::exists(filename)) { if (std::filesystem::exists(filename)) {
@ -158,5 +161,21 @@ void RSGraphicTest::SetSurfaceColor(const RSColor& color)
RSGraphicTestDirector::Instance().SetSurfaceColor(color); RSGraphicTestDirector::Instance().SetSurfaceColor(color);
} }
void RSGraphicTest::SetImageSavePath(const std::string path)
{
namespace fs = std::filesystem;
if (!fs::exists(path)) {
if (!fs::create_directories(path)) {
LOGE("RSGraphicTestDirector create dir failed");
}
} else {
if (!fs::is_directory(path)) {
LOGE("RSGraphicTestDirector path is not dir");
return;
}
}
imageSavePath_ = path;
}
} // namespace Rosen } // namespace Rosen
} // namespace OHOS } // namespace OHOS

View File

@ -32,7 +32,7 @@ constexpr size_t ARGC_TWO = 2;
constexpr size_t ARGC_MAX = 10; constexpr size_t ARGC_MAX = 10;
constexpr int32_t ERR_NOT_OK = -1; constexpr int32_t ERR_NOT_OK = -1;
constexpr int32_t ERR_OK = 0; constexpr int32_t ERR_OK = 0;
constexpr int32_t ERR_NOT_SYSTEM_APP = 222; constexpr int32_t ERR_NOT_SYSTEM_APP = 202;
napi_value RSWindowAnimationManager::Init(napi_env env, napi_value exportObj) napi_value RSWindowAnimationManager::Init(napi_env env, napi_value exportObj)
{ {
@ -62,8 +62,8 @@ napi_value RSWindowAnimationManager::SetController(napi_env env, napi_callback_i
WALOGD("SetController"); WALOGD("SetController");
if (!RSWindowAnimationUtils::IsSystemApp()) { if (!RSWindowAnimationUtils::IsSystemApp()) {
WALOGE("SetController failed"); WALOGE("SetController failed");
napi_throw(env, CreateJsError(env, ERR_NOT_SYSTEM_APP, napi_throw_error(env, std::to_string(ERR_NOT_SYSTEM_APP).c_str(),
"WindowAnimationManager setController failed, is not system app")); "WindowAnimationManager setController failed, is not system app");
return nullptr; return nullptr;
} }
auto me = CheckParamsAndGetThis<RSWindowAnimationManager>(env, info); auto me = CheckParamsAndGetThis<RSWindowAnimationManager>(env, info);
@ -75,8 +75,8 @@ napi_value RSWindowAnimationManager::MinimizeWindowWithAnimation(napi_env env, n
WALOGD("MinimizeWindowWithAnimation"); WALOGD("MinimizeWindowWithAnimation");
if (!RSWindowAnimationUtils::IsSystemApp()) { if (!RSWindowAnimationUtils::IsSystemApp()) {
WALOGE("MinimizeWindowWithAnimation failed"); WALOGE("MinimizeWindowWithAnimation failed");
napi_throw(env, CreateJsError(env, ERR_NOT_SYSTEM_APP, napi_throw_error(env, std::to_string(ERR_NOT_SYSTEM_APP).c_str(),
"WindowAnimationManager minimizeWindowWithAnimation failed, is not system app")); "WindowAnimationManager minimizeWindowWithAnimation failed, is not system app");
return nullptr; return nullptr;
} }
@ -89,8 +89,8 @@ napi_value RSWindowAnimationManager::GetWindowAnimationTargets(napi_env env, nap
WALOGD("GetWindowAnimationTargets"); WALOGD("GetWindowAnimationTargets");
if (!RSWindowAnimationUtils::IsSystemApp()) { if (!RSWindowAnimationUtils::IsSystemApp()) {
WALOGE("GetWindowAnimationTargets failed"); WALOGE("GetWindowAnimationTargets failed");
napi_throw(env, CreateJsError(env, ERR_NOT_SYSTEM_APP, napi_throw_error(env, std::to_string(ERR_NOT_SYSTEM_APP).c_str(),
"WindowAnimationManager getWindowAnimationTargets failed, is not system app")); "WindowAnimationManager getWindowAnimationTargets failed, is not system app");
return nullptr; return nullptr;
} }
auto me = CheckParamsAndGetThis<RSWindowAnimationManager>(env, info); auto me = CheckParamsAndGetThis<RSWindowAnimationManager>(env, info);

View File

@ -57,71 +57,114 @@ ohos_shared_library("drawing_napi") {
subsystem_name = "graphic" subsystem_name = "graphic"
} }
ohos_shared_library("drawing_napi_impl") { if (is_arkui_x) {
sources = [ ohos_source_set("drawing_napi_impl") {
"brush_napi/js_brush.cpp", sources = [
"canvas_napi/js_canvas.cpp", "brush_napi/js_brush.cpp",
"color_filter_napi/js_color_filter.cpp", "canvas_napi/js_canvas.cpp",
"enum_napi/js_enum.cpp", "color_filter_napi/js_color_filter.cpp",
"font_napi/js_font.cpp", "enum_napi/js_enum.cpp",
"font_napi/js_typeface.cpp", "font_napi/js_font.cpp",
"image_filter_napi/js_image_filter.cpp", "font_napi/js_typeface.cpp",
"js_common.cpp", "image_filter_napi/js_image_filter.cpp",
"js_drawing_init.cpp", "js_common.cpp",
"js_drawing_utils.cpp", "js_drawing_init.cpp",
"lattice_napi/js_lattice.cpp", "js_drawing_utils.cpp",
"mask_filter_napi/js_mask_filter.cpp", "lattice_napi/js_lattice.cpp",
"matrix_napi/js_matrix.cpp", "mask_filter_napi/js_mask_filter.cpp",
"path_effect_napi/js_path_effect.cpp", "matrix_napi/js_matrix.cpp",
"path_napi/js_path.cpp", "path_effect_napi/js_path_effect.cpp",
"pen_napi/js_pen.cpp", "path_napi/js_path.cpp",
"region_napi/js_region.cpp", "pen_napi/js_pen.cpp",
"roundRect_napi/js_roundrect.cpp", "region_napi/js_region.cpp",
"sampling_options_napi/js_sampling_options.cpp", "roundRect_napi/js_roundrect.cpp",
"shader_effect_napi/js_shader_effect.cpp", "sampling_options_napi/js_sampling_options.cpp",
"shadow_layer_napi/js_shadow_layer.cpp", "shader_effect_napi/js_shader_effect.cpp",
"text_blob_napi/js_text_blob.cpp", "shadow_layer_napi/js_shadow_layer.cpp",
] "text_blob_napi/js_text_blob.cpp",
defines = []
configs = [ ":local_drawing_config" ]
public_configs = [ ":drawing_config" ]
deps = [
"../../../../../rosen/modules/2d_graphics:2d_graphics",
"../../../../../rosen/modules/render_service_base:librender_service_base",
]
external_deps = [ "napi:ace_napi" ]
if (current_os == "ohos" || current_os == "ohos_ng") {
sanitize = {
boundary_sanitize = true
integer_overflow = true
ubsan = true
}
external_deps += [
"hilog:libhilog",
"image_framework:image_native",
"init:libbegetutil",
] ]
deps += [ "../../../../../utils:libgraphic_utils" ]
defines += [ "ROSEN_OHOS" ] defines = []
cflags = [ "-fstack-protector-strong" ] configs = [ ":local_drawing_config" ]
cflags_cc = [ public_configs = [ ":drawing_config" ]
"-fstack-protector-strong",
"-std=c++17", deps = [
"../../../../../rosen/modules/2d_graphics:2d_graphics",
"../../../../../rosen/modules/render_service_base:librender_service_base_static",
"//foundation/arkui/napi:ace_napi",
] ]
} else {
defines += [ "MODULE_DRAWING" ] defines += [ "MODULE_DRAWING" ]
cflags_cc = [ "-std=c++17" ] cflags_cc = [ "-std=c++17" ]
}
if (current_os == "mingw") { part_name = "graphic_2d"
defines += [ "WINDOWS_PLATFORM" ] subsystem_name = "graphic"
} }
} else {
ohos_shared_library("drawing_napi_impl") {
sources = [
"brush_napi/js_brush.cpp",
"canvas_napi/js_canvas.cpp",
"color_filter_napi/js_color_filter.cpp",
"enum_napi/js_enum.cpp",
"font_napi/js_font.cpp",
"font_napi/js_typeface.cpp",
"image_filter_napi/js_image_filter.cpp",
"js_common.cpp",
"js_drawing_init.cpp",
"js_drawing_utils.cpp",
"lattice_napi/js_lattice.cpp",
"mask_filter_napi/js_mask_filter.cpp",
"matrix_napi/js_matrix.cpp",
"path_effect_napi/js_path_effect.cpp",
"path_napi/js_path.cpp",
"pen_napi/js_pen.cpp",
"region_napi/js_region.cpp",
"roundRect_napi/js_roundrect.cpp",
"sampling_options_napi/js_sampling_options.cpp",
"shader_effect_napi/js_shader_effect.cpp",
"shadow_layer_napi/js_shadow_layer.cpp",
"text_blob_napi/js_text_blob.cpp",
]
defines = []
configs = [ ":local_drawing_config" ]
public_configs = [ ":drawing_config" ]
innerapi_tags = [ "platformsdk" ] deps = [
part_name = "graphic_2d" "../../../../../rosen/modules/2d_graphics:2d_graphics",
subsystem_name = "graphic" "../../../../../rosen/modules/render_service_base:librender_service_base",
]
external_deps = [ "napi:ace_napi" ]
if (current_os == "ohos" || current_os == "ohos_ng") {
sanitize = {
boundary_sanitize = true
integer_overflow = true
ubsan = true
}
external_deps += [
"hilog:libhilog",
"image_framework:image_native",
"init:libbegetutil",
]
deps += [ "../../../../../utils:libgraphic_utils" ]
defines += [ "ROSEN_OHOS" ]
cflags = [ "-fstack-protector-strong" ]
cflags_cc = [
"-fstack-protector-strong",
"-std=c++17",
]
} else {
defines += [ "MODULE_DRAWING" ]
cflags_cc = [ "-std=c++17" ]
}
if (current_os == "mingw") {
defines += [ "WINDOWS_PLATFORM" ]
}
innerapi_tags = [ "platformsdk" ]
part_name = "graphic_2d"
subsystem_name = "graphic"
}
} }

View File

@ -1594,7 +1594,7 @@ napi_value JsCanvas::OnClipRegion(napi_env env, napi_callback_info info)
} }
int32_t jsClipOp = 0; int32_t jsClipOp = 0;
GET_INT32_CHECK_GE_ZERO_PARAM(ARGC_ONE, jsClipOp); GET_ENUM_PARAM(ARGC_ONE, jsClipOp, 0, static_cast<int32_t>(ClipOp::INTERSECT));
m_canvas->ClipRegion(*region, static_cast<ClipOp>(jsClipOp)); m_canvas->ClipRegion(*region, static_cast<ClipOp>(jsClipOp));
return nullptr; return nullptr;
@ -1823,7 +1823,7 @@ napi_value JsCanvas::OnClipRoundRect(napi_env env, napi_callback_info info)
} }
int32_t clipOpInt = 0; int32_t clipOpInt = 0;
GET_INT32_CHECK_GE_ZERO_PARAM(ARGC_ONE, clipOpInt); GET_ENUM_PARAM(ARGC_ONE, clipOpInt, 0, static_cast<int32_t>(ClipOp::INTERSECT));
if (argc == ARGC_TWO) { if (argc == ARGC_TWO) {
m_canvas->ClipRoundRect(jsRoundRect->GetRoundRect(), static_cast<ClipOp>(clipOpInt)); m_canvas->ClipRoundRect(jsRoundRect->GetRoundRect(), static_cast<ClipOp>(clipOpInt));

View File

@ -119,7 +119,7 @@ napi_value JsImageFilter::CreateBlurImageFilter(napi_env env, napi_callback_info
JsImageFilter *jsImageFilter = nullptr; JsImageFilter *jsImageFilter = nullptr;
if (argc > ARGC_THREE) { if (argc > ARGC_THREE) {
napi_unwrap(env, argv[ARGC_THREE], reinterpret_cast<void**>(&jsImageFilter)); GET_UNWRAP_PARAM_OR_NULL(ARGC_THREE, jsImageFilter);
} }
std::shared_ptr<ImageFilter> imageFilter = (jsImageFilter == nullptr) ? std::shared_ptr<ImageFilter> imageFilter = (jsImageFilter == nullptr) ?
@ -141,7 +141,7 @@ napi_value JsImageFilter::CreateFromColorFilter(napi_env env, napi_callback_info
JsImageFilter *jsImageFilter = nullptr; JsImageFilter *jsImageFilter = nullptr;
if (argc > ARGC_ONE) { if (argc > ARGC_ONE) {
napi_unwrap(env, argv[ARGC_ONE], reinterpret_cast<void**>(&jsImageFilter)); GET_UNWRAP_PARAM_OR_NULL(ARGC_ONE, jsImageFilter);
} }
std::shared_ptr<ColorFilter> colorFilter = jsColorFilter->GetColorFilter(); std::shared_ptr<ColorFilter> colorFilter = jsColorFilter->GetColorFilter();

View File

@ -779,6 +779,13 @@ napi_value JsPath::OnGetPositionAndTangent(napi_env env, napi_callback_info info
tangent = Drawing::Point(endPoint[ARGC_ZERO], endPoint[ARGC_ONE]); tangent = Drawing::Point(endPoint[ARGC_ZERO], endPoint[ARGC_ONE]);
bool result = m_path->GetPositionAndTangent(distance, position, tangent, forceClosed); bool result = m_path->GetPositionAndTangent(distance, position, tangent, forceClosed);
if (napi_set_named_property(env, argv[ARGC_TWO], "x", CreateJsNumber(env, position.GetX())) != napi_ok ||
napi_set_named_property(env, argv[ARGC_TWO], "y", CreateJsNumber(env, position.GetY())) != napi_ok ||
napi_set_named_property(env, argv[ARGC_THREE], "x", CreateJsNumber(env, tangent.GetX())) != napi_ok ||
napi_set_named_property(env, argv[ARGC_THREE], "y", CreateJsNumber(env, tangent.GetY())) != napi_ok) {
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM,
"JsPath::OnGetPositionAndTangent Cannot fill 'position' and 'tangent' Point type.");
}
return CreateJsNumber(env, result); return CreateJsNumber(env, result);
} }
@ -1097,7 +1104,7 @@ napi_value JsPath::OnIsClosed(napi_env env, napi_callback_info info)
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Invalid params."); return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Invalid params.");
} }
bool result = m_path->IsClosed(true); bool result = m_path->IsClosed(false);
return CreateJsNumber(env, result); return CreateJsNumber(env, result);
} }

View File

@ -118,14 +118,14 @@ napi_value JsRoundRect ::OnSetCorner(napi_env env, napi_callback_info info)
{ {
napi_value argv[ARGC_THREE] = { nullptr }; napi_value argv[ARGC_THREE] = { nullptr };
CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_THREE); CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_THREE);
RoundRect ::CornerPos pos; int32_t pos = 0;
ConvertFromJsValue(env, argv[0], pos); GET_ENUM_PARAM(ARGC_ZERO, pos, 0, static_cast<int32_t>(RoundRect::CornerPos::CORNER_NUMBER));
double x = 0; double x = 0;
GET_DOUBLE_PARAM(ARGC_ONE, x); GET_DOUBLE_PARAM(ARGC_ONE, x);
double y = 0; double y = 0;
GET_DOUBLE_PARAM(ARGC_TWO, y); GET_DOUBLE_PARAM(ARGC_TWO, y);
m_roundRect.SetCornerRadius(pos, x, y); m_roundRect.SetCornerRadius(static_cast<RoundRect::CornerPos>(pos), x, y);
return nullptr; return nullptr;
} }
@ -140,9 +140,9 @@ napi_value JsRoundRect ::OnGetCorner(napi_env env, napi_callback_info info)
{ {
napi_value argv[ARGC_ONE] = { nullptr }; napi_value argv[ARGC_ONE] = { nullptr };
CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_ONE); CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_ONE);
RoundRect ::CornerPos pos; int32_t pos = 0;
ConvertFromJsValue(env, argv[0], pos); GET_ENUM_PARAM(ARGC_ZERO, pos, 0, static_cast<int32_t>(RoundRect::CornerPos::CORNER_NUMBER));
auto point = m_roundRect.GetCornerRadius(pos); auto point = m_roundRect.GetCornerRadius(static_cast<RoundRect::CornerPos>(pos));
return ConvertPointToJsValue(env, point); return ConvertPointToJsValue(env, point);
} }

View File

@ -304,26 +304,42 @@ napi_value JsTextBlob::MakeFromPosText(napi_env env, napi_callback_info info)
uint32_t len = 0; uint32_t len = 0;
GET_UINT32_PARAM(ARGC_ONE, len); GET_UINT32_PARAM(ARGC_ONE, len);
size_t bufferLen = static_cast<size_t>(len);
char* buffer = new(std::nothrow) char[bufferLen + 1];
if (!buffer) {
ROSEN_LOGE("JsTextBlob::MakeFromPosText: failed to create buffer");
return nullptr;
}
if (napi_get_value_string_utf8(env, argv[ARGC_ZERO], buffer, bufferLen + 1, &bufferLen) != napi_ok) {
delete[] buffer;
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Incorrect Argv[0] type.");
}
napi_value array = argv[ARGC_TWO]; napi_value array = argv[ARGC_TWO];
uint32_t pointsSize = 0; uint32_t pointsSize = 0;
if (napi_get_array_length(env, array, &pointsSize) != napi_ok) { if (napi_get_array_length(env, array, &pointsSize) != napi_ok) {
delete[] buffer;
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Incorrect Argv[2]."); return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Incorrect Argv[2].");
} }
if (pointsSize == 0) { if (pointsSize == 0 || bufferLen == 0) {
ROSEN_LOGE("JsTextBlob::MakeFromPosText: points array is empty"); delete[] buffer;
return nullptr; return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Argv[0] is empty.");
} }
if (len != pointsSize) { if (len != pointsSize || len != bufferLen) {
ROSEN_LOGE("JsTextBlob::MakeFromPosText: string length does not match points array length"); delete[] buffer;
return nullptr; return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM,
"string length does not match points array length.");
} }
Point* points = new(std::nothrow) Point[pointsSize]; Point* points = new(std::nothrow) Point[pointsSize];
if (!points) { if (!points) {
delete[] buffer;
ROSEN_LOGE("JsTextBlob::MakeFromPosText: failed to create Point"); ROSEN_LOGE("JsTextBlob::MakeFromPosText: failed to create Point");
return nullptr; return nullptr;
} }
if (!MakePoints(env, points, pointsSize, array)) { if (!MakePoints(env, points, pointsSize, array)) {
delete[] buffer;
delete[] points;
ROSEN_LOGE("JsTextBlob::MakeFromPosText: Argv[2] is invalid"); ROSEN_LOGE("JsTextBlob::MakeFromPosText: Argv[2] is invalid");
return nullptr; return nullptr;
} }
@ -332,19 +348,11 @@ napi_value JsTextBlob::MakeFromPosText(napi_env env, napi_callback_info info)
GET_UNWRAP_PARAM(ARGC_THREE, jsFont); GET_UNWRAP_PARAM(ARGC_THREE, jsFont);
std::shared_ptr<Font> font = jsFont->GetFont(); std::shared_ptr<Font> font = jsFont->GetFont();
if (font == nullptr) { if (font == nullptr) {
delete[] buffer;
delete[] points;
ROSEN_LOGE("JsTextBlob::MakeFromPosText: font is nullptr"); ROSEN_LOGE("JsTextBlob::MakeFromPosText: font is nullptr");
return nullptr; return nullptr;
} }
size_t bufferLen = static_cast<size_t>(len);
char* buffer = new(std::nothrow) char[bufferLen + 1];
if (!buffer) {
ROSEN_LOGE("JsTextBlob::MakeFromPosText: failed to create buffer");
return nullptr;
}
if (napi_get_value_string_utf8(env, argv[ARGC_ZERO], buffer, bufferLen + 1, &bufferLen) != napi_ok) {
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Incorrect Argv[0] type.");
}
return getJsTextBlob(buffer, bufferLen, points, font, env); return getJsTextBlob(buffer, bufferLen, points, font, env);
} }

View File

@ -181,6 +181,12 @@ napi_value EffectNapi::CreateBrightnessBlender(napi_env env, napi_callback_info
} }
napi_value object = nullptr; napi_value object = nullptr;
napi_create_object(env, &object); napi_create_object(env, &object);
if (object == nullptr) {
UIEFFECT_LOG_E("EffectNapi CreateBrightnessBlender object is Faild");
delete blender;
blender = nullptr;
return nullptr;
}
napi_wrap( napi_wrap(
env, object, blender, env, object, blender,
[](napi_env env, void* data, void* hint) { [](napi_env env, void* data, void* hint) {
@ -196,6 +202,7 @@ napi_value EffectNapi::CreateBrightnessBlender(napi_env env, napi_callback_info
if (argc != 1) { if (argc != 1) {
UIEFFECT_LOG_E("EffectNapi SetbackgroundColorBlender input check failed, argc number is not 1."); UIEFFECT_LOG_E("EffectNapi SetbackgroundColorBlender input check failed, argc number is not 1.");
delete blender; delete blender;
blender = nullptr;
return nullptr; return nullptr;
} }
@ -203,12 +210,14 @@ napi_value EffectNapi::CreateBrightnessBlender(napi_env env, napi_callback_info
if (nativeObj == nullptr) { if (nativeObj == nullptr) {
UIEFFECT_LOG_E("EffectNapi SetbackgroundColorBlender input check failed, nativeObj is nullptr."); UIEFFECT_LOG_E("EffectNapi SetbackgroundColorBlender input check failed, nativeObj is nullptr.");
delete blender; delete blender;
blender = nullptr;
return nullptr; return nullptr;
} }
if (!CheckCreateBrightnessBlender (env, nativeObj)) { if (!CheckCreateBrightnessBlender(env, nativeObj)) {
UIEFFECT_LOG_E("EffectNapi CheckCreateBrightnessBlender failed."); UIEFFECT_LOG_E("EffectNapi CheckCreateBrightnessBlender failed.");
delete blender; delete blender;
blender = nullptr;
return nullptr; return nullptr;
} }
@ -221,9 +230,6 @@ napi_value EffectNapi::CreateBrightnessBlender(napi_env env, napi_callback_info
napi_set_named_property(env, object, "negativeCoefficient", ParseJsValue(env, nativeObj, "negativeCoefficient")); napi_set_named_property(env, object, "negativeCoefficient", ParseJsValue(env, nativeObj, "negativeCoefficient"));
napi_set_named_property(env, object, "fraction", ParseJsValue(env, nativeObj, "fraction")); napi_set_named_property(env, object, "fraction", ParseJsValue(env, nativeObj, "fraction"));
if (object == nullptr) {
UIEFFECT_LOG_E("EffectNapi CreateBrightnessBlender object is Faild");
}
return object; return object;
} }

View File

@ -21,6 +21,7 @@ namespace {
constexpr uint32_t NUM_2 = 2; constexpr uint32_t NUM_2 = 2;
constexpr uint32_t NUM_3 = 3; constexpr uint32_t NUM_3 = 3;
constexpr uint32_t NUM_4 = 4; constexpr uint32_t NUM_4 = 4;
constexpr uint32_t NUM_5 = 5;
} }
namespace OHOS { namespace OHOS {
@ -311,31 +312,34 @@ napi_value FilterNapi::SetWaterRipple(napi_env env, napi_callback_info info)
napi_get_undefined(env, &result); napi_get_undefined(env, &result);
napi_status status; napi_status status;
napi_value thisVar = nullptr; napi_value thisVar = nullptr;
napi_value argValue[NUM_4] = {0}; napi_value argValue[NUM_5] = {0};
size_t argCount = NUM_4; size_t argCount = NUM_5;
UIEFFECT_JS_ARGS(env, info, status, argCount, argValue, thisVar); UIEFFECT_JS_ARGS(env, info, status, argCount, argValue, thisVar);
UIEFFECT_NAPI_CHECK_RET_D(UIEFFECT_IS_OK(status), nullptr, FILTER_LOG_E("fail to napi_get_water_ripple_info")); UIEFFECT_NAPI_CHECK_RET_D(UIEFFECT_IS_OK(status), nullptr, FILTER_LOG_E("fail to napi_get_water_ripple_info"));
std::shared_ptr<WaterRipplePara> para = std::make_shared<WaterRipplePara>(); std::shared_ptr<WaterRipplePara> para = std::make_shared<WaterRipplePara>();
float progress = 0.0f; float progress = 0.0f;
float waveCount = 0.0f; uint32_t waveCount = 0;
float rippleCenterX = 0.0f; float rippleCenterX = 0.0f;
float rippleCenterY = 0.0f; float rippleCenterY = 0.0f;
uint32_t rippleMode = 0;
if (argCount != NUM_4) { if (argCount != NUM_5) {
FILTER_LOG_E("Args number less than 4"); FILTER_LOG_E("Args number less than 5");
} }
progress = GetSpecialValue(env, argValue[NUM_0]); progress = GetSpecialValue(env, argValue[NUM_0]);
waveCount = GetSpecialValue(env, argValue[NUM_1]); waveCount = GetSpecialIntValue(env, argValue[NUM_1]);
rippleCenterX = GetSpecialValue(env, argValue[NUM_2]); rippleCenterX = GetSpecialValue(env, argValue[NUM_2]);
rippleCenterY = GetSpecialValue(env, argValue[NUM_3]); rippleCenterY = GetSpecialValue(env, argValue[NUM_3]);
rippleMode = GetSpecialIntValue(env, argValue[NUM_4]);
para->SetProgress(progress); para->SetProgress(progress);
para->SetWaveCount(waveCount); para->SetWaveCount(waveCount);
para->SetRippleCenterX(rippleCenterX); para->SetRippleCenterX(rippleCenterX);
para->SetRippleCenterY(rippleCenterY); para->SetRippleCenterY(rippleCenterY);
para->SetRippleMode(rippleMode);
Filter* filterObj = nullptr; Filter* filterObj = nullptr;
NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast<void**>(&filterObj))); NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast<void**>(&filterObj)));

View File

@ -1,19 +0,0 @@
# Copyright (c) 2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//foundation/graphic/graphic_2d/graphic_config.gni")
group("test") {
testonly = true
deps = []
}

View File

@ -159,6 +159,10 @@ if (enable_text_gine) {
"$rosen_root/modules/2d_engine/rosen_text/skia_txt/txt/src", "$rosen_root/modules/2d_engine/rosen_text/skia_txt/txt/src",
] ]
if (is_arkui_x) {
include_dirs += [ "//third_party/bounds_checking_function/include" ]
}
defines += [ defines += [
"USE_GRAPHIC_TEXT_GINE", "USE_GRAPHIC_TEXT_GINE",
"WINDOWS_PLATFORM", "WINDOWS_PLATFORM",

View File

@ -27,13 +27,13 @@ namespace SPText {
*/ */
static void GetLayersGroupId(std::vector<size_t>& groupIds, const RSRenderGroup& renderGroup, size_t index) static void GetLayersGroupId(std::vector<size_t>& groupIds, const RSRenderGroup& renderGroup, size_t index)
{ {
for (auto& groupInfo : renderGroup.groupInfos) { for (const auto& groupInfo : renderGroup.groupInfos) {
for (auto& j : groupInfo.layerIndexes) { for (size_t j : groupInfo.layerIndexes) {
if (j < groupIds.size()) { if (j < groupIds.size()) {
groupIds[j] = index; groupIds[j] = index;
} }
} }
for (auto& j : groupInfo.maskIndexes) { for (size_t j : groupInfo.maskIndexes) {
if (j < groupIds.size()) { if (j < groupIds.size()) {
groupIds[j] = index; groupIds[j] = index;
} }
@ -87,7 +87,7 @@ static void MergePathByLayerColor(const std::vector<RSGroupInfo>& groupInfos,
TextEngine::NodeLayerInfo tempLayer; TextEngine::NodeLayerInfo tempLayer;
size_t currentIndex = 0; // the current layerindex, that effective index of tempLayer size_t currentIndex = 0; // the current layerindex, that effective index of tempLayer
bool isFirst = true; bool isFirst = true;
for (auto& layerIndex: groupInfo.layerIndexes) { for (size_t layerIndex: groupInfo.layerIndexes) {
if (layerIndex >= pathLayers.size() || layerIndex >= groupIndexes.size()) { if (layerIndex >= pathLayers.size() || layerIndex >= groupIndexes.size()) {
continue; continue;
} }

View File

@ -157,6 +157,10 @@ void OH_Drawing_TextBlobGetBounds(OH_Drawing_TextBlob* cTextBlob, OH_Drawing_Rec
return; return;
} }
std::shared_ptr<Rect> rect = textblob->Bounds(); std::shared_ptr<Rect> rect = textblob->Bounds();
if (rect == nullptr) {
g_drawingErrorCode = OH_DRAWING_ERROR_INVALID_PARAMETER;
return;
}
*outRect = Rect(rect->GetLeft(), rect->GetTop(), rect->GetRight(), rect->GetBottom()); *outRect = Rect(rect->GetLeft(), rect->GetTop(), rect->GetRight(), rect->GetBottom());
} }

View File

@ -24,8 +24,6 @@ namespace Rosen {
namespace Drawing { namespace Drawing {
class DRAWING_API Paint { class DRAWING_API Paint {
public: public:
constexpr static scalar DEFAULT_MITER_VAL = 4.0f;
Paint() noexcept; Paint() noexcept;
Paint(const Paint& other) noexcept; Paint(const Paint& other) noexcept;
Paint(const Color& c, std::shared_ptr<ColorSpace> colorSpace = nullptr) noexcept; Paint(const Color& c, std::shared_ptr<ColorSpace> colorSpace = nullptr) noexcept;
@ -116,7 +114,7 @@ private:
BlendMode blendMode_ = BlendMode::SRC_OVER; BlendMode blendMode_ = BlendMode::SRC_OVER;
PaintStyle style_ = PaintStyle::PAINT_NONE; PaintStyle style_ = PaintStyle::PAINT_NONE;
scalar width_ = 0.0f; scalar width_ = 0.0f;
scalar miterLimit_ = DEFAULT_MITER_VAL; // default as 4.0f scalar miterLimit_ = Pen::DEFAULT_MITER_VAL; // default as 4.0f
Pen::JoinStyle join_ = Pen::JoinStyle::DEFAULT_JOIN; Pen::JoinStyle join_ = Pen::JoinStyle::DEFAULT_JOIN;
Pen::CapStyle cap_ = Pen::CapStyle::DEFAULT_CAP; Pen::CapStyle cap_ = Pen::CapStyle::DEFAULT_CAP;

View File

@ -28,6 +28,8 @@ namespace Rosen {
namespace Drawing { namespace Drawing {
class DRAWING_API Pen { class DRAWING_API Pen {
public: public:
constexpr static scalar DEFAULT_MITER_VAL = 4.0f;
enum class JoinStyle { enum class JoinStyle {
MITER_JOIN, MITER_JOIN,
ROUND_JOIN, ROUND_JOIN,

View File

@ -17,6 +17,7 @@
#define IMAGE_H #define IMAGE_H
#include "drawing/engine_adapter/impl_interface/image_impl.h" #include "drawing/engine_adapter/impl_interface/image_impl.h"
#include "image/gpu_context.h"
#include "include/core/SkImage.h" #include "include/core/SkImage.h"
#include "utils/drawing_macros.h" #include "utils/drawing_macros.h"
#ifdef RS_ENABLE_VK #ifdef RS_ENABLE_VK

View File

@ -92,7 +92,11 @@ public:
uint32_t offset = opAllocator_.AddrToOffset(op); uint32_t offset = opAllocator_.AddrToOffset(op);
if (lastOpItemOffset_.has_value()) { if (lastOpItemOffset_.has_value()) {
#ifdef CROSS_PLATFORM
auto* lastOpItem = static_cast<OpItem*>(opAllocator_.OffsetToAddr(lastOpItemOffset_.__get()));
#else
auto* lastOpItem = static_cast<OpItem*>(opAllocator_.OffsetToAddr(lastOpItemOffset_.value())); auto* lastOpItem = static_cast<OpItem*>(opAllocator_.OffsetToAddr(lastOpItemOffset_.value()));
#endif
if (lastOpItem != nullptr) { if (lastOpItem != nullptr) {
lastOpItem->SetNextOpItemOffset(offset); lastOpItem->SetNextOpItemOffset(offset);
} }

View File

@ -107,6 +107,9 @@ public:
virtual void Playback(Canvas* canvas, const Rect* rect) = 0; virtual void Playback(Canvas* canvas, const Rect* rect) = 0;
virtual void SetNodeId(NodeId id) {} virtual void SetNodeId(NodeId id) {}
virtual void Dump(std::string& out);
std::string GetOpDesc();
static void SetBaseCallback( static void SetBaseCallback(
std::function<void (std::shared_ptr<Drawing::Image> image)> holdDrawingImagefunc); std::function<void (std::shared_ptr<Drawing::Image> image)> holdDrawingImagefunc);

View File

@ -84,7 +84,11 @@ public:
uint32_t offset = opAllocator_.AddrToOffset(op); uint32_t offset = opAllocator_.AddrToOffset(op);
if (lastOpItemOffset_.has_value()) { if (lastOpItemOffset_.has_value()) {
#ifdef CROSS_PLATFORM
auto* lastOpItem = static_cast<OpItem*>(opAllocator_.OffsetToAddr(lastOpItemOffset_.__get()));
#else
auto* lastOpItem = static_cast<OpItem*>(opAllocator_.OffsetToAddr(lastOpItemOffset_.value())); auto* lastOpItem = static_cast<OpItem*>(opAllocator_.OffsetToAddr(lastOpItemOffset_.value()));
#endif
if (lastOpItem != nullptr) { if (lastOpItem != nullptr) {
lastOpItem->SetNextOpItemOffset(offset); lastOpItem->SetNextOpItemOffset(offset);
} }
@ -183,6 +187,8 @@ public:
void UpdateNodeIdToPicture(NodeId nodeId); void UpdateNodeIdToPicture(NodeId nodeId);
size_t CountTextBlobNum(); size_t CountTextBlobNum();
void Dump(std::string& out);
private: private:
void ClearCache(); void ClearCache();
void GenerateCacheByVector(Canvas* canvas, const Rect* rect); void GenerateCacheByVector(Canvas* canvas, const Rect* rect);

View File

@ -250,7 +250,7 @@ void Paint::Reset()
blendMode_ = BlendMode::SRC_OVER; blendMode_ = BlendMode::SRC_OVER;
style_ = PaintStyle::PAINT_NONE; style_ = PaintStyle::PAINT_NONE;
width_ = 0; width_ = 0;
miterLimit_ = DEFAULT_MITER_VAL; miterLimit_ = Pen::DEFAULT_MITER_VAL;
join_ = Pen::JoinStyle::DEFAULT_JOIN; join_ = Pen::JoinStyle::DEFAULT_JOIN;
cap_ = Pen::CapStyle::DEFAULT_CAP; cap_ = Pen::CapStyle::DEFAULT_CAP;

View File

@ -22,7 +22,7 @@ namespace Rosen {
namespace Drawing { namespace Drawing {
Pen::Pen() noexcept Pen::Pen() noexcept
: width_(0), : width_(0),
miterLimit_(-1), miterLimit_(DEFAULT_MITER_VAL),
join_(Pen::JoinStyle::MITER_JOIN), join_(Pen::JoinStyle::MITER_JOIN),
cap_(Pen::CapStyle::FLAT_CAP), cap_(Pen::CapStyle::FLAT_CAP),
pathEffect_(nullptr), pathEffect_(nullptr),

View File

@ -23,6 +23,7 @@ namespace Drawing {
DrawingSymbolLayersGroups SkiaHmSymbolConfigOhos::GetSymbolLayersGroups(uint16_t glyphId) DrawingSymbolLayersGroups SkiaHmSymbolConfigOhos::GetSymbolLayersGroups(uint16_t glyphId)
{ {
#if !defined(CROSS_PLATFORM)
SymbolLayersGroups groups = HmSymbolConfig_OHOS::GetInstance()->GetSymbolLayersGroups(glyphId); SymbolLayersGroups groups = HmSymbolConfig_OHOS::GetInstance()->GetSymbolLayersGroups(glyphId);
DrawingSymbolLayersGroups drawingGroups; DrawingSymbolLayersGroups drawingGroups;
@ -52,6 +53,10 @@ DrawingSymbolLayersGroups SkiaHmSymbolConfigOhos::GetSymbolLayersGroups(uint16_t
drawingGroups.renderModeGroups = drawingRenderModeGroups; drawingGroups.renderModeGroups = drawingRenderModeGroups;
return drawingGroups; return drawingGroups;
#else
DrawingSymbolLayersGroups drawingGroups;
return drawingGroups;
#endif
} }
DrawingAnimationSetting SkiaHmSymbolConfigOhos::ConvertToDrawingAnimationSetting(AnimationSetting setting) DrawingAnimationSetting SkiaHmSymbolConfigOhos::ConvertToDrawingAnimationSetting(AnimationSetting setting)
@ -120,6 +125,7 @@ static std::vector<DrawingPiecewiseParameter> ConvertPiecewiseParametersVec(cons
return out; return out;
} }
#if !defined(CROSS_PLATFORM)
std::vector<std::vector<DrawingPiecewiseParameter>> SkiaHmSymbolConfigOhos::GetGroupParameters( std::vector<std::vector<DrawingPiecewiseParameter>> SkiaHmSymbolConfigOhos::GetGroupParameters(
DrawingAnimationType type, uint16_t groupSum, uint16_t animationMode, DrawingCommonSubType commonSubType) DrawingAnimationType type, uint16_t groupSum, uint16_t animationMode, DrawingCommonSubType commonSubType)
{ {
@ -134,6 +140,7 @@ std::vector<std::vector<DrawingPiecewiseParameter>> SkiaHmSymbolConfigOhos::GetG
} }
return parameters; return parameters;
} }
#endif
} // namespace Drawing } // namespace Drawing
} // namespace Rosen } // namespace Rosen

View File

@ -170,7 +170,16 @@ bool SkiaImage::BuildSubset(const std::shared_ptr<Image> image, const RectI& rec
LOGD("SkiaImage::BuildSubset failed, origin Image is invalid"); LOGD("SkiaImage::BuildSubset failed, origin Image is invalid");
return false; return false;
} }
auto skiaImage = image->GetImpl<SkiaImage>()->GetImage(); auto imageImpl = image->GetImpl<SkiaImage>();
if (imageImpl == nullptr) {
LOGD("SkiaImage::BuildSubset failed, GetImpl failed");
return false;
}
auto skiaImage = imageImpl->GetImage();
if (skiaImage == nullptr) {
LOGD("SkiaImage::BuildSubset failed, GetImage failed");
return false;
}
auto skiaRect = SkIRect::MakeLTRB(rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); auto skiaRect = SkIRect::MakeLTRB(rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom());
grContext_ = gpuContext.GetImpl<SkiaGPUContext>()->GetGrContext(); grContext_ = gpuContext.GetImpl<SkiaGPUContext>()->GetGrContext();
PostSkImgToTargetThread(); PostSkImgToTargetThread();
@ -215,7 +224,8 @@ bool SkiaImage::BuildFromTexture(GPUContext& gpuContext, const TextureInfo& info
sk_sp<SkColorSpace> skColorSpace = nullptr; sk_sp<SkColorSpace> skColorSpace = nullptr;
if (colorSpace != nullptr) { if (colorSpace != nullptr) {
skColorSpace = colorSpace->GetImpl<SkiaColorSpace>()->GetColorSpace(); auto colorSpaceImpl = colorSpace->GetImpl<SkiaColorSpace>();
skColorSpace = colorSpaceImpl ? colorSpaceImpl->GetColorSpace() : SkColorSpace::MakeSRGB();
} else { } else {
skColorSpace = SkColorSpace::MakeSRGB(); skColorSpace = SkColorSpace::MakeSRGB();
} }
@ -274,7 +284,8 @@ bool SkiaImage::BuildFromSurface(GPUContext& gpuContext, Surface& surface, Textu
sk_sp<SkColorSpace> skColorSpace = nullptr; sk_sp<SkColorSpace> skColorSpace = nullptr;
if (colorSpace != nullptr) { if (colorSpace != nullptr) {
skColorSpace = colorSpace->GetImpl<SkiaColorSpace>()->GetColorSpace(); auto colorSpaceImpl = colorSpace->GetImpl<SkiaColorSpace>();
skColorSpace = colorSpaceImpl ? colorSpaceImpl->GetColorSpace() : nullptr;
} }
PostSkImgToTargetThread(); PostSkImgToTargetThread();
skiaImage_ = SkImage::MakeFromTexture(grContext_.get(), grBackendTexture, skiaImage_ = SkImage::MakeFromTexture(grContext_.get(), grBackendTexture,

View File

@ -90,10 +90,11 @@ public:
static SkImageInfo ConvertToSkImageInfo(const ImageInfo& imageInfo) static SkImageInfo ConvertToSkImageInfo(const ImageInfo& imageInfo)
{ {
auto colorSpace = imageInfo.GetColorSpace(); auto colorSpace = imageInfo.GetColorSpace();
auto colorSpaceImpl = colorSpace ? colorSpace->GetImpl<SkiaColorSpace>() : nullptr;
return SkImageInfo::Make(imageInfo.GetWidth(), imageInfo.GetHeight(), return SkImageInfo::Make(imageInfo.GetWidth(), imageInfo.GetHeight(),
ConvertToSkColorType(imageInfo.GetColorType()), ConvertToSkColorType(imageInfo.GetColorType()),
ConvertToSkAlphaType(imageInfo.GetAlphaType()), ConvertToSkAlphaType(imageInfo.GetAlphaType()),
colorSpace ? colorSpace->GetImpl<SkiaColorSpace>()->GetColorSpace() : nullptr); colorSpaceImpl ? colorSpaceImpl->GetColorSpace() : nullptr);
} }
static ColorType ConvertToColorType(const SkColorType& format) static ColorType ConvertToColorType(const SkColorType& format)

View File

@ -149,7 +149,7 @@ void SkiaPaint::PaintToSkPaint(const Paint& paint, SkPaint& skPaint)
void SkiaPaint::ApplyStrokeParam(const Paint& paint, SkPaint& skPaint) void SkiaPaint::ApplyStrokeParam(const Paint& paint, SkPaint& skPaint)
{ {
if (!IsScalarAlmostEqual(paint.GetMiterLimit(), Paint::DEFAULT_MITER_VAL)) { if (!IsScalarAlmostEqual(paint.GetMiterLimit(), Pen::DEFAULT_MITER_VAL)) {
skPaint.setStrokeMiter(paint.GetMiterLimit()); skPaint.setStrokeMiter(paint.GetMiterLimit());
} }
skPaint.setStrokeWidth(paint.GetWidth()); skPaint.setStrokeWidth(paint.GetWidth());

View File

@ -21,9 +21,13 @@
namespace OHOS { namespace OHOS {
namespace Rosen { namespace Rosen {
namespace Drawing { namespace Drawing {
SkiaRuntimeBlenderBuilder::SkiaRuntimeBlenderBuilder( SkiaRuntimeBlenderBuilder::SkiaRuntimeBlenderBuilder(std::shared_ptr<RuntimeEffect> effect) noexcept
std::shared_ptr<RuntimeEffect> effect) noexcept : skRuntimeBlendBuilder_(std::make_shared<SkRuntimeBlendBuilder>( {
effect->GetImpl<SkiaRuntimeEffect>()->GetRuntimeEffect())) {} auto effectImpl = effect ? effect->GetImpl<SkiaRuntimeEffect>() : nullptr;
if (effectImpl != nullptr) {
skRuntimeBlendBuilder_ = std::make_shared<SkRuntimeBlendBuilder>(effectImpl->GetRuntimeEffect());
}
}
std::shared_ptr<Blender> SkiaRuntimeBlenderBuilder::MakeBlender() std::shared_ptr<Blender> SkiaRuntimeBlenderBuilder::MakeBlender()
{ {

View File

@ -30,10 +30,13 @@
namespace OHOS { namespace OHOS {
namespace Rosen { namespace Rosen {
namespace Drawing { namespace Drawing {
SkiaRuntimeShaderBuilder::SkiaRuntimeShaderBuilder(std::shared_ptr<RuntimeEffect> effect) noexcept
SkiaRuntimeShaderBuilder::SkiaRuntimeShaderBuilder( {
std::shared_ptr<RuntimeEffect> effect) noexcept : skRuntimeShaderBuilder_(std::make_shared<SkRuntimeShaderBuilder>( auto effectImpl = effect ? effect->GetImpl<SkiaRuntimeEffect>() : nullptr;
effect->GetImpl<SkiaRuntimeEffect>()->GetRuntimeEffect())) {} if (effectImpl != nullptr) {
skRuntimeShaderBuilder_ = std::make_shared<SkRuntimeShaderBuilder>(effectImpl->GetRuntimeEffect());
}
}
std::shared_ptr<ShaderEffect> SkiaRuntimeShaderBuilder::MakeShader(const Matrix* localMatrix, bool isOpaque) std::shared_ptr<ShaderEffect> SkiaRuntimeShaderBuilder::MakeShader(const Matrix* localMatrix, bool isOpaque)
{ {

View File

@ -195,7 +195,11 @@ DrawingSymbolLayersGroups SkiaStaticFactory::GetSymbolLayersGroups(uint16_t glyp
std::vector<std::vector<DrawingPiecewiseParameter>> SkiaStaticFactory::GetGroupParameters( std::vector<std::vector<DrawingPiecewiseParameter>> SkiaStaticFactory::GetGroupParameters(
DrawingAnimationType type, uint16_t groupSum, uint16_t animationMode, DrawingCommonSubType commonSubType) DrawingAnimationType type, uint16_t groupSum, uint16_t animationMode, DrawingCommonSubType commonSubType)
{ {
#if !defined(CROSS_PLATFORM)
return SkiaHmSymbolConfigOhos::GetGroupParameters(type, groupSum, animationMode, commonSubType); return SkiaHmSymbolConfigOhos::GetGroupParameters(type, groupSum, animationMode, commonSubType);
#endif
std::vector<std::vector<DrawingPiecewiseParameter>> parameters;
return parameters;
} }
FontStyleSet* SkiaStaticFactory::CreateEmpty() FontStyleSet* SkiaStaticFactory::CreateEmpty()

View File

@ -198,7 +198,10 @@ Path SkiaTextBlob::GetDrawingPathforTextBlob(uint16_t glyphId, const TextBlob* b
{ {
SkTextBlob* skTextBlob = nullptr; SkTextBlob* skTextBlob = nullptr;
if (blob) { if (blob) {
skTextBlob = blob->GetImpl<SkiaTextBlob>()->GetTextBlob().get(); auto skiaBlobImpl = blob->GetImpl<SkiaTextBlob>();
if (skiaBlobImpl != nullptr) {
skTextBlob = skiaBlobImpl->GetTextBlob().get();
}
} }
SkPath skPath = GetPathforTextBlob(glyphId, skTextBlob); SkPath skPath = GetPathforTextBlob(glyphId, skTextBlob);
Path path; Path path;

View File

@ -51,7 +51,9 @@ bool GPUContext::BuildFromVK(const GrVkBackendContext& context, const GPUContext
void GPUContext::GetResourceCacheLimits(int* maxResource, size_t* maxResourceBytes) const void GPUContext::GetResourceCacheLimits(int* maxResource, size_t* maxResourceBytes) const
{ {
impl_->GetResourceCacheLimits(maxResource, maxResourceBytes); if (impl_ != nullptr) {
impl_->GetResourceCacheLimits(maxResource, maxResourceBytes);
}
} }
void GPUContext::SetResourceCacheLimits(int maxResource, size_t maxResourceBytes) void GPUContext::SetResourceCacheLimits(int maxResource, size_t maxResourceBytes)

View File

@ -39,6 +39,63 @@
namespace OHOS { namespace OHOS {
namespace Rosen { namespace Rosen {
namespace Drawing { namespace Drawing {
std::unordered_map<uint32_t, std::string> typeOpDes = {
{ DrawOpItem::OPITEM_HEAD, "OPITEM_HEAD"},
{ DrawOpItem::POINT_OPITEM, "POINT_OPITEM" },
{ DrawOpItem::POINTS_OPITEM, "POINTS_OPITEM" },
{ DrawOpItem::LINE_OPITEM, "LINE_OPITEM" },
{ DrawOpItem::RECT_OPITEM, "RECT_OPITEM" },
{ DrawOpItem::ROUND_RECT_OPITEM, "ROUND_RECT_OPITEM" },
{ DrawOpItem::NESTED_ROUND_RECT_OPITEM, "NESTED_ROUND_RECT_OPITEM" },
{ DrawOpItem::ARC_OPITEM, "ARC_OPITEM" },
{ DrawOpItem::PIE_OPITEM, "PIE_OPITEM" },
{ DrawOpItem::OVAL_OPITEM, "OVAL_OPITEM" },
{ DrawOpItem::CIRCLE_OPITEM, "CIRCLE_OPITEM" },
{ DrawOpItem::PATH_OPITEM, "PATH_OPITEM" },
{ DrawOpItem::BACKGROUND_OPITEM, "BACKGROUND_OPITEM" },
{ DrawOpItem::SHADOW_OPITEM, "SHADOW_OPITEM" },
{ DrawOpItem::SHADOW_STYLE_OPITEM, "SHADOW_STYLE_OPITEM" },
{ DrawOpItem::COLOR_OPITEM, "COLOR_OPITEM" },
{ DrawOpItem::IMAGE_NINE_OPITEM, "IMAGE_NINE_OPITEM" },
{ DrawOpItem::IMAGE_LATTICE_OPITEM, "IMAGE_LATTICE_OPITEM" },
{ DrawOpItem::ATLAS_OPITEM, "ATLAS_OPITEM" },
{ DrawOpItem::BITMAP_OPITEM, "BITMAP_OPITEM" },
{ DrawOpItem::IMAGE_OPITEM, "IMAGE_OPITEM" },
{ DrawOpItem::IMAGE_RECT_OPITEM, "IMAGE_RECT_OPITEM" },
{ DrawOpItem::PICTURE_OPITEM, "PICTURE_OPITEM" },
{ DrawOpItem::TEXT_BLOB_OPITEM, "TEXT_BLOB_OPITEM" },
{ DrawOpItem::SYMBOL_OPITEM, "SYMBOL_OPITEM" },
{ DrawOpItem::CLIP_RECT_OPITEM, "CLIP_RECT_OPITEM" },
{ DrawOpItem::CLIP_IRECT_OPITEM, "CLIP_IRECT_OPITEM" },
{ DrawOpItem::CLIP_ROUND_RECT_OPITEM, "CLIP_ROUND_RECT_OPITEM" },
{ DrawOpItem::CLIP_PATH_OPITEM, "CLIP_PATH_OPITEM" },
{ DrawOpItem::CLIP_REGION_OPITEM, "CLIP_REGION_OPITEM" },
{ DrawOpItem::SET_MATRIX_OPITEM, "SET_MATRIX_OPITEM" },
{ DrawOpItem::RESET_MATRIX_OPITEM, "RESET_MATRIX_OPITEM" },
{ DrawOpItem::CONCAT_MATRIX_OPITEM, "CONCAT_MATRIX_OPITEM" },
{ DrawOpItem::TRANSLATE_OPITEM, "TRANSLATE_OPITEM" },
{ DrawOpItem::SCALE_OPITEM, "SCALE_OPITEM" },
{ DrawOpItem::ROTATE_OPITEM, "ROTATE_OPITEM" },
{ DrawOpItem::SHEAR_OPITEM, "SHEAR_OPITEM" },
{ DrawOpItem::FLUSH_OPITEM, "FLUSH_OPITEM" },
{ DrawOpItem::CLEAR_OPITEM, "CLEAR_OPITEM" },
{ DrawOpItem::SAVE_OPITEM, "SAVE_OPITEM" },
{ DrawOpItem::SAVE_LAYER_OPITEM, "SAVE_LAYER_OPITEM" },
{ DrawOpItem::RESTORE_OPITEM, "RESTORE_OPITEM" },
{ DrawOpItem::DISCARD_OPITEM, "DISCARD_OPITEM" },
{ DrawOpItem::CLIP_ADAPTIVE_ROUND_RECT_OPITEM, "CLIP_ADAPTIVE_ROUND_RECT_OPITEM" },
{ DrawOpItem::IMAGE_WITH_PARM_OPITEM, "IMAGE_WITH_PARM_OPITEM" },
{ DrawOpItem::PIXELMAP_WITH_PARM_OPITEM, "PIXELMAP_WITH_PARM_OPITEM" },
{ DrawOpItem::PIXELMAP_RECT_OPITEM, "PIXELMAP_RECT_OPITEM" },
{ DrawOpItem::REGION_OPITEM, "REGION_OPITEM" },
{ DrawOpItem::PATCH_OPITEM, "PATCH_OPITEM" },
{ DrawOpItem::EDGEAAQUAD_OPITEM, "EDGEAAQUAD_OPITEM" },
{ DrawOpItem::VERTICES_OPITEM, "VERTICES_OPITEM" },
{ DrawOpItem::IMAGE_SNAPSHOT_OPITEM, "IMAGE_SNAPSHOT_OPITEM" },
{ DrawOpItem::SURFACEBUFFER_OPITEM, "SURFACEBUFFER_OPITEM"},
{ DrawOpItem::DRAW_FUNC_OPITEM, "DRAW_FUNC_OPITEM"},
};
namespace { namespace {
constexpr int TEXT_BLOB_CACHE_MARGIN = 10; constexpr int TEXT_BLOB_CACHE_MARGIN = 10;
constexpr float HIGH_CONTRAST_OFFSCREEN_THREASHOLD = 0.99f; constexpr float HIGH_CONTRAST_OFFSCREEN_THREASHOLD = 0.99f;
@ -223,6 +280,16 @@ void DrawOpItem::GenerateHandleFromPaint(CmdList& cmdList, const Paint& paint, P
} }
} }
std::string DrawOpItem::GetOpDesc()
{
return typeOpDes[GetType()];
}
void DrawOpItem::Dump(std::string& out)
{
out += typeOpDes[GetType()];
}
GenerateCachedOpItemPlayer::GenerateCachedOpItemPlayer(DrawCmdList &cmdList, Canvas* canvas, const Rect* rect) GenerateCachedOpItemPlayer::GenerateCachedOpItemPlayer(DrawCmdList &cmdList, Canvas* canvas, const Rect* rect)
: canvas_(canvas), rect_(rect), cmdList_(cmdList) {} : canvas_(canvas), rect_(rect), cmdList_(cmdList) {}

View File

@ -27,63 +27,6 @@ namespace OHOS {
namespace Rosen { namespace Rosen {
namespace Drawing { namespace Drawing {
std::unordered_map<uint32_t, std::string> typeOpDes = {
{ DrawOpItem::OPITEM_HEAD, "OPITEM_HEAD"},
{ DrawOpItem::POINT_OPITEM, "POINT_OPITEM" },
{ DrawOpItem::POINTS_OPITEM, "POINTS_OPITEM" },
{ DrawOpItem::LINE_OPITEM, "LINE_OPITEM" },
{ DrawOpItem::RECT_OPITEM, "RECT_OPITEM" },
{ DrawOpItem::ROUND_RECT_OPITEM, "ROUND_RECT_OPITEM" },
{ DrawOpItem::NESTED_ROUND_RECT_OPITEM, "NESTED_ROUND_RECT_OPITEM" },
{ DrawOpItem::ARC_OPITEM, "ARC_OPITEM" },
{ DrawOpItem::PIE_OPITEM, "PIE_OPITEM" },
{ DrawOpItem::OVAL_OPITEM, "OVAL_OPITEM" },
{ DrawOpItem::CIRCLE_OPITEM, "CIRCLE_OPITEM" },
{ DrawOpItem::PATH_OPITEM, "PATH_OPITEM" },
{ DrawOpItem::BACKGROUND_OPITEM, "BACKGROUND_OPITEM" },
{ DrawOpItem::SHADOW_OPITEM, "SHADOW_OPITEM" },
{ DrawOpItem::SHADOW_STYLE_OPITEM, "SHADOW_STYLE_OPITEM" },
{ DrawOpItem::COLOR_OPITEM, "COLOR_OPITEM" },
{ DrawOpItem::IMAGE_NINE_OPITEM, "IMAGE_NINE_OPITEM" },
{ DrawOpItem::IMAGE_LATTICE_OPITEM, "IMAGE_LATTICE_OPITEM" },
{ DrawOpItem::ATLAS_OPITEM, "ATLAS_OPITEM" },
{ DrawOpItem::BITMAP_OPITEM, "BITMAP_OPITEM" },
{ DrawOpItem::IMAGE_OPITEM, "IMAGE_OPITEM" },
{ DrawOpItem::IMAGE_RECT_OPITEM, "IMAGE_RECT_OPITEM" },
{ DrawOpItem::PICTURE_OPITEM, "PICTURE_OPITEM" },
{ DrawOpItem::TEXT_BLOB_OPITEM, "TEXT_BLOB_OPITEM" },
{ DrawOpItem::SYMBOL_OPITEM, "SYMBOL_OPITEM" },
{ DrawOpItem::CLIP_RECT_OPITEM, "CLIP_RECT_OPITEM" },
{ DrawOpItem::CLIP_IRECT_OPITEM, "CLIP_IRECT_OPITEM" },
{ DrawOpItem::CLIP_ROUND_RECT_OPITEM, "CLIP_ROUND_RECT_OPITEM" },
{ DrawOpItem::CLIP_PATH_OPITEM, "CLIP_PATH_OPITEM" },
{ DrawOpItem::CLIP_REGION_OPITEM, "CLIP_REGION_OPITEM" },
{ DrawOpItem::SET_MATRIX_OPITEM, "SET_MATRIX_OPITEM" },
{ DrawOpItem::RESET_MATRIX_OPITEM, "RESET_MATRIX_OPITEM" },
{ DrawOpItem::CONCAT_MATRIX_OPITEM, "CONCAT_MATRIX_OPITEM" },
{ DrawOpItem::TRANSLATE_OPITEM, "TRANSLATE_OPITEM" },
{ DrawOpItem::SCALE_OPITEM, "SCALE_OPITEM" },
{ DrawOpItem::ROTATE_OPITEM, "ROTATE_OPITEM" },
{ DrawOpItem::SHEAR_OPITEM, "SHEAR_OPITEM" },
{ DrawOpItem::FLUSH_OPITEM, "FLUSH_OPITEM" },
{ DrawOpItem::CLEAR_OPITEM, "CLEAR_OPITEM" },
{ DrawOpItem::SAVE_OPITEM, "SAVE_OPITEM" },
{ DrawOpItem::SAVE_LAYER_OPITEM, "SAVE_LAYER_OPITEM" },
{ DrawOpItem::RESTORE_OPITEM, "RESTORE_OPITEM" },
{ DrawOpItem::DISCARD_OPITEM, "DISCARD_OPITEM" },
{ DrawOpItem::CLIP_ADAPTIVE_ROUND_RECT_OPITEM, "CLIP_ADAPTIVE_ROUND_RECT_OPITEM" },
{ DrawOpItem::IMAGE_WITH_PARM_OPITEM, "IMAGE_WITH_PARM_OPITEM" },
{ DrawOpItem::PIXELMAP_WITH_PARM_OPITEM, "PIXELMAP_WITH_PARM_OPITEM" },
{ DrawOpItem::PIXELMAP_RECT_OPITEM, "PIXELMAP_RECT_OPITEM" },
{ DrawOpItem::REGION_OPITEM, "REGION_OPITEM" },
{ DrawOpItem::PATCH_OPITEM, "PATCH_OPITEM" },
{ DrawOpItem::EDGEAAQUAD_OPITEM, "EDGEAAQUAD_OPITEM" },
{ DrawOpItem::VERTICES_OPITEM, "VERTICES_OPITEM" },
{ DrawOpItem::IMAGE_SNAPSHOT_OPITEM, "IMAGE_SNAPSHOT_OPITEM" },
{ DrawOpItem::SURFACEBUFFER_OPITEM, "SURFACEBUFFER_OPITEM"},
{ DrawOpItem::DRAW_FUNC_OPITEM, "DRAW_FUNC_OPITEM"},
};
std::shared_ptr<DrawCmdList> DrawCmdList::CreateFromData(const CmdListData& data, bool isCopy) std::shared_ptr<DrawCmdList> DrawCmdList::CreateFromData(const CmdListData& data, bool isCopy)
{ {
auto cmdList = std::make_shared<DrawCmdList>(DrawCmdList::UnmarshalMode::DEFERRED); auto cmdList = std::make_shared<DrawCmdList>(DrawCmdList::UnmarshalMode::DEFERRED);
@ -199,13 +142,27 @@ std::string DrawCmdList::GetOpsWithDesc() const
if (item == nullptr) { if (item == nullptr) {
continue; continue;
} }
desc += typeOpDes[item->GetType()]; desc += item->GetOpDesc();
desc += "\n"; desc += "\n";
} }
LOGD("DrawCmdList::GetOpsWithDesc %{public}s, opitem sz: %{public}zu", desc.c_str(), drawOpItems_.size()); LOGD("DrawCmdList::GetOpsWithDesc %{public}s, opitem sz: %{public}zu", desc.c_str(), drawOpItems_.size());
return desc; return desc;
} }
void DrawCmdList::Dump(std::string& out)
{
for (auto& item : drawOpItems_) {
if (item == nullptr) {
continue;
}
item->Dump(out);
out += " ";
}
if (drawOpItems_.size() > 0) {
out.pop_back();
}
}
void DrawCmdList::MarshallingDrawOps() void DrawCmdList::MarshallingDrawOps()
{ {
if (mode_ == DrawCmdList::UnmarshalMode::IMMEDIATE) { if (mode_ == DrawCmdList::UnmarshalMode::IMMEDIATE) {

View File

@ -164,9 +164,7 @@ protected:
#endif #endif
EGLConfig config_; EGLConfig config_;
GraphicColorGamut colorSpace_ = GraphicColorGamut::GRAPHIC_COLOR_GAMUT_SRGB; GraphicColorGamut colorSpace_ = GraphicColorGamut::GRAPHIC_COLOR_GAMUT_SRGB;
#ifndef ROSEN_CROSS_PLATFORM
int32_t pixelFormat_ = GraphicPixelFormat::GRAPHIC_PIXEL_FMT_RGBA_8888; int32_t pixelFormat_ = GraphicPixelFormat::GRAPHIC_PIXEL_FMT_RGBA_8888;
#endif
bool isUniRenderMode_ = false; bool isUniRenderMode_ = false;
const std::string UNIRENDER_CACHE_DIR = "/data/service/el0/render_service"; const std::string UNIRENDER_CACHE_DIR = "/data/service/el0/render_service";

View File

@ -95,6 +95,7 @@ ohos_shared_library("libvsync") {
] ]
external_deps = [ external_deps = [
"access_token:libaccesstoken_sdk",
"c_utils:utils", "c_utils:utils",
"eventhandler:libeventhandler", "eventhandler:libeventhandler",
"hilog:libhilog", "hilog:libhilog",

View File

@ -28,6 +28,9 @@ class VSyncConnectionStub : public IRemoteStub<IVSyncConnection> {
public: public:
virtual int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, virtual int32_t OnRemoteRequest(uint32_t code, MessageParcel &data,
MessageParcel &reply, MessageOption &option) override; MessageParcel &reply, MessageOption &option) override;
private:
bool CheckCallingPermission();
}; };
} // namespace Rosen } // namespace Rosen
} // namespace OHOS } // namespace OHOS

View File

@ -36,8 +36,6 @@ VsyncError VSyncConnectionProxy::RequestNextVSync(const std::string& fromWhom, i
MessageParcel ret; MessageParcel ret;
arg.WriteInterfaceToken(GetDescriptor()); arg.WriteInterfaceToken(GetDescriptor());
arg.WriteString(fromWhom);
arg.WriteInt64(lastVSyncTS);
int res = Remote()->SendRequest(IVSYNC_CONNECTION_REQUEST_NEXT_VSYNC, arg, ret, opt); int res = Remote()->SendRequest(IVSYNC_CONNECTION_REQUEST_NEXT_VSYNC, arg, ret, opt);
if (res != NO_ERROR) { if (res != NO_ERROR) {
VLOGE("ipc send fail, error:%{public}d", res); VLOGE("ipc send fail, error:%{public}d", res);

View File

@ -16,9 +16,16 @@
#include "vsync_connection_stub.h" #include "vsync_connection_stub.h"
#include <unistd.h> #include <unistd.h>
#include "graphic_common.h" #include "graphic_common.h"
#include "accesstoken_kit.h"
#include "ipc_skeleton.h"
#include "vsync_log.h"
namespace OHOS { namespace OHOS {
namespace Rosen { namespace Rosen {
namespace {
const std::string RSS_PROCESS_NAME = "resource_schedule_service";
}
int32_t VSyncConnectionStub::OnRemoteRequest(uint32_t code, MessageParcel &data, int32_t VSyncConnectionStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
MessageParcel &reply, MessageOption &option) MessageParcel &reply, MessageOption &option)
{ {
@ -29,9 +36,7 @@ int32_t VSyncConnectionStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
switch (code) { switch (code) {
case IVSYNC_CONNECTION_REQUEST_NEXT_VSYNC: { case IVSYNC_CONNECTION_REQUEST_NEXT_VSYNC: {
auto fromWho = data.ReadString(); RequestNextVSync();
auto ts = data.ReadInt64();
RequestNextVSync(fromWho, ts);
break; break;
} }
case IVSYNC_CONNECTION_GET_RECEIVE_FD: { case IVSYNC_CONNECTION_GET_RECEIVE_FD: {
@ -61,10 +66,10 @@ int32_t VSyncConnectionStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
return SetUiDvsyncSwitch(dvsyncOn); return SetUiDvsyncSwitch(dvsyncOn);
} }
case IVSYNC_CONNECTION_SET_UI_DVSYNC_CONFIG: { case IVSYNC_CONNECTION_SET_UI_DVSYNC_CONFIG: {
int32_t bufferCount; if (!CheckCallingPermission()) {
if (!data.ReadInt32(bufferCount)) { return VSYNC_ERROR_UNKOWN;
return VSYNC_ERROR_API_FAILED;
} }
int32_t bufferCount = data.ReadInt32();
return SetUiDvsyncConfig(bufferCount); return SetUiDvsyncConfig(bufferCount);
} }
default: { default: {
@ -74,5 +79,17 @@ int32_t VSyncConnectionStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
} }
return 0; return 0;
} }
bool VSyncConnectionStub::CheckCallingPermission()
{
Security::AccessToken::AccessTokenID tokenId = OHOS::IPCSkeleton::GetCallingTokenID();
Security::AccessToken::AccessTokenID rssToken =
Security::AccessToken::AccessTokenKit::GetNativeTokenId(RSS_PROCESS_NAME);
if (tokenId != rssToken) {
VLOGE("CheckPermissionFailed, calling process illegal");
return false;
}
return true;
}
} // namespace Rosen } // namespace Rosen
} // namespace OHOS } // namespace OHOS

View File

@ -125,21 +125,6 @@ HWTEST_F(VsyncReceiverTest, Init002, Function | MediumTest| Level3)
ASSERT_NE(VsyncReceiverTest::vsyncReceiver->Init(), VSYNC_ERROR_NULLPTR); ASSERT_NE(VsyncReceiverTest::vsyncReceiver->Init(), VSYNC_ERROR_NULLPTR);
} }
/*
* Function: Init003
* Type: Function
* Rank: Important(2)
* EnvConditions: N/A
* CaseDescription: 1. call Init
*/
HWTEST_F(VsyncReceiverTest, Init003, Function | MediumTest| Level3)
{
int fd;
sptr<IVSyncConnection> connection_ = nullptr;
VsyncError ret = connection_->GetReceiveFd(fd);
ASSERT_NE(ret, VSYNC_ERROR_OK);
}
/* /*
* Function: IsRequestedNextVSync001 * Function: IsRequestedNextVSync001
* Type: Function * Type: Function

Some files were not shown because too many files have changed in this diff Show More