├── .gitignore ├── LICENSE ├── README.md ├── bones.sln ├── bones.vcxproj ├── bones.vcxproj.filters ├── bones ├── bones.cpp ├── bones.h ├── bones_internal.h ├── core │ ├── accelerator.cpp │ ├── accelerator.h │ ├── accelerator_manager.cpp │ ├── accelerator_manager.h │ ├── animation.cpp │ ├── animation.h │ ├── animation_manager.cpp │ ├── animation_manager.h │ ├── area.h │ ├── color.h │ ├── core.h │ ├── core_imp.cpp │ ├── core_imp.h │ ├── core_imp_unittest.cpp │ ├── css_manager.cpp │ ├── css_manager.h │ ├── css_types.h │ ├── css_utils.cpp │ ├── css_utils.h │ ├── device.cpp │ ├── device.h │ ├── encoding.cpp │ ├── encoding.h │ ├── env_unittest.h │ ├── event.cpp │ ├── event.h │ ├── event_dispatcher.cpp │ ├── event_dispatcher.h │ ├── focus_controller.cpp │ ├── focus_controller.h │ ├── focus_controller_unittest.cpp │ ├── font.cpp │ ├── font.h │ ├── helper.cpp │ ├── helper.h │ ├── image.cpp │ ├── image.h │ ├── input.cpp │ ├── input.h │ ├── keyboard_codes.h │ ├── logging.cpp │ ├── logging.h │ ├── mouse_controller.cpp │ ├── mouse_controller.h │ ├── mouse_controller_unittest.cpp │ ├── pixmap.cpp │ ├── pixmap.h │ ├── point.cpp │ ├── point.h │ ├── rect.cpp │ ├── rect.h │ ├── ref.cpp │ ├── ref.h │ ├── res_manager.cpp │ ├── res_manager.h │ ├── rich_edit.cpp │ ├── rich_edit.h │ ├── root.cpp │ ├── root.h │ ├── root_manager.cpp │ ├── root_manager.h │ ├── scroller.cpp │ ├── scroller.h │ ├── shape.cpp │ ├── shape.h │ ├── size.cpp │ ├── size.h │ ├── text.cpp │ ├── text.h │ ├── view.cpp │ ├── view.h │ ├── view_unittest.cpp │ ├── web_view.cpp │ ├── web_view.h │ ├── xml.cpp │ ├── xml.h │ ├── xml_controller.cpp │ └── xml_controller.h ├── gtest │ ├── include │ │ └── gtest │ │ │ ├── gtest-death-test.h │ │ │ ├── gtest-message.h │ │ │ ├── gtest-param-test.h │ │ │ ├── gtest-param-test.h.pump │ │ │ ├── gtest-printers.h │ │ │ ├── gtest-spi.h │ │ │ ├── gtest-test-part.h │ │ │ ├── gtest-typed-test.h │ │ │ ├── gtest.h │ │ │ ├── gtest_pred_impl.h │ │ │ ├── gtest_prod.h │ │ │ └── internal │ │ │ ├── gtest-death-test-internal.h │ │ │ ├── gtest-filepath.h │ │ │ ├── gtest-internal.h │ │ │ ├── gtest-linked_ptr.h │ │ │ ├── gtest-param-util-generated.h │ │ │ ├── gtest-param-util-generated.h.pump │ │ │ ├── gtest-param-util.h │ │ │ ├── gtest-port.h │ │ │ ├── gtest-string.h │ │ │ ├── gtest-tuple.h │ │ │ ├── gtest-tuple.h.pump │ │ │ ├── gtest-type-util.h │ │ │ └── gtest-type-util.h.pump │ └── src │ │ ├── gtest-all.cc │ │ ├── gtest-death-test.cc │ │ ├── gtest-filepath.cc │ │ ├── gtest-internal-inl.h │ │ ├── gtest-port.cc │ │ ├── gtest-printers.cc │ │ ├── gtest-test-part.cc │ │ ├── gtest-typed-test.cc │ │ ├── gtest.cc │ │ └── gtest_main.cc ├── lua_animation.cpp ├── lua_animation.h ├── lua_check.cpp ├── lua_check.h ├── lua_context.cpp ├── lua_context.h ├── lua_event.cpp ├── lua_event.h ├── lua_handler.h ├── lua_image.cpp ├── lua_image.h ├── lua_input.cpp ├── lua_input.h ├── lua_object.h ├── lua_rich_edit.cpp ├── lua_rich_edit.h ├── lua_root.cpp ├── lua_root.h ├── lua_scroller.cpp ├── lua_scroller.h ├── lua_shape.cpp ├── lua_shape.h ├── lua_text.cpp ├── lua_text.h ├── lua_web_view.cpp ├── lua_web_view.h ├── main.cpp ├── script_parser.cpp ├── script_parser.h ├── simple_proxy.cpp ├── simple_proxy.h ├── utils.cpp └── utils.h ├── cef3 ├── bin.7z ├── include │ ├── base │ │ ├── cef_atomic_ref_count.h │ │ ├── cef_atomicops.h │ │ ├── cef_basictypes.h │ │ ├── cef_bind.h │ │ ├── cef_bind_helpers.h │ │ ├── cef_build.h │ │ ├── cef_callback.h │ │ ├── cef_callback_forward.h │ │ ├── cef_callback_helpers.h │ │ ├── cef_callback_list.h │ │ ├── cef_cancelable_callback.h │ │ ├── cef_lock.h │ │ ├── cef_logging.h │ │ ├── cef_macros.h │ │ ├── cef_move.h │ │ ├── cef_platform_thread.h │ │ ├── cef_ref_counted.h │ │ ├── cef_scoped_ptr.h │ │ ├── cef_string16.h │ │ ├── cef_template_util.h │ │ ├── cef_thread_checker.h │ │ ├── cef_thread_collision_warner.h │ │ ├── cef_trace_event.h │ │ ├── cef_tuple.h │ │ ├── cef_weak_ptr.h │ │ └── internal │ │ │ ├── cef_atomicops_x86_msvc.h │ │ │ ├── cef_bind_internal.h │ │ │ ├── cef_bind_internal_win.h │ │ │ ├── cef_callback_internal.h │ │ │ ├── cef_lock_impl.h │ │ │ ├── cef_raw_scoped_refptr_mismatch_checker.h │ │ │ └── cef_thread_checker_impl.h │ ├── capi │ │ ├── cef_app_capi.h │ │ ├── cef_auth_callback_capi.h │ │ ├── cef_base_capi.h │ │ ├── cef_browser_capi.h │ │ ├── cef_browser_process_handler_capi.h │ │ ├── cef_callback_capi.h │ │ ├── cef_client_capi.h │ │ ├── cef_command_line_capi.h │ │ ├── cef_context_menu_handler_capi.h │ │ ├── cef_cookie_capi.h │ │ ├── cef_dialog_handler_capi.h │ │ ├── cef_display_handler_capi.h │ │ ├── cef_dom_capi.h │ │ ├── cef_download_handler_capi.h │ │ ├── cef_download_item_capi.h │ │ ├── cef_drag_data_capi.h │ │ ├── cef_drag_handler_capi.h │ │ ├── cef_focus_handler_capi.h │ │ ├── cef_frame_capi.h │ │ ├── cef_geolocation_capi.h │ │ ├── cef_geolocation_handler_capi.h │ │ ├── cef_jsdialog_handler_capi.h │ │ ├── cef_keyboard_handler_capi.h │ │ ├── cef_life_span_handler_capi.h │ │ ├── cef_load_handler_capi.h │ │ ├── cef_menu_model_capi.h │ │ ├── cef_navigation_entry_capi.h │ │ ├── cef_origin_whitelist_capi.h │ │ ├── cef_path_util_capi.h │ │ ├── cef_print_handler_capi.h │ │ ├── cef_print_settings_capi.h │ │ ├── cef_process_message_capi.h │ │ ├── cef_process_util_capi.h │ │ ├── cef_render_handler_capi.h │ │ ├── cef_render_process_handler_capi.h │ │ ├── cef_request_capi.h │ │ ├── cef_request_context_capi.h │ │ ├── cef_request_context_handler_capi.h │ │ ├── cef_request_handler_capi.h │ │ ├── cef_resource_bundle_handler_capi.h │ │ ├── cef_resource_handler_capi.h │ │ ├── cef_response_capi.h │ │ ├── cef_scheme_capi.h │ │ ├── cef_stream_capi.h │ │ ├── cef_string_visitor_capi.h │ │ ├── cef_task_capi.h │ │ ├── cef_trace_capi.h │ │ ├── cef_url_capi.h │ │ ├── cef_urlrequest_capi.h │ │ ├── cef_v8_capi.h │ │ ├── cef_values_capi.h │ │ ├── cef_web_plugin_capi.h │ │ ├── cef_xml_reader_capi.h │ │ └── cef_zip_reader_capi.h │ ├── cef_app.h │ ├── cef_auth_callback.h │ ├── cef_base.h │ ├── cef_browser.h │ ├── cef_browser_process_handler.h │ ├── cef_callback.h │ ├── cef_client.h │ ├── cef_command_line.h │ ├── cef_context_menu_handler.h │ ├── cef_cookie.h │ ├── cef_dialog_handler.h │ ├── cef_display_handler.h │ ├── cef_dom.h │ ├── cef_download_handler.h │ ├── cef_download_item.h │ ├── cef_drag_data.h │ ├── cef_drag_handler.h │ ├── cef_focus_handler.h │ ├── cef_frame.h │ ├── cef_geolocation.h │ ├── cef_geolocation_handler.h │ ├── cef_jsdialog_handler.h │ ├── cef_keyboard_handler.h │ ├── cef_life_span_handler.h │ ├── cef_load_handler.h │ ├── cef_menu_model.h │ ├── cef_navigation_entry.h │ ├── cef_origin_whitelist.h │ ├── cef_pack_resources.h │ ├── cef_pack_strings.h │ ├── cef_path_util.h │ ├── cef_print_handler.h │ ├── cef_print_settings.h │ ├── cef_process_message.h │ ├── cef_process_util.h │ ├── cef_render_handler.h │ ├── cef_render_process_handler.h │ ├── cef_request.h │ ├── cef_request_context.h │ ├── cef_request_context_handler.h │ ├── cef_request_handler.h │ ├── cef_resource_bundle_handler.h │ ├── cef_resource_handler.h │ ├── cef_response.h │ ├── cef_runnable.h │ ├── cef_sandbox_win.h │ ├── cef_scheme.h │ ├── cef_stream.h │ ├── cef_string_visitor.h │ ├── cef_task.h │ ├── cef_trace.h │ ├── cef_url.h │ ├── cef_urlrequest.h │ ├── cef_v8.h │ ├── cef_values.h │ ├── cef_version.h │ ├── cef_web_plugin.h │ ├── cef_xml_reader.h │ ├── cef_zip_reader.h │ ├── internal │ │ ├── cef_export.h │ │ ├── cef_logging_internal.h │ │ ├── cef_ptr.h │ │ ├── cef_string.h │ │ ├── cef_string_list.h │ │ ├── cef_string_map.h │ │ ├── cef_string_multimap.h │ │ ├── cef_string_types.h │ │ ├── cef_string_wrappers.h │ │ ├── cef_thread_internal.h │ │ ├── cef_time.h │ │ ├── cef_trace_event_internal.h │ │ ├── cef_types.h │ │ ├── cef_types_win.h │ │ ├── cef_types_wrappers.h │ │ └── cef_win.h │ └── wrapper │ │ ├── cef_byte_read_handler.h │ │ ├── cef_closure_task.h │ │ ├── cef_helpers.h │ │ ├── cef_message_router.h │ │ ├── cef_stream_resource_handler.h │ │ ├── cef_xml_object.h │ │ └── cef_zip_archive.h └── lib │ └── libcef.lib ├── libcef_dll ├── CMakeLists.txt ├── base │ ├── cef_atomicops_x86_gcc.cc │ ├── cef_bind_helpers.cc │ ├── cef_callback_helpers.cc │ ├── cef_callback_internal.cc │ ├── cef_lock.cc │ ├── cef_lock_impl.cc │ ├── cef_logging.cc │ ├── cef_ref_counted.cc │ ├── cef_string16.cc │ ├── cef_thread_checker_impl.cc │ ├── cef_thread_collision_warner.cc │ └── cef_weak_ptr.cc ├── cpptoc │ ├── app_cpptoc.cc │ ├── app_cpptoc.h │ ├── base_cpptoc.h │ ├── browser_process_handler_cpptoc.cc │ ├── browser_process_handler_cpptoc.h │ ├── client_cpptoc.cc │ ├── client_cpptoc.h │ ├── completion_callback_cpptoc.cc │ ├── completion_callback_cpptoc.h │ ├── context_menu_handler_cpptoc.cc │ ├── context_menu_handler_cpptoc.h │ ├── cookie_visitor_cpptoc.cc │ ├── cookie_visitor_cpptoc.h │ ├── cpptoc.h │ ├── dialog_handler_cpptoc.cc │ ├── dialog_handler_cpptoc.h │ ├── display_handler_cpptoc.cc │ ├── display_handler_cpptoc.h │ ├── domvisitor_cpptoc.cc │ ├── domvisitor_cpptoc.h │ ├── download_handler_cpptoc.cc │ ├── download_handler_cpptoc.h │ ├── drag_handler_cpptoc.cc │ ├── drag_handler_cpptoc.h │ ├── end_tracing_callback_cpptoc.cc │ ├── end_tracing_callback_cpptoc.h │ ├── focus_handler_cpptoc.cc │ ├── focus_handler_cpptoc.h │ ├── geolocation_handler_cpptoc.cc │ ├── geolocation_handler_cpptoc.h │ ├── get_geolocation_callback_cpptoc.cc │ ├── get_geolocation_callback_cpptoc.h │ ├── jsdialog_handler_cpptoc.cc │ ├── jsdialog_handler_cpptoc.h │ ├── keyboard_handler_cpptoc.cc │ ├── keyboard_handler_cpptoc.h │ ├── life_span_handler_cpptoc.cc │ ├── life_span_handler_cpptoc.h │ ├── load_handler_cpptoc.cc │ ├── load_handler_cpptoc.h │ ├── navigation_entry_visitor_cpptoc.cc │ ├── navigation_entry_visitor_cpptoc.h │ ├── print_handler_cpptoc.cc │ ├── print_handler_cpptoc.h │ ├── read_handler_cpptoc.cc │ ├── read_handler_cpptoc.h │ ├── render_handler_cpptoc.cc │ ├── render_handler_cpptoc.h │ ├── render_process_handler_cpptoc.cc │ ├── render_process_handler_cpptoc.h │ ├── request_context_handler_cpptoc.cc │ ├── request_context_handler_cpptoc.h │ ├── request_handler_cpptoc.cc │ ├── request_handler_cpptoc.h │ ├── resource_bundle_handler_cpptoc.cc │ ├── resource_bundle_handler_cpptoc.h │ ├── resource_handler_cpptoc.cc │ ├── resource_handler_cpptoc.h │ ├── run_file_dialog_callback_cpptoc.cc │ ├── run_file_dialog_callback_cpptoc.h │ ├── scheme_handler_factory_cpptoc.cc │ ├── scheme_handler_factory_cpptoc.h │ ├── string_visitor_cpptoc.cc │ ├── string_visitor_cpptoc.h │ ├── task_cpptoc.cc │ ├── task_cpptoc.h │ ├── urlrequest_client_cpptoc.cc │ ├── urlrequest_client_cpptoc.h │ ├── v8accessor_cpptoc.cc │ ├── v8accessor_cpptoc.h │ ├── v8handler_cpptoc.cc │ ├── v8handler_cpptoc.h │ ├── web_plugin_info_visitor_cpptoc.cc │ ├── web_plugin_info_visitor_cpptoc.h │ ├── web_plugin_unstable_callback_cpptoc.cc │ ├── web_plugin_unstable_callback_cpptoc.h │ ├── write_handler_cpptoc.cc │ └── write_handler_cpptoc.h ├── ctocpp │ ├── allow_certificate_error_callback_ctocpp.cc │ ├── allow_certificate_error_callback_ctocpp.h │ ├── auth_callback_ctocpp.cc │ ├── auth_callback_ctocpp.h │ ├── base_ctocpp.h │ ├── before_download_callback_ctocpp.cc │ ├── before_download_callback_ctocpp.h │ ├── binary_value_ctocpp.cc │ ├── binary_value_ctocpp.h │ ├── browser_ctocpp.cc │ ├── browser_ctocpp.h │ ├── browser_host_ctocpp.cc │ ├── browser_host_ctocpp.h │ ├── callback_ctocpp.cc │ ├── callback_ctocpp.h │ ├── command_line_ctocpp.cc │ ├── command_line_ctocpp.h │ ├── context_menu_params_ctocpp.cc │ ├── context_menu_params_ctocpp.h │ ├── cookie_manager_ctocpp.cc │ ├── cookie_manager_ctocpp.h │ ├── ctocpp.h │ ├── dictionary_value_ctocpp.cc │ ├── dictionary_value_ctocpp.h │ ├── domdocument_ctocpp.cc │ ├── domdocument_ctocpp.h │ ├── domnode_ctocpp.cc │ ├── domnode_ctocpp.h │ ├── download_item_callback_ctocpp.cc │ ├── download_item_callback_ctocpp.h │ ├── download_item_ctocpp.cc │ ├── download_item_ctocpp.h │ ├── drag_data_ctocpp.cc │ ├── drag_data_ctocpp.h │ ├── file_dialog_callback_ctocpp.cc │ ├── file_dialog_callback_ctocpp.h │ ├── frame_ctocpp.cc │ ├── frame_ctocpp.h │ ├── geolocation_callback_ctocpp.cc │ ├── geolocation_callback_ctocpp.h │ ├── jsdialog_callback_ctocpp.cc │ ├── jsdialog_callback_ctocpp.h │ ├── list_value_ctocpp.cc │ ├── list_value_ctocpp.h │ ├── menu_model_ctocpp.cc │ ├── menu_model_ctocpp.h │ ├── navigation_entry_ctocpp.cc │ ├── navigation_entry_ctocpp.h │ ├── post_data_ctocpp.cc │ ├── post_data_ctocpp.h │ ├── post_data_element_ctocpp.cc │ ├── post_data_element_ctocpp.h │ ├── print_dialog_callback_ctocpp.cc │ ├── print_dialog_callback_ctocpp.h │ ├── print_job_callback_ctocpp.cc │ ├── print_job_callback_ctocpp.h │ ├── print_settings_ctocpp.cc │ ├── print_settings_ctocpp.h │ ├── process_message_ctocpp.cc │ ├── process_message_ctocpp.h │ ├── quota_callback_ctocpp.cc │ ├── quota_callback_ctocpp.h │ ├── request_context_ctocpp.cc │ ├── request_context_ctocpp.h │ ├── request_ctocpp.cc │ ├── request_ctocpp.h │ ├── response_ctocpp.cc │ ├── response_ctocpp.h │ ├── scheme_registrar_ctocpp.cc │ ├── scheme_registrar_ctocpp.h │ ├── stream_reader_ctocpp.cc │ ├── stream_reader_ctocpp.h │ ├── stream_writer_ctocpp.cc │ ├── stream_writer_ctocpp.h │ ├── task_runner_ctocpp.cc │ ├── task_runner_ctocpp.h │ ├── urlrequest_ctocpp.cc │ ├── urlrequest_ctocpp.h │ ├── v8context_ctocpp.cc │ ├── v8context_ctocpp.h │ ├── v8exception_ctocpp.cc │ ├── v8exception_ctocpp.h │ ├── v8stack_frame_ctocpp.cc │ ├── v8stack_frame_ctocpp.h │ ├── v8stack_trace_ctocpp.cc │ ├── v8stack_trace_ctocpp.h │ ├── v8value_ctocpp.cc │ ├── v8value_ctocpp.h │ ├── web_plugin_info_ctocpp.cc │ ├── web_plugin_info_ctocpp.h │ ├── xml_reader_ctocpp.cc │ ├── xml_reader_ctocpp.h │ ├── zip_reader_ctocpp.cc │ └── zip_reader_ctocpp.h ├── transfer_util.cpp ├── transfer_util.h └── wrapper │ ├── cef_browser_info_map.h │ ├── cef_byte_read_handler.cc │ ├── cef_closure_task.cc │ ├── cef_message_router.cc │ ├── cef_stream_resource_handler.cc │ ├── cef_xml_object.cc │ ├── cef_zip_archive.cc │ ├── libcef_dll_wrapper.cc │ └── libcef_dll_wrapper2.cc ├── libcef_dll_wrapper.vcxproj ├── libcef_dll_wrapper.vcxproj.filters ├── lua.vcxproj ├── lua └── src │ ├── Makefile │ ├── lapi.c │ ├── lapi.h │ ├── lauxlib.c │ ├── lauxlib.h │ ├── lbaselib.c │ ├── lbitlib.c │ ├── lcode.c │ ├── lcode.h │ ├── lcorolib.c │ ├── lctype.c │ ├── lctype.h │ ├── ldblib.c │ ├── ldebug.c │ ├── ldebug.h │ ├── ldo.c │ ├── ldo.h │ ├── ldump.c │ ├── lfunc.c │ ├── lfunc.h │ ├── lgc.c │ ├── lgc.h │ ├── linit.c │ ├── liolib.c │ ├── llex.c │ ├── llex.h │ ├── llimits.h │ ├── lmathlib.c │ ├── lmem.c │ ├── lmem.h │ ├── loadlib.c │ ├── lobject.c │ ├── lobject.h │ ├── lopcodes.c │ ├── lopcodes.h │ ├── loslib.c │ ├── lparser.c │ ├── lparser.h │ ├── lprefix.h │ ├── lstate.c │ ├── lstate.h │ ├── lstring.c │ ├── lstring.h │ ├── lstrlib.c │ ├── ltable.c │ ├── ltable.h │ ├── ltablib.c │ ├── ltm.c │ ├── ltm.h │ ├── lua.c │ ├── lua.h │ ├── lua.hpp │ ├── luac.c │ ├── luaconf.h │ ├── lualib.h │ ├── lundump.c │ ├── lundump.h │ ├── lutf8lib.c │ ├── lvm.c │ ├── lvm.h │ ├── lzio.c │ └── lzio.h ├── rapidxml ├── license.txt ├── rapidxml.hpp ├── rapidxml_iterators.hpp ├── rapidxml_print.hpp └── rapidxml_utils.hpp ├── sample.vcxproj ├── sample.vcxproj.filters ├── sample ├── animate.lua ├── background.lua ├── button.css ├── button.lua ├── button.xml ├── main.cpp ├── panel.cpp ├── panel.h ├── res │ ├── common.png │ ├── common_small.png │ ├── disable.png │ ├── disable_small.png │ ├── highlight.png │ ├── highlight_small.png │ ├── lena.bmp │ ├── pic.jpg │ ├── press.png │ └── press_small.png ├── scrollimg.lua ├── scrollimg.xml ├── test.css ├── test_.xml ├── utils.h └── xml │ ├── button.lua │ ├── button.xml │ ├── listctrl.lua │ ├── listctrl.xml │ ├── listitem.lua │ ├── listitem.xml │ ├── scrollbar.lua │ ├── scrollbar.xml │ ├── tabctrl.lua │ ├── tabctrl.xml │ ├── tabitem.lua │ ├── tabitem.xml │ ├── test.lua │ └── test.xml ├── skia.vcxproj ├── skia.vcxproj.filters ├── skia ├── include │ ├── config │ │ └── SkUserConfig.h │ ├── core │ │ ├── SkAdvancedTypefaceMetrics.h │ │ ├── SkAnnotation.h │ │ ├── SkBitmap.h │ │ ├── SkBitmapDevice.h │ │ ├── SkBlitRow.h │ │ ├── SkBounder.h │ │ ├── SkCanvas.h │ │ ├── SkChecksum.h │ │ ├── SkChunkAlloc.h │ │ ├── SkClipStack.h │ │ ├── SkColor.h │ │ ├── SkColorFilter.h │ │ ├── SkColorPriv.h │ │ ├── SkColorShader.h │ │ ├── SkColorTable.h │ │ ├── SkComposeShader.h │ │ ├── SkData.h │ │ ├── SkDataTable.h │ │ ├── SkDeque.h │ │ ├── SkDevice.h │ │ ├── SkDeviceProperties.h │ │ ├── SkDither.h │ │ ├── SkDocument.h │ │ ├── SkDraw.h │ │ ├── SkDrawFilter.h │ │ ├── SkDrawLooper.h │ │ ├── SkDynamicAnnotations.h │ │ ├── SkEmptyShader.h │ │ ├── SkEndian.h │ │ ├── SkError.h │ │ ├── SkFixed.h │ │ ├── SkFlate.h │ │ ├── SkFlattenable.h │ │ ├── SkFlattenableBuffers.h │ │ ├── SkFlattenableSerialization.h │ │ ├── SkFloatBits.h │ │ ├── SkFloatingPoint.h │ │ ├── SkFontHost.h │ │ ├── SkFontLCDConfig.h │ │ ├── SkGeometry.h │ │ ├── SkGraphics.h │ │ ├── SkImage.h │ │ ├── SkImageDecoder.h │ │ ├── SkImageEncoder.h │ │ ├── SkImageFilter.h │ │ ├── SkImageGenerator.h │ │ ├── SkImageInfo.h │ │ ├── SkInstCnt.h │ │ ├── SkLineClipper.h │ │ ├── SkMallocPixelRef.h │ │ ├── SkMask.h │ │ ├── SkMaskFilter.h │ │ ├── SkMath.h │ │ ├── SkMatrix.h │ │ ├── SkMetaData.h │ │ ├── SkOSFile.h │ │ ├── SkOnce.h │ │ ├── SkPackBits.h │ │ ├── SkPaint.h │ │ ├── SkPaintOptionsAndroid.h │ │ ├── SkPath.h │ │ ├── SkPathEffect.h │ │ ├── SkPathMeasure.h │ │ ├── SkPathRef.h │ │ ├── SkPicture.h │ │ ├── SkPixelRef.h │ │ ├── SkPoint.h │ │ ├── SkPostConfig.h │ │ ├── SkPreConfig.h │ │ ├── SkRRect.h │ │ ├── SkRasterizer.h │ │ ├── SkReadBuffer.h │ │ ├── SkReader32.h │ │ ├── SkRect.h │ │ ├── SkRefCnt.h │ │ ├── SkRegion.h │ │ ├── SkScalar.h │ │ ├── SkShader.h │ │ ├── SkSize.h │ │ ├── SkStream.h │ │ ├── SkString.h │ │ ├── SkStringUtils.h │ │ ├── SkStrokeRec.h │ │ ├── SkSurface.h │ │ ├── SkTArray.h │ │ ├── SkTDArray.h │ │ ├── SkTDStack.h │ │ ├── SkTDict.h │ │ ├── SkTInternalLList.h │ │ ├── SkTLazy.h │ │ ├── SkTRegistry.h │ │ ├── SkTSearch.h │ │ ├── SkTemplates.h │ │ ├── SkThread.h │ │ ├── SkTileGridPicture.h │ │ ├── SkTime.h │ │ ├── SkTypeface.h │ │ ├── SkTypes.h │ │ ├── SkUnPreMultiply.h │ │ ├── SkUnitMapper.h │ │ ├── SkUtils.h │ │ ├── SkWeakRefCnt.h │ │ ├── SkWriteBuffer.h │ │ ├── SkWriter32.h │ │ └── SkXfermode.h │ ├── effects │ │ ├── Sk1DPathEffect.h │ │ ├── Sk2DPathEffect.h │ │ ├── SkAlphaThresholdFilter.h │ │ ├── SkArithmeticMode.h │ │ ├── SkAvoidXfermode.h │ │ ├── SkBicubicImageFilter.h │ │ ├── SkBitmapSource.h │ │ ├── SkBlurDrawLooper.h │ │ ├── SkBlurImageFilter.h │ │ ├── SkBlurMaskFilter.h │ │ ├── SkColorFilterImageFilter.h │ │ ├── SkColorMatrix.h │ │ ├── SkColorMatrixFilter.h │ │ ├── SkComposeImageFilter.h │ │ ├── SkCornerPathEffect.h │ │ ├── SkDashPathEffect.h │ │ ├── SkDiscretePathEffect.h │ │ ├── SkDisplacementMapEffect.h │ │ ├── SkDrawExtraPathEffect.h │ │ ├── SkDropShadowImageFilter.h │ │ ├── SkEmbossMaskFilter.h │ │ ├── SkGradientShader.h │ │ ├── SkKernel33MaskFilter.h │ │ ├── SkLayerDrawLooper.h │ │ ├── SkLayerRasterizer.h │ │ ├── SkLerpXfermode.h │ │ ├── SkLightingImageFilter.h │ │ ├── SkLumaColorFilter.h │ │ ├── SkMagnifierImageFilter.h │ │ ├── SkMatrixConvolutionImageFilter.h │ │ ├── SkMatrixImageFilter.h │ │ ├── SkMergeImageFilter.h │ │ ├── SkMorphologyImageFilter.h │ │ ├── SkOffsetImageFilter.h │ │ ├── SkPaintFlagsDrawFilter.h │ │ ├── SkPerlinNoiseShader.h │ │ ├── SkPictureImageFilter.h │ │ ├── SkPixelXorXfermode.h │ │ ├── SkPorterDuff.h │ │ ├── SkRectShaderImageFilter.h │ │ ├── SkResizeImageFilter.h │ │ ├── SkStippleMaskFilter.h │ │ ├── SkTableColorFilter.h │ │ ├── SkTableMaskFilter.h │ │ ├── SkTestImageFilters.h │ │ ├── SkTileImageFilter.h │ │ ├── SkTransparentShader.h │ │ └── SkXfermodeImageFilter.h │ ├── images │ │ ├── SkForceLinking.h │ │ ├── SkImageRef.h │ │ ├── SkImageRef_GlobalPool.h │ │ ├── SkImages.h │ │ ├── SkMovie.h │ │ └── SkPageFlipper.h │ ├── pathops │ │ └── SkPathOps.h │ ├── ports │ │ ├── SkFontConfigInterface.h │ │ ├── SkFontMgr.h │ │ ├── SkFontMgr_indirect.h │ │ ├── SkFontStyle.h │ │ ├── SkHarfBuzzFont.h │ │ ├── SkRemotableFontMgr.h │ │ ├── SkTypeface_android.h │ │ ├── SkTypeface_mac.h │ │ └── SkTypeface_win.h │ └── utils │ │ ├── SkBoundaryPatch.h │ │ ├── SkCamera.h │ │ ├── SkCanvasStateUtils.h │ │ ├── SkCondVar.h │ │ ├── SkCountdown.h │ │ ├── SkCubicInterval.h │ │ ├── SkCullPoints.h │ │ ├── SkDebugUtils.h │ │ ├── SkDeferredCanvas.h │ │ ├── SkDumpCanvas.h │ │ ├── SkEventTracer.h │ │ ├── SkFrontBufferedStream.h │ │ ├── SkInterpolator.h │ │ ├── SkJSON.h │ │ ├── SkJSONCPP.h │ │ ├── SkLayer.h │ │ ├── SkLua.h │ │ ├── SkLuaCanvas.h │ │ ├── SkMatrix44.h │ │ ├── SkMeshUtils.h │ │ ├── SkNWayCanvas.h │ │ ├── SkNinePatch.h │ │ ├── SkNoSaveLayerCanvas.h │ │ ├── SkNullCanvas.h │ │ ├── SkParse.h │ │ ├── SkParsePaint.h │ │ ├── SkParsePath.h │ │ ├── SkPathUtils.h │ │ ├── SkPictureUtils.h │ │ ├── SkProxyCanvas.h │ │ ├── SkRTConf.h │ │ ├── SkRandom.h │ │ ├── SkRunnable.h │ │ ├── SkThreadPool.h │ │ ├── SkUnitMappers.h │ │ ├── SkWGL.h │ │ ├── ios │ │ └── SkStream_NSData.h │ │ ├── mac │ │ └── SkCGUtils.h │ │ └── win │ │ ├── SkAutoCoInitialize.h │ │ ├── SkHRESULT.h │ │ ├── SkIStream.h │ │ └── SkTScopedComPtr.h └── src │ ├── core │ ├── ARGB32_Clamp_Bilinear_BitmapShader.h │ ├── SkAAClip.cpp │ ├── SkAAClip.h │ ├── SkAdvancedTypefaceMetrics.cpp │ ├── SkAlphaRuns.cpp │ ├── SkAnnotation.cpp │ ├── SkAntiRun.h │ ├── SkAutoKern.h │ ├── SkBBoxHierarchy.h │ ├── SkBBoxHierarchyRecord.cpp │ ├── SkBBoxHierarchyRecord.h │ ├── SkBBoxRecord.cpp │ ├── SkBBoxRecord.h │ ├── SkBitmap.cpp │ ├── SkBitmapDevice.cpp │ ├── SkBitmapFilter.cpp │ ├── SkBitmapFilter.h │ ├── SkBitmapHeap.cpp │ ├── SkBitmapHeap.h │ ├── SkBitmapProcShader.cpp │ ├── SkBitmapProcShader.h │ ├── SkBitmapProcState.cpp │ ├── SkBitmapProcState.h │ ├── SkBitmapProcState_filter.h │ ├── SkBitmapProcState_matrix.h │ ├── SkBitmapProcState_matrixProcs.cpp │ ├── SkBitmapProcState_procs.h │ ├── SkBitmapProcState_sample.h │ ├── SkBitmapProcState_shaderproc.h │ ├── SkBitmapProcState_utils.h │ ├── SkBitmapScaler.cpp │ ├── SkBitmapScaler.h │ ├── SkBitmapShader16BilerpTemplate.h │ ├── SkBitmapShaderTemplate.h │ ├── SkBitmap_scroll.cpp │ ├── SkBlitBWMaskTemplate.h │ ├── SkBlitMask.h │ ├── SkBlitMask_D32.cpp │ ├── SkBlitRow_D16.cpp │ ├── SkBlitRow_D32.cpp │ ├── SkBlitter.cpp │ ├── SkBlitter.h │ ├── SkBlitter_A8.cpp │ ├── SkBlitter_ARGB32.cpp │ ├── SkBlitter_RGB16.cpp │ ├── SkBlitter_Sprite.cpp │ ├── SkBuffer.cpp │ ├── SkBuffer.h │ ├── SkCanvas.cpp │ ├── SkChunkAlloc.cpp │ ├── SkClipStack.cpp │ ├── SkColor.cpp │ ├── SkColorFilter.cpp │ ├── SkColorTable.cpp │ ├── SkComposeShader.cpp │ ├── SkConfig8888.cpp │ ├── SkConfig8888.h │ ├── SkConvolver.cpp │ ├── SkConvolver.h │ ├── SkCoreBlitters.h │ ├── SkCubicClipper.cpp │ ├── SkCubicClipper.h │ ├── SkData.cpp │ ├── SkDataTable.cpp │ ├── SkDebug.cpp │ ├── SkDeque.cpp │ ├── SkDescriptor.h │ ├── SkDevice.cpp │ ├── SkDeviceImageFilterProxy.h │ ├── SkDeviceLooper.cpp │ ├── SkDeviceLooper.h │ ├── SkDeviceProfile.cpp │ ├── SkDeviceProfile.h │ ├── SkDiscardableMemory.h │ ├── SkDistanceFieldGen.cpp │ ├── SkDistanceFieldGen.h │ ├── SkDither.cpp │ ├── SkDraw.cpp │ ├── SkDrawLooper.cpp │ ├── SkDrawProcs.h │ ├── SkEdge.cpp │ ├── SkEdge.h │ ├── SkEdgeBuilder.cpp │ ├── SkEdgeBuilder.h │ ├── SkEdgeClipper.cpp │ ├── SkEdgeClipper.h │ ├── SkError.cpp │ ├── SkErrorInternals.h │ ├── SkFDot6.h │ ├── SkFilterProc.cpp │ ├── SkFilterProc.h │ ├── SkFilterShader.cpp │ ├── SkFilterShader.h │ ├── SkFlate.cpp │ ├── SkFlattenable.cpp │ ├── SkFlattenableSerialization.cpp │ ├── SkFloat.cpp │ ├── SkFloat.h │ ├── SkFloatBits.cpp │ ├── SkFontDescriptor.cpp │ ├── SkFontDescriptor.h │ ├── SkFontHost.cpp │ ├── SkFontStream.cpp │ ├── SkFontStream.h │ ├── SkGeometry.cpp │ ├── SkGlyph.h │ ├── SkGlyphCache.cpp │ ├── SkGlyphCache.h │ ├── SkGlyphCache_Globals.h │ ├── SkGraphics.cpp │ ├── SkImageFilter.cpp │ ├── SkImageInfo.cpp │ ├── SkInstCnt.cpp │ ├── SkLineClipper.cpp │ ├── SkMallocPixelRef.cpp │ ├── SkMask.cpp │ ├── SkMaskFilter.cpp │ ├── SkMaskGamma.cpp │ ├── SkMaskGamma.h │ ├── SkMath.cpp │ ├── SkMathPriv.h │ ├── SkMatrix.cpp │ ├── SkMatrixClipStateMgr.cpp │ ├── SkMatrixClipStateMgr.h │ ├── SkMatrixUtils.h │ ├── SkMessageBus.h │ ├── SkMetaData.cpp │ ├── SkMipMap.cpp │ ├── SkMipMap.h │ ├── SkOffsetTable.h │ ├── SkOrderedReadBuffer.h │ ├── SkPackBits.cpp │ ├── SkPaint.cpp │ ├── SkPaintDefaults.h │ ├── SkPaintOptionsAndroid.cpp │ ├── SkPaintPriv.cpp │ ├── SkPaintPriv.h │ ├── SkPath.cpp │ ├── SkPathEffect.cpp │ ├── SkPathHeap.cpp │ ├── SkPathHeap.h │ ├── SkPathMeasure.cpp │ ├── SkPathRef.cpp │ ├── SkPerspIter.h │ ├── SkPicture.cpp │ ├── SkPictureFlat.cpp │ ├── SkPictureFlat.h │ ├── SkPicturePlayback.cpp │ ├── SkPicturePlayback.h │ ├── SkPictureRecord.cpp │ ├── SkPictureRecord.h │ ├── SkPictureStateTree.cpp │ ├── SkPictureStateTree.h │ ├── SkPixelRef.cpp │ ├── SkPoint.cpp │ ├── SkProcSpriteBlitter.cpp │ ├── SkPtrRecorder.cpp │ ├── SkPtrRecorder.h │ ├── SkQuadClipper.cpp │ ├── SkQuadClipper.h │ ├── SkQuadTree.cpp │ ├── SkQuadTree.h │ ├── SkQuadTreePicture.cpp │ ├── SkQuadTreePicture.h │ ├── SkRRect.cpp │ ├── SkRTree.cpp │ ├── SkRTree.h │ ├── SkRasterClip.cpp │ ├── SkRasterClip.h │ ├── SkRasterizer.cpp │ ├── SkReadBuffer.cpp │ ├── SkRect.cpp │ ├── SkRefDict.cpp │ ├── SkRefDict.h │ ├── SkRegion.cpp │ ├── SkRegionPriv.h │ ├── SkRegion_path.cpp │ ├── SkRegion_rects.cpp │ ├── SkScalar.cpp │ ├── SkScaledImageCache.cpp │ ├── SkScaledImageCache.h │ ├── SkScalerContext.cpp │ ├── SkScalerContext.h │ ├── SkScan.cpp │ ├── SkScan.h │ ├── SkScanPriv.h │ ├── SkScan_AntiPath.cpp │ ├── SkScan_Antihair.cpp │ ├── SkScan_Hairline.cpp │ ├── SkScan_Path.cpp │ ├── SkShader.cpp │ ├── SkSinTable.h │ ├── SkSmallAllocator.h │ ├── SkSpriteBlitter.h │ ├── SkSpriteBlitterTemplate.h │ ├── SkSpriteBlitter_ARGB32.cpp │ ├── SkSpriteBlitter_RGB16.cpp │ ├── SkStream.cpp │ ├── SkString.cpp │ ├── SkStringUtils.cpp │ ├── SkStroke.cpp │ ├── SkStroke.h │ ├── SkStrokeRec.cpp │ ├── SkStrokerPriv.cpp │ ├── SkStrokerPriv.h │ ├── SkTDynamicHash.h │ ├── SkTInternalSList.h │ ├── SkTLList.h │ ├── SkTLS.cpp │ ├── SkTLS.h │ ├── SkTObjectPool.h │ ├── SkTRefArray.h │ ├── SkTSearch.cpp │ ├── SkTSort.h │ ├── SkTextFormatParams.h │ ├── SkTextToPathIter.h │ ├── SkTileGrid.cpp │ ├── SkTileGrid.h │ ├── SkTileGridPicture.cpp │ ├── SkTraceEvent.h │ ├── SkTypeface.cpp │ ├── SkTypefaceCache.cpp │ ├── SkTypefaceCache.h │ ├── SkTypefacePriv.h │ ├── SkUnPreMultiply.cpp │ ├── SkUtils.cpp │ ├── SkUtilsArm.cpp │ ├── SkUtilsArm.h │ ├── SkValidatingReadBuffer.cpp │ ├── SkValidatingReadBuffer.h │ ├── SkValidationUtils.h │ ├── SkWriteBuffer.cpp │ ├── SkWriter32.cpp │ ├── SkXfermode.cpp │ └── SkXfermode_proccoeff.h │ ├── effects │ ├── Sk1DPathEffect.cpp │ ├── Sk2DPathEffect.cpp │ ├── SkAlphaThresholdFilter.cpp │ ├── SkArithmeticMode.cpp │ ├── SkAvoidXfermode.cpp │ ├── SkBicubicImageFilter.cpp │ ├── SkBitmapSource.cpp │ ├── SkBlurDrawLooper.cpp │ ├── SkBlurImageFilter.cpp │ ├── SkBlurMask.cpp │ ├── SkBlurMask.h │ ├── SkBlurMaskFilter.cpp │ ├── SkColorFilterImageFilter.cpp │ ├── SkColorFilters.cpp │ ├── SkColorMatrix.cpp │ ├── SkColorMatrixFilter.cpp │ ├── SkComposeImageFilter.cpp │ ├── SkCornerPathEffect.cpp │ ├── SkDashPathEffect.cpp │ ├── SkDiscretePathEffect.cpp │ ├── SkDisplacementMapEffect.cpp │ ├── SkDropShadowImageFilter.cpp │ ├── SkEmbossMask.cpp │ ├── SkEmbossMask.h │ ├── SkEmbossMaskFilter.cpp │ ├── SkEmbossMask_Table.h │ ├── SkGpuBlurUtils.cpp │ ├── SkGpuBlurUtils.h │ ├── SkKernel33MaskFilter.cpp │ ├── SkLayerDrawLooper.cpp │ ├── SkLayerRasterizer.cpp │ ├── SkLerpXfermode.cpp │ ├── SkLightingImageFilter.cpp │ ├── SkLumaColorFilter.cpp │ ├── SkMagnifierImageFilter.cpp │ ├── SkMatrixConvolutionImageFilter.cpp │ ├── SkMatrixImageFilter.cpp │ ├── SkMergeImageFilter.cpp │ ├── SkMorphologyImageFilter.cpp │ ├── SkOffsetImageFilter.cpp │ ├── SkPaintFlagsDrawFilter.cpp │ ├── SkPerlinNoiseShader.cpp │ ├── SkPictureImageFilter.cpp │ ├── SkPixelXorXfermode.cpp │ ├── SkPorterDuff.cpp │ ├── SkRectShaderImageFilter.cpp │ ├── SkResizeImageFilter.cpp │ ├── SkStippleMaskFilter.cpp │ ├── SkTableColorFilter.cpp │ ├── SkTableMaskFilter.cpp │ ├── SkTestImageFilters.cpp │ ├── SkTileImageFilter.cpp │ ├── SkTransparentShader.cpp │ ├── SkXfermodeImageFilter.cpp │ └── gradients │ │ ├── SkBitmapCache.cpp │ │ ├── SkBitmapCache.h │ │ ├── SkClampRange.cpp │ │ ├── SkClampRange.h │ │ ├── SkGradientShader.cpp │ │ ├── SkGradientShaderPriv.h │ │ ├── SkLinearGradient.cpp │ │ ├── SkLinearGradient.h │ │ ├── SkRadialGradient.cpp │ │ ├── SkRadialGradient.h │ │ ├── SkRadialGradient_Table.h │ │ ├── SkSweepGradient.cpp │ │ ├── SkSweepGradient.h │ │ ├── SkTwoPointConicalGradient.cpp │ │ ├── SkTwoPointConicalGradient.h │ │ ├── SkTwoPointRadialGradient.cpp │ │ └── SkTwoPointRadialGradient.h │ ├── image │ ├── SkImage.cpp │ ├── SkImagePriv.cpp │ ├── SkImagePriv.h │ ├── SkImage_Base.h │ ├── SkImage_Codec.cpp │ ├── SkImage_Gpu.cpp │ ├── SkImage_Picture.cpp │ ├── SkImage_Raster.cpp │ ├── SkSurface.cpp │ ├── SkSurface_Base.h │ ├── SkSurface_Gpu.cpp │ ├── SkSurface_Picture.cpp │ └── SkSurface_Raster.cpp │ ├── images │ ├── SkDecodingImageGenerator.cpp │ ├── SkDecodingImageGenerator.h │ ├── SkForceLinking.cpp │ ├── SkImageDecoder.cpp │ ├── SkImageDecoder_FactoryDefault.cpp │ ├── SkImageDecoder_FactoryRegistrar.cpp │ ├── SkImageDecoder_libbmp.cpp │ ├── SkImageDecoder_libgif.cpp │ ├── SkImageDecoder_libico.cpp │ ├── SkImageDecoder_libjpeg.cpp │ ├── SkImageDecoder_libpng.cpp │ ├── SkImageDecoder_libwebp.cpp │ ├── SkImageDecoder_wbmp.cpp │ ├── SkImageEncoder.cpp │ ├── SkImageEncoder_Factory.cpp │ ├── SkImageEncoder_argb.cpp │ ├── SkImageRef.cpp │ ├── SkImageRefPool.cpp │ ├── SkImageRefPool.h │ ├── SkImageRef_GlobalPool.cpp │ ├── SkImageRef_ashmem.cpp │ ├── SkImageRef_ashmem.h │ ├── SkImages.cpp │ ├── SkJpegUtility.cpp │ ├── SkJpegUtility.h │ ├── SkMovie.cpp │ ├── SkMovie_gif.cpp │ ├── SkPageFlipper.cpp │ ├── SkScaledBitmapSampler.cpp │ ├── SkScaledBitmapSampler.h │ ├── SkStreamHelpers.cpp │ ├── SkStreamHelpers.h │ ├── bmpdecoderhelper.cpp │ ├── bmpdecoderhelper.h │ └── transform_scanline.h │ ├── opts │ ├── SkBitmapFilter_opts_SSE2.cpp │ ├── SkBitmapFilter_opts_SSE2.h │ ├── SkBitmapProcState_arm_neon.cpp │ ├── SkBitmapProcState_filter_neon.h │ ├── SkBitmapProcState_matrixProcs_neon.cpp │ ├── SkBitmapProcState_matrix_neon.h │ ├── SkBitmapProcState_opts_SSE2.cpp │ ├── SkBitmapProcState_opts_SSE2.h │ ├── SkBitmapProcState_opts_SSSE3.cpp │ ├── SkBitmapProcState_opts_SSSE3.h │ ├── SkBitmapProcState_opts_arm.cpp │ ├── SkBitmapProcState_opts_none.cpp │ ├── SkBlitMask_opts_arm.cpp │ ├── SkBlitMask_opts_arm_neon.cpp │ ├── SkBlitMask_opts_arm_neon.h │ ├── SkBlitMask_opts_none.cpp │ ├── SkBlitRect_opts_SSE2.cpp │ ├── SkBlitRect_opts_SSE2.h │ ├── SkBlitRow_opts_SSE2.cpp │ ├── SkBlitRow_opts_SSE2.h │ ├── SkBlitRow_opts_arm.cpp │ ├── SkBlitRow_opts_arm_neon.cpp │ ├── SkBlitRow_opts_arm_neon.h │ ├── SkBlitRow_opts_none.cpp │ ├── SkBlurImage_opts.h │ ├── SkBlurImage_opts_SSE2.cpp │ ├── SkBlurImage_opts_SSE2.h │ ├── SkBlurImage_opts_arm.cpp │ ├── SkBlurImage_opts_neon.cpp │ ├── SkBlurImage_opts_neon.h │ ├── SkBlurImage_opts_none.cpp │ ├── SkCachePreload_arm.h │ ├── SkColor_opts_SSE2.h │ ├── SkColor_opts_neon.h │ ├── SkMorphology_opts.h │ ├── SkMorphology_opts_SSE2.cpp │ ├── SkMorphology_opts_SSE2.h │ ├── SkMorphology_opts_arm.cpp │ ├── SkMorphology_opts_neon.cpp │ ├── SkMorphology_opts_neon.h │ ├── SkMorphology_opts_none.cpp │ ├── SkUtils_opts_SSE2.cpp │ ├── SkUtils_opts_SSE2.h │ ├── SkUtils_opts_arm.cpp │ ├── SkUtils_opts_none.cpp │ ├── SkXfermode_opts_arm.cpp │ ├── SkXfermode_opts_arm_neon.cpp │ ├── SkXfermode_opts_arm_neon.h │ ├── SkXfermode_opts_none.cpp │ ├── memset.arm.S │ ├── memset16_neon.S │ ├── memset32_neon.S │ └── opts_check_SSE2.cpp │ ├── pathops │ ├── SkAddIntersections.cpp │ ├── SkAddIntersections.h │ ├── SkDCubicIntersection.cpp │ ├── SkDCubicLineIntersection.cpp │ ├── SkDCubicToQuads.cpp │ ├── SkDLineIntersection.cpp │ ├── SkDQuadImplicit.cpp │ ├── SkDQuadImplicit.h │ ├── SkDQuadIntersection.cpp │ ├── SkDQuadLineIntersection.cpp │ ├── SkIntersectionHelper.h │ ├── SkIntersections.cpp │ ├── SkIntersections.h │ ├── SkLineParameters.h │ ├── SkOpAngle.cpp │ ├── SkOpAngle.h │ ├── SkOpContour.cpp │ ├── SkOpContour.h │ ├── SkOpEdgeBuilder.cpp │ ├── SkOpEdgeBuilder.h │ ├── SkOpSegment.cpp │ ├── SkOpSegment.h │ ├── SkOpSpan.h │ ├── SkPathOpsBounds.cpp │ ├── SkPathOpsBounds.h │ ├── SkPathOpsCommon.cpp │ ├── SkPathOpsCommon.h │ ├── SkPathOpsCubic.cpp │ ├── SkPathOpsCubic.h │ ├── SkPathOpsCurve.h │ ├── SkPathOpsDebug.cpp │ ├── SkPathOpsDebug.h │ ├── SkPathOpsLine.cpp │ ├── SkPathOpsLine.h │ ├── SkPathOpsOp.cpp │ ├── SkPathOpsPoint.cpp │ ├── SkPathOpsPoint.h │ ├── SkPathOpsQuad.cpp │ ├── SkPathOpsQuad.h │ ├── SkPathOpsRect.cpp │ ├── SkPathOpsRect.h │ ├── SkPathOpsSimplify.cpp │ ├── SkPathOpsTriangle.cpp │ ├── SkPathOpsTriangle.h │ ├── SkPathOpsTypes.cpp │ ├── SkPathOpsTypes.h │ ├── SkPathWriter.cpp │ ├── SkPathWriter.h │ ├── SkQuarticRoot.cpp │ ├── SkQuarticRoot.h │ ├── SkReduceOrder.cpp │ └── SkReduceOrder.h │ ├── ports │ ├── SkAtomics_android.h │ ├── SkAtomics_none.h │ ├── SkAtomics_sync.h │ ├── SkAtomics_win.h │ ├── SkDebug_android.cpp │ ├── SkDebug_nacl.cpp │ ├── SkDebug_stdio.cpp │ ├── SkDebug_win.cpp │ ├── SkDiscardableMemory_ashmem.cpp │ ├── SkDiscardableMemory_none.cpp │ ├── SkFontConfigInterface_android.cpp │ ├── SkFontConfigInterface_direct.cpp │ ├── SkFontConfigParser_android.cpp │ ├── SkFontConfigParser_android.h │ ├── SkFontConfigTypeface.h │ ├── SkFontHost_FreeType.cpp │ ├── SkFontHost_FreeType_common.cpp │ ├── SkFontHost_FreeType_common.h │ ├── SkFontHost_fontconfig.cpp │ ├── SkFontHost_linux.cpp │ ├── SkFontHost_mac.cpp │ ├── SkFontHost_none.cpp │ ├── SkFontHost_win.cpp │ ├── SkFontHost_win_dw.cpp │ ├── SkFontMgr_default_dw.cpp │ ├── SkFontMgr_default_gdi.cpp │ ├── SkGlobalInitialization_chromium.cpp │ ├── SkGlobalInitialization_default.cpp │ ├── SkHarfBuzzFont.cpp │ ├── SkImageDecoder_CG.cpp │ ├── SkImageDecoder_WIC.cpp │ ├── SkImageDecoder_empty.cpp │ ├── SkMemory_malloc.cpp │ ├── SkMemory_mozalloc.cpp │ ├── SkMutex_none.h │ ├── SkMutex_pthread.h │ ├── SkMutex_win.h │ ├── SkOSFile_none.cpp │ ├── SkOSFile_posix.cpp │ ├── SkOSFile_stdio.cpp │ ├── SkOSFile_win.cpp │ ├── SkPurgeableMemoryBlock_android.cpp │ ├── SkPurgeableMemoryBlock_mac.cpp │ ├── SkPurgeableMemoryBlock_none.cpp │ ├── SkRemotableFontMgr_win_dw.cpp │ ├── SkTLS_none.cpp │ ├── SkTLS_pthread.cpp │ ├── SkTLS_win.cpp │ ├── SkTime_Unix.cpp │ ├── SkTime_win.cpp │ ├── SkXMLParser_empty.cpp │ ├── SkXMLParser_expat.cpp │ ├── SkXMLParser_tinyxml.cpp │ └── SkXMLPullParser_expat.cpp │ ├── sfnt │ ├── SkIBMFamilyClass.h │ ├── SkOTTableTypes.h │ ├── SkOTTable_OS_2.h │ ├── SkOTTable_OS_2_V0.h │ ├── SkOTTable_OS_2_V1.h │ ├── SkOTTable_OS_2_V2.h │ ├── SkOTTable_OS_2_V3.h │ ├── SkOTTable_OS_2_V4.h │ ├── SkOTTable_OS_2_VA.h │ ├── SkOTTable_glyf.h │ ├── SkOTTable_head.h │ ├── SkOTTable_hhea.h │ ├── SkOTTable_loca.h │ ├── SkOTTable_maxp.h │ ├── SkOTTable_maxp_CFF.h │ ├── SkOTTable_maxp_TT.h │ ├── SkOTTable_name.cpp │ ├── SkOTTable_name.h │ ├── SkOTTable_post.h │ ├── SkOTUtils.cpp │ ├── SkOTUtils.h │ ├── SkPanose.h │ ├── SkPreprocessorSeq.h │ ├── SkSFNTHeader.h │ ├── SkTTCFHeader.h │ └── SkTypedEnum.h │ └── utils │ ├── SkBase64.cpp │ ├── SkBase64.h │ ├── SkBitSet.cpp │ ├── SkBitSet.h │ ├── SkBitmapHasher.cpp │ ├── SkBitmapHasher.h │ ├── SkBoundaryPatch.cpp │ ├── SkCamera.cpp │ ├── SkCanvasStack.cpp │ ├── SkCanvasStack.h │ ├── SkCanvasStateUtils.cpp │ ├── SkCondVar.cpp │ ├── SkCountdown.cpp │ ├── SkCubicInterval.cpp │ ├── SkCullPoints.cpp │ ├── SkDeferredCanvas.cpp │ ├── SkDumpCanvas.cpp │ ├── SkEventTracer.cpp │ ├── SkFloatUtils.h │ ├── SkFrontBufferedStream.cpp │ ├── SkGatherPixelRefsAndRects.cpp │ ├── SkGatherPixelRefsAndRects.h │ ├── SkInterpolator.cpp │ ├── SkJSON.cpp │ ├── SkLayer.cpp │ ├── SkLua.cpp │ ├── SkLuaCanvas.cpp │ ├── SkMD5.cpp │ ├── SkMD5.h │ ├── SkMatrix44.cpp │ ├── SkMeshUtils.cpp │ ├── SkNWayCanvas.cpp │ ├── SkNinePatch.cpp │ ├── SkNullCanvas.cpp │ ├── SkOSFile.cpp │ ├── SkPDFRasterizer.cpp │ ├── SkPDFRasterizer.h │ ├── SkParse.cpp │ ├── SkParseColor.cpp │ ├── SkParsePath.cpp │ ├── SkPathUtils.cpp │ ├── SkPictureUtils.cpp │ ├── SkProxyCanvas.cpp │ ├── SkRTConf.cpp │ ├── SkSHA1.cpp │ ├── SkSHA1.h │ ├── SkTFitsIn.h │ ├── SkTLogic.h │ ├── SkThreadUtils.h │ ├── SkThreadUtils_pthread.cpp │ ├── SkThreadUtils_pthread.h │ ├── SkThreadUtils_pthread_linux.cpp │ ├── SkThreadUtils_pthread_mach.cpp │ ├── SkThreadUtils_pthread_other.cpp │ ├── SkThreadUtils_win.cpp │ ├── SkThreadUtils_win.h │ ├── SkUnitMappers.cpp │ ├── android │ ├── ashmem.cpp │ └── ashmem.h │ ├── debugger │ ├── SkDebugCanvas.cpp │ ├── SkDebugCanvas.h │ ├── SkDrawCommand.cpp │ ├── SkDrawCommand.h │ ├── SkObjectParser.cpp │ └── SkObjectParser.h │ ├── ios │ ├── SkFontHost_iOS.mm │ ├── SkImageDecoder_iOS.mm │ ├── SkOSFile_iOS.mm │ └── SkStream_NSData.mm │ ├── mac │ ├── SkCreateCGImageRef.cpp │ └── SkStream_mac.cpp │ └── win │ ├── SkAutoCoInitialize.cpp │ ├── SkDWrite.cpp │ ├── SkDWrite.h │ ├── SkDWriteFontFileStream.cpp │ ├── SkDWriteFontFileStream.h │ ├── SkDWriteGeometrySink.cpp │ ├── SkDWriteGeometrySink.h │ ├── SkHRESULT.cpp │ ├── SkIStream.cpp │ └── SkWGL_win.cpp ├── unittest.vcxproj └── unittest.vcxproj.filters /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.sdf 3 | *.opensdf 4 | out/ 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 bonescreater 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # bones -------------------------------------------------------------------------------- /bones/core/accelerator.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_ACCELERATOR_H_ 2 | #define BONES_CORE_ACCELERATOR_H_ 3 | 4 | #include "keyboard_codes.h" 5 | #include "event.h" 6 | 7 | namespace bones 8 | { 9 | 10 | class Accelerator 11 | { 12 | public: 13 | static Accelerator make(const KeyEvent & ke); 14 | 15 | Accelerator(); 16 | 17 | Accelerator(EventType type, KeyboardCode keycode, int modifiers); 18 | 19 | Accelerator(const Accelerator & accelerator); 20 | 21 | Accelerator& operator=(const Accelerator& accelerator); 22 | 23 | bool operator <(const Accelerator& rhs) const; 24 | 25 | bool operator ==(const Accelerator& rhs) const; 26 | 27 | bool operator !=(const Accelerator& rhs) const; 28 | 29 | EventType type() const; 30 | 31 | int modifiers() const; 32 | 33 | bool IsShiftDown() const; 34 | 35 | bool IsCtrlDown() const; 36 | 37 | bool IsAltDown() const; 38 | 39 | bool IsCmdDown() const; 40 | protected: 41 | KeyboardCode key_code_; 42 | EventType type_; 43 | int modifiers_; 44 | }; 45 | 46 | class AcceleratorTarget 47 | { 48 | public: 49 | virtual bool process(const Accelerator & accelerator) = 0; 50 | 51 | virtual bool canProcess() const = 0; 52 | }; 53 | 54 | 55 | } 56 | 57 | #endif -------------------------------------------------------------------------------- /bones/core/accelerator_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_ACCELERATOR_MANAGER_H_ 2 | #define BONES_CORE_ACCELERATOR_MANAGER_H_ 3 | 4 | #include "accelerator.h" 5 | #include 6 | #include 7 | 8 | namespace bones 9 | { 10 | 11 | class AcceleratorManager 12 | { 13 | public: 14 | AcceleratorManager(); 15 | 16 | ~AcceleratorManager(); 17 | 18 | void regAccelerator(const Accelerator & accelerator, AcceleratorTarget * target); 19 | 20 | void unregAccelerator(const Accelerator & accelerator, AcceleratorTarget * target); 21 | 22 | void unregAllAccelerator(AcceleratorTarget * target); 23 | 24 | bool process(const Accelerator & accelerator); 25 | private: 26 | typedef std::list AcceleratorTargetList; 27 | typedef std::map AcceleratorMap; 28 | 29 | AcceleratorMap accelerators_; 30 | }; 31 | 32 | } 33 | 34 | #endif -------------------------------------------------------------------------------- /bones/core/animation_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_ANIMATION_MANAGER_H_ 2 | #define BONES_CORE_ANIMATION_MANAGER_H_ 3 | 4 | 5 | #include "ref.h" 6 | #include 7 | #include 8 | 9 | namespace bones 10 | { 11 | class Animation; 12 | class View; 13 | 14 | class AnimationManager 15 | { 16 | public: 17 | ~AnimationManager(); 18 | 19 | void removeAll(bool end); 20 | 21 | void remove(View * ref, bool end); 22 | 23 | void add(Animation * ani); 24 | 25 | void remove(Animation * ani, bool end); 26 | 27 | void pause(Animation * ani); 28 | 29 | void resume(Animation * ani); 30 | 31 | void run(uint64_t delta); 32 | protected: 33 | AnimationManager(); 34 | private: 35 | std::map, std::list>> animations_; 36 | 37 | friend class Core; 38 | }; 39 | 40 | } 41 | 42 | #endif -------------------------------------------------------------------------------- /bones/core/css_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_CSS_MANAGER_H_ 2 | #define BONES_CORE_CSS_MANAGER_H_ 3 | 4 | #include "core.h" 5 | #include "css_types.h" 6 | 7 | namespace bones 8 | { 9 | /*类似css 目前仅支持 10 | .class 11 | { 12 | a:b; 13 | b:c d e; 14 | m:n; 15 | } 16 | 注释暂时不支持 有空再加 17 | */ 18 | 19 | class CSSManager 20 | { 21 | public: 22 | void clean(); 23 | 24 | void append(const char * buf); 25 | 26 | void applyCSS(Ref * ob, const char * css); 27 | 28 | void applyClass(Ref * ob, const char * class_name); 29 | protected: 30 | CSSManager(); 31 | private: 32 | void applyEntries(Ref * ob, const CSSEntries & entries); 33 | //{css:mmm;} 34 | void parse(const char * css, CSSEntries & entries); 35 | private: 36 | CSSStyles styles_; 37 | 38 | friend class Core; 39 | }; 40 | 41 | } 42 | 43 | 44 | #endif -------------------------------------------------------------------------------- /bones/core/device.cpp: -------------------------------------------------------------------------------- 1 | #include "device.h" 2 | #include "SkBitmapDevice.h" 3 | #include "pixmap.h" 4 | #include "helper.h" 5 | 6 | namespace bones 7 | { 8 | 9 | class SurfaceDevice : public SkBitmapDevice 10 | { 11 | public: 12 | SurfaceDevice(Surface & pm) 13 | :SkBitmapDevice(Helper::ToSkBitmap(pm)), target_(pm) 14 | { 15 | ; 16 | } 17 | 18 | Surface & getTarget() 19 | { 20 | return target_; 21 | } 22 | private: 23 | Surface target_; 24 | }; 25 | 26 | 27 | SkBaseDevice * Device::Create(Surface & pm) 28 | { 29 | return new SurfaceDevice(pm); 30 | } 31 | 32 | Surface & Device::From(SkBaseDevice * sd) 33 | { 34 | return ((SurfaceDevice *)sd)->getTarget(); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /bones/core/device.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_DEVICE_H_ 2 | #define BONES_CORE_DEVICE_H_ 3 | 4 | #include "core.h" 5 | 6 | class SkBaseDevice; 7 | 8 | namespace bones 9 | { 10 | 11 | class Surface; 12 | 13 | class Device 14 | { 15 | public: 16 | static SkBaseDevice * Create(Surface & pm); 17 | 18 | static Surface & From(SkBaseDevice * sd); 19 | }; 20 | 21 | } 22 | 23 | 24 | 25 | #endif -------------------------------------------------------------------------------- /bones/core/encoding.cpp: -------------------------------------------------------------------------------- 1 | #include "encoding.h" 2 | 3 | namespace bones 4 | { 5 | 6 | std::string Encoding::ToUTF8(const wchar_t * wide) 7 | { 8 | return ToUTF8(wide, -1); 9 | } 10 | 11 | std::string Encoding::ToUTF8(const wchar_t * wide, size_t length) 12 | { 13 | if (!wide || !length) 14 | return ""; 15 | 16 | int need_len = WideCharToMultiByte(CP_UTF8, 0, wide, length, 17 | NULL, 0, NULL, NULL); 18 | if (0 == need_len) 19 | return ""; 20 | std::string utf8; 21 | utf8.resize(length == -1 ? need_len - 1 : need_len); 22 | WideCharToMultiByte(CP_UTF8, 0, wide, length, 23 | &utf8[0], need_len, NULL, NULL); 24 | 25 | return utf8; 26 | } 27 | 28 | std::wstring Encoding::FromUTF8(const char * utf8) 29 | { 30 | return FromUTF8(utf8, -1); 31 | } 32 | 33 | std::wstring Encoding::FromUTF8(const char * utf8, size_t length) 34 | { 35 | if (!utf8 || !length) 36 | return L""; 37 | int need_len = MultiByteToWideChar(CP_UTF8, 0, utf8, length, NULL, 0); 38 | if (0 == need_len) 39 | return L""; 40 | std::wstring wide; 41 | wide.resize(length == -1 ? need_len - 1 : need_len); 42 | 43 | MultiByteToWideChar(CP_UTF8, 0, utf8, length, &wide[0], need_len); 44 | return wide; 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /bones/core/encoding.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_ENCODING_H_ 2 | #define BONES_CORE_ENCODING_H_ 3 | 4 | #include "core.h" 5 | #include 6 | 7 | namespace bones 8 | { 9 | 10 | 11 | class Encoding 12 | { 13 | public: 14 | static std::string ToUTF8(const wchar_t * wide); 15 | 16 | static std::string ToUTF8(const wchar_t * wide, size_t length); 17 | 18 | static std::wstring FromUTF8(const char * utf8); 19 | 20 | static std::wstring FromUTF8(const char * utf8, size_t length); 21 | }; 22 | 23 | } 24 | 25 | 26 | #endif -------------------------------------------------------------------------------- /bones/core/env_unittest.h: -------------------------------------------------------------------------------- 1 |  2 | #include "gtest\gtest.h" 3 | #include "core_imp.h" 4 | 5 | namespace bones 6 | { 7 | 8 | class ENVCORE : public testing::Test 9 | { 10 | protected: 11 | virtual void SetUp() override 12 | { 13 | Core::Config cf = { nullptr, Log::kNone, true, false, nullptr }; 14 | Core::StartUp(cf); 15 | } 16 | virtual void TearDown() override 17 | { 18 | Core::ShutDown(); 19 | } 20 | }; 21 | } -------------------------------------------------------------------------------- /bones/core/event_dispatcher.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_EVENT_DISPATCHER_H_ 2 | #define BONES_CORE_EVENT_DISPATCHER_H_ 3 | 4 | #include "ref.h" 5 | #include 6 | 7 | 8 | namespace bones 9 | { 10 | 11 | class Event; 12 | class View; 13 | 14 | class EventDispatcher 15 | { 16 | public: 17 | typedef std::list> Path; 18 | public: 19 | static void Push(Event & e); 20 | 21 | static void GetPath(View * v, Path & path); 22 | public: 23 | virtual void run(Event & e, Path & path); 24 | }; 25 | 26 | 27 | } 28 | #endif -------------------------------------------------------------------------------- /bones/core/font.cpp: -------------------------------------------------------------------------------- 1 | #include "font.h" 2 | 3 | namespace bones 4 | { 5 | 6 | Font::Font() 7 | :family_("Microsoft Yahei"), st_(kNormal), size_(12) 8 | { 9 | 10 | } 11 | void Font::setFamily(const char * family) 12 | { 13 | family_.clear(); 14 | if (family) 15 | family_ = family; 16 | } 17 | 18 | void Font::setStyle(uint32_t st) 19 | { 20 | st_ = st; 21 | } 22 | 23 | void Font::setSize(Scalar s) 24 | { 25 | size_ = s; 26 | } 27 | 28 | const char * Font::getFamily() const 29 | { 30 | return family_.data(); 31 | } 32 | 33 | uint32_t Font::getStyle() const 34 | { 35 | return st_; 36 | } 37 | 38 | Scalar Font::getSize() const 39 | { 40 | return size_; 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /bones/core/font.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_FONT_H_ 2 | #define BONES_CORE_FONT_H_ 3 | 4 | #include "core.h" 5 | #include 6 | 7 | namespace bones 8 | { 9 | 10 | 11 | class Font 12 | { 13 | public: 14 | enum Style//字体样式 15 | { 16 | kNormal = 0, 17 | kBold = 1 << 0,//!<粗体 18 | kItalic = 1 << 1,//!<倾斜 19 | kUnderline = 1 << 2,//下划线 20 | kStrikeOut = 1 << 3,//删除线 21 | }; 22 | public: 23 | Font(); 24 | 25 | void setFamily(const char * family); 26 | 27 | void setStyle(uint32_t st); 28 | 29 | void setSize(Scalar s); 30 | 31 | const char * getFamily() const; 32 | 33 | uint32_t getStyle() const; 34 | 35 | Scalar getSize() const; 36 | private: 37 | std::string family_; 38 | uint32_t st_; 39 | Scalar size_; 40 | }; 41 | 42 | } 43 | 44 | #endif -------------------------------------------------------------------------------- /bones/core/logging.cpp: -------------------------------------------------------------------------------- 1 | #include "logging.h" 2 | 3 | namespace bones 4 | { 5 | 6 | Log::Level Log::log_level = kNone; 7 | 8 | std::ofstream Log::log; 9 | 10 | bool Log::StartUp(const wchar_t * file_name, Log::Level level) 11 | { 12 | log_level = level; 13 | bool bret = true; 14 | if (file_name) 15 | { 16 | log.open(file_name); 17 | bret = !!log; 18 | } 19 | return bret; 20 | } 21 | 22 | void Log::ShutDown() 23 | { 24 | log_level = kNone; 25 | log.close(); 26 | } 27 | 28 | Log::Log(Log::Level level) 29 | :level_(level) 30 | { 31 | 32 | } 33 | 34 | Log::~Log() 35 | { 36 | if (log) 37 | { 38 | log << "\n"; 39 | log.flush(); 40 | } 41 | 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /bones/core/logging.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_LOGGING_H_ 2 | #define BONES_CORE_LOGGING_H_ 3 | 4 | #include "core.h" 5 | #include 6 | 7 | namespace bones 8 | { 9 | 10 | 11 | class Log 12 | { 13 | public: 14 | enum Level 15 | { 16 | kNone = 0, 17 | kError = 1,// only error 18 | kVerbose = 2,// everything 19 | }; 20 | public: 21 | static bool StartUp(const wchar_t * file_name, Level l); 22 | 23 | static void ShutDown(); 24 | 25 | Log(Level level); 26 | 27 | ~Log(); 28 | 29 | template 30 | Log & operator<<(const T & t) 31 | { 32 | if (log && level_ <= log_level) 33 | log << t; 34 | return *this; 35 | } 36 | private: 37 | Level level_; 38 | private: 39 | static Level log_level; 40 | static std::ofstream log; 41 | }; 42 | 43 | #define BLG_ERROR Log (Log::kError) <<"[LEVEL:ERROR]"<< " " 44 | #define BLG_VERBOSE Log (Log::kVerbose) <<"[LEVEL:VERBOSE]"<< " " 45 | 46 | } 47 | 48 | 49 | #endif -------------------------------------------------------------------------------- /bones/core/mouse_controller.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_MOUSE_CONTROLLER_H_ 2 | #define BONES_CORE_MOUSE_CONTROLLER_H_ 3 | 4 | 5 | #include "event.h" 6 | 7 | namespace bones 8 | { 9 | 10 | class View; 11 | class Root; 12 | class MouseEvent; 13 | 14 | class MouseController 15 | { 16 | public: 17 | MouseController(Root * root); 18 | 19 | void handleEvent(MouseEvent & e); 20 | 21 | void handleWheel(WheelEvent & e); 22 | 23 | View * capture() const; 24 | 25 | View * over() const; 26 | 27 | void removed(View * n); 28 | 29 | void shiftIfNecessary(); 30 | private: 31 | View * getTargetByPos(const Point & pt, bool ignore_capture); 32 | 33 | void shiftCapture(View * n); 34 | 35 | void shiftOver(View * n); 36 | 37 | void clearIfNecessary(); 38 | private: 39 | Root * root_; 40 | RefPtr over_; 41 | RefPtr capture_; 42 | Point last_mouse_point_; 43 | 44 | FRIEND_TEST(MouseControllerUnitTest, CheckConstructor); 45 | FRIEND_TEST(MouseControllerUnitTest, Shift); 46 | }; 47 | 48 | 49 | } 50 | 51 | 52 | #endif -------------------------------------------------------------------------------- /bones/core/point.cpp: -------------------------------------------------------------------------------- 1 | #include "point.h" 2 | 3 | namespace bones 4 | { 5 | 6 | Point Point::Make(Scalar x, Scalar y) 7 | { 8 | return Point(x, y); 9 | } 10 | 11 | Point::Point() 12 | { 13 | set(0, 0); 14 | } 15 | 16 | Point::Point(Scalar x, Scalar y) 17 | { 18 | set(x, y); 19 | } 20 | 21 | void Point::set(Scalar x, Scalar y) 22 | { 23 | x_ = x, y_ = y; 24 | } 25 | 26 | Scalar Point::x() const 27 | { 28 | return x_; 29 | } 30 | 31 | Scalar Point::y() const 32 | { 33 | return y_; 34 | } 35 | 36 | bool Point::isZero() const 37 | { 38 | return 0 == x_ && 0 == y_; 39 | } 40 | 41 | bool Point::operator == (const Point & rh) 42 | { 43 | return x_ == rh.x_ && y_ == rh.y_; 44 | } 45 | 46 | bool Point::operator != (const Point & rh) 47 | { 48 | return !(*this == rh); 49 | } 50 | 51 | void Point::offset(Scalar x, Scalar y) 52 | { 53 | x_ += x; 54 | y_ += y; 55 | } 56 | 57 | void Point::offset(const Point & pt) 58 | { 59 | x_ += pt.x_; 60 | y_ += pt.y_; 61 | } 62 | 63 | 64 | } -------------------------------------------------------------------------------- /bones/core/point.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_POINT_H_ 2 | #define BONES_CORE_POINT_H_ 3 | 4 | #include "core.h" 5 | 6 | namespace bones 7 | { 8 | class Point 9 | { 10 | public: 11 | static Point Make(Scalar x, Scalar y); 12 | 13 | Point(); 14 | 15 | Point(Scalar x, Scalar y); 16 | 17 | void set(Scalar x, Scalar y); 18 | 19 | Scalar x() const; 20 | 21 | Scalar y() const; 22 | 23 | bool isZero() const; 24 | 25 | bool operator == (const Point & rh); 26 | 27 | bool operator != (const Point & rh); 28 | 29 | void offset(Scalar x, Scalar y); 30 | 31 | void offset(const Point & pt); 32 | private: 33 | Scalar x_; 34 | Scalar y_; 35 | }; 36 | } 37 | #endif -------------------------------------------------------------------------------- /bones/core/rect.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_RECT_H_ 2 | #define BONES_CORE_RECT_H_ 3 | 4 | #include "core.h" 5 | 6 | namespace bones 7 | { 8 | 9 | class Rect 10 | { 11 | public: 12 | static Rect MakeLTRB(Scalar left, Scalar top, Scalar right, Scalar bottom); 13 | 14 | static Rect MakeXYWH(Scalar left, Scalar top, Scalar width, Scalar height); 15 | 16 | Rect(); 17 | 18 | Rect(Scalar left, Scalar top, Scalar right, Scalar bottom); 19 | 20 | bool isEmpty() const; 21 | 22 | Scalar left() const; 23 | 24 | Scalar top() const; 25 | 26 | Scalar right() const; 27 | 28 | Scalar bottom() const; 29 | 30 | Scalar width() const; 31 | 32 | Scalar height() const; 33 | 34 | void setEmpty(); 35 | 36 | void setLTRB(Scalar left, Scalar top, Scalar right, Scalar bottom); 37 | 38 | void setXYWH(Scalar left, Scalar top, Scalar width, Scalar height); 39 | 40 | void offset(Scalar dx, Scalar dy); 41 | 42 | void offsetTo(Scalar x, Scalar y); 43 | 44 | void inset(Scalar dx, Scalar dy); 45 | 46 | void outset(Scalar dx, Scalar dy); 47 | 48 | bool intersect(const Rect & r); 49 | 50 | void join(const Rect & r); 51 | 52 | bool contains(Scalar x, Scalar y); 53 | private: 54 | Scalar left_; 55 | Scalar top_; 56 | Scalar right_; 57 | Scalar bottom_; 58 | }; 59 | 60 | 61 | } 62 | #endif -------------------------------------------------------------------------------- /bones/core/ref.cpp: -------------------------------------------------------------------------------- 1 |  2 | #include "ref.h" 3 | #include "logging.h" 4 | 5 | namespace bones 6 | { 7 | 8 | Ref::Ref() :count_(1) 9 | { 10 | ; 11 | } 12 | 13 | Ref::~Ref() 14 | { 15 | assert(count_ == 0); 16 | } 17 | 18 | void Ref::retain() 19 | { 20 | assert(count_ > 0); 21 | ++count_; 22 | } 23 | 24 | void Ref::release() 25 | { 26 | assert(count_ > 0); 27 | --count_; 28 | if (0 == count_) 29 | delete this; 30 | } 31 | 32 | int Ref::getRefCount() const 33 | { 34 | return count_; 35 | } 36 | 37 | NoncopyableObject::NoncopyableObject() 38 | { 39 | 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /bones/core/res_manager.cpp: -------------------------------------------------------------------------------- 1 | #include "res_manager.h" 2 | 3 | namespace bones 4 | { 5 | 6 | void ResManager::addPixmap(const char * key, Pixmap & pm) 7 | { 8 | if (!key) 9 | return; 10 | key2pm_[key] = pm; 11 | } 12 | 13 | 14 | void ResManager::clean() 15 | { 16 | key2pm_.clear(); 17 | } 18 | 19 | Pixmap * ResManager::getPixmap(const char * key) 20 | { 21 | if (key) 22 | { 23 | auto iter = key2pm_.find(key); 24 | if (iter != key2pm_.end()) 25 | return &iter->second; 26 | } 27 | return nullptr; 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /bones/core/res_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_RES_MANAGER_H_ 2 | #define BONES_CORE_RES_MANAGER_H_ 3 | 4 | #include "core.h" 5 | #include "pixmap.h" 6 | #include 7 | #include 8 | 9 | namespace bones 10 | { 11 | 12 | class ResManager 13 | { 14 | public: 15 | void addPixmap(const char * key, Pixmap & pm); 16 | 17 | void clean(); 18 | 19 | Pixmap * getPixmap(const char * key); 20 | private: 21 | std::map key2pm_; 22 | }; 23 | 24 | } 25 | 26 | 27 | #endif -------------------------------------------------------------------------------- /bones/core/root_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_ROOT_MANAGER_H_ 2 | #define BONES_CORE_ROOT_MANAGER_H_ 3 | 4 | 5 | #include "root.h" 6 | #include 7 | 8 | namespace bones 9 | { 10 | class Root; 11 | 12 | class RootManager 13 | { 14 | public: 15 | ~RootManager(); 16 | 17 | Root * getRoot(int index) const; 18 | 19 | size_t getRootCount() const; 20 | 21 | void add(Root * root); 22 | 23 | void remove(Root * root); 24 | 25 | void remove(); 26 | 27 | void update(); 28 | private: 29 | std::vector> roots_; 30 | }; 31 | 32 | } 33 | #endif -------------------------------------------------------------------------------- /bones/core/size.cpp: -------------------------------------------------------------------------------- 1 | #include "size.h" 2 | 3 | namespace bones 4 | { 5 | 6 | Size Size::Make(Scalar w, Scalar h) 7 | { 8 | return Size(w, h); 9 | } 10 | 11 | Size::Size() 12 | { 13 | set(0, 0); 14 | } 15 | 16 | Size::Size(Scalar w, Scalar h) 17 | { 18 | set(w, h); 19 | } 20 | 21 | void Size::set(Scalar w, Scalar h) 22 | { 23 | width_ = w; 24 | height_ = h; 25 | } 26 | 27 | Scalar Size::width() const 28 | { 29 | return width_; 30 | } 31 | 32 | Scalar Size::height() const 33 | { 34 | return height_; 35 | } 36 | 37 | bool Size::operator == (const Size & rh) 38 | { 39 | return width_ == rh.width_ && height_ == rh.height_; 40 | } 41 | 42 | bool Size::operator != (const Size & rh) 43 | { 44 | return !(*this == rh); 45 | } 46 | 47 | 48 | } -------------------------------------------------------------------------------- /bones/core/size.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_CORE_SIZE_H_ 2 | #define BONES_CORE_SIZE_H_ 3 | 4 | #include "core.h" 5 | 6 | namespace bones 7 | { 8 | 9 | class Size 10 | { 11 | public: 12 | static Size Make(Scalar w, Scalar h); 13 | 14 | Size(); 15 | 16 | Size(Scalar w, Scalar h); 17 | 18 | void set(Scalar w, Scalar h); 19 | 20 | Scalar width() const; 21 | 22 | Scalar height() const; 23 | 24 | bool operator == (const Size & rh); 25 | 26 | bool operator != (const Size & rh); 27 | private: 28 | Scalar width_; 29 | Scalar height_; 30 | }; 31 | 32 | } 33 | #endif -------------------------------------------------------------------------------- /bones/lua_check.cpp: -------------------------------------------------------------------------------- 1 | #include "lua_check.h" 2 | #include "core/logging.h" 3 | 4 | namespace bones 5 | { 6 | 7 | 8 | LuaStackAutoCheck::LuaStackAutoCheck(lua_State * l, int count) 9 | :l_(l), count_(count) 10 | { 11 | top_ = lua_gettop(l_); 12 | } 13 | 14 | LuaStackAutoCheck::~LuaStackAutoCheck() 15 | { 16 | auto top = lua_gettop(l_); 17 | if (top - top_ != count_) 18 | { 19 | BLG_ERROR << "stack error\n"; 20 | assert(0); 21 | } 22 | 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /bones/lua_check.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_LUA_CHECK_H_ 2 | #define BONES_LUA_CHECK_H_ 3 | 4 | #include "bones.h" 5 | #include "lua.hpp" 6 | namespace bones 7 | { 8 | 9 | class LuaStackAutoCheck 10 | { 11 | public: 12 | LuaStackAutoCheck(lua_State * l, int count = 0); 13 | 14 | ~LuaStackAutoCheck(); 15 | private: 16 | lua_State * l_; 17 | int top_; 18 | int count_; 19 | }; 20 | 21 | #define LUA_STACK_AUTO_CHECK(l) LuaStackAutoCheck __##__LINE__(l) 22 | 23 | #define LUA_STACK_AUTO_CHECK_COUNT(l, a) LuaStackAutoCheck __##__LINE__(l, a) 24 | } 25 | 26 | #endif -------------------------------------------------------------------------------- /bones/lua_context.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_LUA_CONTEXT_H_ 2 | #define BONES_LUA_CONTEXT_H_ 3 | 4 | #include "bones.h" 5 | #include "lua.hpp" 6 | 7 | namespace bones 8 | { 9 | class LuaContext 10 | { 11 | public: 12 | static bool StartUp(); 13 | 14 | static void ShutDown(); 15 | 16 | static void Reset(); 17 | 18 | static lua_State * State(); 19 | 20 | static void GetGlobalTable(lua_State * l); 21 | 22 | static void GetCO2LOTable(lua_State * l); 23 | 24 | static void ClearLOFromCO(lua_State * l, void * co); 25 | 26 | static void * GetEventCache(lua_State * l, int count); 27 | 28 | static int SafeLOPCall(lua_State * l, int nargs, int nresults); 29 | 30 | static void GetLOFromCO(lua_State * l, void * co); 31 | 32 | static void SetGetCObject(lua_State * l, void * co); 33 | 34 | static void * CallGetCObject(lua_State *l); 35 | 36 | static void PushScriptArg(lua_State * l, BonesObject::ScriptArg arg); 37 | 38 | static BonesObject::ScriptArg GetScriptArg(lua_State * l, int idx); 39 | }; 40 | 41 | } 42 | 43 | #endif -------------------------------------------------------------------------------- /bones/lua_image.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_LUA_IMAGE_H_ 2 | #define BONES_LUA_IMAGE_H_ 3 | 4 | #include "lua_handler.h" 5 | #include "core/image.h" 6 | 7 | namespace bones 8 | { 9 | 10 | class LuaImage : public LuaObject, 11 | public Image::Delegate 12 | { 13 | public: 14 | LuaImage(Image * ob); 15 | 16 | void createMetaTable(lua_State * l) override; 17 | 18 | void setDirect(const BonesPoint * bp) override; 19 | 20 | void setStretch(const BonesRect * dst) override; 21 | 22 | void setNine(const BonesRect * dst, const BonesRect * center) override; 23 | 24 | void setContent(BonesPixmap pm) override; 25 | 26 | void setColorMatrix(const BonesColorMatrix * cm) override; 27 | 28 | LUA_HANDLER(Image); 29 | }; 30 | 31 | } 32 | 33 | #endif -------------------------------------------------------------------------------- /bones/lua_input.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_LUA_INPUT_H_ 2 | #define BONES_LUA_INPUT_H_ 3 | 4 | #include "lua_handler.h" 5 | #include "core/input.h" 6 | 7 | namespace bones 8 | { 9 | 10 | class LuaInput : public LuaObject, 11 | public Input::Delegate 12 | { 13 | public: 14 | LuaInput(Input * ob); 15 | 16 | void createMetaTable(lua_State * l) override; 17 | 18 | void setFont(const BonesFont & font) override; 19 | 20 | void setColor(BonesColor color) override; 21 | 22 | void setColor(BonesShader shader) override; 23 | 24 | void setContent(const wchar_t * str) override; 25 | 26 | void setPassword(bool pw, wchar_t password) override; 27 | 28 | void moveCaret(int index) override; 29 | 30 | void select(int start, int end) override; 31 | 32 | LUA_HANDLER(Input); 33 | }; 34 | 35 | } 36 | 37 | #endif -------------------------------------------------------------------------------- /bones/lua_rich_edit.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_LUA_RICH_EDIT_H_ 2 | #define BONES_LUA_RICH_EDIT_H_ 3 | 4 | #include "lua_handler.h" 5 | #include "core/rich_edit.h" 6 | 7 | namespace bones 8 | { 9 | 10 | class LuaRichEdit : public LuaObject, 11 | public RichEdit::Delegate 12 | { 13 | public: 14 | LuaRichEdit(RichEdit * ob); 15 | 16 | void createMetaTable(lua_State * l) override; 17 | 18 | HRESULT txNotify(RichEdit * sender, DWORD iNotify, void *pv) override; 19 | 20 | LUA_HANDLER(RichEdit); 21 | }; 22 | 23 | 24 | } 25 | 26 | 27 | #endif -------------------------------------------------------------------------------- /bones/lua_scroller.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_LUA_SCROLLER_H_ 2 | #define BONES_LUA_SCROLLER_H_ 3 | 4 | #include "lua_handler.h" 5 | #include "core\scroller.h" 6 | 7 | namespace bones 8 | { 9 | 10 | 11 | class LuaScroller : public LuaObject, 12 | public Scroller::Delegate 13 | { 14 | public: 15 | LuaScroller(Scroller * ob); 16 | 17 | void createMetaTable(lua_State * l) override; 18 | 19 | void setScrollInfo(BonesScalar total, bool horizontal) override; 20 | 21 | void setScrollPos(BonesScalar cur, bool horizontal) override; 22 | 23 | void onScrollRange(Scroller * sender, 24 | Scalar min_pos, 25 | Scalar max_pos, 26 | Scalar view_port, 27 | bool horizontal) override; 28 | 29 | void onScrollPos(Scroller * sender, 30 | Scalar cur_pos, 31 | bool horizontal) override; 32 | 33 | BonesScalar getScrollPos(bool horizontal) override; 34 | 35 | LUA_HANDLER(Scroller); 36 | }; 37 | 38 | } 39 | 40 | 41 | #endif -------------------------------------------------------------------------------- /bones/lua_shape.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_LUA_SHAPE_H_ 2 | #define BONES_LUA_SHAPE_H_ 3 | 4 | #include "lua_handler.h" 5 | #include "core/shape.h" 6 | 7 | namespace bones 8 | { 9 | 10 | class LuaShape : public LuaObject, 11 | public Shape::Delegate 12 | { 13 | public: 14 | LuaShape(Shape * ob); 15 | 16 | void createMetaTable(lua_State * l) override; 17 | 18 | void setStroke(bool stroke) override; 19 | 20 | void setStrokeEffect(size_t count, 21 | BonesScalar * interval, 22 | BonesScalar offset) override; 23 | 24 | void setStrokeWidth(BonesScalar stroke_width) override; 25 | 26 | void setColor(BonesColor color) override; 27 | 28 | void setColor(BonesShader shader) override; 29 | 30 | void setCircle(const BonesPoint & center, BonesScalar radius) override; 31 | 32 | void setRect(BonesScalar rx, BonesScalar ry, 33 | const BonesRect * rect) override; 34 | 35 | void setLine(const BonesPoint & start, const BonesPoint & end) override; 36 | 37 | void setPoint(const BonesPoint & pt) override; 38 | 39 | void setOval(const BonesRect * oval) override; 40 | 41 | void setArc(BonesScalar start, 42 | BonesScalar sweep, 43 | bool use_center, 44 | const BonesRect * oval) override; 45 | 46 | void setPath(BonesPath path) override; 47 | 48 | LUA_HANDLER(Shape); 49 | }; 50 | 51 | } 52 | 53 | #endif -------------------------------------------------------------------------------- /bones/lua_text.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_LUA_TEXT_H_ 2 | #define BONES_LUA_TEXT_H_ 3 | 4 | #include "lua_handler.h" 5 | #include "core/text.h" 6 | 7 | namespace bones 8 | { 9 | class Text; 10 | class LuaText : public LuaObject, 11 | public Text::Delegate 12 | { 13 | public: 14 | LuaText(Text * ob); 15 | 16 | void createMetaTable(lua_State * l) override; 17 | 18 | void setFont(const BonesFont & font) override; 19 | 20 | void setColor(BonesColor color) override; 21 | 22 | void setColor(BonesShader shader) override; 23 | 24 | void setContent(const wchar_t * str) override; 25 | 26 | void setLineSpace(BonesScalar ls) override; 27 | 28 | void setAuto(Align align, bool ellipsis) override; 29 | 30 | void setFloat() override; 31 | 32 | void setPos(size_t count, const BonesPoint * pts) override; 33 | 34 | void setPath(BonesPath path) override; 35 | 36 | BonesRect getFloatBounds(BonesScalar max_width) const override; 37 | 38 | LUA_HANDLER(Text); 39 | }; 40 | 41 | } 42 | 43 | 44 | #endif -------------------------------------------------------------------------------- /bones/lua_web_view.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_LUA_WEB_VIEW_H_ 2 | #define BONES_LUA_WEB_VIEW_H_ 3 | 4 | #include "lua_handler.h" 5 | #include "core/web_view.h" 6 | 7 | namespace bones 8 | { 9 | 10 | class LuaWebView : public LuaObject, 11 | public WebView::Delegate 12 | { 13 | public: 14 | LuaWebView(WebView * ob); 15 | 16 | void createMetaTable(lua_State * l) override; 17 | 18 | bool open() override; 19 | 20 | void close() override; 21 | 22 | void loadURL(const wchar_t * url) override; 23 | 24 | void executeJS(const wchar_t * code, 25 | const wchar_t * url, 26 | int start_line) override; 27 | 28 | LUA_HANDLER(WebView); 29 | }; 30 | } 31 | 32 | #endif -------------------------------------------------------------------------------- /bones/main.cpp: -------------------------------------------------------------------------------- 1 | #include "bones.h" 2 | #include 3 | BOOL CALLBACK DllMain(HMODULE module, DWORD reason, LPVOID reverse) 4 | { 5 | return true; 6 | } 7 | 8 | 9 | -------------------------------------------------------------------------------- /bones/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_UTILS_H_ 2 | #define BONES_UTILS_H_ 3 | 4 | #include "bones.h" 5 | #include "lua.hpp" 6 | #include "core/event.h" 7 | 8 | class SkPath; 9 | class SkShader; 10 | 11 | 12 | namespace bones 13 | { 14 | class Pixmap; 15 | class Rect; 16 | 17 | class Utils 18 | { 19 | public: 20 | static SkPath * ToSkPath(BonesPath path); 21 | 22 | static BonesPath ToBonesPath(SkPath * path); 23 | 24 | static SkShader * ToSkShader(BonesShader shader); 25 | 26 | static BonesShader ToBonesShader(SkShader * shader); 27 | 28 | static Pixmap * ToPixmap(BonesPixmap pm); 29 | 30 | static BonesPixmap ToBonesPixmap(Pixmap * bm); 31 | 32 | static Rect ToRect(const BonesRect & rect); 33 | 34 | static BonesRect ToBonesRect(const Rect & rect); 35 | 36 | static BonesScalar ToBonesScalar(lua_Number t); 37 | 38 | static BonesColor ToBonesColor(lua_Integer i); 39 | 40 | static int ToInt(lua_Number i); 41 | 42 | static void ToEMForMouse(BonesRoot::MouseMessage msg, EventType & type, MouseButton & mb); 43 | }; 44 | } 45 | 46 | #endif -------------------------------------------------------------------------------- /cef3/bin.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bonescreater/bones/618ced87a9a2061b0a7879be32b2fea263880f1b/cef3/bin.7z -------------------------------------------------------------------------------- /cef3/lib/libcef.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bonescreater/bones/618ced87a9a2061b0a7879be32b2fea263880f1b/cef3/lib/libcef.lib -------------------------------------------------------------------------------- /libcef_dll/base/cef_bind_helpers.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "include/base/cef_bind_helpers.h" 6 | 7 | #include "include/base/cef_callback.h" 8 | 9 | namespace base { 10 | 11 | void DoNothing() { 12 | } 13 | 14 | } // namespace base 15 | -------------------------------------------------------------------------------- /libcef_dll/base/cef_callback_helpers.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "include/base/cef_callback_helpers.h" 6 | 7 | #include "include/base/cef_callback.h" 8 | 9 | namespace base { 10 | 11 | ScopedClosureRunner::ScopedClosureRunner() { 12 | } 13 | 14 | ScopedClosureRunner::ScopedClosureRunner(const Closure& closure) 15 | : closure_(closure) { 16 | } 17 | 18 | ScopedClosureRunner::~ScopedClosureRunner() { 19 | if (!closure_.is_null()) 20 | closure_.Run(); 21 | } 22 | 23 | void ScopedClosureRunner::Reset() { 24 | Closure old_closure = Release(); 25 | if (!old_closure.is_null()) 26 | old_closure.Run(); 27 | } 28 | 29 | void ScopedClosureRunner::Reset(const Closure& closure) { 30 | Closure old_closure = Release(); 31 | closure_ = closure; 32 | if (!old_closure.is_null()) 33 | old_closure.Run(); 34 | } 35 | 36 | Closure ScopedClosureRunner::Release() { 37 | Closure result = closure_; 38 | closure_.Reset(); 39 | return result; 40 | } 41 | 42 | } // namespace base 43 | -------------------------------------------------------------------------------- /libcef_dll/base/cef_callback_internal.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "include/base/internal/cef_callback_internal.h" 6 | 7 | #include "include/base/cef_logging.h" 8 | 9 | namespace base { 10 | namespace internal { 11 | 12 | void CallbackBase::Reset() { 13 | polymorphic_invoke_ = NULL; 14 | // NULL the bind_state_ last, since it may be holding the last ref to whatever 15 | // object owns us, and we may be deleted after that. 16 | bind_state_ = NULL; 17 | } 18 | 19 | bool CallbackBase::Equals(const CallbackBase& other) const { 20 | return bind_state_.get() == other.bind_state_.get() && 21 | polymorphic_invoke_ == other.polymorphic_invoke_; 22 | } 23 | 24 | CallbackBase::CallbackBase(BindStateBase* bind_state) 25 | : bind_state_(bind_state), 26 | polymorphic_invoke_(NULL) { 27 | DCHECK(!bind_state_.get() || bind_state_->HasOneRef()); 28 | } 29 | 30 | CallbackBase::~CallbackBase() { 31 | } 32 | 33 | } // namespace internal 34 | } // namespace base 35 | -------------------------------------------------------------------------------- /libcef_dll/base/cef_ref_counted.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "include/base/cef_ref_counted.h" 6 | #include "include/base/cef_thread_collision_warner.h" 7 | 8 | namespace base { 9 | 10 | namespace subtle { 11 | 12 | bool RefCountedThreadSafeBase::HasOneRef() const { 13 | return AtomicRefCountIsOne( 14 | &const_cast(this)->ref_count_); 15 | } 16 | 17 | RefCountedThreadSafeBase::RefCountedThreadSafeBase() : ref_count_(0) { 18 | #ifndef NDEBUG 19 | in_dtor_ = false; 20 | #endif 21 | } 22 | 23 | RefCountedThreadSafeBase::~RefCountedThreadSafeBase() { 24 | #ifndef NDEBUG 25 | DCHECK(in_dtor_) << "RefCountedThreadSafe object deleted without " 26 | "calling Release()"; 27 | #endif 28 | } 29 | 30 | void RefCountedThreadSafeBase::AddRef() const { 31 | #ifndef NDEBUG 32 | DCHECK(!in_dtor_); 33 | #endif 34 | AtomicRefCountInc(&ref_count_); 35 | } 36 | 37 | bool RefCountedThreadSafeBase::Release() const { 38 | #ifndef NDEBUG 39 | DCHECK(!in_dtor_); 40 | DCHECK(!AtomicRefCountIsZero(&ref_count_)); 41 | #endif 42 | if (!AtomicRefCountDec(&ref_count_)) { 43 | #ifndef NDEBUG 44 | in_dtor_ = true; 45 | #endif 46 | return true; 47 | } 48 | return false; 49 | } 50 | 51 | } // namespace subtle 52 | 53 | } // namespace base 54 | -------------------------------------------------------------------------------- /libcef_dll/base/cef_thread_checker_impl.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "include/base/internal/cef_thread_checker_impl.h" 6 | 7 | namespace base { 8 | 9 | ThreadCheckerImpl::ThreadCheckerImpl() 10 | : valid_thread_id_() { 11 | EnsureThreadIdAssigned(); 12 | } 13 | 14 | ThreadCheckerImpl::~ThreadCheckerImpl() {} 15 | 16 | bool ThreadCheckerImpl::CalledOnValidThread() const { 17 | EnsureThreadIdAssigned(); 18 | AutoLock auto_lock(lock_); 19 | return valid_thread_id_ == PlatformThread::CurrentRef(); 20 | } 21 | 22 | void ThreadCheckerImpl::DetachFromThread() { 23 | AutoLock auto_lock(lock_); 24 | valid_thread_id_ = PlatformThreadRef(); 25 | } 26 | 27 | void ThreadCheckerImpl::EnsureThreadIdAssigned() const { 28 | AutoLock auto_lock(lock_); 29 | if (valid_thread_id_.is_null()) { 30 | valid_thread_id_ = PlatformThread::CurrentRef(); 31 | } 32 | } 33 | 34 | } // namespace base 35 | -------------------------------------------------------------------------------- /libcef_dll/cpptoc/app_cpptoc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #ifndef CEF_LIBCEF_DLL_CPPTOC_APP_CPPTOC_H_ 14 | #define CEF_LIBCEF_DLL_CPPTOC_APP_CPPTOC_H_ 15 | #pragma once 16 | 17 | #ifndef USING_CEF_SHARED 18 | #pragma message("Warning: "__FILE__" may be accessed wrapper-side only") 19 | #else // USING_CEF_SHARED 20 | 21 | #include "include/cef_app.h" 22 | #include "include/capi/cef_app_capi.h" 23 | #include "libcef_dll/cpptoc/cpptoc.h" 24 | 25 | // Wrap a C++ class with a C structure. 26 | // This class may be instantiated and accessed wrapper-side only. 27 | class CefAppCppToC 28 | : public CefCppToC { 29 | public: 30 | explicit CefAppCppToC(CefApp* cls); 31 | virtual ~CefAppCppToC() {} 32 | }; 33 | 34 | #endif // USING_CEF_SHARED 35 | #endif // CEF_LIBCEF_DLL_CPPTOC_APP_CPPTOC_H_ 36 | 37 | -------------------------------------------------------------------------------- /libcef_dll/cpptoc/client_cpptoc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #ifndef CEF_LIBCEF_DLL_CPPTOC_CLIENT_CPPTOC_H_ 14 | #define CEF_LIBCEF_DLL_CPPTOC_CLIENT_CPPTOC_H_ 15 | #pragma once 16 | 17 | #ifndef USING_CEF_SHARED 18 | #pragma message("Warning: "__FILE__" may be accessed wrapper-side only") 19 | #else // USING_CEF_SHARED 20 | 21 | #include "include/cef_client.h" 22 | #include "include/capi/cef_client_capi.h" 23 | #include "libcef_dll/cpptoc/cpptoc.h" 24 | 25 | // Wrap a C++ class with a C structure. 26 | // This class may be instantiated and accessed wrapper-side only. 27 | class CefClientCppToC 28 | : public CefCppToC { 29 | public: 30 | explicit CefClientCppToC(CefClient* cls); 31 | virtual ~CefClientCppToC() {} 32 | }; 33 | 34 | #endif // USING_CEF_SHARED 35 | #endif // CEF_LIBCEF_DLL_CPPTOC_CLIENT_CPPTOC_H_ 36 | 37 | -------------------------------------------------------------------------------- /libcef_dll/cpptoc/domvisitor_cpptoc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #ifndef CEF_LIBCEF_DLL_CPPTOC_DOMVISITOR_CPPTOC_H_ 14 | #define CEF_LIBCEF_DLL_CPPTOC_DOMVISITOR_CPPTOC_H_ 15 | #pragma once 16 | 17 | #ifndef USING_CEF_SHARED 18 | #pragma message("Warning: "__FILE__" may be accessed wrapper-side only") 19 | #else // USING_CEF_SHARED 20 | 21 | #include "include/cef_dom.h" 22 | #include "include/capi/cef_dom_capi.h" 23 | #include "libcef_dll/cpptoc/cpptoc.h" 24 | 25 | // Wrap a C++ class with a C structure. 26 | // This class may be instantiated and accessed wrapper-side only. 27 | class CefDOMVisitorCppToC 28 | : public CefCppToC { 29 | public: 30 | explicit CefDOMVisitorCppToC(CefDOMVisitor* cls); 31 | virtual ~CefDOMVisitorCppToC() {} 32 | }; 33 | 34 | #endif // USING_CEF_SHARED 35 | #endif // CEF_LIBCEF_DLL_CPPTOC_DOMVISITOR_CPPTOC_H_ 36 | 37 | -------------------------------------------------------------------------------- /libcef_dll/cpptoc/task_cpptoc.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #include "libcef_dll/cpptoc/task_cpptoc.h" 14 | 15 | 16 | // MEMBER FUNCTIONS - Body may be edited by hand. 17 | 18 | void CEF_CALLBACK task_execute(struct _cef_task_t* self) { 19 | // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 20 | 21 | DCHECK(self); 22 | if (!self) 23 | return; 24 | 25 | // Execute 26 | CefTaskCppToC::Get(self)->Execute(); 27 | } 28 | 29 | 30 | // CONSTRUCTOR - Do not edit by hand. 31 | 32 | CefTaskCppToC::CefTaskCppToC(CefTask* cls) 33 | : CefCppToC(cls) { 34 | struct_.struct_.execute = task_execute; 35 | } 36 | 37 | #ifndef NDEBUG 38 | template<> base::AtomicRefCount CefCppToC::DebugObjCt = 0; 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /libcef_dll/cpptoc/task_cpptoc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #ifndef CEF_LIBCEF_DLL_CPPTOC_TASK_CPPTOC_H_ 14 | #define CEF_LIBCEF_DLL_CPPTOC_TASK_CPPTOC_H_ 15 | #pragma once 16 | 17 | #ifndef USING_CEF_SHARED 18 | #pragma message("Warning: "__FILE__" may be accessed wrapper-side only") 19 | #else // USING_CEF_SHARED 20 | 21 | #include "include/cef_task.h" 22 | #include "include/capi/cef_task_capi.h" 23 | #include "libcef_dll/cpptoc/cpptoc.h" 24 | 25 | // Wrap a C++ class with a C structure. 26 | // This class may be instantiated and accessed wrapper-side only. 27 | class CefTaskCppToC 28 | : public CefCppToC { 29 | public: 30 | explicit CefTaskCppToC(CefTask* cls); 31 | virtual ~CefTaskCppToC() {} 32 | }; 33 | 34 | #endif // USING_CEF_SHARED 35 | #endif // CEF_LIBCEF_DLL_CPPTOC_TASK_CPPTOC_H_ 36 | 37 | -------------------------------------------------------------------------------- /libcef_dll/cpptoc/v8accessor_cpptoc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #ifndef CEF_LIBCEF_DLL_CPPTOC_V8ACCESSOR_CPPTOC_H_ 14 | #define CEF_LIBCEF_DLL_CPPTOC_V8ACCESSOR_CPPTOC_H_ 15 | #pragma once 16 | 17 | #ifndef USING_CEF_SHARED 18 | #pragma message("Warning: "__FILE__" may be accessed wrapper-side only") 19 | #else // USING_CEF_SHARED 20 | 21 | #include "include/cef_v8.h" 22 | #include "include/capi/cef_v8_capi.h" 23 | #include "libcef_dll/cpptoc/cpptoc.h" 24 | 25 | // Wrap a C++ class with a C structure. 26 | // This class may be instantiated and accessed wrapper-side only. 27 | class CefV8AccessorCppToC 28 | : public CefCppToC { 29 | public: 30 | explicit CefV8AccessorCppToC(CefV8Accessor* cls); 31 | virtual ~CefV8AccessorCppToC() {} 32 | }; 33 | 34 | #endif // USING_CEF_SHARED 35 | #endif // CEF_LIBCEF_DLL_CPPTOC_V8ACCESSOR_CPPTOC_H_ 36 | 37 | -------------------------------------------------------------------------------- /libcef_dll/cpptoc/v8handler_cpptoc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #ifndef CEF_LIBCEF_DLL_CPPTOC_V8HANDLER_CPPTOC_H_ 14 | #define CEF_LIBCEF_DLL_CPPTOC_V8HANDLER_CPPTOC_H_ 15 | #pragma once 16 | 17 | #ifndef USING_CEF_SHARED 18 | #pragma message("Warning: "__FILE__" may be accessed wrapper-side only") 19 | #else // USING_CEF_SHARED 20 | 21 | #include "include/cef_v8.h" 22 | #include "include/capi/cef_v8_capi.h" 23 | #include "libcef_dll/cpptoc/cpptoc.h" 24 | 25 | // Wrap a C++ class with a C structure. 26 | // This class may be instantiated and accessed wrapper-side only. 27 | class CefV8HandlerCppToC 28 | : public CefCppToC { 29 | public: 30 | explicit CefV8HandlerCppToC(CefV8Handler* cls); 31 | virtual ~CefV8HandlerCppToC() {} 32 | }; 33 | 34 | #endif // USING_CEF_SHARED 35 | #endif // CEF_LIBCEF_DLL_CPPTOC_V8HANDLER_CPPTOC_H_ 36 | 37 | -------------------------------------------------------------------------------- /libcef_dll/ctocpp/allow_certificate_error_callback_ctocpp.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #include "libcef_dll/ctocpp/allow_certificate_error_callback_ctocpp.h" 14 | 15 | 16 | // VIRTUAL METHODS - Body may be edited by hand. 17 | 18 | void CefAllowCertificateErrorCallbackCToCpp::Continue(bool allow) { 19 | if (CEF_MEMBER_MISSING(struct_, cont)) 20 | return; 21 | 22 | // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 23 | 24 | // Execute 25 | struct_->cont(struct_, 26 | allow); 27 | } 28 | 29 | 30 | #ifndef NDEBUG 31 | template<> base::AtomicRefCount CefCToCpp::DebugObjCt = 0; 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /libcef_dll/ctocpp/before_download_callback_ctocpp.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #include "libcef_dll/ctocpp/before_download_callback_ctocpp.h" 14 | 15 | 16 | // VIRTUAL METHODS - Body may be edited by hand. 17 | 18 | void CefBeforeDownloadCallbackCToCpp::Continue(const CefString& download_path, 19 | bool show_dialog) { 20 | if (CEF_MEMBER_MISSING(struct_, cont)) 21 | return; 22 | 23 | // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 24 | 25 | // Unverified params: download_path 26 | 27 | // Execute 28 | struct_->cont(struct_, 29 | download_path.GetStruct(), 30 | show_dialog); 31 | } 32 | 33 | 34 | #ifndef NDEBUG 35 | template<> base::AtomicRefCount CefCToCpp::DebugObjCt = 37 | 0; 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /libcef_dll/ctocpp/callback_ctocpp.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #include "libcef_dll/ctocpp/callback_ctocpp.h" 14 | 15 | 16 | // VIRTUAL METHODS - Body may be edited by hand. 17 | 18 | void CefCallbackCToCpp::Continue() { 19 | if (CEF_MEMBER_MISSING(struct_, cont)) 20 | return; 21 | 22 | // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 23 | 24 | // Execute 25 | struct_->cont(struct_); 26 | } 27 | 28 | void CefCallbackCToCpp::Cancel() { 29 | if (CEF_MEMBER_MISSING(struct_, cancel)) 30 | return; 31 | 32 | // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 33 | 34 | // Execute 35 | struct_->cancel(struct_); 36 | } 37 | 38 | 39 | #ifndef NDEBUG 40 | template<> base::AtomicRefCount CefCToCpp::DebugObjCt = 0; 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /libcef_dll/ctocpp/download_item_callback_ctocpp.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #include "libcef_dll/ctocpp/download_item_callback_ctocpp.h" 14 | 15 | 16 | // VIRTUAL METHODS - Body may be edited by hand. 17 | 18 | void CefDownloadItemCallbackCToCpp::Cancel() { 19 | if (CEF_MEMBER_MISSING(struct_, cancel)) 20 | return; 21 | 22 | // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 23 | 24 | // Execute 25 | struct_->cancel(struct_); 26 | } 27 | 28 | 29 | #ifndef NDEBUG 30 | template<> base::AtomicRefCount CefCToCpp::DebugObjCt = 0; 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /libcef_dll/ctocpp/geolocation_callback_ctocpp.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #include "libcef_dll/ctocpp/geolocation_callback_ctocpp.h" 14 | 15 | 16 | // VIRTUAL METHODS - Body may be edited by hand. 17 | 18 | void CefGeolocationCallbackCToCpp::Continue(bool allow) { 19 | if (CEF_MEMBER_MISSING(struct_, cont)) 20 | return; 21 | 22 | // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 23 | 24 | // Execute 25 | struct_->cont(struct_, 26 | allow); 27 | } 28 | 29 | 30 | #ifndef NDEBUG 31 | template<> base::AtomicRefCount CefCToCpp::DebugObjCt = 0; 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #include "libcef_dll/ctocpp/jsdialog_callback_ctocpp.h" 14 | 15 | 16 | // VIRTUAL METHODS - Body may be edited by hand. 17 | 18 | void CefJSDialogCallbackCToCpp::Continue(bool success, 19 | const CefString& user_input) { 20 | if (CEF_MEMBER_MISSING(struct_, cont)) 21 | return; 22 | 23 | // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 24 | 25 | // Unverified params: user_input 26 | 27 | // Execute 28 | struct_->cont(struct_, 29 | success, 30 | user_input.GetStruct()); 31 | } 32 | 33 | 34 | #ifndef NDEBUG 35 | template<> base::AtomicRefCount CefCToCpp::DebugObjCt = 0; 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /libcef_dll/ctocpp/print_job_callback_ctocpp.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #include "libcef_dll/ctocpp/print_job_callback_ctocpp.h" 14 | 15 | 16 | // VIRTUAL METHODS - Body may be edited by hand. 17 | 18 | void CefPrintJobCallbackCToCpp::Continue() { 19 | if (CEF_MEMBER_MISSING(struct_, cont)) 20 | return; 21 | 22 | // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 23 | 24 | // Execute 25 | struct_->cont(struct_); 26 | } 27 | 28 | 29 | #ifndef NDEBUG 30 | template<> base::AtomicRefCount CefCToCpp::DebugObjCt = 0; 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /libcef_dll/ctocpp/quota_callback_ctocpp.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | // 5 | // --------------------------------------------------------------------------- 6 | // 7 | // This file was generated by the CEF translator tool. If making changes by 8 | // hand only do so within the body of existing method and function 9 | // implementations. See the translator.README.txt file in the tools directory 10 | // for more information. 11 | // 12 | 13 | #include "libcef_dll/ctocpp/quota_callback_ctocpp.h" 14 | 15 | 16 | // VIRTUAL METHODS - Body may be edited by hand. 17 | 18 | void CefQuotaCallbackCToCpp::Continue(bool allow) { 19 | if (CEF_MEMBER_MISSING(struct_, cont)) 20 | return; 21 | 22 | // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 23 | 24 | // Execute 25 | struct_->cont(struct_, 26 | allow); 27 | } 28 | 29 | void CefQuotaCallbackCToCpp::Cancel() { 30 | if (CEF_MEMBER_MISSING(struct_, cancel)) 31 | return; 32 | 33 | // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 34 | 35 | // Execute 36 | struct_->cancel(struct_); 37 | } 38 | 39 | 40 | #ifndef NDEBUG 41 | template<> base::AtomicRefCount CefCToCpp::DebugObjCt = 0; 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /libcef_dll/wrapper/cef_closure_task.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "include/wrapper/cef_closure_task.h" 6 | #include "include/base/cef_callback.h" 7 | 8 | namespace { 9 | 10 | class CefClosureTask : public CefTask { 11 | public: 12 | explicit CefClosureTask(const base::Closure& closure) 13 | : closure_(closure) { 14 | } 15 | 16 | // CefTask method 17 | virtual void Execute() OVERRIDE { 18 | closure_.Run(); 19 | closure_.Reset(); 20 | } 21 | 22 | private: 23 | base::Closure closure_; 24 | 25 | IMPLEMENT_REFCOUNTING(CefClosureTask); 26 | DISALLOW_COPY_AND_ASSIGN(CefClosureTask); 27 | }; 28 | 29 | } // namespace 30 | 31 | CefRefPtr CefCreateClosureTask(const base::Closure& closure) { 32 | return new CefClosureTask(closure); 33 | } 34 | 35 | bool CefPostTask(CefThreadId threadId, const base::Closure& closure) { 36 | return CefPostTask(threadId, new CefClosureTask(closure)); 37 | } 38 | 39 | bool CefPostDelayedTask(CefThreadId threadId, const base::Closure& closure, 40 | int64 delay_ms) { 41 | return CefPostDelayedTask(threadId, new CefClosureTask(closure), delay_ms); 42 | } 43 | -------------------------------------------------------------------------------- /libcef_dll/wrapper/libcef_dll_wrapper2.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | -------------------------------------------------------------------------------- /lua/src/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h,v 2.8 2014/07/15 21:26:50 roberto Exp $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "llimits.h" 12 | #include "lstate.h" 13 | 14 | #define api_incr_top(L) {L->top++; api_check(L->top <= L->ci->top, \ 15 | "stack overflow");} 16 | 17 | #define adjustresults(L,nres) \ 18 | { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } 19 | 20 | #define api_checknelems(L,n) api_check((n) < (L->top - L->ci->func), \ 21 | "not enough elements in the stack") 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /lua/src/lprefix.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $ 3 | ** Definitions for Lua code that must come before any other header file 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lprefix_h 8 | #define lprefix_h 9 | 10 | 11 | /* 12 | ** Allows POSIX/XSI stuff 13 | */ 14 | #if !defined(LUA_USE_C89) /* { */ 15 | 16 | #if !defined(_XOPEN_SOURCE) 17 | #define _XOPEN_SOURCE 600 18 | #elif _XOPEN_SOURCE == 0 19 | #undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ 20 | #endif 21 | 22 | /* 23 | ** Allows manipulation of large files in gcc and some other compilers 24 | */ 25 | #if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) 26 | #define _LARGEFILE_SOURCE 1 27 | #define _FILE_OFFSET_BITS 64 28 | #endif 29 | 30 | #endif /* } */ 31 | 32 | 33 | /* 34 | ** Windows stuff 35 | */ 36 | #if defined(_WIN32) /* { */ 37 | 38 | #if !defined(_CRT_SECURE_NO_WARNINGS) 39 | #define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ 40 | #endif 41 | 42 | #endif /* } */ 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /lua/src/lua.hpp: -------------------------------------------------------------------------------- 1 | // lua.hpp 2 | // Lua header files for C++ 3 | // <> not supplied automatically because Lua also compiles as C++ 4 | 5 | extern "C" { 6 | #include "lua.h" 7 | #include "lualib.h" 8 | #include "lauxlib.h" 9 | } 10 | -------------------------------------------------------------------------------- /lua/src/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h,v 1.44 2014/02/06 17:32:33 roberto Exp $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | 15 | LUAMOD_API int (luaopen_base) (lua_State *L); 16 | 17 | #define LUA_COLIBNAME "coroutine" 18 | LUAMOD_API int (luaopen_coroutine) (lua_State *L); 19 | 20 | #define LUA_TABLIBNAME "table" 21 | LUAMOD_API int (luaopen_table) (lua_State *L); 22 | 23 | #define LUA_IOLIBNAME "io" 24 | LUAMOD_API int (luaopen_io) (lua_State *L); 25 | 26 | #define LUA_OSLIBNAME "os" 27 | LUAMOD_API int (luaopen_os) (lua_State *L); 28 | 29 | #define LUA_STRLIBNAME "string" 30 | LUAMOD_API int (luaopen_string) (lua_State *L); 31 | 32 | #define LUA_UTF8LIBNAME "utf8" 33 | LUAMOD_API int (luaopen_utf8) (lua_State *L); 34 | 35 | #define LUA_BITLIBNAME "bit32" 36 | LUAMOD_API int (luaopen_bit32) (lua_State *L); 37 | 38 | #define LUA_MATHLIBNAME "math" 39 | LUAMOD_API int (luaopen_math) (lua_State *L); 40 | 41 | #define LUA_DBLIBNAME "debug" 42 | LUAMOD_API int (luaopen_debug) (lua_State *L); 43 | 44 | #define LUA_LOADLIBNAME "package" 45 | LUAMOD_API int (luaopen_package) (lua_State *L); 46 | 47 | 48 | /* open all previous libraries */ 49 | LUALIB_API void (luaL_openlibs) (lua_State *L); 50 | 51 | 52 | 53 | #if !defined(lua_assert) 54 | #define lua_assert(x) ((void)0) 55 | #endif 56 | 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /lua/src/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h,v 1.44 2014/06/19 18:27:20 roberto Exp $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "llimits.h" 11 | #include "lobject.h" 12 | #include "lzio.h" 13 | 14 | 15 | /* data to catch conversion errors */ 16 | #define LUAC_DATA "\x19\x93\r\n\x1a\n" 17 | 18 | #define LUAC_INT 0x5678 19 | #define LUAC_NUM cast_num(370.5) 20 | 21 | #define MYINT(s) (s[0]-'0') 22 | #define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) 23 | #define LUAC_FORMAT 0 /* this is the official format */ 24 | 25 | /* load one chunk; from lundump.c */ 26 | LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, 27 | const char* name); 28 | 29 | /* dump one chunk; from ldump.c */ 30 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, 31 | void* data, int strip); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /sample/animate.lua: -------------------------------------------------------------------------------- 1 | local mod = {} 2 | 3 | --固定步长 4 | function mod.calcTime(interval, step, start, stop) 5 | return (math.abs(stop - start)) / step * interval; 6 | end 7 | 8 | function mod.fadeIn(ani, bone, progress) 9 | local org_opacity = bone["__current_opacity__"] 10 | if org_opacity == nil then 11 | bone["__current_opacity__"] = bone:getOpacity() 12 | org_opacity = bone["__current_opacity__"]; 13 | end 14 | 15 | new_opacity = org_opacity + (1.0 - org_opacity) * progress 16 | bone:applyCSS(string.format("{opacity: %f;}", new_opacity)) 17 | if progress == 1 then 18 | bone["__current_opacity__"] = nil 19 | end 20 | end 21 | 22 | function mod.fadeOut(ani, bone, progress) 23 | local org_opacity = bone["__current_opacity__"] 24 | if org_opacity == nil then 25 | bone["__current_opacity__"] = bone:getOpacity() 26 | org_opacity = bone["__current_opacity__"]; 27 | end 28 | 29 | new_opacity = (org_opacity) * (1 - progress) 30 | bone:applyCSS(string.format("{opacity: %f;}", new_opacity)) 31 | if progress == 1 then 32 | bone["__current_opacity__"] = nil 33 | end 34 | end 35 | 36 | print("load animate") 37 | return mod; -------------------------------------------------------------------------------- /sample/background.lua: -------------------------------------------------------------------------------- 1 |  2 | local mod = {} 3 | 4 | --self代表root标签 5 | function mod.onCreate(self) 6 | self:setColor(0xffff0000) 7 | end 8 | 9 | 10 | 11 | return mod; -------------------------------------------------------------------------------- /sample/button.css: -------------------------------------------------------------------------------- 1 |  2 | .b 3 | { 4 | color: #ffff00; 5 | } 6 | .t 7 | { 8 | color: #000000; 9 | } -------------------------------------------------------------------------------- /sample/button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /sample/res/common.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bonescreater/bones/618ced87a9a2061b0a7879be32b2fea263880f1b/sample/res/common.png -------------------------------------------------------------------------------- /sample/res/common_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bonescreater/bones/618ced87a9a2061b0a7879be32b2fea263880f1b/sample/res/common_small.png -------------------------------------------------------------------------------- /sample/res/disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bonescreater/bones/618ced87a9a2061b0a7879be32b2fea263880f1b/sample/res/disable.png -------------------------------------------------------------------------------- /sample/res/disable_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bonescreater/bones/618ced87a9a2061b0a7879be32b2fea263880f1b/sample/res/disable_small.png -------------------------------------------------------------------------------- /sample/res/highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bonescreater/bones/618ced87a9a2061b0a7879be32b2fea263880f1b/sample/res/highlight.png -------------------------------------------------------------------------------- /sample/res/highlight_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bonescreater/bones/618ced87a9a2061b0a7879be32b2fea263880f1b/sample/res/highlight_small.png -------------------------------------------------------------------------------- /sample/res/lena.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bonescreater/bones/618ced87a9a2061b0a7879be32b2fea263880f1b/sample/res/lena.bmp -------------------------------------------------------------------------------- /sample/res/pic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bonescreater/bones/618ced87a9a2061b0a7879be32b2fea263880f1b/sample/res/pic.jpg -------------------------------------------------------------------------------- /sample/res/press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bonescreater/bones/618ced87a9a2061b0a7879be32b2fea263880f1b/sample/res/press.png -------------------------------------------------------------------------------- /sample/res/press_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bonescreater/bones/618ced87a9a2061b0a7879be32b2fea263880f1b/sample/res/press_small.png -------------------------------------------------------------------------------- /sample/scrollimg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /sample/test.css: -------------------------------------------------------------------------------- 1 | .b11 { 2 | width: 72px; 3 | height: 28px; 4 | } 5 | .b12{ 6 | left:20px; 7 | top: 20px; 8 | } 9 | .b13 10 | { 11 | left :100px; 12 | top:20px; 13 | } 14 | 15 | .b14 16 | { 17 | left :180px; 18 | top:20px; 19 | } 20 | 21 | .b15 22 | { 23 | left :260px; 24 | top:20px; 25 | } 26 | 27 | .p1 28 | { 29 | width:50px; 30 | height:50px; 31 | color:#ff0000; 32 | hit-test: caption 0px 0px 50px 20px; 33 | } 34 | .p2 35 | { 36 | left:150px; 37 | top:130px; 38 | } -------------------------------------------------------------------------------- /sample/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef BONES_SAMPLE_UTILS_H_ 2 | #define BONES_SAMPLE_UTILS_H_ 3 | 4 | #include 5 | 6 | 7 | class BSStr 8 | { 9 | public: 10 | BSStr() 11 | { 12 | reset(); 13 | } 14 | 15 | void reset() 16 | { 17 | s.clear(); 18 | s.str(""); 19 | } 20 | template 21 | BSStr & operator<<(const T & t) 22 | { 23 | s << t; 24 | return *this; 25 | } 26 | std::string str() 27 | { 28 | return s.str(); 29 | } 30 | private: 31 | static std::ostringstream s; 32 | }; 33 | 34 | #endif -------------------------------------------------------------------------------- /sample/xml/button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sample/xml/listctrl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /sample/xml/listitem.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /sample/xml/scrollbar.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /sample/xml/tabctrl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /sample/xml/tabitem.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /sample/xml/test.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /skia/include/core/SkEmptyShader.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef SkEmptyShader_DEFINED 12 | #define SkEmptyShader_DEFINED 13 | 14 | #include "SkShader.h" 15 | 16 | /** 17 | * \class SkEmptyShader 18 | * A Shader that always draws nothing. Its setContext always returns false, 19 | * so it never expects that its shadeSpan() methods will get called. 20 | */ 21 | class SK_API SkEmptyShader : public SkShader { 22 | public: 23 | SkEmptyShader() {} 24 | 25 | virtual uint32_t getFlags() SK_OVERRIDE; 26 | virtual uint8_t getSpan16Alpha() const SK_OVERRIDE; 27 | virtual bool setContext(const SkBitmap&, const SkPaint&, 28 | const SkMatrix&) SK_OVERRIDE; 29 | virtual void shadeSpan(int x, int y, SkPMColor span[], int count) SK_OVERRIDE; 30 | virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE; 31 | virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK_OVERRIDE; 32 | 33 | SK_TO_STRING_OVERRIDE() 34 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader) 35 | 36 | protected: 37 | SkEmptyShader(SkReadBuffer& buffer) : INHERITED(buffer) {} 38 | 39 | private: 40 | typedef SkShader INHERITED; 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /skia/include/core/SkFlattenableBuffers.h: -------------------------------------------------------------------------------- 1 | // Temporary shim to keep a couple dependencies working in Chromium. 2 | #ifndef SkFlattenableBuffers_DEFINED 3 | #define SkFlattenableBuffers_DEFINED 4 | 5 | #include "SkReadBuffer.h" 6 | #include "SkWriteBuffer.h" 7 | 8 | typedef SkReadBuffer SkFlattenableReadBuffer; 9 | 10 | #endif//SkFlattenableBuffers_DEFINED 11 | -------------------------------------------------------------------------------- /skia/include/core/SkFlattenableSerialization.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkFlattenableSerialization_DEFINED 9 | #define SkFlattenableSerialization_DEFINED 10 | 11 | #include "SkFlattenable.h" 12 | 13 | class SkData; 14 | 15 | SK_API SkData* SkValidatingSerializeFlattenable(SkFlattenable*); 16 | SK_API SkFlattenable* SkValidatingDeserializeFlattenable(const void* data, size_t size, 17 | SkFlattenable::Type type); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /skia/include/core/SkRasterizer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkRasterizer_DEFINED 11 | #define SkRasterizer_DEFINED 12 | 13 | #include "SkFlattenable.h" 14 | #include "SkMask.h" 15 | 16 | class SkMaskFilter; 17 | class SkMatrix; 18 | class SkPath; 19 | struct SkIRect; 20 | 21 | class SK_API SkRasterizer : public SkFlattenable { 22 | public: 23 | SK_DECLARE_INST_COUNT(SkRasterizer) 24 | 25 | /** Turn the path into a mask, respecting the specified local->device matrix. 26 | */ 27 | bool rasterize(const SkPath& path, const SkMatrix& matrix, 28 | const SkIRect* clipBounds, SkMaskFilter* filter, 29 | SkMask* mask, SkMask::CreateMode mode) const; 30 | 31 | SK_DEFINE_FLATTENABLE_TYPE(SkRasterizer) 32 | 33 | protected: 34 | SkRasterizer() {} 35 | SkRasterizer(SkReadBuffer& buffer) : INHERITED(buffer) {} 36 | 37 | virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix, 38 | const SkIRect* clipBounds, 39 | SkMask* mask, SkMask::CreateMode mode) const; 40 | 41 | private: 42 | typedef SkFlattenable INHERITED; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /skia/include/core/SkStringUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkStringUtils_DEFINED 9 | #define SkStringUtils_DEFINED 10 | 11 | class SkString; 12 | 13 | /** 14 | * Add 'flagStr' to 'string' and set 'needSeparator' to true only if 'flag' is 15 | * true. If 'needSeparator' is true append a '|' before 'flagStr'. This method 16 | * is used to streamline the creation of ASCII flag strings within the toString 17 | * methods. 18 | */ 19 | void SkAddFlagToString(SkString* string, bool flag, 20 | const char* flagStr, bool* needSeparator); 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /skia/include/core/SkUnitMapper.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkUnitMapper_DEFINED 11 | #define SkUnitMapper_DEFINED 12 | 13 | #include "SkRefCnt.h" 14 | #include "SkScalar.h" 15 | 16 | #include "SkFlattenable.h" 17 | 18 | class SkUnitMapper : public SkFlattenable { 19 | public: 20 | SK_DECLARE_INST_COUNT(SkUnitMapper) 21 | 22 | SkUnitMapper() {} 23 | 24 | /** Given a value in [0..0xFFFF], return a value in the same range. 25 | */ 26 | virtual uint16_t mapUnit16(uint16_t x) = 0; 27 | 28 | SK_DEFINE_FLATTENABLE_TYPE(SkUnitMapper) 29 | 30 | protected: 31 | SkUnitMapper(SkReadBuffer& rb) : SkFlattenable(rb) {} 32 | 33 | private: 34 | typedef SkFlattenable INHERITED; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /skia/include/effects/SkAlphaThresholdFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkAlphaThresholdFilter_DEFINED 9 | #define SkAlphaThresholdFilter_DEFINED 10 | 11 | #include "SkRegion.h" 12 | #include "SkImageFilter.h" 13 | 14 | class SK_API SkAlphaThresholdFilter { 15 | public: 16 | /** 17 | * Creates an image filter that samples a region. If the sample is inside the 18 | * region the alpha of the image is boosted up to a threshold value. If it is 19 | * outside the region then the alpha is decreased to the threshold value. 20 | * The 0,0 point of the region corresponds to the upper left corner of the 21 | * source image. 22 | */ 23 | static SkImageFilter* Create(const SkRegion& region, SkScalar innerThreshold, SkScalar outerThreshold); 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /skia/include/effects/SkArithmeticMode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkArithmeticMode_DEFINED 9 | #define SkArithmeticMode_DEFINED 10 | 11 | #include "SkFlattenable.h" 12 | #include "SkScalar.h" 13 | 14 | class SkXfermode; 15 | 16 | class SK_API SkArithmeticMode { 17 | public: 18 | /** 19 | * result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4] 20 | * 21 | * src and dst are treated as being [0.0 .. 1.0]. The polynomial is 22 | * evaluated on their unpremultiplied components. 23 | * 24 | * k1=k2=k3=0, k4=1.0 results in returning opaque white 25 | * k1=k3=k4=0, k2=1.0 results in returning the src 26 | * k1=k2=k4=0, k3=1.0 results in returning the dst 27 | */ 28 | static SkXfermode* Create(SkScalar k1, SkScalar k2, 29 | SkScalar k3, SkScalar k4); 30 | 31 | SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP(); 32 | 33 | private: 34 | SkArithmeticMode(); // can't be instantiated 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /skia/include/effects/SkComposeImageFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkComposeImageFilter_DEFINED 9 | #define SkComposeImageFilter_DEFINED 10 | 11 | #include "SkImageFilter.h" 12 | 13 | class SK_API SkComposeImageFilter : public SkImageFilter { 14 | public: 15 | virtual ~SkComposeImageFilter(); 16 | 17 | static SkComposeImageFilter* Create(SkImageFilter* outer, SkImageFilter* inner) { 18 | return SkNEW_ARGS(SkComposeImageFilter, (outer, inner)); 19 | } 20 | 21 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeImageFilter) 22 | 23 | protected: 24 | explicit SkComposeImageFilter(SkReadBuffer& buffer); 25 | 26 | virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 27 | SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE; 28 | virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const SK_OVERRIDE; 29 | 30 | #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS 31 | public: 32 | #endif 33 | SkComposeImageFilter(SkImageFilter* outer, SkImageFilter* inner) : INHERITED(outer, inner) {} 34 | 35 | private: 36 | typedef SkImageFilter INHERITED; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /skia/include/effects/SkDrawExtraPathEffect.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SK_DRAW_EXTRA_PATH_EFFECT_H 9 | #define SK_DRAW_EXTRA_PATH_EFFECT_H 10 | 11 | class SkAnimator; 12 | 13 | void InitializeSkExtraPathEffects(SkAnimator* animator); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /skia/include/effects/SkLumaColorFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkLumaColorFilter_DEFINED 9 | #define SkLumaColorFilter_DEFINED 10 | 11 | #include "SkColorFilter.h" 12 | 13 | /** 14 | * Luminance-to-alpha color filter, as defined in 15 | * http://www.w3.org/TR/SVG/masking.html#Masking 16 | * http://www.w3.org/TR/css-masking/#MaskValues 17 | * 18 | * The resulting color is black with transparency equal to the 19 | * luminance value modulated by alpha: 20 | * 21 | * C' = [ Lum * a, 0, 0, 0 ] 22 | * 23 | */ 24 | class SK_API SkLumaColorFilter : public SkColorFilter { 25 | public: 26 | static SkColorFilter* Create(); 27 | 28 | virtual void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const SK_OVERRIDE; 29 | 30 | #if SK_SUPPORT_GPU 31 | virtual GrEffectRef* asNewEffect(GrContext*) const SK_OVERRIDE; 32 | #endif 33 | 34 | SK_TO_STRING_OVERRIDE() 35 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLumaColorFilter) 36 | 37 | protected: 38 | SkLumaColorFilter(SkReadBuffer& buffer); 39 | virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 40 | 41 | private: 42 | SkLumaColorFilter(); 43 | 44 | typedef SkColorFilter INHERITED; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /skia/include/effects/SkPaintFlagsDrawFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkPaintFlagsDrawFilter_DEFINED 9 | #define SkPaintFlagsDrawFilter_DEFINED 10 | 11 | #include "SkDrawFilter.h" 12 | 13 | class SK_API SkPaintFlagsDrawFilter : public SkDrawFilter { 14 | public: 15 | SkPaintFlagsDrawFilter(uint32_t clearFlags, uint32_t setFlags); 16 | 17 | virtual bool filter(SkPaint*, Type) SK_OVERRIDE; 18 | 19 | private: 20 | uint16_t fClearFlags; // user specified 21 | uint16_t fSetFlags; // user specified 22 | }; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /skia/include/effects/SkStippleMaskFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkStippleMaskFilter_DEFINED 9 | #define SkStippleMaskFilter_DEFINED 10 | 11 | #include "SkMaskFilter.h" 12 | 13 | /** 14 | * Simple MaskFilter that creates a screen door stipple pattern. 15 | */ 16 | class SK_API SkStippleMaskFilter : public SkMaskFilter { 17 | public: 18 | static SkStippleMaskFilter* Create() { 19 | return SkNEW(SkStippleMaskFilter); 20 | } 21 | 22 | virtual bool filterMask(SkMask* dst, const SkMask& src, 23 | const SkMatrix& matrix, 24 | SkIPoint* margin) const SK_OVERRIDE; 25 | 26 | // getFormat is from SkMaskFilter 27 | virtual SkMask::Format getFormat() const SK_OVERRIDE { 28 | return SkMask::kA8_Format; 29 | } 30 | 31 | SK_TO_STRING_OVERRIDE() 32 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkStippleMaskFilter); 33 | 34 | protected: 35 | SkStippleMaskFilter(SkReadBuffer& buffer) 36 | : SkMaskFilter(buffer) { 37 | } 38 | 39 | #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS 40 | public: 41 | #endif 42 | SkStippleMaskFilter() : INHERITED() { 43 | } 44 | 45 | private: 46 | typedef SkMaskFilter INHERITED; 47 | }; 48 | 49 | #endif // SkStippleMaskFilter_DEFINED 50 | -------------------------------------------------------------------------------- /skia/include/effects/SkTestImageFilters.h: -------------------------------------------------------------------------------- 1 | #ifndef _SkTestImageFilters_h 2 | #define _SkTestImageFilters_h 3 | 4 | #include "SkImageFilter.h" 5 | #include "SkPoint.h" 6 | 7 | // Fun mode that scales down (only) and then scales back up to look pixelated 8 | class SK_API SkDownSampleImageFilter : public SkImageFilter { 9 | public: 10 | static SkDownSampleImageFilter* Create(SkScalar scale) { 11 | return SkNEW_ARGS(SkDownSampleImageFilter, (scale)); 12 | } 13 | 14 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDownSampleImageFilter) 15 | 16 | protected: 17 | SkDownSampleImageFilter(SkScalar scale) : INHERITED(0), fScale(scale) {} 18 | SkDownSampleImageFilter(SkReadBuffer& buffer); 19 | virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 20 | 21 | virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 22 | SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE; 23 | 24 | private: 25 | SkScalar fScale; 26 | 27 | typedef SkImageFilter INHERITED; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /skia/include/effects/SkTransparentShader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkTransparentShader_DEFINED 9 | #define SkTransparentShader_DEFINED 10 | 11 | #include "SkShader.h" 12 | 13 | class SK_API SkTransparentShader : public SkShader { 14 | public: 15 | SkTransparentShader() {} 16 | 17 | virtual uint32_t getFlags() SK_OVERRIDE; 18 | virtual bool setContext(const SkBitmap& device, 19 | const SkPaint& paint, 20 | const SkMatrix& matrix) SK_OVERRIDE; 21 | virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE; 22 | virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE; 23 | 24 | SK_TO_STRING_OVERRIDE() 25 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTransparentShader) 26 | 27 | private: 28 | // these are a cache from the call to setContext() 29 | const SkBitmap* fDevice; 30 | uint8_t fAlpha; 31 | 32 | SkTransparentShader(SkReadBuffer& buffer) : INHERITED(buffer) {} 33 | 34 | typedef SkShader INHERITED; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /skia/include/images/SkForceLinking.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * This function's sole purpose is to trick the linker into not discarding 10 | * SkImageDecoder subclasses just because we do not directly call them. 11 | * This is necessary in applications that will create image decoders from 12 | * a stream. 13 | * Call this function with an expression that evaluates to false to ensure 14 | * that the linker includes the subclasses. 15 | * Passing true will result in leaked objects. 16 | */ 17 | int SkForceLinking(bool doNotPassTrue); 18 | 19 | #define __SK_FORCE_IMAGE_DECODER_LINKING \ 20 | static int linking_forced = SkForceLinking(false) 21 | -------------------------------------------------------------------------------- /skia/include/images/SkImages.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | class SkImages { 9 | public: 10 | /** 11 | * Initializes flattenables in the images project. 12 | */ 13 | static void InitializeFlattenables(); 14 | }; 15 | -------------------------------------------------------------------------------- /skia/include/ports/SkHarfBuzzFont.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkHarfBuzzFont_DEFINED 9 | #define SkHarfBuzzFont_DEFINED 10 | 11 | extern "C" { 12 | #include "harfbuzz-shaper.h" 13 | //#include "harfbuzz-unicode.h" 14 | } 15 | 16 | #include "SkTypes.h" 17 | 18 | class SkPaint; 19 | class SkTypeface; 20 | 21 | class SkHarfBuzzFont { 22 | public: 23 | /** The subclass returns the typeface for this font, or NULL 24 | */ 25 | virtual SkTypeface* getTypeface() const = 0; 26 | /** The subclass sets the text related attributes of the paint. 27 | e.g. textSize, typeface, textSkewX, etc. 28 | All of the attributes that could effect how the text is measured. 29 | Color information (e.g. color, xfermode, shader, etc.) are not required. 30 | */ 31 | virtual void setupPaint(SkPaint*) const = 0; 32 | 33 | /** Implementation of HB_GetFontTableFunc, using SkHarfBuzzFont* as 34 | the first parameter. 35 | */ 36 | static HB_Error GetFontTableFunc(void* skharfbuzzfont, const HB_Tag tag, 37 | HB_Byte* buffer, HB_UInt* len); 38 | 39 | static const HB_FontClass& GetFontClass(); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /skia/include/ports/SkTypeface_mac.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #ifndef SkTypeface_mac_DEFINED 12 | #define SkTypeface_mac_DEFINED 13 | 14 | #include "SkTypeface.h" 15 | #ifdef SK_BUILD_FOR_MAC 16 | #import 17 | #endif 18 | 19 | #ifdef SK_BUILD_FOR_IOS 20 | #include 21 | #endif 22 | /** 23 | * Like the other Typeface create methods, this returns a new reference to the 24 | * corresponding typeface for the specified CTFontRef. The caller must call 25 | * unref() when it is finished. 26 | */ 27 | SK_API extern SkTypeface* SkCreateTypefaceFromCTFont(CTFontRef); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /skia/include/utils/SkCountdown.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkCountdown_DEFINED 9 | #define SkCountdown_DEFINED 10 | 11 | #include "SkCondVar.h" 12 | #include "SkRunnable.h" 13 | #include "SkTypes.h" 14 | 15 | class SkCountdown : public SkRunnable { 16 | public: 17 | explicit SkCountdown(int32_t count); 18 | 19 | /** 20 | * Resets the countdown to the count provided. 21 | */ 22 | void reset(int32_t count); 23 | 24 | virtual void run() SK_OVERRIDE; 25 | 26 | /** 27 | * Blocks until run() has been called count times. 28 | */ 29 | void wait(); 30 | 31 | private: 32 | SkCondVar fReady; 33 | int32_t fCount; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /skia/include/utils/SkCubicInterval.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkCubicInterval_DEFINED 9 | #define SkCubicInterval_DEFINED 10 | 11 | #include "SkPoint.h" 12 | 13 | SkScalar SkEvalCubicInterval(SkScalar x1, SkScalar y1, 14 | SkScalar x2, SkScalar y2, 15 | SkScalar unitX); 16 | 17 | static inline SkScalar SkEvalCubicInterval(const SkPoint pts[2], SkScalar x) { 18 | return SkEvalCubicInterval(pts[0].fX, pts[0].fY, 19 | pts[1].fX, pts[1].fY, x); 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /skia/include/utils/SkJSONCPP.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | * 7 | * A common place to put the jsoncpp library includes, as opposed to littering 8 | * the pragmas repeatedly through our code. 9 | */ 10 | #ifndef SkJSONCPP_DEFINED 11 | #define SkJSONCPP_DEFINED 12 | 13 | #ifdef SK_BUILD_FOR_WIN 14 | // json includes xlocale which generates warning 4530 because we're 15 | // compiling without exceptions; 16 | // see https://code.google.com/p/skia/issues/detail?id=1067 17 | #pragma warning(push) 18 | #pragma warning(disable : 4530) 19 | #endif 20 | #include "json/reader.h" 21 | #include "json/value.h" 22 | #ifdef SK_BUILD_FOR_WIN 23 | #pragma warning(pop) 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /skia/include/utils/SkMeshUtils.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkMeshUtils_DEFINED 9 | #define SkMeshUtils_DEFINED 10 | 11 | #include "SkPoint.h" 12 | #include "SkColor.h" 13 | 14 | class SkBitmap; 15 | class SkCanvas; 16 | class SkPaint; 17 | 18 | class SkMeshIndices { 19 | public: 20 | SkMeshIndices(); 21 | ~SkMeshIndices(); 22 | 23 | bool init(int texW, int texH, int rows, int cols) { 24 | return this->init(NULL, NULL, texW, texH, rows, cols); 25 | } 26 | 27 | bool init(SkPoint tex[], uint16_t indices[], 28 | int texW, int texH, int rows, int cols); 29 | 30 | int indexCount() const { return fIndexCount; } 31 | const uint16_t* indices() const { return fIndices; } 32 | 33 | size_t texCount() const { return fTexCount; } 34 | const SkPoint* tex() const { return fTex; } 35 | 36 | private: 37 | int fIndexCount, fTexCount; 38 | SkPoint* fTex; 39 | uint16_t* fIndices; 40 | void* fStorage; // may be null 41 | }; 42 | 43 | class SkMeshUtils { 44 | public: 45 | static void Draw(SkCanvas*, const SkBitmap&, int rows, int cols, 46 | const SkPoint verts[], const SkColor colors[], 47 | const SkPaint& paint); 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /skia/include/utils/SkNinePatch.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkNinePatch_DEFINED 11 | #define SkNinePatch_DEFINED 12 | 13 | #include "SkRect.h" 14 | #include "SkRegion.h" 15 | 16 | class SkBitmap; 17 | class SkCanvas; 18 | class SkPaint; 19 | 20 | class SkNinePatch { 21 | public: 22 | static void DrawNine(SkCanvas* canvas, const SkRect& dst, 23 | const SkBitmap& bitmap, const SkIRect& margins, 24 | const SkPaint* paint = NULL); 25 | 26 | static void DrawMesh(SkCanvas* canvas, const SkRect& dst, 27 | const SkBitmap& bitmap, 28 | const int32_t xDivs[], int numXDivs, 29 | const int32_t yDivs[], int numYDivs, 30 | const SkPaint* paint = NULL); 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /skia/include/utils/SkNullCanvas.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkNullCanvas_DEFINED 9 | #define SkNullCanvas_DEFINED 10 | 11 | #include "SkBitmap.h" 12 | 13 | class SkCanvas; 14 | 15 | /** 16 | * Creates a canvas that draws nothing. This is useful for performance testing. 17 | */ 18 | SK_API SkCanvas* SkCreateNullCanvas(); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /skia/include/utils/SkParse.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkParse_DEFINED 11 | #define SkParse_DEFINED 12 | 13 | #include "SkColor.h" 14 | 15 | class SkParse { 16 | public: 17 | static int Count(const char str[]); // number of scalars or int values 18 | static int Count(const char str[], char separator); 19 | static const char* FindColor(const char str[], SkColor* value); 20 | static const char* FindHex(const char str[], uint32_t* value); 21 | static const char* FindMSec(const char str[], SkMSec* value); 22 | static const char* FindNamedColor(const char str[], size_t len, SkColor* color); 23 | static const char* FindS32(const char str[], int32_t* value); 24 | static const char* FindScalar(const char str[], SkScalar* value); 25 | static const char* FindScalars(const char str[], SkScalar value[], int count); 26 | 27 | static bool FindBool(const char str[], bool* value); 28 | // return the index of str in list[], or -1 if not found 29 | static int FindList(const char str[], const char list[]); 30 | #ifdef SK_SUPPORT_UNITTEST 31 | static void TestColor(); 32 | static void UnitTest(); 33 | #endif 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /skia/include/utils/SkParsePaint.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkParsePaint_DEFINED 11 | #define SkParsePaint_DEFINED 12 | 13 | #include "SkPaint.h" 14 | #include "SkDOM.h" 15 | 16 | /** "color" color 17 | "opacity" scalar [0..1] 18 | "stroke-width" scalar (0...inf) 19 | "text-size" scalar (0..inf) 20 | "is-stroke" bool 21 | "is-antialias" bool 22 | "is-lineartext" bool 23 | */ 24 | void SkPaint_Inflate(SkPaint*, const SkDOM&, const SkDOM::Node*); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /skia/include/utils/SkParsePath.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkParsePath_DEFINED 11 | #define SkParsePath_DEFINED 12 | 13 | #include "SkPath.h" 14 | 15 | class SkString; 16 | 17 | class SkParsePath { 18 | public: 19 | static bool FromSVGString(const char str[], SkPath*); 20 | static void ToSVGString(const SkPath&, SkString*); 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /skia/include/utils/SkRunnable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkRunnable_DEFINED 9 | #define SkRunnable_DEFINED 10 | 11 | template 12 | struct SkTRunnable { 13 | virtual ~SkTRunnable() {}; 14 | virtual void run(T&) = 0; 15 | }; 16 | 17 | template <> 18 | struct SkTRunnable { 19 | virtual ~SkTRunnable() {}; 20 | virtual void run() = 0; 21 | }; 22 | 23 | typedef SkTRunnable SkRunnable; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /skia/include/utils/ios/SkStream_NSData.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkStream_NSData_DEFINED 9 | #define SkStream_NSData_DEFINED 10 | 11 | #import 12 | #include "SkStream.h" 13 | 14 | /** Returns an NSData with a copy of the stream's data. The caller must call 15 | retain if it intends to keep the data object beyond the current stack-frame 16 | (i.e. internally we're calling [NSData dataWithBytes...] 17 | */ 18 | NSData* NSData_dataWithStream(SkStream* stream); 19 | 20 | /** Returns an NSData from the named resource (from main bundle). 21 | The caller must call retain if it intends to keep the data object beyond 22 | the current stack-frame 23 | (i.e. internally we're calling [NSData dataWithContentsOfMappedFile...] 24 | */ 25 | NSData* NSData_dataFromResource(const char name[], const char suffix[]); 26 | 27 | /** Wrap a stream around NSData. 28 | */ 29 | class SkStream_NSData : public SkMemoryStream { 30 | public: 31 | SkStream_NSData(NSData* data); 32 | virtual ~SkStream_NSData(); 33 | 34 | static SkStream_NSData* CreateFromResource(const char name[], 35 | const char suffix[]); 36 | 37 | private: 38 | NSData* fNSData; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /skia/include/utils/win/SkAutoCoInitialize.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkAutoCo_DEFINED 11 | #define SkAutoCo_DEFINED 12 | 13 | #define WIN32_LEAN_AND_MEAN 14 | #include 15 | #include "SkTemplates.h" 16 | 17 | /** 18 | * An instance of this class initializes COM on creation 19 | * and closes the COM library on destruction. 20 | */ 21 | class SkAutoCoInitialize : SkNoncopyable { 22 | private: 23 | HRESULT fHR; 24 | public: 25 | SkAutoCoInitialize(); 26 | ~SkAutoCoInitialize(); 27 | bool succeeded(); 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /skia/src/core/SkColorFilter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkColorFilter.h" 9 | 10 | #include "SkReadBuffer.h" 11 | #include "SkWriteBuffer.h" 12 | #include "SkShader.h" 13 | #include "SkUnPreMultiply.h" 14 | #include "SkString.h" 15 | 16 | bool SkColorFilter::asColorMode(SkColor* color, SkXfermode::Mode* mode) const { 17 | return false; 18 | } 19 | 20 | bool SkColorFilter::asColorMatrix(SkScalar matrix[20]) const { 21 | return false; 22 | } 23 | 24 | bool SkColorFilter::asComponentTable(SkBitmap*) const { 25 | return false; 26 | } 27 | 28 | void SkColorFilter::filterSpan16(const uint16_t s[], int count, uint16_t d[]) const { 29 | SkASSERT(this->getFlags() & SkColorFilter::kHasFilter16_Flag); 30 | SkDEBUGFAIL("missing implementation of SkColorFilter::filterSpan16"); 31 | 32 | if (d != s) { 33 | memcpy(d, s, count * sizeof(uint16_t)); 34 | } 35 | } 36 | 37 | SkColor SkColorFilter::filterColor(SkColor c) const { 38 | SkPMColor dst, src = SkPreMultiplyColor(c); 39 | this->filterSpan(&src, 1, &dst); 40 | return SkUnPreMultiply::PMColorToColor(dst); 41 | } 42 | 43 | GrEffectRef* SkColorFilter::asNewEffect(GrContext*) const { 44 | return NULL; 45 | } 46 | -------------------------------------------------------------------------------- /skia/src/core/SkConfig8888.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkPixelInfo_DEFINED 9 | #define SkPixelInfo_DEFINED 10 | 11 | #include "SkImageInfo.h" 12 | 13 | struct SkPixelInfo { 14 | SkColorType fColorType; 15 | SkAlphaType fAlphaType; 16 | size_t fRowBytes; 17 | }; 18 | 19 | struct SkDstPixelInfo : SkPixelInfo { 20 | void* fPixels; 21 | }; 22 | 23 | struct SkSrcPixelInfo : SkPixelInfo { 24 | const void* fPixels; 25 | 26 | // Guaranteed to work even if src.fPixels and dst.fPixels are the same 27 | // (but not if they overlap partially) 28 | bool convertPixelsTo(SkDstPixelInfo* dst, int width, int height) const; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /skia/src/core/SkCubicClipper.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2009 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkCubicClipper_DEFINED 11 | #define SkCubicClipper_DEFINED 12 | 13 | #include "SkPoint.h" 14 | #include "SkRect.h" 15 | 16 | /** This class is initialized with a clip rectangle, and then can be fed cubics, 17 | which must already be monotonic in Y. 18 | 19 | In the future, it might return a series of segments, allowing it to clip 20 | also in X, to ensure that all segments fit in a finite coordinate system. 21 | */ 22 | class SkCubicClipper { 23 | public: 24 | SkCubicClipper(); 25 | 26 | void setClip(const SkIRect& clip); 27 | 28 | bool clipCubic(const SkPoint src[4], SkPoint dst[4]); 29 | 30 | private: 31 | SkRect fClip; 32 | }; 33 | 34 | #endif // SkCubicClipper_DEFINED 35 | -------------------------------------------------------------------------------- /skia/src/core/SkDebug.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTypes.h" 11 | 12 | #ifdef SK_DEBUG 13 | 14 | int8_t SkToS8(intmax_t x) { 15 | SkASSERT((int8_t)x == x); 16 | return (int8_t)x; 17 | } 18 | 19 | uint8_t SkToU8(uintmax_t x) { 20 | SkASSERT((uint8_t)x == x); 21 | return (uint8_t)x; 22 | } 23 | 24 | int16_t SkToS16(intmax_t x) { 25 | SkASSERT((int16_t)x == x); 26 | return (int16_t)x; 27 | } 28 | 29 | uint16_t SkToU16(uintmax_t x) { 30 | SkASSERT((uint16_t)x == x); 31 | return (uint16_t)x; 32 | } 33 | 34 | int32_t SkToS32(intmax_t x) { 35 | SkASSERT((int32_t)x == x); 36 | return (int32_t)x; 37 | } 38 | 39 | uint32_t SkToU32(uintmax_t x) { 40 | SkASSERT((uint32_t)x == x); 41 | return (uint32_t)x; 42 | } 43 | 44 | int SkToInt(intmax_t x) { 45 | SkASSERT((int)x == x); 46 | return (int)x; 47 | } 48 | 49 | unsigned SkToUInt(uintmax_t x) { 50 | SkASSERT((unsigned)x == x); 51 | return (unsigned)x; 52 | } 53 | 54 | size_t SkToSizeT(uintmax_t x) { 55 | SkASSERT((size_t)x == x); 56 | return (size_t)x; 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /skia/src/core/SkDeviceImageFilterProxy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkDeviceImageFilterProxy_DEFINED 9 | #define SkDeviceImageFilterProxy_DEFINED 10 | 11 | #include "SkImageFilter.h" 12 | 13 | class SkDeviceImageFilterProxy : public SkImageFilter::Proxy { 14 | public: 15 | SkDeviceImageFilterProxy(SkBaseDevice* device) : fDevice(device) {} 16 | 17 | virtual SkBaseDevice* createDevice(int w, int h) SK_OVERRIDE { 18 | return fDevice->createCompatibleDevice(SkImageInfo::MakeN32Premul(w, h)); 19 | } 20 | virtual bool canHandleImageFilter(const SkImageFilter* filter) SK_OVERRIDE { 21 | return fDevice->canHandleImageFilter(filter); 22 | } 23 | virtual bool filterImage(const SkImageFilter* filter, const SkBitmap& src, 24 | const SkImageFilter::Context& ctx, 25 | SkBitmap* result, SkIPoint* offset) SK_OVERRIDE { 26 | return fDevice->filterImage(filter, src, ctx, result, offset); 27 | } 28 | 29 | private: 30 | SkBaseDevice* fDevice; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /skia/src/core/SkDistanceFieldGen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkDistanceFieldGen_DEFINED 8 | #define SkDistanceFieldGen_DEFINED 9 | 10 | /** Given 8-bit mask data, generate the associated distance field 11 | 12 | * @param distanceField The distance field to be generated. Should already be allocated 13 | * by the client with the padding below. 14 | * @param image 8-bit mask we're using to generate the distance field. 15 | * @param w Width of the image. 16 | * @param h Height of the image. 17 | * @param distanceMagnitude Largest possible absolute value for the distance. The distance field 18 | * will be padded to w + 2*distanceMagnitude, h + 2*distanceMagnitude. 19 | */ 20 | bool SkGenerateDistanceFieldFromImage(unsigned char* distanceField, 21 | const unsigned char* image, 22 | int w, int h, 23 | int distanceMagnitude); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /skia/src/core/SkErrorInternals.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2013 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #ifndef SkErrorInternals_DEFINED 10 | #define SkErrorInternals_DEFINED 11 | 12 | #include "SkError.h" 13 | 14 | class SkErrorInternals { 15 | 16 | public: 17 | static void ClearError(); 18 | static void SetError(SkError code, const char *fmt, ...); 19 | static SkError GetLastError(); 20 | static const char *GetLastErrorString(); 21 | static void SetErrorCallback(SkErrorCallbackFunction cb, void *context); 22 | static void DefaultErrorCallback(SkError code, void *context); 23 | }; 24 | 25 | 26 | 27 | #endif /* SkErrorInternals_DEFINED */ 28 | -------------------------------------------------------------------------------- /skia/src/core/SkFDot6.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkFDot6_DEFINED 11 | #define SkFDot6_DEFINED 12 | 13 | #include "SkScalar.h" 14 | #include "SkMath.h" 15 | 16 | typedef int32_t SkFDot6; 17 | 18 | #define SK_FDot6One (64) 19 | #define SK_FDot6Half (32) 20 | 21 | #ifdef SK_DEBUG 22 | inline SkFDot6 SkIntToFDot6(S16CPU x) { 23 | SkASSERT(SkToS16(x) == x); 24 | return x << 6; 25 | } 26 | #else 27 | #define SkIntToFDot6(x) ((x) << 6) 28 | #endif 29 | 30 | #define SkFDot6Floor(x) ((x) >> 6) 31 | #define SkFDot6Ceil(x) (((x) + 63) >> 6) 32 | #define SkFDot6Round(x) (((x) + 32) >> 6) 33 | 34 | #define SkFixedToFDot6(x) ((x) >> 10) 35 | 36 | inline SkFixed SkFDot6ToFixed(SkFDot6 x) { 37 | SkASSERT((x << 10 >> 10) == x); 38 | 39 | return x << 10; 40 | } 41 | 42 | #define SkScalarToFDot6(x) (SkFDot6)((x) * 64) 43 | #define SkFDot6ToScalar(x) ((SkScalar)(x) * 0.015625f) 44 | 45 | inline SkFixed SkFDot6Div(SkFDot6 a, SkFDot6 b) { 46 | SkASSERT(b != 0); 47 | 48 | if (a == (int16_t)a) { 49 | return (a << 16) / b; 50 | } else { 51 | return SkFixedDiv(a, b); 52 | } 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /skia/src/core/SkFilterShader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkFilterShader_DEFINED 9 | #define SkFilterShader_DEFINED 10 | 11 | #include "SkShader.h" 12 | 13 | class SkColorFilter; 14 | 15 | class SkFilterShader : public SkShader { 16 | public: 17 | SkFilterShader(SkShader* shader, SkColorFilter* filter); 18 | virtual ~SkFilterShader(); 19 | 20 | virtual uint32_t getFlags() SK_OVERRIDE; 21 | virtual bool setContext(const SkBitmap&, const SkPaint&, 22 | const SkMatrix&) SK_OVERRIDE; 23 | virtual void endContext() SK_OVERRIDE; 24 | virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE; 25 | virtual void shadeSpan16(int x, int y, uint16_t[], int count) SK_OVERRIDE; 26 | 27 | SK_TO_STRING_OVERRIDE() 28 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkFilterShader) 29 | 30 | protected: 31 | SkFilterShader(SkReadBuffer& ); 32 | virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 33 | 34 | private: 35 | SkShader* fShader; 36 | SkColorFilter* fFilter; 37 | 38 | typedef SkShader INHERITED; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /skia/src/core/SkFlattenableSerialization.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkFlattenableSerialization.h" 9 | 10 | #include "SkData.h" 11 | #include "SkValidatingReadBuffer.h" 12 | #include "SkWriteBuffer.h" 13 | 14 | SkData* SkValidatingSerializeFlattenable(SkFlattenable* flattenable) { 15 | SkWriteBuffer writer(SkWriteBuffer::kValidation_Flag); 16 | writer.writeFlattenable(flattenable); 17 | size_t size = writer.bytesWritten(); 18 | void* data = sk_malloc_throw(size); 19 | writer.writeToMemory(data); 20 | return SkData::NewFromMalloc(data, size); 21 | } 22 | 23 | SkFlattenable* SkValidatingDeserializeFlattenable(const void* data, size_t size, 24 | SkFlattenable::Type type) { 25 | SkValidatingReadBuffer buffer(data, size); 26 | return buffer.readFlattenable(type); 27 | } 28 | -------------------------------------------------------------------------------- /skia/src/core/SkImageInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkImageInfo.h" 9 | #include "SkReadBuffer.h" 10 | #include "SkWriteBuffer.h" 11 | 12 | static bool alpha_type_is_valid(SkAlphaType alphaType) { 13 | return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType); 14 | } 15 | 16 | static bool color_type_is_valid(SkColorType colorType) { 17 | return (colorType >= 0) && (colorType <= kLastEnum_SkColorType); 18 | } 19 | 20 | void SkImageInfo::unflatten(SkReadBuffer& buffer) { 21 | fWidth = buffer.read32(); 22 | fHeight = buffer.read32(); 23 | 24 | uint32_t packed = buffer.read32(); 25 | SkASSERT(0 == (packed >> 16)); 26 | fAlphaType = (SkAlphaType)((packed >> 8) & 0xFF); 27 | fColorType = (SkColorType)((packed >> 0) & 0xFF); 28 | buffer.validate(alpha_type_is_valid(fAlphaType) && 29 | color_type_is_valid(fColorType)); 30 | } 31 | 32 | void SkImageInfo::flatten(SkWriteBuffer& buffer) const { 33 | buffer.write32(fWidth); 34 | buffer.write32(fHeight); 35 | 36 | SkASSERT(0 == (fAlphaType & ~0xFF)); 37 | SkASSERT(0 == (fColorType & ~0xFF)); 38 | uint32_t packed = (fAlphaType << 8) | fColorType; 39 | buffer.write32(packed); 40 | } 41 | -------------------------------------------------------------------------------- /skia/src/core/SkInstCnt.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkInstCnt.h" 9 | 10 | #if SK_ENABLE_INST_COUNT 11 | bool gPrintInstCount = false; 12 | #endif 13 | -------------------------------------------------------------------------------- /skia/src/core/SkMipMap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkMipMap_DEFINED 9 | #define SkMipMap_DEFINED 10 | 11 | #include "SkRefCnt.h" 12 | #include "SkScalar.h" 13 | 14 | class SkBitmap; 15 | 16 | class SkMipMap : public SkRefCnt { 17 | public: 18 | static SkMipMap* Build(const SkBitmap& src); 19 | 20 | struct Level { 21 | void* fPixels; 22 | uint32_t fRowBytes; 23 | uint32_t fWidth, fHeight; 24 | float fScale; // < 1.0 25 | }; 26 | 27 | bool extractLevel(SkScalar scale, Level*) const; 28 | 29 | size_t getSize() const { return fSize; } 30 | 31 | private: 32 | size_t fSize; 33 | Level* fLevels; 34 | int fCount; 35 | 36 | // we take ownership of levels, and will free it with sk_free() 37 | SkMipMap(Level* levels, int count, size_t size); 38 | virtual ~SkMipMap(); 39 | 40 | static Level* AllocLevels(int levelCount, size_t pixelSize); 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /skia/src/core/SkOrderedReadBuffer.h: -------------------------------------------------------------------------------- 1 | // Temporary shim to keep a couple dependencies working in Chromium. 2 | #ifndef SkOrderedReadBuffer_DEFINED 3 | #define SkOrderedReadBuffer_DEFINED 4 | 5 | #include "SkReadBuffer.h" 6 | 7 | typedef SkReadBuffer SkOrderedReadBuffer; 8 | 9 | #endif//SkOrderedReadBuffer_DEFINED 10 | -------------------------------------------------------------------------------- /skia/src/core/SkPaintDefaults.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkPaintDefaults_DEFINED 9 | #define SkPaintDefaults_DEFINED 10 | 11 | #include "SkPaint.h" 12 | 13 | /** 14 | * Any of these can be specified by the build system (or SkUserConfig.h) 15 | * to change the default values for a SkPaint. This file should not be 16 | * edited directly. 17 | */ 18 | 19 | #ifndef SkPaintDefaults_Flags 20 | #define SkPaintDefaults_Flags 0 21 | #endif 22 | 23 | #ifndef SkPaintDefaults_TextSize 24 | #define SkPaintDefaults_TextSize SkIntToScalar(12) 25 | #endif 26 | 27 | #ifndef SkPaintDefaults_Hinting 28 | #define SkPaintDefaults_Hinting SkPaint::kNormal_Hinting 29 | #endif 30 | 31 | #ifndef SkPaintDefaults_MiterLimit 32 | #define SkPaintDefaults_MiterLimit SkIntToScalar(4) 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /skia/src/core/SkPaintOptionsAndroid.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "SkPaintOptionsAndroid.h" 10 | #include "SkReadBuffer.h" 11 | #include "SkWriteBuffer.h" 12 | #include "SkTDict.h" 13 | #include "SkThread.h" 14 | #include 15 | 16 | SkLanguage SkLanguage::getParent() const { 17 | SkASSERT(!fTag.isEmpty()); 18 | const char* tag = fTag.c_str(); 19 | 20 | // strip off the rightmost "-.*" 21 | const char* parentTagEnd = strrchr(tag, '-'); 22 | if (parentTagEnd == NULL) { 23 | return SkLanguage(); 24 | } 25 | size_t parentTagLen = parentTagEnd - tag; 26 | return SkLanguage(tag, parentTagLen); 27 | } 28 | 29 | void SkPaintOptionsAndroid::flatten(SkWriteBuffer& buffer) const { 30 | buffer.writeUInt(fFontVariant); 31 | buffer.writeString(fLanguage.getTag().c_str()); 32 | buffer.writeBool(fUseFontFallbacks); 33 | } 34 | 35 | void SkPaintOptionsAndroid::unflatten(SkReadBuffer& buffer) { 36 | fFontVariant = (FontVariant)buffer.readUInt(); 37 | SkString tag; 38 | buffer.readString(&tag); 39 | fLanguage = SkLanguage(tag); 40 | fUseFontFallbacks = buffer.readBool(); 41 | } 42 | -------------------------------------------------------------------------------- /skia/src/core/SkPaintPriv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkPaintPriv_DEFINED 9 | #define SkPaintPriv_DEFINED 10 | 11 | class SkBitmap; 12 | class SkPaint; 13 | 14 | #include "SkTypes.h" 15 | /** Returns true if draw calls that use the paint will completely occlude 16 | canvas contents that are covered by the draw. 17 | @param paint The paint to be analyzed, NULL is equivalent to 18 | the default paint. 19 | @param bmpReplacesShader a bitmap to be used in place of the paint's 20 | shader. 21 | @return true if paint is opaque 22 | */ 23 | bool isPaintOpaque(const SkPaint* paint, 24 | const SkBitmap* bmpReplacesShader = NULL); 25 | #endif 26 | -------------------------------------------------------------------------------- /skia/src/core/SkQuadTreePicture.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkQuadTreePicture.h" 9 | 10 | #include "SkQuadTree.h" 11 | 12 | SkBBoxHierarchy* SkQuadTreePicture::createBBoxHierarchy() const { 13 | return SkNEW_ARGS(SkQuadTree, (fBounds)); 14 | } 15 | -------------------------------------------------------------------------------- /skia/src/core/SkQuadTreePicture.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkQuadTreePicture_DEFINED 9 | #define SkQuadTreePicture_DEFINED 10 | 11 | #include "SkPicture.h" 12 | #include "SkRect.h" 13 | 14 | /** 15 | * Subclass of SkPicture that override the behavior of the 16 | * kOptimizeForClippedPlayback_RecordingFlag by creating an SkQuadGrid 17 | * structure rather than an R-Tree. The quad tree has generally faster 18 | * tree creation time, but slightly slower query times, as compared to 19 | * R-Tree, so some cases may be faster and some cases slower. 20 | */ 21 | class SK_API SkQuadTreePicture : public SkPicture { 22 | public: 23 | SkQuadTreePicture(const SkIRect& bounds) : fBounds(bounds) {} 24 | virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE; 25 | private: 26 | SkIRect fBounds; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /skia/src/core/SkScalar.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkMath.h" 11 | #include "SkScalar.h" 12 | 13 | SkScalar SkScalarInterpFunc(SkScalar searchKey, const SkScalar keys[], 14 | const SkScalar values[], int length) { 15 | SkASSERT(length > 0); 16 | SkASSERT(keys != NULL); 17 | SkASSERT(values != NULL); 18 | #ifdef SK_DEBUG 19 | for (int i = 1; i < length; i++) 20 | SkASSERT(keys[i] >= keys[i-1]); 21 | #endif 22 | int right = 0; 23 | while (right < length && searchKey > keys[right]) 24 | right++; 25 | // Could use sentinel values to eliminate conditionals, but since the 26 | // tables are taken as input, a simpler format is better. 27 | if (length == right) 28 | return values[length-1]; 29 | if (0 == right) 30 | return values[0]; 31 | // Otherwise, interpolate between right - 1 and right. 32 | SkScalar rightKey = keys[right]; 33 | SkScalar leftKey = keys[right-1]; 34 | SkScalar fract = SkScalarDiv(searchKey-leftKey,rightKey-leftKey); 35 | return SkScalarInterp(values[right-1], values[right], fract); 36 | } 37 | -------------------------------------------------------------------------------- /skia/src/core/SkScanPriv.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkScanPriv_DEFINED 11 | #define SkScanPriv_DEFINED 12 | 13 | #include "SkScan.h" 14 | #include "SkBlitter.h" 15 | 16 | class SkScanClipper { 17 | public: 18 | SkScanClipper(SkBlitter* blitter, const SkRegion* clip, const SkIRect& bounds, 19 | bool skipRejectTest = false); 20 | 21 | SkBlitter* getBlitter() const { return fBlitter; } 22 | const SkIRect* getClipRect() const { return fClipRect; } 23 | 24 | private: 25 | SkRectClipBlitter fRectBlitter; 26 | SkRgnClipBlitter fRgnBlitter; 27 | SkBlitter* fBlitter; 28 | const SkIRect* fClipRect; 29 | }; 30 | 31 | // clipRect == null means path is entirely inside the clip 32 | void sk_fill_path(const SkPath& path, const SkIRect* clipRect, 33 | SkBlitter* blitter, int start_y, int stop_y, int shiftEdgesUp, 34 | const SkRegion& clipRgn); 35 | 36 | // blit the rects above and below avoid, clipped to clip 37 | void sk_blit_above(SkBlitter*, const SkIRect& avoid, const SkRegion& clip); 38 | void sk_blit_below(SkBlitter*, const SkIRect& avoid, const SkRegion& clip); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /skia/src/core/SkStringUtils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkString.h" 9 | #include "SkStringUtils.h" 10 | 11 | void SkAddFlagToString(SkString* string, bool flag, const char* flagStr, bool* needSeparator) { 12 | if (flag) { 13 | if (*needSeparator) { 14 | string->append("|"); 15 | } 16 | string->append(flagStr); 17 | *needSeparator = true; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /skia/src/core/SkStrokerPriv.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkStrokerPriv_DEFINED 11 | #define SkStrokerPriv_DEFINED 12 | 13 | #include "SkStroke.h" 14 | 15 | #define CWX(x, y) (-y) 16 | #define CWY(x, y) (x) 17 | #define CCWX(x, y) (y) 18 | #define CCWY(x, y) (-x) 19 | 20 | #define CUBIC_ARC_FACTOR ((SK_ScalarSqrt2 - SK_Scalar1) * 4 / 3) 21 | 22 | class SkStrokerPriv { 23 | public: 24 | typedef void (*CapProc)(SkPath* path, 25 | const SkPoint& pivot, 26 | const SkVector& normal, 27 | const SkPoint& stop, 28 | SkPath* otherPath); 29 | 30 | typedef void (*JoinProc)(SkPath* outer, SkPath* inner, 31 | const SkVector& beforeUnitNormal, 32 | const SkPoint& pivot, 33 | const SkVector& afterUnitNormal, 34 | SkScalar radius, SkScalar invMiterLimit, 35 | bool prevIsLine, bool currIsLine); 36 | 37 | static CapProc CapFactory(SkPaint::Cap); 38 | static JoinProc JoinFactory(SkPaint::Join); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /skia/src/core/SkTileGridPicture.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkTileGridPicture.h" 9 | 10 | #include "SkPictureStateTree.h" 11 | #include "SkTileGrid.h" 12 | 13 | SkTileGridPicture::SkTileGridPicture(int width, int height, const TileGridInfo& info) { 14 | SkASSERT(info.fMargin.width() >= 0); 15 | SkASSERT(info.fMargin.height() >= 0); 16 | fInfo = info; 17 | // Note: SkIRects are non-inclusive of the right() column and bottom() row. 18 | // For example, an SkIRect at 0,0 with a size of (1,1) will only have 19 | // content at pixel (0,0) and will report left=0 and right=1, hence the 20 | // "-1"s below. 21 | fXTileCount = (width + info.fTileInterval.width() - 1) / info.fTileInterval.width(); 22 | fYTileCount = (height + info.fTileInterval.height() - 1) / info.fTileInterval.height(); 23 | } 24 | 25 | SkBBoxHierarchy* SkTileGridPicture::createBBoxHierarchy() const { 26 | return SkNEW_ARGS(SkTileGrid, (fXTileCount, fYTileCount, fInfo, 27 | SkTileGridNextDatum)); 28 | } 29 | -------------------------------------------------------------------------------- /skia/src/core/SkTypefacePriv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkTypefacePriv_DEFINED 9 | #define SkTypefacePriv_DEFINED 10 | 11 | #include "SkTypeface.h" 12 | 13 | /** 14 | * Return a ref'd typeface, which must later be unref'd 15 | * 16 | * If the parameter is non-null, it will be ref'd and returned, otherwise 17 | * it will be the default typeface. 18 | */ 19 | static inline SkTypeface* ref_or_default(SkTypeface* face) { 20 | return face ? SkRef(face) : SkTypeface::RefDefault(); 21 | } 22 | 23 | /** 24 | * Always resolves to a non-null typeface, either the value passed to its 25 | * constructor, or the default typeface if null was passed. 26 | */ 27 | class SkAutoResolveDefaultTypeface : public SkAutoTUnref { 28 | public: 29 | SkAutoResolveDefaultTypeface() : INHERITED(SkTypeface::RefDefault()) {} 30 | 31 | SkAutoResolveDefaultTypeface(SkTypeface* face) 32 | : INHERITED(ref_or_default(face)) {} 33 | 34 | private: 35 | typedef SkAutoTUnref INHERITED; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /skia/src/effects/SkEmbossMask.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkEmbossMask_DEFINED 11 | #define SkEmbossMask_DEFINED 12 | 13 | #include "SkEmbossMaskFilter.h" 14 | 15 | class SkEmbossMask { 16 | public: 17 | static void Emboss(SkMask* mask, const SkEmbossMaskFilter::Light&); 18 | }; 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /skia/src/effects/SkPaintFlagsDrawFilter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkPaintFlagsDrawFilter.h" 9 | #include "SkPaint.h" 10 | 11 | SkPaintFlagsDrawFilter::SkPaintFlagsDrawFilter(uint32_t clearFlags, 12 | uint32_t setFlags) { 13 | fClearFlags = SkToU16(clearFlags & SkPaint::kAllFlags); 14 | fSetFlags = SkToU16(setFlags & SkPaint::kAllFlags); 15 | } 16 | 17 | bool SkPaintFlagsDrawFilter::filter(SkPaint* paint, Type) { 18 | paint->setFlags((paint->getFlags() & ~fClearFlags) | fSetFlags); 19 | return true; 20 | } 21 | -------------------------------------------------------------------------------- /skia/src/effects/SkPixelXorXfermode.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkPixelXorXfermode.h" 11 | #include "SkColorPriv.h" 12 | #include "SkReadBuffer.h" 13 | #include "SkWriteBuffer.h" 14 | #include "SkString.h" 15 | 16 | // we always return an opaque color, 'cause I don't know what to do with 17 | // the alpha-component and still return a valid premultiplied color. 18 | SkPMColor SkPixelXorXfermode::xferColor(SkPMColor src, SkPMColor dst) const { 19 | SkPMColor res = src ^ dst ^ fOpColor; 20 | res |= (SK_A32_MASK << SK_A32_SHIFT); // force it to be opaque 21 | return res; 22 | } 23 | 24 | void SkPixelXorXfermode::flatten(SkWriteBuffer& wb) const { 25 | this->INHERITED::flatten(wb); 26 | wb.writeColor(fOpColor); 27 | } 28 | 29 | SkPixelXorXfermode::SkPixelXorXfermode(SkReadBuffer& rb) 30 | : INHERITED(rb) { 31 | fOpColor = rb.readColor(); 32 | } 33 | 34 | #ifndef SK_IGNORE_TO_STRING 35 | void SkPixelXorXfermode::toString(SkString* str) const { 36 | str->append("SkPixelXorXfermode: "); 37 | str->appendHex(fOpColor); 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /skia/src/effects/gradients/SkBitmapCache.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkBitmapCache_DEFINED 11 | #define SkBitmapCache_DEFINED 12 | 13 | #include "SkBitmap.h" 14 | 15 | class SkBitmapCache : SkNoncopyable { 16 | public: 17 | SkBitmapCache(int maxEntries); 18 | ~SkBitmapCache(); 19 | 20 | bool find(const void* buffer, size_t len, SkBitmap*) const; 21 | void add(const void* buffer, size_t len, const SkBitmap&); 22 | 23 | private: 24 | int fEntryCount; 25 | const int fMaxEntries; 26 | 27 | struct Entry; 28 | mutable Entry* fHead; 29 | mutable Entry* fTail; 30 | 31 | inline Entry* detach(Entry*) const; 32 | inline void attachToHead(Entry*) const; 33 | 34 | #ifdef SK_DEBUG 35 | void validate() const; 36 | #else 37 | void validate() const {} 38 | #endif 39 | 40 | class AutoValidate : SkNoncopyable { 41 | public: 42 | AutoValidate(const SkBitmapCache* bc) : fBC(bc) { bc->validate(); } 43 | ~AutoValidate() { fBC->validate(); } 44 | private: 45 | const SkBitmapCache* fBC; 46 | }; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /skia/src/effects/gradients/SkClampRange.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #ifndef SkClampRange_DEFINED 11 | #define SkClampRange_DEFINED 12 | 13 | #include "SkFixed.h" 14 | 15 | /** 16 | * Iteration fixed fx by dx, clamping as you go to [0..0xFFFF], this class 17 | * computes the (up to) 3 spans there are: 18 | * 19 | * range0: use constant value V0 20 | * range1: iterate as usual fx += dx 21 | * range2: use constant value V1 22 | */ 23 | struct SkClampRange { 24 | int fCount0; // count for fV0 25 | int fCount1; // count for interpolating (fV0...fV1) 26 | int fCount2; // count for fV1 27 | SkFixed fFx1; // initial fx value for the fCount1 range. 28 | // only valid if fCount1 > 0 29 | int fV0, fV1; 30 | bool fOverflowed; // true if we had to clamp due to numerical overflow 31 | 32 | void init(SkFixed fx, SkFixed dx, int count, int v0, int v1); 33 | 34 | private: 35 | void initFor1(SkFixed fx); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /skia/src/effects/gradients/SkLinearGradient.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #ifndef SkLinearGradient_DEFINED 10 | #define SkLinearGradient_DEFINED 11 | 12 | #include "SkGradientShaderPriv.h" 13 | 14 | class SkLinearGradient : public SkGradientShaderBase { 15 | public: 16 | SkLinearGradient(const SkPoint pts[2], const Descriptor&); 17 | 18 | virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK_OVERRIDE; 19 | virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE; 20 | virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE; 21 | virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*) const SK_OVERRIDE; 22 | virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; 23 | virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const SK_OVERRIDE; 24 | 25 | SK_TO_STRING_OVERRIDE() 26 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLinearGradient) 27 | 28 | protected: 29 | SkLinearGradient(SkReadBuffer& buffer); 30 | virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; 31 | 32 | private: 33 | typedef SkGradientShaderBase INHERITED; 34 | const SkPoint fStart; 35 | const SkPoint fEnd; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /skia/src/effects/gradients/SkSweepGradient.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #ifndef SkSweepGradient_DEFINED 10 | #define SkSweepGradient_DEFINED 11 | 12 | #include "SkGradientShaderPriv.h" 13 | 14 | class SkSweepGradient : public SkGradientShaderBase { 15 | public: 16 | SkSweepGradient(SkScalar cx, SkScalar cy, const Descriptor&); 17 | virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE; 18 | virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE; 19 | 20 | virtual BitmapType asABitmap(SkBitmap* bitmap, 21 | SkMatrix* matrix, 22 | TileMode* xy) const SK_OVERRIDE; 23 | 24 | virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; 25 | 26 | virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const SK_OVERRIDE; 27 | 28 | SK_TO_STRING_OVERRIDE() 29 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSweepGradient) 30 | 31 | protected: 32 | SkSweepGradient(SkReadBuffer& buffer); 33 | virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; 34 | 35 | private: 36 | typedef SkGradientShaderBase INHERITED; 37 | const SkPoint fCenter; 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /skia/src/image/SkImage_Base.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkImage_Base_DEFINED 9 | #define SkImage_Base_DEFINED 10 | 11 | #include "SkImage.h" 12 | 13 | class SkImage_Base : public SkImage { 14 | public: 15 | SkImage_Base(int width, int height) : INHERITED(width, height) {} 16 | 17 | virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) = 0; 18 | virtual void onDrawRectToRect(SkCanvas*, const SkRect* src, 19 | const SkRect& dst, const SkPaint*) = 0; 20 | 21 | // Default impl calls onDraw 22 | virtual bool onReadPixels(SkBitmap*, const SkIRect& subset) const; 23 | 24 | virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const { 25 | return NULL; 26 | } 27 | 28 | virtual GrTexture* onGetTexture() { return NULL; } 29 | 30 | // return a read-only copy of the pixels. We promise to not modify them, 31 | // but only inspect them (or encode them). 32 | virtual bool getROPixels(SkBitmap*) const { return false; } 33 | 34 | private: 35 | typedef SkImage INHERITED; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /skia/src/images/SkForceLinking.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkForceLinking.h" 9 | #include "SkImageDecoder.h" 10 | 11 | // This method is required to fool the linker into not discarding the pre-main 12 | // initialization and registration of the decoder classes. Passing true will 13 | // cause memory leaks. 14 | int SkForceLinking(bool doNotPassTrue) { 15 | if (doNotPassTrue) { 16 | SkASSERT(false); 17 | CreateJPEGImageDecoder(); 18 | CreateWEBPImageDecoder(); 19 | CreateBMPImageDecoder(); 20 | CreateICOImageDecoder(); 21 | CreateWBMPImageDecoder(); 22 | // Only link GIF and PNG on platforms that build them. See images.gyp 23 | #if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_NACL) \ 24 | && !defined(SK_BUILD_FOR_IOS) 25 | CreateGIFImageDecoder(); 26 | #endif 27 | #if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_IOS) 28 | CreatePNGImageDecoder(); 29 | #endif 30 | return -1; 31 | } 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /skia/src/images/SkImageDecoder_FactoryDefault.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "SkImageDecoder.h" 10 | #include "SkMovie.h" 11 | #include "SkStream.h" 12 | 13 | extern SkImageDecoder* image_decoder_from_stream(SkStreamRewindable*); 14 | 15 | SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable* stream) { 16 | return image_decoder_from_stream(stream); 17 | } 18 | 19 | ///////////////////////////////////////////////////////////////////////// 20 | 21 | typedef SkTRegistry MovieReg; 22 | 23 | SkMovie* SkMovie::DecodeStream(SkStreamRewindable* stream) { 24 | const MovieReg* curr = MovieReg::Head(); 25 | while (curr) { 26 | SkMovie* movie = curr->factory()(stream); 27 | if (movie) { 28 | return movie; 29 | } 30 | // we must rewind only if we got NULL, since we gave the stream to the 31 | // movie, who may have already started reading from it 32 | stream->rewind(); 33 | curr = curr->next(); 34 | } 35 | return NULL; 36 | } 37 | -------------------------------------------------------------------------------- /skia/src/images/SkImageEncoder_Factory.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2009 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "SkImageEncoder.h" 10 | 11 | template SkImageEncoder_EncodeReg* SkImageEncoder_EncodeReg::gHead; 12 | 13 | SkImageEncoder* SkImageEncoder::Create(Type t) { 14 | SkImageEncoder* codec = NULL; 15 | const SkImageEncoder_EncodeReg* curr = SkImageEncoder_EncodeReg::Head(); 16 | while (curr) { 17 | if ((codec = curr->factory()(t)) != NULL) { 18 | return codec; 19 | } 20 | curr = curr->next(); 21 | } 22 | return NULL; 23 | } 24 | -------------------------------------------------------------------------------- /skia/src/images/SkImageRefPool.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkImageRefPool_DEFINED 9 | #define SkImageRefPool_DEFINED 10 | 11 | #include "SkTypes.h" 12 | 13 | class SkImageRef; 14 | class SkImageRef_GlobalPool; 15 | 16 | class SkImageRefPool { 17 | public: 18 | SkImageRefPool(); 19 | ~SkImageRefPool(); 20 | 21 | size_t getRAMBudget() const { return fRAMBudget; } 22 | void setRAMBudget(size_t); 23 | 24 | size_t getRAMUsed() const { return fRAMUsed; } 25 | void setRAMUsed(size_t limit); 26 | 27 | void addToHead(SkImageRef*); 28 | void addToTail(SkImageRef*); 29 | void detach(SkImageRef*); 30 | 31 | void dump() const; 32 | 33 | private: 34 | size_t fRAMBudget; 35 | size_t fRAMUsed; 36 | 37 | int fCount; 38 | SkImageRef* fHead, *fTail; 39 | 40 | int computeCount() const; 41 | 42 | friend class SkImageRef_GlobalPool; 43 | 44 | void justAddedPixels(SkImageRef*); 45 | void canLosePixels(SkImageRef*); 46 | void purgeIfNeeded(); 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /skia/src/images/SkImageRef_ashmem.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #ifndef SkImageRef_ashmem_DEFINED 9 | #define SkImageRef_ashmem_DEFINED 10 | 11 | #include "SkImageRef.h" 12 | 13 | struct SkAshmemRec { 14 | int fFD; 15 | void* fAddr; 16 | size_t fSize; 17 | bool fPinned; 18 | }; 19 | 20 | class SkImageRef_ashmem : public SkImageRef { 21 | public: 22 | SkImageRef_ashmem(const SkImageInfo&, SkStreamRewindable*, int sampleSize = 1); 23 | virtual ~SkImageRef_ashmem(); 24 | 25 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkImageRef_ashmem) 26 | 27 | protected: 28 | SkImageRef_ashmem(SkReadBuffer&); 29 | virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 30 | 31 | virtual bool onDecode(SkImageDecoder* codec, SkStreamRewindable* stream, 32 | SkBitmap* bitmap, SkBitmap::Config config, 33 | SkImageDecoder::Mode mode); 34 | 35 | virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; 36 | virtual void onUnlockPixels() SK_OVERRIDE; 37 | 38 | private: 39 | void closeFD(); 40 | 41 | SkColorTable* fCT; 42 | SkAshmemRec fRec; 43 | 44 | typedef SkImageRef INHERITED; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /skia/src/images/SkImages.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkFlattenable.h" 9 | #include "SkImageRef_GlobalPool.h" 10 | #include "SkImages.h" 11 | 12 | #ifdef SK_BUILD_FOR_ANDROID 13 | #include "SkImageRef_ashmem.h" 14 | #endif 15 | 16 | void SkImages::InitializeFlattenables() { 17 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageRef_GlobalPool) 18 | #ifdef SK_BUILD_FOR_ANDROID 19 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageRef_ashmem) 20 | #endif 21 | } 22 | -------------------------------------------------------------------------------- /skia/src/images/SkStreamHelpers.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkStream.h" 9 | #include "SkStreamHelpers.h" 10 | #include "SkTypes.h" 11 | 12 | size_t CopyStreamToStorage(SkAutoMalloc* storage, SkStream* stream) { 13 | SkASSERT(storage != NULL); 14 | SkASSERT(stream != NULL); 15 | 16 | if (stream->hasLength()) { 17 | const size_t length = stream->getLength(); 18 | void* dst = storage->reset(length); 19 | if (stream->read(dst, length) != length) { 20 | return 0; 21 | } 22 | return length; 23 | } 24 | 25 | SkDynamicMemoryWStream tempStream; 26 | // Arbitrary buffer size. 27 | const size_t bufferSize = 256 * 1024; // 256KB 28 | char buffer[bufferSize]; 29 | SkDEBUGCODE(size_t debugLength = 0;) 30 | do { 31 | size_t bytesRead = stream->read(buffer, bufferSize); 32 | tempStream.write(buffer, bytesRead); 33 | SkDEBUGCODE(debugLength += bytesRead); 34 | SkASSERT(tempStream.bytesWritten() == debugLength); 35 | } while (!stream->isAtEnd()); 36 | const size_t length = tempStream.bytesWritten(); 37 | void* dst = storage->reset(length); 38 | tempStream.copyTo(dst); 39 | return length; 40 | } 41 | -------------------------------------------------------------------------------- /skia/src/images/SkStreamHelpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkStreamHelpers_DEFINED 9 | #define SkStreamHelpers_DEFINED 10 | 11 | class SkAutoMalloc; 12 | class SkStream; 13 | 14 | /** 15 | * Copy the provided stream to memory allocated by storage. 16 | * Used by SkImageDecoder_libbmp and SkImageDecoder_libico. 17 | * @param storage Allocator to hold the memory. Will be reset to be large 18 | * enough to hold the entire stream. Upon successful return, 19 | * storage->get() will point to data holding the SkStream's entire 20 | * contents. 21 | * @param stream SkStream to be copied into storage. 22 | * @return size_t Total number of bytes in the SkStream, which is also the 23 | * number of bytes pointed to by storage->get(). Returns 0 on failure. 24 | */ 25 | size_t CopyStreamToStorage(SkAutoMalloc* storage, SkStream* stream); 26 | 27 | #endif // SkStreamHelpers_DEFINED 28 | -------------------------------------------------------------------------------- /skia/src/opts/SkBitmapProcState_opts_SSSE3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkBitmapProcState.h" 9 | 10 | void S32_opaque_D32_filter_DX_SSSE3(const SkBitmapProcState& s, 11 | const uint32_t* xy, 12 | int count, uint32_t* colors); 13 | void S32_alpha_D32_filter_DX_SSSE3(const SkBitmapProcState& s, 14 | const uint32_t* xy, 15 | int count, uint32_t* colors); 16 | void S32_opaque_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, 17 | const uint32_t* xy, 18 | int count, uint32_t* colors); 19 | void S32_alpha_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, 20 | const uint32_t* xy, 21 | int count, uint32_t* colors); 22 | -------------------------------------------------------------------------------- /skia/src/opts/SkBitmapProcState_opts_none.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | #include "SkBitmapProcState.h" 9 | 10 | /* A platform may optionally overwrite any of these with accelerated 11 | versions. On input, these will already have valid function pointers, 12 | so a platform need only overwrite the ones it chooses, based on the 13 | current state (e.g. fBitmap, fInvMatrix, etc.) 14 | 15 | fShaderProc32 16 | fShaderProc16 17 | fMatrixProc 18 | fSampleProc32 19 | fSampleProc32 20 | */ 21 | 22 | // empty implementation just uses default supplied function pointers 23 | void SkBitmapProcState::platformProcs() {} 24 | 25 | // empty implementation just uses default supplied function pointers 26 | void SkBitmapProcState::platformConvolutionProcs(SkConvolutionProcs*) {} 27 | -------------------------------------------------------------------------------- /skia/src/opts/SkBlitMask_opts_arm_neon.h: -------------------------------------------------------------------------------- 1 | #ifndef SkBlitMask_opts_arm_neon_DEFINED 2 | #define SkBlitMask_opts_arm_neon_DEFINED 3 | 4 | #include "SkColor.h" 5 | #include "SkBlitMask.h" 6 | 7 | extern SkBlitMask::ColorProc D32_A8_Factory_neon(SkColor color); 8 | 9 | extern void SkBlitLCD16OpaqueRow_neon(SkPMColor dst[], const uint16_t src[], 10 | SkColor color, int width, 11 | SkPMColor opaqueDst); 12 | 13 | extern void SkBlitLCD16Row_neon(SkPMColor dst[], const uint16_t src[], 14 | SkColor color, int width, SkPMColor); 15 | 16 | #endif // #ifndef SkBlitMask_opts_arm_neon_DEFINED 17 | -------------------------------------------------------------------------------- /skia/src/opts/SkBlitMask_opts_none.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "SkBlitMask.h" 3 | 4 | SkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkBitmap::Config dstConfig, 5 | SkMask::Format maskFormat, 6 | SkColor color) { 7 | return NULL; 8 | } 9 | 10 | SkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) { 11 | return NULL; 12 | } 13 | 14 | SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkBitmap::Config dstConfig, 15 | SkMask::Format maskFormat, 16 | RowFlags flags) { 17 | return NULL; 18 | } 19 | -------------------------------------------------------------------------------- /skia/src/opts/SkBlitRect_opts_SSE2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkBlitRect_opts_SSE2_DEFINED 9 | #define SkBlitRect_opts_SSE2_DEFINED 10 | 11 | /* 12 | These functions' implementations copy sections of both 13 | SkBlitRow_opts_SSE2 and SkUtils_opts_SSE2. 14 | */ 15 | 16 | #include "SkColor.h" 17 | 18 | void ColorRect32_SSE2(SkPMColor* SK_RESTRICT dst, 19 | int width, int height, 20 | size_t rowBytes, uint32_t color); 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /skia/src/opts/SkBlitRow_opts_arm_neon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkBlitRow_opts_arm_neon_DEFINED 8 | #define SkBlitRow_opts_arm_neon_DEFINED 9 | 10 | #include "SkBlitRow.h" 11 | 12 | extern const SkBlitRow::Proc sk_blitrow_platform_565_procs_arm_neon[]; 13 | extern const SkBlitRow::Proc32 sk_blitrow_platform_32_procs_arm_neon[]; 14 | 15 | extern void Color32_arm_neon(SkPMColor* dst, const SkPMColor* src, int count, 16 | SkPMColor color); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /skia/src/opts/SkBlitRow_opts_none.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkBlitRow.h" 9 | 10 | // Platform impl of Platform_procs with no overrides 11 | 12 | SkBlitRow::Proc SkBlitRow::PlatformProcs565(unsigned flags) { 13 | return NULL; 14 | } 15 | 16 | SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) { 17 | return NULL; 18 | } 19 | 20 | SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() { 21 | return NULL; 22 | } 23 | 24 | SkBlitRow::ColorRectProc PlatformColorRectProcFactory() { 25 | return NULL; 26 | } 27 | -------------------------------------------------------------------------------- /skia/src/opts/SkBlurImage_opts.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkBlurImage_opts_DEFINED 9 | #define SkBlurImage_opts_DEFINED 10 | 11 | #include "SkColorPriv.h" 12 | 13 | typedef void (*SkBoxBlurProc)(const SkPMColor* src, int srcStride, SkPMColor* dst, int kernelSize, 14 | int leftOffset, int rightOffset, int width, int height); 15 | 16 | bool SkBoxBlurGetPlatformProcs(SkBoxBlurProc* boxBlurX, 17 | SkBoxBlurProc* boxBlurY, 18 | SkBoxBlurProc* boxBlurXY, 19 | SkBoxBlurProc* boxBlurYX); 20 | #endif 21 | -------------------------------------------------------------------------------- /skia/src/opts/SkBlurImage_opts_SSE2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkBlurImage_opts.h" 9 | 10 | bool SkBoxBlurGetPlatformProcs_SSE2(SkBoxBlurProc* boxBlurX, 11 | SkBoxBlurProc* boxBlurY, 12 | SkBoxBlurProc* boxBlurXY, 13 | SkBoxBlurProc* boxBlurYX); 14 | -------------------------------------------------------------------------------- /skia/src/opts/SkBlurImage_opts_arm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 ARM Ltd. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkBlurImage_opts_neon.h" 9 | #include "SkUtilsArm.h" 10 | 11 | bool SkBoxBlurGetPlatformProcs(SkBoxBlurProc* boxBlurX, 12 | SkBoxBlurProc* boxBlurY, 13 | SkBoxBlurProc* boxBlurXY, 14 | SkBoxBlurProc* boxBlurYX) { 15 | #if SK_ARM_NEON_IS_NONE 16 | return false; 17 | #else 18 | #if SK_ARM_NEON_IS_DYNAMIC 19 | if (!sk_cpu_arm_has_neon()) { 20 | return false; 21 | } 22 | #endif 23 | return SkBoxBlurGetPlatformProcs_NEON(boxBlurX, boxBlurY, boxBlurXY, boxBlurYX); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /skia/src/opts/SkBlurImage_opts_neon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkBlurImage_opts.h" 9 | 10 | bool SkBoxBlurGetPlatformProcs_NEON(SkBoxBlurProc* boxBlurX, 11 | SkBoxBlurProc* boxBlurY, 12 | SkBoxBlurProc* boxBlurXY, 13 | SkBoxBlurProc* boxBlurYX); 14 | -------------------------------------------------------------------------------- /skia/src/opts/SkBlurImage_opts_none.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkBlurImage_opts.h" 9 | 10 | bool SkBoxBlurGetPlatformProcs(SkBoxBlurProc* boxBlurX, 11 | SkBoxBlurProc* boxBlurY, 12 | SkBoxBlurProc* boxBlurXY, 13 | SkBoxBlurProc* boxBlurYX) { 14 | return false; 15 | } 16 | -------------------------------------------------------------------------------- /skia/src/opts/SkCachePreload_arm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkCachePreload_arm_DEFINED 8 | #define SkCachePreload_arm_DEFINED 9 | 10 | // This file defines macros for preload instructions for ARM. These macros 11 | // are designed to be embedded inside GNU inline assembly. 12 | // For the use of these macros, __ARM_USE_PLD needs to be enabled. The cache 13 | // line size also needs to be known (and needs to be contained inside 14 | // __ARM_CACHE_LINE_SIZE). 15 | #if defined(__ARM_USE_PLD) 16 | 17 | #define PLD(x, n) "pld [%["#x"], #("#n")]\n\t" 18 | 19 | #if __ARM_CACHE_LINE_SIZE == 32 20 | #define PLD64(x, n) PLD(x, n) PLD(x, (n) + 32) 21 | #elif __ARM_CACHE_LINE_SIZE == 64 22 | #define PLD64(x, n) PLD(x, n) 23 | #else 24 | #error "unknown __ARM_CACHE_LINE_SIZE." 25 | #endif 26 | #else 27 | // PLD is disabled, all macros become empty. 28 | #define PLD(x, n) 29 | #define PLD64(x, n) 30 | #endif 31 | 32 | #define PLD128(x, n) PLD64(x, n) PLD64(x, (n) + 64) 33 | 34 | #endif // SkCachePreload_arm_DEFINED 35 | -------------------------------------------------------------------------------- /skia/src/opts/SkColor_opts_SSE2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkColor_opts_SSE2_DEFINED 9 | #define SkColor_opts_SSE2_DEFINED 10 | 11 | #include 12 | 13 | static inline __m128i SkMul16ShiftRound_SSE(__m128i a, __m128i b, int shift) { 14 | __m128i prod = _mm_mullo_epi16(a, b); 15 | prod = _mm_add_epi16(prod, _mm_set1_epi16(1 << (shift - 1))); 16 | prod = _mm_add_epi16(prod, _mm_srli_epi16(prod, shift)); 17 | prod = _mm_srli_epi16(prod, shift); 18 | 19 | return prod; 20 | } 21 | 22 | static inline __m128i SkPackRGB16_SSE(__m128i r, __m128i g, __m128i b) { 23 | r = _mm_slli_epi16(r, SK_R16_SHIFT); 24 | g = _mm_slli_epi16(g, SK_G16_SHIFT); 25 | b = _mm_slli_epi16(b, SK_B16_SHIFT); 26 | 27 | __m128i c = _mm_or_si128(r, g); 28 | return _mm_or_si128(c, b); 29 | } 30 | 31 | #endif//SkColor_opts_SSE2_DEFINED 32 | -------------------------------------------------------------------------------- /skia/src/opts/SkMorphology_opts.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkMorphology_opts_DEFINED 9 | #define SkMorphology_opts_DEFINED 10 | 11 | #include 12 | 13 | enum SkMorphologyProcType { 14 | kDilateX_SkMorphologyProcType, 15 | kDilateY_SkMorphologyProcType, 16 | kErodeX_SkMorphologyProcType, 17 | kErodeY_SkMorphologyProcType 18 | }; 19 | 20 | SkMorphologyImageFilter::Proc SkMorphologyGetPlatformProc(SkMorphologyProcType type); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /skia/src/opts/SkMorphology_opts_SSE2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | void SkDilateX_SSE2(const SkPMColor* src, SkPMColor* dst, int radius, 9 | int width, int height, int srcStride, int dstStride); 10 | void SkDilateY_SSE2(const SkPMColor* src, SkPMColor* dst, int radius, 11 | int width, int height, int srcStride, int dstStride); 12 | void SkErodeX_SSE2(const SkPMColor* src, SkPMColor* dst, int radius, 13 | int width, int height, int srcStride, int dstStride); 14 | void SkErodeY_SSE2(const SkPMColor* src, SkPMColor* dst, int radius, 15 | int width, int height, int srcStride, int dstStride); 16 | -------------------------------------------------------------------------------- /skia/src/opts/SkMorphology_opts_arm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 ARM Ltd. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkMorphology_opts.h" 9 | #include "SkMorphology_opts_neon.h" 10 | #include "SkUtilsArm.h" 11 | 12 | SkMorphologyImageFilter::Proc SkMorphologyGetPlatformProc(SkMorphologyProcType type) { 13 | #if SK_ARM_NEON_IS_NONE 14 | return NULL; 15 | #else 16 | #if SK_ARM_NEON_IS_DYNAMIC 17 | if (!sk_cpu_arm_has_neon()) { 18 | return NULL; 19 | } 20 | #endif 21 | switch (type) { 22 | case kDilateX_SkMorphologyProcType: 23 | return SkDilateX_neon; 24 | case kDilateY_SkMorphologyProcType: 25 | return SkDilateY_neon; 26 | case kErodeX_SkMorphologyProcType: 27 | return SkErodeX_neon; 28 | case kErodeY_SkMorphologyProcType: 29 | return SkErodeY_neon; 30 | default: 31 | return NULL; 32 | } 33 | #endif 34 | } 35 | -------------------------------------------------------------------------------- /skia/src/opts/SkMorphology_opts_neon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | void SkDilateX_neon(const SkPMColor* src, SkPMColor* dst, int radius, 9 | int width, int height, int srcStride, int dstStride); 10 | void SkDilateY_neon(const SkPMColor* src, SkPMColor* dst, int radius, 11 | int width, int height, int srcStride, int dstStride); 12 | void SkErodeX_neon(const SkPMColor* src, SkPMColor* dst, int radius, 13 | int width, int height, int srcStride, int dstStride); 14 | void SkErodeY_neon(const SkPMColor* src, SkPMColor* dst, int radius, 15 | int width, int height, int srcStride, int dstStride); 16 | -------------------------------------------------------------------------------- /skia/src/opts/SkMorphology_opts_none.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkMorphology_opts.h" 9 | 10 | SkMorphologyImageFilter::Proc SkMorphologyGetPlatformProc(SkMorphologyProcType) { 11 | return NULL; 12 | } 13 | -------------------------------------------------------------------------------- /skia/src/opts/SkUtils_opts_SSE2.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2009 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTypes.h" 11 | 12 | void sk_memset16_SSE2(uint16_t *dst, uint16_t value, int count); 13 | void sk_memset32_SSE2(uint32_t *dst, uint32_t value, int count); 14 | -------------------------------------------------------------------------------- /skia/src/opts/SkUtils_opts_none.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2009 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkUtils.h" 11 | 12 | SkMemset16Proc SkMemset16GetPlatformProc() { 13 | return NULL; 14 | } 15 | 16 | SkMemset32Proc SkMemset32GetPlatformProc() { 17 | return NULL; 18 | } 19 | -------------------------------------------------------------------------------- /skia/src/opts/SkXfermode_opts_arm.cpp: -------------------------------------------------------------------------------- 1 | #include "SkXfermode.h" 2 | #include "SkXfermode_proccoeff.h" 3 | #include "SkUtilsArm.h" 4 | 5 | extern SkProcCoeffXfermode* SkPlatformXfermodeFactory_impl_neon(const ProcCoeff& rec, 6 | SkXfermode::Mode mode); 7 | 8 | extern SkXfermodeProc SkPlatformXfermodeProcFactory_impl_neon(SkXfermode::Mode mode); 9 | 10 | SkProcCoeffXfermode* SkPlatformXfermodeFactory_impl(const ProcCoeff& rec, 11 | SkXfermode::Mode mode) { 12 | return NULL; 13 | } 14 | 15 | SkXfermodeProc SkPlatformXfermodeProcFactory_impl(SkXfermode::Mode mode) { 16 | return NULL; 17 | } 18 | 19 | SkProcCoeffXfermode* SkPlatformXfermodeFactory(const ProcCoeff& rec, 20 | SkXfermode::Mode mode) { 21 | return SK_ARM_NEON_WRAP(SkPlatformXfermodeFactory_impl)(rec, mode); 22 | } 23 | 24 | SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode) { 25 | return SK_ARM_NEON_WRAP(SkPlatformXfermodeProcFactory_impl)(mode); 26 | } 27 | -------------------------------------------------------------------------------- /skia/src/opts/SkXfermode_opts_none.cpp: -------------------------------------------------------------------------------- 1 | #include "SkXfermode.h" 2 | #include "SkXfermode_proccoeff.h" 3 | 4 | // The prototypes below are for Clang 5 | extern SkProcCoeffXfermode* SkPlatformXfermodeFactory(const ProcCoeff& rec, 6 | SkXfermode::Mode mode); 7 | 8 | extern SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode); 9 | 10 | SkProcCoeffXfermode* SkPlatformXfermodeFactory(const ProcCoeff& rec, 11 | SkXfermode::Mode mode) { 12 | return NULL; 13 | } 14 | 15 | SkXfermodeProc SkPlatformXfermodeProcFactory(SkXfermode::Mode mode) { 16 | return NULL; 17 | } 18 | -------------------------------------------------------------------------------- /skia/src/pathops/SkAddIntersections.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkAddIntersections_DEFINED 8 | #define SkAddIntersections_DEFINED 9 | 10 | #include "SkIntersectionHelper.h" 11 | #include "SkIntersections.h" 12 | #include "SkTArray.h" 13 | 14 | bool AddIntersectTs(SkOpContour* test, SkOpContour* next); 15 | void AddSelfIntersectTs(SkOpContour* test); 16 | void CoincidenceCheck(SkTArray* contourList, int total); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /skia/src/pathops/SkDQuadImplicit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkDQuadImplicit_DEFINED 8 | #define SkDQuadImplicit_DEFINED 9 | 10 | #include "SkPathOpsQuad.h" 11 | 12 | class SkDQuadImplicit { 13 | public: 14 | explicit SkDQuadImplicit(const SkDQuad& q); 15 | 16 | bool match(const SkDQuadImplicit& two) const; 17 | static bool Match(const SkDQuad& quad1, const SkDQuad& quad2); 18 | 19 | double x2() const { return fP[kXx_Coeff]; } 20 | double xy() const { return fP[kXy_Coeff]; } 21 | double y2() const { return fP[kYy_Coeff]; } 22 | double x() const { return fP[kX_Coeff]; } 23 | double y() const { return fP[kY_Coeff]; } 24 | double c() const { return fP[kC_Coeff]; } 25 | 26 | private: 27 | enum Coeffs { 28 | kXx_Coeff, 29 | kXy_Coeff, 30 | kYy_Coeff, 31 | kX_Coeff, 32 | kY_Coeff, 33 | kC_Coeff, 34 | }; 35 | 36 | double fP[kC_Coeff + 1]; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /skia/src/pathops/SkOpSpan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkOpSpan_DEFINED 8 | #define SkOpSpan_DEFINED 9 | 10 | #include "SkPoint.h" 11 | 12 | class SkOpSegment; 13 | 14 | struct SkOpSpan { 15 | SkOpSegment* fOther; 16 | SkPoint fPt; // computed when the curves are intersected 17 | double fT; 18 | double fOtherT; // value at fOther[fOtherIndex].fT 19 | int fOtherIndex; // can't be used during intersection 20 | int fWindSum; // accumulated from contours surrounding this one. 21 | int fOppSum; // for binary operators: the opposite winding sum 22 | int fWindValue; // 0 == canceled; 1 == normal; >1 == coincident 23 | int fOppValue; // normally 0 -- when binary coincident edges combine, opp value goes here 24 | bool fDone; // if set, this span to next higher T has been processed 25 | bool fUnsortableStart; // set when start is part of an unsortable pair 26 | bool fUnsortableEnd; // set when end is part of an unsortable pair 27 | bool fSmall; // if set, consecutive points are almost equal 28 | bool fTiny; // if set, span may still be considered once for edge following 29 | bool fLoop; // set when a cubic loops back to this point 30 | 31 | #ifdef SK_DEBUG 32 | void dump() const; 33 | #endif 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /skia/src/pathops/SkPathOpsBounds.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #include "SkPathOpsBounds.h" 8 | #include "SkPathOpsCubic.h" 9 | #include "SkPathOpsLine.h" 10 | #include "SkPathOpsQuad.h" 11 | 12 | void SkPathOpsBounds::setCubicBounds(const SkPoint a[4]) { 13 | SkDCubic cubic; 14 | cubic.set(a); 15 | SkDRect dRect; 16 | dRect.setBounds(cubic); 17 | set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), 18 | SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); 19 | } 20 | 21 | void SkPathOpsBounds::setLineBounds(const SkPoint a[2]) { 22 | setPointBounds(a[0]); 23 | add(a[1]); 24 | } 25 | 26 | void SkPathOpsBounds::setQuadBounds(const SkPoint a[3]) { 27 | SkDQuad quad; 28 | quad.set(a); 29 | SkDRect dRect; 30 | dRect.setBounds(quad); 31 | set(SkDoubleToScalar(dRect.fLeft), SkDoubleToScalar(dRect.fTop), 32 | SkDoubleToScalar(dRect.fRight), SkDoubleToScalar(dRect.fBottom)); 33 | } 34 | 35 | void (SkPathOpsBounds::*SetCurveBounds[])(const SkPoint[]) = { 36 | NULL, 37 | &SkPathOpsBounds::setLineBounds, 38 | &SkPathOpsBounds::setQuadBounds, 39 | &SkPathOpsBounds::setCubicBounds 40 | }; 41 | -------------------------------------------------------------------------------- /skia/src/pathops/SkPathOpsCommon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkPathOpsCommon_DEFINED 8 | #define SkPathOpsCommon_DEFINED 9 | 10 | #include "SkOpAngle.h" 11 | #include "SkOpContour.h" 12 | #include "SkTDArray.h" 13 | 14 | class SkPathWriter; 15 | 16 | void Assemble(const SkPathWriter& path, SkPathWriter* simple); 17 | // FIXME: find chase uses insert, so it can't be converted to SkTArray yet 18 | SkOpSegment* FindChase(SkTDArray& chase, int& tIndex, int& endIndex); 19 | SkOpSegment* FindSortableTop(const SkTArray& , SkOpAngle::IncludeType , 20 | bool* firstContour, int* index, int* endIndex, SkPoint* topLeft, 21 | bool* unsortable, bool* done); 22 | SkOpSegment* FindUndone(SkTArray& contourList, int* start, int* end); 23 | void MakeContourList(SkTArray& contours, SkTArray& list, 24 | bool evenOdd, bool oppEvenOdd); 25 | void HandleCoincidence(SkTArray* , int ); 26 | 27 | #if DEBUG_ACTIVE_SPANS || DEBUG_ACTIVE_SPANS_FIRST_ONLY 28 | void DebugShowActiveSpans(SkTArray& contourList); 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /skia/src/pathops/SkPathOpsPoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #include "SkPathOpsPoint.h" 8 | 9 | SkDVector operator-(const SkDPoint& a, const SkDPoint& b) { 10 | SkDVector v = {a.fX - b.fX, a.fY - b.fY}; 11 | return v; 12 | } 13 | 14 | SkDPoint operator+(const SkDPoint& a, const SkDVector& b) { 15 | SkDPoint v = {a.fX + b.fX, a.fY + b.fY}; 16 | return v; 17 | } 18 | -------------------------------------------------------------------------------- /skia/src/pathops/SkPathOpsTriangle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkPathOpsTriangle_DEFINED 9 | #define SkPathOpsTriangle_DEFINED 10 | 11 | #include "SkPathOpsPoint.h" 12 | 13 | struct SkDTriangle { 14 | SkDPoint fPts[3]; 15 | 16 | bool contains(const SkDPoint& pt) const; 17 | 18 | }; 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /skia/src/pathops/SkPathWriter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkPathWriter_DEFINED 8 | #define SkPathWriter_DEFINED 9 | 10 | #include "SkPath.h" 11 | 12 | class SkPathWriter { 13 | public: 14 | SkPathWriter(SkPath& path); 15 | void close(); 16 | void cubicTo(const SkPoint& pt1, const SkPoint& pt2, const SkPoint& pt3); 17 | void deferredLine(const SkPoint& pt); 18 | void deferredMove(const SkPoint& pt); 19 | void deferredMoveLine(const SkPoint& pt); 20 | bool hasMove() const; 21 | void init(); 22 | bool isClosed() const; 23 | bool isEmpty() const { return fEmpty; } 24 | void lineTo(); 25 | const SkPath* nativePath() const; 26 | void nudge(); 27 | void quadTo(const SkPoint& pt1, const SkPoint& pt2); 28 | bool someAssemblyRequired() const; 29 | 30 | private: 31 | bool changedSlopes(const SkPoint& pt) const; 32 | void moveTo(); 33 | 34 | SkPath* fPathPtr; 35 | SkPoint fDefer[2]; 36 | SkPoint fFirstPt; 37 | int fCloses; 38 | int fMoves; 39 | bool fEmpty; 40 | bool fHasMove; 41 | bool fMoved; 42 | }; 43 | 44 | 45 | #endif /* defined(__PathOps__SkPathWriter__) */ 46 | -------------------------------------------------------------------------------- /skia/src/pathops/SkQuarticRoot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkDQuarticRoot_DEFINED 8 | #define SkDQuarticRoot_DEFINED 9 | 10 | int SkReducedQuarticRoots(const double t4, const double t3, const double t2, const double t1, 11 | const double t0, const bool oneHint, double s[4]); 12 | 13 | int SkQuarticRootsReal(int firstCubicRoot, const double A, const double B, const double C, 14 | const double D, const double E, double s[4]); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /skia/src/pathops/SkReduceOrder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkReduceOrder_DEFINED 8 | #define SkReduceOrder_DEFINED 9 | 10 | #include "SkPath.h" 11 | #include "SkPathOpsCubic.h" 12 | #include "SkPathOpsLine.h" 13 | #include "SkPathOpsQuad.h" 14 | #include "SkTArray.h" 15 | 16 | union SkReduceOrder { 17 | enum Quadratics { 18 | kNo_Quadratics, 19 | kAllow_Quadratics 20 | }; 21 | 22 | int reduce(const SkDCubic& cubic, Quadratics); 23 | int reduce(const SkDLine& line); 24 | int reduce(const SkDQuad& quad); 25 | 26 | static SkPath::Verb Cubic(const SkPoint pts[4], SkPoint* reducePts); 27 | static SkPath::Verb Quad(const SkPoint pts[3], SkPoint* reducePts); 28 | 29 | SkDLine fLine; 30 | SkDQuad fQuad; 31 | SkDCubic fCubic; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /skia/src/ports/SkAtomics_none.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkAtomics_none_DEFINED 9 | #define SkAtomics_none_DEFINED 10 | 11 | /** Non-atomic atomics for uniprocessor systems. */ 12 | 13 | #include 14 | 15 | static inline int32_t sk_atomic_inc(int32_t* addr) { 16 | int32_t value = *addr; 17 | *addr = value + 1; 18 | return value; 19 | } 20 | 21 | static inline int32_t sk_atomic_add(int32_t* addr, int32_t inc) { 22 | int32_t value = *addr; 23 | *addr = value + inc; 24 | return value; 25 | } 26 | 27 | static inline int32_t sk_atomic_dec(int32_t* addr) { 28 | int32_t value = *addr; 29 | *addr = value - 1; 30 | return value; 31 | } 32 | 33 | static inline void sk_membar_acquire__after_atomic_dec() { } 34 | 35 | static inline int32_t sk_atomic_conditional_inc(int32_t* addr) { 36 | int32_t value = *addr; 37 | if (value != 0) ++*addr; 38 | return value; 39 | } 40 | 41 | static inline bool sk_atomic_cas(int32_t* addr, int32_t before, int32_t after) { 42 | if (*addr != before) return false; 43 | *addr = after; 44 | return true; 45 | } 46 | 47 | static inline void sk_membar_acquire__after_atomic_conditional_inc() { } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /skia/src/ports/SkDebug_android.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTypes.h" 11 | #include 12 | 13 | static const size_t kBufferSize = 256; 14 | 15 | #define LOG_TAG "skia" 16 | #include 17 | 18 | static bool gSkDebugToStdOut = false; 19 | 20 | extern "C" void AndroidSkDebugToStdOut(bool debugToStdOut) { 21 | gSkDebugToStdOut = debugToStdOut; 22 | } 23 | 24 | void SkDebugf(const char format[], ...) { 25 | va_list args; 26 | va_start(args, format); 27 | __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, format, args); 28 | 29 | // Print debug output to stdout as well. This is useful for command 30 | // line applications (e.g. skia_launcher) 31 | if (gSkDebugToStdOut) { 32 | vprintf(format, args); 33 | } 34 | 35 | va_end(args); 36 | } 37 | -------------------------------------------------------------------------------- /skia/src/ports/SkDebug_nacl.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #include "SkTypes.h" 12 | 13 | static const size_t kBufferSize = 2048; 14 | 15 | #include 16 | #include 17 | 18 | #include "ppapi/cpp/instance.h" 19 | #include "ppapi/cpp/var.h" 20 | 21 | extern pp::Instance* gPluginInstance; 22 | 23 | namespace { 24 | static const char* kLogPrefix = "SkDebugf:"; 25 | } 26 | 27 | void SkDebugf(const char format[], ...) { 28 | if (gPluginInstance) { 29 | char buffer[kBufferSize + 1]; 30 | va_list args; 31 | va_start(args, format); 32 | sprintf(buffer, kLogPrefix); 33 | vsnprintf(buffer + strlen(kLogPrefix), kBufferSize, format, args); 34 | va_end(args); 35 | pp::Var msg = pp::Var(buffer); 36 | gPluginInstance->PostMessage(msg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /skia/src/ports/SkDebug_stdio.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTypes.h" 11 | 12 | #include 13 | #include 14 | 15 | void SkDebugf(const char format[], ...) { 16 | va_list args; 17 | va_start(args, format); 18 | vfprintf(stderr, format, args); 19 | va_end(args); 20 | } 21 | -------------------------------------------------------------------------------- /skia/src/ports/SkDebug_win.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | 11 | #include "SkTypes.h" 12 | 13 | static const size_t kBufferSize = 2048; 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | void SkDebugf(const char format[], ...) { 20 | char buffer[kBufferSize + 1]; 21 | va_list args; 22 | 23 | va_start(args, format); 24 | vprintf(format, args); 25 | va_end(args); 26 | // When we crash on Windows we often are missing a lot of prints. Since we don't really care 27 | // about SkDebugf performance we flush after every print. 28 | fflush(stdout); 29 | 30 | va_start(args, format); 31 | vsnprintf(buffer, kBufferSize, format, args); 32 | va_end(args); 33 | 34 | OutputDebugStringA(buffer); 35 | } 36 | -------------------------------------------------------------------------------- /skia/src/ports/SkDiscardableMemory_none.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkDiscardableMemoryPool.h" 9 | #include "SkTypes.h" 10 | 11 | SkDiscardableMemory* SkDiscardableMemory::Create(size_t bytes) { 12 | return SkGetGlobalDiscardableMemoryPool()->create(bytes); 13 | } 14 | -------------------------------------------------------------------------------- /skia/src/ports/SkFontHost_none.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2008 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "SkFontMgr.h" 10 | #include "SkScalerContext.h" 11 | 12 | SkFontMgr* SkFontMgr::Factory() { 13 | // Always return NULL, an empty SkFontMgr will be used. 14 | return NULL; 15 | } 16 | -------------------------------------------------------------------------------- /skia/src/ports/SkFontMgr_default_dw.cpp: -------------------------------------------------------------------------------- 1 | #include "SkFontMgr.h" 2 | #include "SkTypeface_win.h" 3 | 4 | SkFontMgr* SkFontMgr::Factory() { 5 | return SkFontMgr_New_DirectWrite(); 6 | } 7 | -------------------------------------------------------------------------------- /skia/src/ports/SkFontMgr_default_gdi.cpp: -------------------------------------------------------------------------------- 1 | #include "SkFontMgr.h" 2 | #include "SkTypeface_win.h" 3 | 4 | SkFontMgr* SkFontMgr::Factory() { 5 | return SkFontMgr_New_GDI(); 6 | } 7 | -------------------------------------------------------------------------------- /skia/src/ports/SkMemory_mozalloc.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * Copyright 2012 Mozilla Foundation 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #include "SkTypes.h" 10 | 11 | #include "mozilla/mozalloc.h" 12 | #include "mozilla/mozalloc_abort.h" 13 | #include "mozilla/mozalloc_oom.h" 14 | 15 | void sk_throw() { 16 | SkDEBUGFAIL("sk_throw"); 17 | mozalloc_abort("Abort from sk_throw"); 18 | } 19 | 20 | void sk_out_of_memory(void) { 21 | SkDEBUGFAIL("sk_out_of_memory"); 22 | mozalloc_handle_oom(0); 23 | } 24 | 25 | void* sk_malloc_throw(size_t size) { 26 | return sk_malloc_flags(size, SK_MALLOC_THROW); 27 | } 28 | 29 | void* sk_realloc_throw(void* addr, size_t size) { 30 | return moz_xrealloc(addr, size); 31 | } 32 | 33 | void sk_free(void* p) { 34 | moz_free(p); 35 | } 36 | 37 | void* sk_malloc_flags(size_t size, unsigned flags) { 38 | return (flags & SK_MALLOC_THROW) ? moz_xmalloc(size) : moz_malloc(size); 39 | } 40 | 41 | void* sk_calloc(size_t size) { 42 | return moz_calloc(size, 1); 43 | } 44 | 45 | void* sk_calloc_throw(size_t size) { 46 | return moz_xcalloc(size, 1); 47 | } 48 | -------------------------------------------------------------------------------- /skia/src/ports/SkMutex_none.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkMutex_none_DEFINED 9 | #define SkMutex_none_DEFINED 10 | 11 | /** Non-mutex mutex for uniprocessor systems. */ 12 | 13 | struct SkBaseMutex { 14 | void acquire() { } 15 | void release() { } 16 | }; 17 | 18 | class SkMutex : public SkBaseMutex { 19 | public: 20 | SkMutex() { } 21 | ~SkMutex() { } 22 | 23 | private: 24 | SkMutex(const SkMutex&); 25 | SkMutex& operator=(const SkMutex&); 26 | }; 27 | 28 | // Using POD-style initialization prevents the generation of a static initializer. 29 | #define SK_DECLARE_STATIC_MUTEX(name) static SkBaseMutex name = { } 30 | 31 | // Special case used when the static mutex must be available globally. 32 | #define SK_DECLARE_GLOBAL_MUTEX(name) SkBaseMutex name = { } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /skia/src/ports/SkOSFile_none.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkOSFile.h" 9 | 10 | bool sk_fidentical(SkFILE* a, SkFILE* b) { 11 | return false; 12 | } 13 | 14 | int sk_fileno(SkFILE* f) { 15 | return -1; 16 | } 17 | 18 | void sk_fmunmap(const void* addr, size_t length) { } 19 | 20 | void* sk_fdmmap(int fd, size_t* size) { 21 | return NULL; 22 | } 23 | 24 | void* sk_fmmap(SkFILE* f, size_t* size) { 25 | return NULL; 26 | } 27 | -------------------------------------------------------------------------------- /skia/src/ports/SkPurgeableMemoryBlock_none.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkPurgeableMemoryBlock.h" 9 | 10 | bool SkPurgeableMemoryBlock::IsSupported() { 11 | return false; 12 | } 13 | 14 | #ifdef SK_DEBUG 15 | bool SkPurgeableMemoryBlock::PlatformSupportsPurgingAllUnpinnedBlocks() { 16 | return false; 17 | } 18 | 19 | bool SkPurgeableMemoryBlock::PurgeAllUnpinnedBlocks() { 20 | return false; 21 | } 22 | 23 | bool SkPurgeableMemoryBlock::purge() { 24 | return false; 25 | } 26 | #endif 27 | 28 | SkPurgeableMemoryBlock::SkPurgeableMemoryBlock(size_t size) { 29 | SkASSERT(false); 30 | } 31 | 32 | SkPurgeableMemoryBlock::~SkPurgeableMemoryBlock() { 33 | } 34 | 35 | void* SkPurgeableMemoryBlock::pin(SkPurgeableMemoryBlock::PinResult*) { 36 | return NULL; 37 | } 38 | 39 | void SkPurgeableMemoryBlock::unpin() { 40 | } 41 | -------------------------------------------------------------------------------- /skia/src/ports/SkTLS_none.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkTLS.h" 9 | 10 | static void* gSpecific = NULL; 11 | 12 | void* SkTLS::PlatformGetSpecific(bool) { 13 | return gSpecific; 14 | } 15 | 16 | void SkTLS::PlatformSetSpecific(void* ptr) { 17 | gSpecific = ptr; 18 | } 19 | -------------------------------------------------------------------------------- /skia/src/ports/SkTLS_pthread.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkTLS.h" 9 | 10 | #include 11 | 12 | static pthread_key_t gSkTLSKey; 13 | static pthread_once_t gSkTLSKey_Once = PTHREAD_ONCE_INIT; 14 | 15 | static void sk_tls_make_key() { 16 | (void)pthread_key_create(&gSkTLSKey, SkTLS::Destructor); 17 | } 18 | 19 | void* SkTLS::PlatformGetSpecific(bool forceCreateTheSlot) { 20 | // should we use forceCreateTheSlot to potentially skip calling pthread_once 21 | // and just return NULL if we've never been called with 22 | // forceCreateTheSlot==true ? 23 | 24 | (void)pthread_once(&gSkTLSKey_Once, sk_tls_make_key); 25 | return pthread_getspecific(gSkTLSKey); 26 | } 27 | 28 | void SkTLS::PlatformSetSpecific(void* ptr) { 29 | (void)pthread_setspecific(gSkTLSKey, ptr); 30 | } 31 | -------------------------------------------------------------------------------- /skia/src/ports/SkTime_Unix.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2006 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTime.h" 11 | 12 | #include 13 | #include 14 | 15 | void SkTime::GetDateTime(DateTime* dt) 16 | { 17 | if (dt) 18 | { 19 | time_t m_time; 20 | time(&m_time); 21 | struct tm* tstruct; 22 | tstruct = localtime(&m_time); 23 | 24 | dt->fYear = tstruct->tm_year; 25 | dt->fMonth = SkToU8(tstruct->tm_mon + 1); 26 | dt->fDayOfWeek = SkToU8(tstruct->tm_wday); 27 | dt->fDay = SkToU8(tstruct->tm_mday); 28 | dt->fHour = SkToU8(tstruct->tm_hour); 29 | dt->fMinute = SkToU8(tstruct->tm_min); 30 | dt->fSecond = SkToU8(tstruct->tm_sec); 31 | } 32 | } 33 | 34 | SkMSec SkTime::GetMSecs() 35 | { 36 | struct timeval tv; 37 | gettimeofday(&tv, NULL); 38 | return (SkMSec) (tv.tv_sec * 1000 + tv.tv_usec / 1000 ); // microseconds to milliseconds 39 | } 40 | -------------------------------------------------------------------------------- /skia/src/ports/SkTime_win.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2009 The Android Open Source Project 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #include "SkTime.h" 11 | 12 | void SkTime::GetDateTime(DateTime* dt) 13 | { 14 | if (dt) 15 | { 16 | SYSTEMTIME st; 17 | GetSystemTime(&st); 18 | 19 | dt->fYear = st.wYear; 20 | dt->fMonth = SkToU8(st.wMonth + 1); 21 | dt->fDayOfWeek = SkToU8(st.wDayOfWeek); 22 | dt->fDay = SkToU8(st.wDay); 23 | dt->fHour = SkToU8(st.wHour); 24 | dt->fMinute = SkToU8(st.wMinute); 25 | dt->fSecond = SkToU8(st.wSecond); 26 | } 27 | } 28 | 29 | SkMSec SkTime::GetMSecs() 30 | { 31 | FILETIME ft; 32 | LARGE_INTEGER li; 33 | GetSystemTimeAsFileTime(&ft); 34 | li.LowPart = ft.dwLowDateTime; 35 | li.HighPart = ft.dwHighDateTime; 36 | __int64 t = li.QuadPart; /* In 100-nanosecond intervals */ 37 | return (SkMSec)(t / 10000); /* In milliseconds */ 38 | } 39 | -------------------------------------------------------------------------------- /skia/src/ports/SkXMLParser_empty.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkXMLParser.h" 9 | 10 | bool SkXMLParser::parse(SkStream& docStream) 11 | { 12 | return false; 13 | } 14 | 15 | bool SkXMLParser::parse(const char doc[], size_t len) 16 | { 17 | return false; 18 | } 19 | 20 | void SkXMLParser::GetNativeErrorString(int error, SkString* str) 21 | { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /skia/src/sfnt/SkOTTable_loca.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkOTTable_loca_DEFINED 9 | #define SkOTTable_loca_DEFINED 10 | 11 | #include "SkEndian.h" 12 | #include "SkOTTableTypes.h" 13 | 14 | #pragma pack(push, 1) 15 | 16 | struct SkOTTableIndexToLocation { 17 | static const SK_OT_CHAR TAG0 = 'l'; 18 | static const SK_OT_CHAR TAG1 = 'o'; 19 | static const SK_OT_CHAR TAG2 = 'c'; 20 | static const SK_OT_CHAR TAG3 = 'a'; 21 | static const SK_OT_ULONG TAG = SkOTTableTAG::value; 22 | 23 | union Offsets { 24 | SK_OT_USHORT shortOffset[1]; 25 | SK_OT_ULONG longOffset[1]; 26 | } offsets; 27 | }; 28 | 29 | #pragma pack(pop) 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /skia/src/sfnt/SkOTTable_maxp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkOTTable_maxp_DEFINED 9 | #define SkOTTable_maxp_DEFINED 10 | 11 | #include "SkOTTableTypes.h" 12 | #include "SkOTTable_maxp_CFF.h" 13 | #include "SkOTTable_maxp_TT.h" 14 | 15 | #pragma pack(push, 1) 16 | 17 | struct SkOTTableMaximumProfile { 18 | static const SK_OT_CHAR TAG0 = 'm'; 19 | static const SK_OT_CHAR TAG1 = 'a'; 20 | static const SK_OT_CHAR TAG2 = 'x'; 21 | static const SK_OT_CHAR TAG3 = 'p'; 22 | static const SK_OT_ULONG TAG = SkOTTableTAG::value; 23 | 24 | union Version { 25 | SK_OT_Fixed version; 26 | 27 | struct CFF : SkOTTableMaximumProfile_CFF { } cff; 28 | struct TT : SkOTTableMaximumProfile_TT { } tt; 29 | } version; 30 | }; 31 | 32 | #pragma pack(pop) 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /skia/src/sfnt/SkOTTable_maxp_CFF.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkOTTable_maxp_CFF_DEFINED 9 | #define SkOTTable_maxp_CFF_DEFINED 10 | 11 | #include "SkEndian.h" 12 | #include "SkOTTableTypes.h" 13 | 14 | #pragma pack(push, 1) 15 | 16 | struct SkOTTableMaximumProfile_CFF { 17 | SK_OT_Fixed version; 18 | static const SK_OT_Fixed VERSION = SkTEndian_SwapBE32(0x00005000); 19 | 20 | SK_OT_USHORT numGlyphs; 21 | }; 22 | 23 | #pragma pack(pop) 24 | 25 | 26 | #include 27 | SK_COMPILE_ASSERT(offsetof(SkOTTableMaximumProfile_CFF, numGlyphs) == 4, SkOTTableHead_glyphDataFormat_not_at_2); 28 | SK_COMPILE_ASSERT(sizeof(SkOTTableMaximumProfile_CFF) == 6, sizeof_SkOTTableHead_not_4); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /skia/src/sfnt/SkOTTable_name.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bonescreater/bones/618ced87a9a2061b0a7879be32b2fea263880f1b/skia/src/sfnt/SkOTTable_name.cpp -------------------------------------------------------------------------------- /skia/src/utils/SkBase64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 The Android Open Source Project 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkBase64_DEFINED 9 | #define SkBase64_DEFINED 10 | 11 | #include "SkTypes.h" 12 | 13 | struct SkBase64 { 14 | public: 15 | enum Error { 16 | kNoError, 17 | kPadError, 18 | kBadCharError 19 | }; 20 | 21 | SkBase64(); 22 | Error decode(const char* src, size_t length); 23 | char* getData() { return fData; } 24 | /** 25 | Base64 encodes src into dst. encode is a pointer to at least 65 chars. 26 | encode[64] will be used as the pad character. Encodings other than the 27 | default encoding cannot be decoded. 28 | */ 29 | static size_t Encode(const void* src, size_t length, void* dest, const char* encode = NULL); 30 | 31 | private: 32 | Error decode(const void* srcPtr, size_t length, bool writeDestination); 33 | 34 | size_t fLength; 35 | char* fData; 36 | friend class SkImageBaseBitmap; 37 | }; 38 | 39 | #endif // SkBase64_DEFINED 40 | -------------------------------------------------------------------------------- /skia/src/utils/SkBitmapHasher.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2012 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | #ifndef SkBitmapHasher_DEFINED 10 | #define SkBitmapHasher_DEFINED 11 | 12 | #include "SkBitmap.h" 13 | 14 | /** 15 | * Static class that generates a uint64 hash digest from an SkBitmap. 16 | */ 17 | class SkBitmapHasher { 18 | public: 19 | /** 20 | * Fills in "result" with a hash of the pixels in this bitmap. 21 | * 22 | * If this is unable to compute the hash for some reason, 23 | * it returns false. 24 | * 25 | * Note: depending on the bitmap config, we may need to create an 26 | * intermediate SkBitmap and copy the pixels over to it... so in some 27 | * cases, performance and memory usage can suffer. 28 | */ 29 | static bool ComputeDigest(const SkBitmap& bitmap, uint64_t *result); 30 | 31 | private: 32 | static bool ComputeDigestInternal(const SkBitmap& bitmap, uint64_t *result); 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /skia/src/utils/SkCountdown.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkCountdown.h" 9 | #include "SkThread.h" 10 | 11 | SkCountdown::SkCountdown(int32_t count) 12 | : fCount(count) {} 13 | 14 | void SkCountdown::reset(int32_t count) { 15 | fCount = count; 16 | } 17 | 18 | void SkCountdown::run() { 19 | if (sk_atomic_dec(&fCount) == 1) { 20 | fReady.lock(); 21 | fReady.signal(); 22 | fReady.unlock(); 23 | } 24 | } 25 | 26 | void SkCountdown::wait() { 27 | fReady.lock(); 28 | while (fCount > 0) { 29 | fReady.wait(); 30 | } 31 | fReady.unlock(); 32 | } 33 | -------------------------------------------------------------------------------- /skia/src/utils/SkGatherPixelRefsAndRects.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkGatherPixelRefsAndRects.h" 9 | #include "SkNoSaveLayerCanvas.h" 10 | #include "SkPictureUtils.h" 11 | 12 | void SkPictureUtils::GatherPixelRefsAndRects(SkPicture* pict, 13 | SkPictureUtils::SkPixelRefContainer* prCont) { 14 | if (0 == pict->width() || 0 == pict->height()) { 15 | return ; 16 | } 17 | 18 | SkGatherPixelRefsAndRectsDevice device(pict->width(), pict->height(), prCont); 19 | SkNoSaveLayerCanvas canvas(&device); 20 | 21 | canvas.clipRect(SkRect::MakeWH(SkIntToScalar(pict->width()), 22 | SkIntToScalar(pict->height())), 23 | SkRegion::kIntersect_Op, false); 24 | canvas.drawPicture(*pict); 25 | } 26 | -------------------------------------------------------------------------------- /skia/src/utils/SkNullCanvas.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkNullCanvas.h" 9 | 10 | #include "SkCanvas.h" 11 | #include "SkNWayCanvas.h" 12 | 13 | 14 | SkCanvas* SkCreateNullCanvas() { 15 | // An N-Way canvas forwards calls to N canvas's. When N == 0 it's 16 | // effectively a null canvas. 17 | return SkNEW_ARGS(SkNWayCanvas, (0,0)); 18 | } 19 | -------------------------------------------------------------------------------- /skia/src/utils/SkPDFRasterizer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | #ifndef SkPDFRasterizer_DEFINED 8 | #define SkPDFRasterizer_DEFINED 9 | 10 | #include "SkBitmap.h" 11 | #include "SkStream.h" 12 | 13 | #ifdef SK_BUILD_POPPLER 14 | bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output); 15 | #endif // SK_BUILD_POPPLER 16 | 17 | #ifdef SK_BUILD_NATIVE_PDF_RENDERER 18 | bool SkNativeRasterizePDF(SkStream* pdf, SkBitmap* output); 19 | #endif // SK_BUILD_NATIVE_PDF_RENDERER 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /skia/src/utils/SkThreadUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkThreadUtils_DEFINED 9 | #define SkThreadUtils_DEFINED 10 | 11 | #include "SkTypes.h" 12 | 13 | class SkThread : SkNoncopyable { 14 | public: 15 | typedef void (*entryPointProc)(void*); 16 | 17 | SkThread(entryPointProc entryPoint, void* data = NULL); 18 | 19 | /** 20 | * Non-virtual, do not subclass. 21 | */ 22 | ~SkThread(); 23 | 24 | /** 25 | * Starts the thread. Returns false if the thread could not be started. 26 | */ 27 | bool start(); 28 | 29 | /** 30 | * Waits for the thread to finish. 31 | * If the thread has not started, returns immediately. 32 | */ 33 | void join(); 34 | 35 | /** 36 | * SkThreads with an affinity for the same processor will attempt to run cache 37 | * locally with each other. SkThreads with an affinity for different processors 38 | * will attempt to run on different cores. Returns false if the request failed. 39 | */ 40 | bool setProcessorAffinity(unsigned int processor); 41 | 42 | private: 43 | void* fData; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /skia/src/utils/SkThreadUtils_pthread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkThreadUtils_PThreadData_DEFINED 9 | #define SkThreadUtils_PThreadData_DEFINED 10 | 11 | #include "SkThreadUtils.h" 12 | #include 13 | 14 | class PThreadEvent : SkNoncopyable { 15 | public: 16 | PThreadEvent(); 17 | ~PThreadEvent(); 18 | void trigger(); 19 | void wait(); 20 | bool isTriggered(); 21 | 22 | private: 23 | pthread_cond_t fCondition; 24 | pthread_mutex_t fConditionMutex; 25 | bool fConditionFlag; 26 | }; 27 | 28 | class SkThread_PThreadData : SkNoncopyable { 29 | public: 30 | SkThread_PThreadData(SkThread::entryPointProc entryPoint, void* data); 31 | ~SkThread_PThreadData(); 32 | pthread_t fPThread; 33 | bool fValidPThread; 34 | PThreadEvent fStarted; 35 | PThreadEvent fCanceled; 36 | 37 | pthread_attr_t fAttr; 38 | 39 | void* fParam; 40 | SkThread::entryPointProc fEntryPoint; 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /skia/src/utils/SkThreadUtils_pthread_mach.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkThreadUtils.h" 9 | #include "SkThreadUtils_pthread.h" 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | bool SkThread::setProcessorAffinity(unsigned int processor) { 16 | SkThread_PThreadData* pthreadData = static_cast(fData); 17 | if (!pthreadData->fValidPThread) { 18 | return false; 19 | } 20 | 21 | mach_port_t tid = pthread_mach_thread_np(pthreadData->fPThread); 22 | 23 | thread_affinity_policy_data_t policy; 24 | policy.affinity_tag = processor; 25 | 26 | return 0 == thread_policy_set(tid, 27 | THREAD_AFFINITY_POLICY, 28 | (thread_policy_t) &policy, 29 | THREAD_AFFINITY_POLICY_COUNT); 30 | } 31 | -------------------------------------------------------------------------------- /skia/src/utils/SkThreadUtils_pthread_other.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkThreadUtils.h" 9 | 10 | bool SkThread::setProcessorAffinity(unsigned int processor) { 11 | return false; 12 | } 13 | -------------------------------------------------------------------------------- /skia/src/utils/SkThreadUtils_win.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #ifndef SkThreadUtils_WinData_DEFINED 9 | #define SkThreadUtils_WinData_DEFINED 10 | 11 | #include "SkTypes.h" 12 | 13 | #include "SkThreadUtils.h" 14 | 15 | class SkThread_WinData : SkNoncopyable { 16 | public: 17 | SkThread_WinData(SkThread::entryPointProc entryPoint, void* data); 18 | ~SkThread_WinData(); 19 | HANDLE fHandle; 20 | HANDLE fCancelEvent; 21 | 22 | LPVOID fParam; 23 | DWORD fThreadId; 24 | SkThread::entryPointProc fEntryPoint; 25 | bool fStarted; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /skia/src/utils/win/SkAutoCoInitialize.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2011 Google Inc. 4 | * 5 | * Use of this source code is governed by a BSD-style license that can be 6 | * found in the LICENSE file. 7 | */ 8 | 9 | 10 | #define WIN32_LEAN_AND_MEAN 11 | #include 12 | #include 13 | #include "SkAutoCoInitialize.h" 14 | 15 | SkAutoCoInitialize::SkAutoCoInitialize() : 16 | fHR( 17 | CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE) 18 | ) 19 | { } 20 | 21 | SkAutoCoInitialize::~SkAutoCoInitialize() { 22 | if (SUCCEEDED(this->fHR)) { 23 | CoUninitialize(); 24 | } 25 | } 26 | 27 | bool SkAutoCoInitialize::succeeded() { 28 | return SUCCEEDED(this->fHR) || RPC_E_CHANGED_MODE == this->fHR; 29 | } 30 | -------------------------------------------------------------------------------- /skia/src/utils/win/SkDWrite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkTemplates.h" 9 | 10 | #include 11 | 12 | class SkString; 13 | 14 | //////////////////////////////////////////////////////////////////////////////// 15 | // Factory 16 | 17 | IDWriteFactory* sk_get_dwrite_factory(); 18 | 19 | //////////////////////////////////////////////////////////////////////////////// 20 | // String conversion 21 | 22 | /** Prefer to use this type to prevent template proliferation. */ 23 | typedef SkAutoSTMalloc<16, WCHAR> SkSMallocWCHAR; 24 | 25 | /** Converts a utf8 string to a WCHAR string. */ 26 | HRESULT sk_cstring_to_wchar(const char* skname, SkSMallocWCHAR* name); 27 | 28 | /** Converts a WCHAR string to a utf8 string. */ 29 | HRESULT sk_wchar_to_skstring(WCHAR* name, SkString* skname); 30 | 31 | //////////////////////////////////////////////////////////////////////////////// 32 | // Locale 33 | 34 | void sk_get_locale_string(IDWriteLocalizedStrings* names, const WCHAR* preferedLocale, 35 | SkString* skname); 36 | 37 | typedef decltype(GetUserDefaultLocaleName)* SkGetUserDefaultLocaleNameProc; 38 | HRESULT SkGetGetUserDefaultLocaleNameProc(SkGetUserDefaultLocaleNameProc* proc); 39 | -------------------------------------------------------------------------------- /skia/src/utils/win/SkHRESULT.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | #include "SkTypes.h" 9 | 10 | #include "SkHRESULT.h" 11 | 12 | void SkTraceHR(const char* file, unsigned long line, 13 | HRESULT hr, const char* msg) { 14 | SkDEBUGCODE(if (NULL != msg) SkDEBUGF(("%s\n", msg))); 15 | SkDEBUGF(("%s(%lu) : error 0x%x: ", file, line, hr)); 16 | 17 | LPSTR errorText = NULL; 18 | FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | 19 | FORMAT_MESSAGE_FROM_SYSTEM | 20 | FORMAT_MESSAGE_IGNORE_INSERTS, 21 | NULL, 22 | hr, 23 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 24 | (LPSTR) &errorText, 25 | 0, 26 | NULL 27 | ); 28 | 29 | if (NULL == errorText) { 30 | SkDEBUGF(("\n")); 31 | } else { 32 | SkDEBUGF(("%s", errorText)); 33 | LocalFree(errorText); 34 | errorText = NULL; 35 | } 36 | } 37 | --------------------------------------------------------------------------------