mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-23 15:11:51 +00:00
Merge branch 'master' of gitee.com:openharmony/graphic_graphic_2d into master
Signed-off-by: 王禹臻 <wangyuzhen5@huawei.com>
This commit is contained in:
commit
18a4113662
2
BUILD.gn
2
BUILD.gn
@ -34,7 +34,7 @@ group("graphic_common_test") {
|
||||
"frameworks/bootanimation/test:test",
|
||||
"frameworks/opengl_wrapper/test:test",
|
||||
"frameworks/vulkan_layers/test:test",
|
||||
"rosen/graphic_test:test",
|
||||
"graphic_test:test",
|
||||
"rosen/modules/composer:test",
|
||||
"rosen/modules/create_pixelmap_surface:test",
|
||||
"rosen/modules/effect/test/unittest:test",
|
||||
|
@ -14,19 +14,34 @@
|
||||
import("//build/test.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
|
||||
deps = [ ":RSGraphicTestTemplateTest" ]
|
||||
deps = [ ":RSGraphicTest" ]
|
||||
}
|
||||
|
||||
## Build RSGraphicTestTemplateTest
|
||||
ohos_unittest("RSGraphicTestTemplateTest") {
|
||||
## Build RSGraphicTest
|
||||
ohos_unittest("RSGraphicTest") {
|
||||
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 = []
|
||||
external_deps = [
|
14
graphic_test/graphic_test/drawing_engine/2d_engine/demo.cpp
Normal file
14
graphic_test/graphic_test/drawing_engine/2d_engine/demo.cpp
Normal 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.
|
||||
*/
|
14
graphic_test/graphic_test/drawing_engine/3d_engine/demo.cpp
Normal file
14
graphic_test/graphic_test/drawing_engine/3d_engine/demo.cpp
Normal 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.
|
||||
*/
|
14
graphic_test/graphic_test/drawing_engine/drawing/demo.cpp
Normal file
14
graphic_test/graphic_test/drawing_engine/drawing/demo.cpp
Normal 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.
|
||||
*/
|
14
graphic_test/graphic_test/drawing_engine/opengl/demo.cpp
Normal file
14
graphic_test/graphic_test/drawing_engine/opengl/demo.cpp
Normal 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.
|
||||
*/
|
14
graphic_test/graphic_test/drawing_engine/vulkan/demo.cpp
Normal file
14
graphic_test/graphic_test/drawing_engine/vulkan/demo.cpp
Normal 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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
14
graphic_test/graphic_test/open_capability/pixmap/demo.cpp
Normal file
14
graphic_test/graphic_test/open_capability/pixmap/demo.cpp
Normal 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.
|
||||
*/
|
14
graphic_test/graphic_test/open_capability/symbol/demo.cpp
Normal file
14
graphic_test/graphic_test/open_capability/symbol/demo.cpp
Normal 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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
14
graphic_test/graphic_test/rs_framework/performance/demo.cpp
Normal file
14
graphic_test/graphic_test/rs_framework/performance/demo.cpp
Normal 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.
|
||||
*/
|
@ -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.
|
||||
*/
|
14
graphic_test/graphic_test/rs_framework/uni_render/demo.cpp
Normal file
14
graphic_test/graphic_test/rs_framework/uni_render/demo.cpp
Normal 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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
14
graphic_test/graphic_test/rs_func_feature/g2_corner/demo.cpp
Normal file
14
graphic_test/graphic_test/rs_func_feature/g2_corner/demo.cpp
Normal 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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
14
graphic_test/graphic_test/rs_perform_feature/dvsync/demo.cpp
Normal file
14
graphic_test/graphic_test/rs_perform_feature/dvsync/demo.cpp
Normal 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.
|
||||
*/
|
14
graphic_test/graphic_test/rs_perform_feature/hwc/demo.cpp
Normal file
14
graphic_test/graphic_test/rs_perform_feature/hwc/demo.cpp
Normal 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.
|
||||
*/
|
@ -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.
|
||||
*/
|
14
graphic_test/graphic_test/rs_perform_feature/ltpo/demo.cpp
Normal file
14
graphic_test/graphic_test/rs_perform_feature/ltpo/demo.cpp
Normal 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.
|
||||
*/
|
@ -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.
|
||||
*/
|
14
graphic_test/graphic_test/rs_perform_feature/opinc/demo.cpp
Normal file
14
graphic_test/graphic_test/rs_perform_feature/opinc/demo.cpp
Normal 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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -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.
|
||||
*/
|
@ -27,6 +27,7 @@ public:
|
||||
auto size = GetScreenSize();
|
||||
SetSurfaceBounds({0, 0, size.x_ / 2.0f, size.y_ / 2.0f});
|
||||
SetSurfaceColor(RSColor(0xffff0000));
|
||||
SetImageSavePath("/data/local/graphic_test/test_template/");
|
||||
}
|
||||
|
||||
// called after each tests
|
@ -13,7 +13,7 @@
|
||||
|
||||
import("//build/test.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") {
|
||||
include_dirs = [
|
@ -33,6 +33,7 @@ public:
|
||||
void SetSurfaceBounds(const Vector4f& bounds);
|
||||
void SetSurfaceColor(const RSColor& color);
|
||||
void RegisterNode(std::shared_ptr<RSNode> node);
|
||||
void SetImageSavePath(const std::string path);
|
||||
|
||||
// overrides gtest functions
|
||||
static void SetUpTestCase();
|
||||
@ -49,6 +50,7 @@ private:
|
||||
Vector4f surfaceBounds_;
|
||||
std::vector<std::shared_ptr<RSNode>> nodes_;
|
||||
static uint32_t imageWriteId_;
|
||||
std::string imageSavePath_ = "";
|
||||
};
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
@ -112,6 +112,9 @@ void RSGraphicTest::TearDown()
|
||||
RSParameterParse::Instance().surfaceCaptureWaitTime);
|
||||
if (pixelMap) {
|
||||
std::string filename = RSParameterParse::Instance().imageSavePath;
|
||||
if (imageSavePath_ != "") {
|
||||
filename = imageSavePath_;
|
||||
}
|
||||
filename += testInfo->test_case_name() + std::string("_");
|
||||
filename += testInfo->name() + std::string(".png");
|
||||
if (std::filesystem::exists(filename)) {
|
||||
@ -158,5 +161,21 @@ void RSGraphicTest::SetSurfaceColor(const RSColor& 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 OHOS
|
@ -32,7 +32,7 @@ constexpr size_t ARGC_TWO = 2;
|
||||
constexpr size_t ARGC_MAX = 10;
|
||||
constexpr int32_t ERR_NOT_OK = -1;
|
||||
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)
|
||||
{
|
||||
@ -62,8 +62,8 @@ napi_value RSWindowAnimationManager::SetController(napi_env env, napi_callback_i
|
||||
WALOGD("SetController");
|
||||
if (!RSWindowAnimationUtils::IsSystemApp()) {
|
||||
WALOGE("SetController failed");
|
||||
napi_throw(env, CreateJsError(env, ERR_NOT_SYSTEM_APP,
|
||||
"WindowAnimationManager setController failed, is not system app"));
|
||||
napi_throw_error(env, std::to_string(ERR_NOT_SYSTEM_APP).c_str(),
|
||||
"WindowAnimationManager setController failed, is not system app");
|
||||
return nullptr;
|
||||
}
|
||||
auto me = CheckParamsAndGetThis<RSWindowAnimationManager>(env, info);
|
||||
@ -75,8 +75,8 @@ napi_value RSWindowAnimationManager::MinimizeWindowWithAnimation(napi_env env, n
|
||||
WALOGD("MinimizeWindowWithAnimation");
|
||||
if (!RSWindowAnimationUtils::IsSystemApp()) {
|
||||
WALOGE("MinimizeWindowWithAnimation failed");
|
||||
napi_throw(env, CreateJsError(env, ERR_NOT_SYSTEM_APP,
|
||||
"WindowAnimationManager minimizeWindowWithAnimation failed, is not system app"));
|
||||
napi_throw_error(env, std::to_string(ERR_NOT_SYSTEM_APP).c_str(),
|
||||
"WindowAnimationManager minimizeWindowWithAnimation failed, is not system app");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -89,8 +89,8 @@ napi_value RSWindowAnimationManager::GetWindowAnimationTargets(napi_env env, nap
|
||||
WALOGD("GetWindowAnimationTargets");
|
||||
if (!RSWindowAnimationUtils::IsSystemApp()) {
|
||||
WALOGE("GetWindowAnimationTargets failed");
|
||||
napi_throw(env, CreateJsError(env, ERR_NOT_SYSTEM_APP,
|
||||
"WindowAnimationManager getWindowAnimationTargets failed, is not system app"));
|
||||
napi_throw_error(env, std::to_string(ERR_NOT_SYSTEM_APP).c_str(),
|
||||
"WindowAnimationManager getWindowAnimationTargets failed, is not system app");
|
||||
return nullptr;
|
||||
}
|
||||
auto me = CheckParamsAndGetThis<RSWindowAnimationManager>(env, info);
|
||||
|
@ -57,71 +57,114 @@ ohos_shared_library("drawing_napi") {
|
||||
subsystem_name = "graphic"
|
||||
}
|
||||
|
||||
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" ]
|
||||
|
||||
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",
|
||||
if (is_arkui_x) {
|
||||
ohos_source_set("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",
|
||||
]
|
||||
deps += [ "../../../../../utils:libgraphic_utils" ]
|
||||
defines += [ "ROSEN_OHOS" ]
|
||||
cflags = [ "-fstack-protector-strong" ]
|
||||
cflags_cc = [
|
||||
"-fstack-protector-strong",
|
||||
"-std=c++17",
|
||||
|
||||
defines = []
|
||||
configs = [ ":local_drawing_config" ]
|
||||
public_configs = [ ":drawing_config" ]
|
||||
|
||||
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" ]
|
||||
cflags_cc = [ "-std=c++17" ]
|
||||
}
|
||||
|
||||
if (current_os == "mingw") {
|
||||
defines += [ "WINDOWS_PLATFORM" ]
|
||||
part_name = "graphic_2d"
|
||||
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" ]
|
||||
part_name = "graphic_2d"
|
||||
subsystem_name = "graphic"
|
||||
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" ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
@ -1594,7 +1594,7 @@ napi_value JsCanvas::OnClipRegion(napi_env env, napi_callback_info info)
|
||||
}
|
||||
|
||||
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));
|
||||
return nullptr;
|
||||
@ -1823,7 +1823,7 @@ napi_value JsCanvas::OnClipRoundRect(napi_env env, napi_callback_info info)
|
||||
}
|
||||
|
||||
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) {
|
||||
m_canvas->ClipRoundRect(jsRoundRect->GetRoundRect(), static_cast<ClipOp>(clipOpInt));
|
||||
|
@ -119,7 +119,7 @@ napi_value JsImageFilter::CreateBlurImageFilter(napi_env env, napi_callback_info
|
||||
|
||||
JsImageFilter *jsImageFilter = nullptr;
|
||||
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) ?
|
||||
@ -141,7 +141,7 @@ napi_value JsImageFilter::CreateFromColorFilter(napi_env env, napi_callback_info
|
||||
|
||||
JsImageFilter *jsImageFilter = nullptr;
|
||||
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();
|
||||
|
@ -779,6 +779,13 @@ napi_value JsPath::OnGetPositionAndTangent(napi_env env, napi_callback_info info
|
||||
tangent = Drawing::Point(endPoint[ARGC_ZERO], endPoint[ARGC_ONE]);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1097,7 +1104,7 @@ napi_value JsPath::OnIsClosed(napi_env env, napi_callback_info info)
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -118,14 +118,14 @@ napi_value JsRoundRect ::OnSetCorner(napi_env env, napi_callback_info info)
|
||||
{
|
||||
napi_value argv[ARGC_THREE] = { nullptr };
|
||||
CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_THREE);
|
||||
RoundRect ::CornerPos pos;
|
||||
ConvertFromJsValue(env, argv[0], pos);
|
||||
int32_t pos = 0;
|
||||
GET_ENUM_PARAM(ARGC_ZERO, pos, 0, static_cast<int32_t>(RoundRect::CornerPos::CORNER_NUMBER));
|
||||
double x = 0;
|
||||
GET_DOUBLE_PARAM(ARGC_ONE, x);
|
||||
double y = 0;
|
||||
GET_DOUBLE_PARAM(ARGC_TWO, y);
|
||||
|
||||
m_roundRect.SetCornerRadius(pos, x, y);
|
||||
m_roundRect.SetCornerRadius(static_cast<RoundRect::CornerPos>(pos), x, y);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@ -140,9 +140,9 @@ napi_value JsRoundRect ::OnGetCorner(napi_env env, napi_callback_info info)
|
||||
{
|
||||
napi_value argv[ARGC_ONE] = { nullptr };
|
||||
CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_ONE);
|
||||
RoundRect ::CornerPos pos;
|
||||
ConvertFromJsValue(env, argv[0], pos);
|
||||
auto point = m_roundRect.GetCornerRadius(pos);
|
||||
int32_t pos = 0;
|
||||
GET_ENUM_PARAM(ARGC_ZERO, pos, 0, static_cast<int32_t>(RoundRect::CornerPos::CORNER_NUMBER));
|
||||
auto point = m_roundRect.GetCornerRadius(static_cast<RoundRect::CornerPos>(pos));
|
||||
return ConvertPointToJsValue(env, point);
|
||||
}
|
||||
|
||||
|
@ -304,26 +304,42 @@ napi_value JsTextBlob::MakeFromPosText(napi_env env, napi_callback_info info)
|
||||
uint32_t len = 0;
|
||||
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];
|
||||
uint32_t pointsSize = 0;
|
||||
if (napi_get_array_length(env, array, &pointsSize) != napi_ok) {
|
||||
delete[] buffer;
|
||||
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Incorrect Argv[2].");
|
||||
}
|
||||
if (pointsSize == 0) {
|
||||
ROSEN_LOGE("JsTextBlob::MakeFromPosText: points array is empty");
|
||||
return nullptr;
|
||||
if (pointsSize == 0 || bufferLen == 0) {
|
||||
delete[] buffer;
|
||||
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Argv[0] is empty.");
|
||||
}
|
||||
if (len != pointsSize) {
|
||||
ROSEN_LOGE("JsTextBlob::MakeFromPosText: string length does not match points array length");
|
||||
return nullptr;
|
||||
if (len != pointsSize || len != bufferLen) {
|
||||
delete[] buffer;
|
||||
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM,
|
||||
"string length does not match points array length.");
|
||||
}
|
||||
|
||||
Point* points = new(std::nothrow) Point[pointsSize];
|
||||
if (!points) {
|
||||
delete[] buffer;
|
||||
ROSEN_LOGE("JsTextBlob::MakeFromPosText: failed to create Point");
|
||||
return nullptr;
|
||||
}
|
||||
if (!MakePoints(env, points, pointsSize, array)) {
|
||||
delete[] buffer;
|
||||
delete[] points;
|
||||
ROSEN_LOGE("JsTextBlob::MakeFromPosText: Argv[2] is invalid");
|
||||
return nullptr;
|
||||
}
|
||||
@ -332,19 +348,11 @@ napi_value JsTextBlob::MakeFromPosText(napi_env env, napi_callback_info info)
|
||||
GET_UNWRAP_PARAM(ARGC_THREE, jsFont);
|
||||
std::shared_ptr<Font> font = jsFont->GetFont();
|
||||
if (font == nullptr) {
|
||||
delete[] buffer;
|
||||
delete[] points;
|
||||
ROSEN_LOGE("JsTextBlob::MakeFromPosText: font is 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);
|
||||
}
|
||||
|
||||
|
@ -181,6 +181,12 @@ napi_value EffectNapi::CreateBrightnessBlender(napi_env env, napi_callback_info
|
||||
}
|
||||
napi_value object = nullptr;
|
||||
napi_create_object(env, &object);
|
||||
if (object == nullptr) {
|
||||
UIEFFECT_LOG_E("EffectNapi CreateBrightnessBlender object is Faild");
|
||||
delete blender;
|
||||
blender = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
napi_wrap(
|
||||
env, object, blender,
|
||||
[](napi_env env, void* data, void* hint) {
|
||||
@ -196,6 +202,7 @@ napi_value EffectNapi::CreateBrightnessBlender(napi_env env, napi_callback_info
|
||||
if (argc != 1) {
|
||||
UIEFFECT_LOG_E("EffectNapi SetbackgroundColorBlender input check failed, argc number is not 1.");
|
||||
delete blender;
|
||||
blender = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -203,12 +210,14 @@ napi_value EffectNapi::CreateBrightnessBlender(napi_env env, napi_callback_info
|
||||
if (nativeObj == nullptr) {
|
||||
UIEFFECT_LOG_E("EffectNapi SetbackgroundColorBlender input check failed, nativeObj is nullptr.");
|
||||
delete blender;
|
||||
blender = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!CheckCreateBrightnessBlender (env, nativeObj)) {
|
||||
if (!CheckCreateBrightnessBlender(env, nativeObj)) {
|
||||
UIEFFECT_LOG_E("EffectNapi CheckCreateBrightnessBlender failed.");
|
||||
delete blender;
|
||||
blender = 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, "fraction", ParseJsValue(env, nativeObj, "fraction"));
|
||||
|
||||
if (object == nullptr) {
|
||||
UIEFFECT_LOG_E("EffectNapi CreateBrightnessBlender object is Faild");
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ namespace {
|
||||
constexpr uint32_t NUM_2 = 2;
|
||||
constexpr uint32_t NUM_3 = 3;
|
||||
constexpr uint32_t NUM_4 = 4;
|
||||
constexpr uint32_t NUM_5 = 5;
|
||||
}
|
||||
|
||||
namespace OHOS {
|
||||
@ -311,31 +312,34 @@ napi_value FilterNapi::SetWaterRipple(napi_env env, napi_callback_info info)
|
||||
napi_get_undefined(env, &result);
|
||||
napi_status status;
|
||||
napi_value thisVar = nullptr;
|
||||
napi_value argValue[NUM_4] = {0};
|
||||
size_t argCount = NUM_4;
|
||||
napi_value argValue[NUM_5] = {0};
|
||||
size_t argCount = NUM_5;
|
||||
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"));
|
||||
|
||||
std::shared_ptr<WaterRipplePara> para = std::make_shared<WaterRipplePara>();
|
||||
|
||||
float progress = 0.0f;
|
||||
float waveCount = 0.0f;
|
||||
uint32_t waveCount = 0;
|
||||
float rippleCenterX = 0.0f;
|
||||
float rippleCenterY = 0.0f;
|
||||
uint32_t rippleMode = 0;
|
||||
|
||||
if (argCount != NUM_4) {
|
||||
FILTER_LOG_E("Args number less than 4");
|
||||
if (argCount != NUM_5) {
|
||||
FILTER_LOG_E("Args number less than 5");
|
||||
}
|
||||
|
||||
progress = GetSpecialValue(env, argValue[NUM_0]);
|
||||
waveCount = GetSpecialValue(env, argValue[NUM_1]);
|
||||
waveCount = GetSpecialIntValue(env, argValue[NUM_1]);
|
||||
rippleCenterX = GetSpecialValue(env, argValue[NUM_2]);
|
||||
rippleCenterY = GetSpecialValue(env, argValue[NUM_3]);
|
||||
rippleMode = GetSpecialIntValue(env, argValue[NUM_4]);
|
||||
|
||||
para->SetProgress(progress);
|
||||
para->SetWaveCount(waveCount);
|
||||
para->SetRippleCenterX(rippleCenterX);
|
||||
para->SetRippleCenterY(rippleCenterY);
|
||||
para->SetRippleMode(rippleMode);
|
||||
|
||||
Filter* filterObj = nullptr;
|
||||
NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast<void**>(&filterObj)));
|
||||
|
@ -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 = []
|
||||
}
|
@ -159,6 +159,10 @@ if (enable_text_gine) {
|
||||
"$rosen_root/modules/2d_engine/rosen_text/skia_txt/txt/src",
|
||||
]
|
||||
|
||||
if (is_arkui_x) {
|
||||
include_dirs += [ "//third_party/bounds_checking_function/include" ]
|
||||
}
|
||||
|
||||
defines += [
|
||||
"USE_GRAPHIC_TEXT_GINE",
|
||||
"WINDOWS_PLATFORM",
|
||||
|
@ -27,13 +27,13 @@ namespace SPText {
|
||||
*/
|
||||
static void GetLayersGroupId(std::vector<size_t>& groupIds, const RSRenderGroup& renderGroup, size_t index)
|
||||
{
|
||||
for (auto& groupInfo : renderGroup.groupInfos) {
|
||||
for (auto& j : groupInfo.layerIndexes) {
|
||||
for (const auto& groupInfo : renderGroup.groupInfos) {
|
||||
for (size_t j : groupInfo.layerIndexes) {
|
||||
if (j < groupIds.size()) {
|
||||
groupIds[j] = index;
|
||||
}
|
||||
}
|
||||
for (auto& j : groupInfo.maskIndexes) {
|
||||
for (size_t j : groupInfo.maskIndexes) {
|
||||
if (j < groupIds.size()) {
|
||||
groupIds[j] = index;
|
||||
}
|
||||
@ -87,7 +87,7 @@ static void MergePathByLayerColor(const std::vector<RSGroupInfo>& groupInfos,
|
||||
TextEngine::NodeLayerInfo tempLayer;
|
||||
size_t currentIndex = 0; // the current layerindex, that effective index of tempLayer
|
||||
bool isFirst = true;
|
||||
for (auto& layerIndex: groupInfo.layerIndexes) {
|
||||
for (size_t layerIndex: groupInfo.layerIndexes) {
|
||||
if (layerIndex >= pathLayers.size() || layerIndex >= groupIndexes.size()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -157,6 +157,10 @@ void OH_Drawing_TextBlobGetBounds(OH_Drawing_TextBlob* cTextBlob, OH_Drawing_Rec
|
||||
return;
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,6 @@ namespace Rosen {
|
||||
namespace Drawing {
|
||||
class DRAWING_API Paint {
|
||||
public:
|
||||
constexpr static scalar DEFAULT_MITER_VAL = 4.0f;
|
||||
|
||||
Paint() noexcept;
|
||||
Paint(const Paint& other) noexcept;
|
||||
Paint(const Color& c, std::shared_ptr<ColorSpace> colorSpace = nullptr) noexcept;
|
||||
@ -116,7 +114,7 @@ private:
|
||||
BlendMode blendMode_ = BlendMode::SRC_OVER;
|
||||
PaintStyle style_ = PaintStyle::PAINT_NONE;
|
||||
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::CapStyle cap_ = Pen::CapStyle::DEFAULT_CAP;
|
||||
|
||||
|
@ -28,6 +28,8 @@ namespace Rosen {
|
||||
namespace Drawing {
|
||||
class DRAWING_API Pen {
|
||||
public:
|
||||
constexpr static scalar DEFAULT_MITER_VAL = 4.0f;
|
||||
|
||||
enum class JoinStyle {
|
||||
MITER_JOIN,
|
||||
ROUND_JOIN,
|
||||
|
@ -17,6 +17,7 @@
|
||||
#define IMAGE_H
|
||||
|
||||
#include "drawing/engine_adapter/impl_interface/image_impl.h"
|
||||
#include "image/gpu_context.h"
|
||||
#include "include/core/SkImage.h"
|
||||
#include "utils/drawing_macros.h"
|
||||
#ifdef RS_ENABLE_VK
|
||||
|
@ -92,7 +92,11 @@ public:
|
||||
|
||||
uint32_t offset = opAllocator_.AddrToOffset(op);
|
||||
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()));
|
||||
#endif
|
||||
if (lastOpItem != nullptr) {
|
||||
lastOpItem->SetNextOpItemOffset(offset);
|
||||
}
|
||||
|
@ -107,6 +107,9 @@ public:
|
||||
virtual void Playback(Canvas* canvas, const Rect* rect) = 0;
|
||||
|
||||
virtual void SetNodeId(NodeId id) {}
|
||||
virtual void Dump(std::string& out);
|
||||
|
||||
std::string GetOpDesc();
|
||||
|
||||
static void SetBaseCallback(
|
||||
std::function<void (std::shared_ptr<Drawing::Image> image)> holdDrawingImagefunc);
|
||||
|
@ -84,7 +84,11 @@ public:
|
||||
|
||||
uint32_t offset = opAllocator_.AddrToOffset(op);
|
||||
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()));
|
||||
#endif
|
||||
if (lastOpItem != nullptr) {
|
||||
lastOpItem->SetNextOpItemOffset(offset);
|
||||
}
|
||||
@ -183,6 +187,8 @@ public:
|
||||
void UpdateNodeIdToPicture(NodeId nodeId);
|
||||
|
||||
size_t CountTextBlobNum();
|
||||
|
||||
void Dump(std::string& out);
|
||||
private:
|
||||
void ClearCache();
|
||||
void GenerateCacheByVector(Canvas* canvas, const Rect* rect);
|
||||
|
@ -250,7 +250,7 @@ void Paint::Reset()
|
||||
blendMode_ = BlendMode::SRC_OVER;
|
||||
style_ = PaintStyle::PAINT_NONE;
|
||||
width_ = 0;
|
||||
miterLimit_ = DEFAULT_MITER_VAL;
|
||||
miterLimit_ = Pen::DEFAULT_MITER_VAL;
|
||||
join_ = Pen::JoinStyle::DEFAULT_JOIN;
|
||||
cap_ = Pen::CapStyle::DEFAULT_CAP;
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace Rosen {
|
||||
namespace Drawing {
|
||||
Pen::Pen() noexcept
|
||||
: width_(0),
|
||||
miterLimit_(-1),
|
||||
miterLimit_(DEFAULT_MITER_VAL),
|
||||
join_(Pen::JoinStyle::MITER_JOIN),
|
||||
cap_(Pen::CapStyle::FLAT_CAP),
|
||||
pathEffect_(nullptr),
|
||||
|
@ -23,6 +23,7 @@ namespace Drawing {
|
||||
|
||||
DrawingSymbolLayersGroups SkiaHmSymbolConfigOhos::GetSymbolLayersGroups(uint16_t glyphId)
|
||||
{
|
||||
#if !defined(CROSS_PLATFORM)
|
||||
SymbolLayersGroups groups = HmSymbolConfig_OHOS::GetInstance()->GetSymbolLayersGroups(glyphId);
|
||||
|
||||
DrawingSymbolLayersGroups drawingGroups;
|
||||
@ -52,6 +53,10 @@ DrawingSymbolLayersGroups SkiaHmSymbolConfigOhos::GetSymbolLayersGroups(uint16_t
|
||||
drawingGroups.renderModeGroups = drawingRenderModeGroups;
|
||||
|
||||
return drawingGroups;
|
||||
#else
|
||||
DrawingSymbolLayersGroups drawingGroups;
|
||||
return drawingGroups;
|
||||
#endif
|
||||
}
|
||||
|
||||
DrawingAnimationSetting SkiaHmSymbolConfigOhos::ConvertToDrawingAnimationSetting(AnimationSetting setting)
|
||||
@ -120,6 +125,7 @@ static std::vector<DrawingPiecewiseParameter> ConvertPiecewiseParametersVec(cons
|
||||
return out;
|
||||
}
|
||||
|
||||
#if !defined(CROSS_PLATFORM)
|
||||
std::vector<std::vector<DrawingPiecewiseParameter>> SkiaHmSymbolConfigOhos::GetGroupParameters(
|
||||
DrawingAnimationType type, uint16_t groupSum, uint16_t animationMode, DrawingCommonSubType commonSubType)
|
||||
{
|
||||
@ -134,6 +140,7 @@ std::vector<std::vector<DrawingPiecewiseParameter>> SkiaHmSymbolConfigOhos::GetG
|
||||
}
|
||||
return parameters;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace Drawing
|
||||
} // namespace Rosen
|
||||
|
@ -170,7 +170,16 @@ bool SkiaImage::BuildSubset(const std::shared_ptr<Image> image, const RectI& rec
|
||||
LOGD("SkiaImage::BuildSubset failed, origin Image is invalid");
|
||||
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());
|
||||
grContext_ = gpuContext.GetImpl<SkiaGPUContext>()->GetGrContext();
|
||||
PostSkImgToTargetThread();
|
||||
@ -215,7 +224,8 @@ bool SkiaImage::BuildFromTexture(GPUContext& gpuContext, const TextureInfo& info
|
||||
|
||||
sk_sp<SkColorSpace> skColorSpace = nullptr;
|
||||
if (colorSpace != nullptr) {
|
||||
skColorSpace = colorSpace->GetImpl<SkiaColorSpace>()->GetColorSpace();
|
||||
auto colorSpaceImpl = colorSpace->GetImpl<SkiaColorSpace>();
|
||||
skColorSpace = colorSpaceImpl ? colorSpaceImpl->GetColorSpace() : SkColorSpace::MakeSRGB();
|
||||
} else {
|
||||
skColorSpace = SkColorSpace::MakeSRGB();
|
||||
}
|
||||
@ -274,7 +284,8 @@ bool SkiaImage::BuildFromSurface(GPUContext& gpuContext, Surface& surface, Textu
|
||||
|
||||
sk_sp<SkColorSpace> skColorSpace = nullptr;
|
||||
if (colorSpace != nullptr) {
|
||||
skColorSpace = colorSpace->GetImpl<SkiaColorSpace>()->GetColorSpace();
|
||||
auto colorSpaceImpl = colorSpace->GetImpl<SkiaColorSpace>();
|
||||
skColorSpace = colorSpaceImpl ? colorSpaceImpl->GetColorSpace() : nullptr;
|
||||
}
|
||||
PostSkImgToTargetThread();
|
||||
skiaImage_ = SkImage::MakeFromTexture(grContext_.get(), grBackendTexture,
|
||||
|
@ -90,10 +90,11 @@ public:
|
||||
static SkImageInfo ConvertToSkImageInfo(const ImageInfo& imageInfo)
|
||||
{
|
||||
auto colorSpace = imageInfo.GetColorSpace();
|
||||
auto colorSpaceImpl = colorSpace ? colorSpace->GetImpl<SkiaColorSpace>() : nullptr;
|
||||
return SkImageInfo::Make(imageInfo.GetWidth(), imageInfo.GetHeight(),
|
||||
ConvertToSkColorType(imageInfo.GetColorType()),
|
||||
ConvertToSkAlphaType(imageInfo.GetAlphaType()),
|
||||
colorSpace ? colorSpace->GetImpl<SkiaColorSpace>()->GetColorSpace() : nullptr);
|
||||
colorSpaceImpl ? colorSpaceImpl->GetColorSpace() : nullptr);
|
||||
}
|
||||
|
||||
static ColorType ConvertToColorType(const SkColorType& format)
|
||||
|
@ -149,7 +149,7 @@ void SkiaPaint::PaintToSkPaint(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.setStrokeWidth(paint.GetWidth());
|
||||
|
@ -21,9 +21,13 @@
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace Drawing {
|
||||
SkiaRuntimeBlenderBuilder::SkiaRuntimeBlenderBuilder(
|
||||
std::shared_ptr<RuntimeEffect> effect) noexcept : skRuntimeBlendBuilder_(std::make_shared<SkRuntimeBlendBuilder>(
|
||||
effect->GetImpl<SkiaRuntimeEffect>()->GetRuntimeEffect())) {}
|
||||
SkiaRuntimeBlenderBuilder::SkiaRuntimeBlenderBuilder(std::shared_ptr<RuntimeEffect> effect) noexcept
|
||||
{
|
||||
auto effectImpl = effect ? effect->GetImpl<SkiaRuntimeEffect>() : nullptr;
|
||||
if (effectImpl != nullptr) {
|
||||
skRuntimeBlendBuilder_ = std::make_shared<SkRuntimeBlendBuilder>(effectImpl->GetRuntimeEffect());
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Blender> SkiaRuntimeBlenderBuilder::MakeBlender()
|
||||
{
|
||||
|
@ -30,10 +30,13 @@
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace Drawing {
|
||||
|
||||
SkiaRuntimeShaderBuilder::SkiaRuntimeShaderBuilder(
|
||||
std::shared_ptr<RuntimeEffect> effect) noexcept : skRuntimeShaderBuilder_(std::make_shared<SkRuntimeShaderBuilder>(
|
||||
effect->GetImpl<SkiaRuntimeEffect>()->GetRuntimeEffect())) {}
|
||||
SkiaRuntimeShaderBuilder::SkiaRuntimeShaderBuilder(std::shared_ptr<RuntimeEffect> effect) noexcept
|
||||
{
|
||||
auto effectImpl = effect ? effect->GetImpl<SkiaRuntimeEffect>() : nullptr;
|
||||
if (effectImpl != nullptr) {
|
||||
skRuntimeShaderBuilder_ = std::make_shared<SkRuntimeShaderBuilder>(effectImpl->GetRuntimeEffect());
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<ShaderEffect> SkiaRuntimeShaderBuilder::MakeShader(const Matrix* localMatrix, bool isOpaque)
|
||||
{
|
||||
|
@ -195,7 +195,11 @@ DrawingSymbolLayersGroups SkiaStaticFactory::GetSymbolLayersGroups(uint16_t glyp
|
||||
std::vector<std::vector<DrawingPiecewiseParameter>> SkiaStaticFactory::GetGroupParameters(
|
||||
DrawingAnimationType type, uint16_t groupSum, uint16_t animationMode, DrawingCommonSubType commonSubType)
|
||||
{
|
||||
#if !defined(CROSS_PLATFORM)
|
||||
return SkiaHmSymbolConfigOhos::GetGroupParameters(type, groupSum, animationMode, commonSubType);
|
||||
#endif
|
||||
std::vector<std::vector<DrawingPiecewiseParameter>> parameters;
|
||||
return parameters;
|
||||
}
|
||||
|
||||
FontStyleSet* SkiaStaticFactory::CreateEmpty()
|
||||
|
@ -198,7 +198,10 @@ Path SkiaTextBlob::GetDrawingPathforTextBlob(uint16_t glyphId, const TextBlob* b
|
||||
{
|
||||
SkTextBlob* skTextBlob = nullptr;
|
||||
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);
|
||||
Path path;
|
||||
|
@ -51,7 +51,9 @@ bool GPUContext::BuildFromVK(const GrVkBackendContext& context, const GPUContext
|
||||
|
||||
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)
|
||||
|
@ -39,6 +39,63 @@
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
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 {
|
||||
constexpr int TEXT_BLOB_CACHE_MARGIN = 10;
|
||||
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)
|
||||
: canvas_(canvas), rect_(rect), cmdList_(cmdList) {}
|
||||
|
||||
|
@ -27,63 +27,6 @@ namespace OHOS {
|
||||
namespace Rosen {
|
||||
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)
|
||||
{
|
||||
auto cmdList = std::make_shared<DrawCmdList>(DrawCmdList::UnmarshalMode::DEFERRED);
|
||||
@ -199,13 +142,27 @@ std::string DrawCmdList::GetOpsWithDesc() const
|
||||
if (item == nullptr) {
|
||||
continue;
|
||||
}
|
||||
desc += typeOpDes[item->GetType()];
|
||||
desc += item->GetOpDesc();
|
||||
desc += "\n";
|
||||
}
|
||||
LOGD("DrawCmdList::GetOpsWithDesc %{public}s, opitem sz: %{public}zu", desc.c_str(), drawOpItems_.size());
|
||||
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()
|
||||
{
|
||||
if (mode_ == DrawCmdList::UnmarshalMode::IMMEDIATE) {
|
||||
|
@ -164,9 +164,7 @@ protected:
|
||||
#endif
|
||||
EGLConfig config_;
|
||||
GraphicColorGamut colorSpace_ = GraphicColorGamut::GRAPHIC_COLOR_GAMUT_SRGB;
|
||||
#ifndef ROSEN_CROSS_PLATFORM
|
||||
int32_t pixelFormat_ = GraphicPixelFormat::GRAPHIC_PIXEL_FMT_RGBA_8888;
|
||||
#endif
|
||||
|
||||
bool isUniRenderMode_ = false;
|
||||
const std::string UNIRENDER_CACHE_DIR = "/data/service/el0/render_service";
|
||||
|
@ -95,6 +95,7 @@ ohos_shared_library("libvsync") {
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"c_utils:utils",
|
||||
"eventhandler:libeventhandler",
|
||||
"hilog:libhilog",
|
||||
|
@ -28,6 +28,9 @@ class VSyncConnectionStub : public IRemoteStub<IVSyncConnection> {
|
||||
public:
|
||||
virtual int32_t OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option) override;
|
||||
|
||||
private:
|
||||
bool CheckCallingPermission();
|
||||
};
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -36,8 +36,6 @@ VsyncError VSyncConnectionProxy::RequestNextVSync(const std::string& fromWhom, i
|
||||
MessageParcel ret;
|
||||
|
||||
arg.WriteInterfaceToken(GetDescriptor());
|
||||
arg.WriteString(fromWhom);
|
||||
arg.WriteInt64(lastVSyncTS);
|
||||
int res = Remote()->SendRequest(IVSYNC_CONNECTION_REQUEST_NEXT_VSYNC, arg, ret, opt);
|
||||
if (res != NO_ERROR) {
|
||||
VLOGE("ipc send fail, error:%{public}d", res);
|
||||
|
@ -16,9 +16,16 @@
|
||||
#include "vsync_connection_stub.h"
|
||||
#include <unistd.h>
|
||||
#include "graphic_common.h"
|
||||
#include "accesstoken_kit.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "vsync_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace {
|
||||
const std::string RSS_PROCESS_NAME = "resource_schedule_service";
|
||||
}
|
||||
|
||||
int32_t VSyncConnectionStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
@ -29,9 +36,7 @@ int32_t VSyncConnectionStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
|
||||
switch (code) {
|
||||
case IVSYNC_CONNECTION_REQUEST_NEXT_VSYNC: {
|
||||
auto fromWho = data.ReadString();
|
||||
auto ts = data.ReadInt64();
|
||||
RequestNextVSync(fromWho, ts);
|
||||
RequestNextVSync();
|
||||
break;
|
||||
}
|
||||
case IVSYNC_CONNECTION_GET_RECEIVE_FD: {
|
||||
@ -61,10 +66,10 @@ int32_t VSyncConnectionStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
return SetUiDvsyncSwitch(dvsyncOn);
|
||||
}
|
||||
case IVSYNC_CONNECTION_SET_UI_DVSYNC_CONFIG: {
|
||||
int32_t bufferCount;
|
||||
if (!data.ReadInt32(bufferCount)) {
|
||||
return VSYNC_ERROR_API_FAILED;
|
||||
if (!CheckCallingPermission()) {
|
||||
return VSYNC_ERROR_UNKOWN;
|
||||
}
|
||||
int32_t bufferCount = data.ReadInt32();
|
||||
return SetUiDvsyncConfig(bufferCount);
|
||||
}
|
||||
default: {
|
||||
@ -74,5 +79,17 @@ int32_t VSyncConnectionStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
}
|
||||
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 OHOS
|
||||
|
@ -125,21 +125,6 @@ HWTEST_F(VsyncReceiverTest, Init002, Function | MediumTest| Level3)
|
||||
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
|
||||
* Type: Function
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user