summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/android_builds.yml26
-rw-r--r--.github/workflows/linux_builds.yml4
-rw-r--r--.github/workflows/macos_builds.yml2
-rw-r--r--.github/workflows/windows_builds.yml2
-rw-r--r--core/project_settings.cpp27
-rw-r--r--core/script_language.h1
-rw-r--r--core/variant.h11
-rw-r--r--core/variant_call.cpp52
-rw-r--r--doc/classes/BaseButton.xml6
-rw-r--r--doc/classes/ButtonGroup.xml2
-rw-r--r--doc/classes/ColorRect.xml2
-rw-r--r--doc/classes/Gradient.xml14
-rw-r--r--doc/classes/ReferenceRect.xml5
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp10
-rw-r--r--editor/editor_node.cpp1
-rw-r--r--editor/editor_properties.cpp2
-rw-r--r--editor/icons/PaintVertex.svg1
-rw-r--r--editor/icons/Rectangle.svg1
-rw-r--r--editor/icons/RectangleShape2D.svg2
-rw-r--r--editor/icons/UnpaintVertex.svg1
-rw-r--r--editor/plugins/gradient_editor_plugin.h8
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp2
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp13
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp6
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp4
-rwxr-xr-xmisc/ci/android-tools-linux.sh108
-rw-r--r--modules/gdnative/xr/config.py6
-rw-r--r--modules/gdscript/gdscript_editor.cpp8
-rw-r--r--modules/gridmap/grid_map.cpp2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs65
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/BottomPanel.cs339
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs (renamed from modules/mono/editor/GodotTools/GodotTools/BuildInfo.cs)10
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs (renamed from modules/mono/editor/GodotTools/GodotTools/BuildManager.cs)123
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs (renamed from modules/mono/editor/GodotTools/GodotTools/BuildTab.cs)212
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildResult.cs8
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs42
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs165
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs6
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs9
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs46
-rw-r--r--platform/android/export/export.cpp2
-rw-r--r--scene/2d/animated_sprite_2d.cpp41
-rw-r--r--scene/2d/animated_sprite_2d.h43
-rw-r--r--scene/2d/cpu_particles_2d.cpp20
-rw-r--r--scene/2d/cpu_particles_2d.h4
-rw-r--r--scene/2d/gpu_particles_2d.cpp19
-rw-r--r--scene/2d/gpu_particles_2d.h4
-rw-r--r--scene/2d/light_2d.cpp14
-rw-r--r--scene/2d/light_2d.h4
-rw-r--r--scene/2d/line_2d.cpp2
-rw-r--r--scene/2d/mesh_instance_2d.cpp2
-rw-r--r--scene/2d/multimesh_instance_2d.cpp2
-rw-r--r--scene/2d/polygon_2d.cpp58
-rw-r--r--scene/2d/polygon_2d.h16
-rw-r--r--scene/2d/sprite_2d.cpp57
-rw-r--r--scene/2d/sprite_2d.h14
-rw-r--r--scene/2d/tile_map.cpp5
-rw-r--r--scene/gui/base_button.cpp2
-rw-r--r--scene/gui/code_edit.cpp5
-rw-r--r--scene/gui/reference_rect.cpp20
-rw-r--r--scene/gui/reference_rect.h11
-rw-r--r--scene/gui/text_edit.cpp96
-rw-r--r--scene/gui/text_edit.h27
-rw-r--r--scene/main/canvas_item.cpp245
-rw-r--r--scene/main/canvas_item.h70
-rw-r--r--scene/main/viewport.cpp59
-rw-r--r--scene/main/viewport.h3
-rw-r--r--scene/register_scene_types.cpp1
-rw-r--r--scene/resources/dynamic_font.cpp2
-rw-r--r--scene/resources/font.cpp2
-rw-r--r--scene/resources/gradient.cpp20
-rw-r--r--scene/resources/style_box.cpp23
-rw-r--r--scene/resources/style_box.h4
-rw-r--r--scene/resources/texture.cpp115
-rw-r--r--scene/resources/texture.h36
-rw-r--r--scene/resources/tile_set.cpp18
-rw-r--r--scene/resources/tile_set.h4
-rw-r--r--servers/rendering/rasterizer.h98
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp839
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h145
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp4
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp233
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.h49
-rw-r--r--servers/rendering/rasterizer_rd/shaders/canvas.glsl57
-rw-r--r--servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl14
-rw-r--r--servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl93
-rw-r--r--servers/rendering/rasterizer_rd/shaders/tonemap.glsl5
-rw-r--r--servers/rendering/rendering_server_canvas.cpp151
-rw-r--r--servers/rendering/rendering_server_canvas.h42
-rw-r--r--servers/rendering/rendering_server_raster.h37
-rw-r--r--servers/rendering/rendering_server_viewport.cpp20
-rw-r--r--servers/rendering/rendering_server_viewport.h6
-rw-r--r--servers/rendering/rendering_server_wrap_mt.h37
-rw-r--r--servers/rendering_server.cpp3
-rw-r--r--servers/rendering_server.h83
-rw-r--r--thirdparty/README.md2
-rw-r--r--thirdparty/freetype/include/freetype/config/ftconfig.h530
-rw-r--r--thirdparty/freetype/include/freetype/config/ftheader.h62
-rw-r--r--thirdparty/freetype/include/freetype/config/ftmodule.h2
-rw-r--r--thirdparty/freetype/include/freetype/config/ftoption.h10
-rw-r--r--thirdparty/freetype/include/freetype/config/integer-types.h245
-rw-r--r--thirdparty/freetype/include/freetype/config/mac-support.h49
-rw-r--r--thirdparty/freetype/include/freetype/config/public-macros.h120
-rw-r--r--thirdparty/freetype/include/freetype/freetype.h49
-rw-r--r--thirdparty/freetype/include/freetype/ftadvanc.h4
-rw-r--r--thirdparty/freetype/include/freetype/ftbbox.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftbdf.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftbitmap.h5
-rw-r--r--thirdparty/freetype/include/freetype/ftbzip2.h22
-rw-r--r--thirdparty/freetype/include/freetype/ftcache.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftcid.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftcolor.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftdriver.h9
-rw-r--r--thirdparty/freetype/include/freetype/fterrors.h21
-rw-r--r--thirdparty/freetype/include/freetype/ftfntfmt.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftgasp.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftglyph.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftgxval.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftgzip.h22
-rw-r--r--thirdparty/freetype/include/freetype/ftimage.h39
-rw-r--r--thirdparty/freetype/include/freetype/ftincrem.h5
-rw-r--r--thirdparty/freetype/include/freetype/ftlcdfil.h32
-rw-r--r--thirdparty/freetype/include/freetype/ftlist.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftlzw.h22
-rw-r--r--thirdparty/freetype/include/freetype/ftmac.h1
-rw-r--r--thirdparty/freetype/include/freetype/ftmm.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftmodapi.h7
-rw-r--r--thirdparty/freetype/include/freetype/ftmoderr.h2
-rw-r--r--thirdparty/freetype/include/freetype/ftotval.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftoutln.h19
-rw-r--r--thirdparty/freetype/include/freetype/ftparams.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftpfr.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftrender.h5
-rw-r--r--thirdparty/freetype/include/freetype/ftsizes.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftsnames.h5
-rw-r--r--thirdparty/freetype/include/freetype/ftstroke.h7
-rw-r--r--thirdparty/freetype/include/freetype/ftsynth.h3
-rw-r--r--thirdparty/freetype/include/freetype/ftsystem.h1
-rw-r--r--thirdparty/freetype/include/freetype/fttrigon.h2
-rw-r--r--thirdparty/freetype/include/freetype/fttypes.h4
-rw-r--r--thirdparty/freetype/include/freetype/ftwinfnt.h3
-rw-r--r--thirdparty/freetype/include/freetype/internal/autohint.h6
-rw-r--r--thirdparty/freetype/include/freetype/internal/cffotypes.h11
-rw-r--r--thirdparty/freetype/include/freetype/internal/cfftypes.h13
-rw-r--r--thirdparty/freetype/include/freetype/internal/compiler-macros.h307
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftcalc.h7
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftdebug.h6
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftdrv.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftgloadr.h5
-rw-r--r--thirdparty/freetype/include/freetype/internal/fthash.h3
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftmemory.h5
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftobjs.h31
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftpsprop.h3
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftrfork.h3
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftserv.h28
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftstream.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/ftvalid.h3
-rw-r--r--thirdparty/freetype/include/freetype/internal/psaux.h15
-rw-r--r--thirdparty/freetype/include/freetype/internal/pshints.h5
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svbdf.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svcfftl.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svcid.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svfntfmt.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svgldict.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svgxval.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svkern.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svmetric.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svmm.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svotval.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svpfr.h5
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svpostnm.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svpscmap.h2
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svpsinfo.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svsfnt.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svttcmap.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svtteng.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svttglyf.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/services/svwinfnt.h4
-rw-r--r--thirdparty/freetype/include/freetype/internal/sfnt.h7
-rw-r--r--thirdparty/freetype/include/freetype/internal/t1types.h11
-rw-r--r--thirdparty/freetype/include/freetype/internal/tttypes.h9
-rw-r--r--thirdparty/freetype/include/freetype/internal/wofftypes.h5
-rw-r--r--thirdparty/freetype/include/freetype/t1tables.h3
-rw-r--r--thirdparty/freetype/include/freetype/ttnameid.h1
-rw-r--r--thirdparty/freetype/include/freetype/tttables.h3
-rw-r--r--thirdparty/freetype/include/freetype/tttags.h3
-rw-r--r--thirdparty/freetype/include/ft2build.h8
-rw-r--r--thirdparty/freetype/src/autofit/afblue.c53
-rw-r--r--thirdparty/freetype/src/autofit/afblue.dat64
-rw-r--r--thirdparty/freetype/src/autofit/afblue.h166
-rw-r--r--thirdparty/freetype/src/autofit/afcjk.c21
-rw-r--r--thirdparty/freetype/src/autofit/aferrors.h4
-rw-r--r--thirdparty/freetype/src/autofit/afglobal.c4
-rw-r--r--thirdparty/freetype/src/autofit/afhints.c4
-rw-r--r--thirdparty/freetype/src/autofit/aflatin.c55
-rw-r--r--thirdparty/freetype/src/autofit/aflatin2.c3
-rw-r--r--thirdparty/freetype/src/autofit/afloader.c2
-rw-r--r--thirdparty/freetype/src/autofit/afmodule.c14
-rw-r--r--thirdparty/freetype/src/autofit/afmodule.h6
-rw-r--r--thirdparty/freetype/src/autofit/afranges.c12
-rw-r--r--thirdparty/freetype/src/autofit/afscript.h6
-rw-r--r--thirdparty/freetype/src/autofit/afshaper.c5
-rw-r--r--thirdparty/freetype/src/autofit/afshaper.h3
-rw-r--r--thirdparty/freetype/src/autofit/afstyles.h7
-rw-r--r--thirdparty/freetype/src/autofit/aftypes.h9
-rw-r--r--thirdparty/freetype/src/autofit/autofit.c1
-rw-r--r--thirdparty/freetype/src/base/ftadvanc.c7
-rw-r--r--thirdparty/freetype/src/base/ftbase.c1
-rw-r--r--thirdparty/freetype/src/base/ftbase.h7
-rw-r--r--thirdparty/freetype/src/base/ftbbox.c15
-rw-r--r--thirdparty/freetype/src/base/ftbdf.c7
-rw-r--r--thirdparty/freetype/src/base/ftbitmap.c15
-rw-r--r--thirdparty/freetype/src/base/ftcalc.c11
-rw-r--r--thirdparty/freetype/src/base/ftcid.c7
-rw-r--r--thirdparty/freetype/src/base/ftcolor.c9
-rw-r--r--thirdparty/freetype/src/base/ftdbgmem.c10
-rw-r--r--thirdparty/freetype/src/base/ftdebug.c7
-rw-r--r--thirdparty/freetype/src/base/fterrors.c7
-rw-r--r--thirdparty/freetype/src/base/ftfntfmt.c7
-rw-r--r--thirdparty/freetype/src/base/ftfstype.c9
-rw-r--r--thirdparty/freetype/src/base/ftgasp.c5
-rw-r--r--thirdparty/freetype/src/base/ftgloadr.c10
-rw-r--r--thirdparty/freetype/src/base/ftglyph.c13
-rw-r--r--thirdparty/freetype/src/base/ftgxval.c7
-rw-r--r--thirdparty/freetype/src/base/fthash.c5
-rw-r--r--thirdparty/freetype/src/base/ftinit.c6
-rw-r--r--thirdparty/freetype/src/base/ftlcdfil.c9
-rw-r--r--thirdparty/freetype/src/base/ftmac.c7
-rw-r--r--thirdparty/freetype/src/base/ftmm.c11
-rw-r--r--thirdparty/freetype/src/base/ftobjs.c120
-rw-r--r--thirdparty/freetype/src/base/ftotval.c9
-rw-r--r--thirdparty/freetype/src/base/ftoutln.c18
-rw-r--r--thirdparty/freetype/src/base/ftpatent.c13
-rw-r--r--thirdparty/freetype/src/base/ftpfr.c7
-rw-r--r--thirdparty/freetype/src/base/ftpsprop.c11
-rw-r--r--thirdparty/freetype/src/base/ftrfork.c13
-rw-r--r--thirdparty/freetype/src/base/ftsnames.c9
-rw-r--r--thirdparty/freetype/src/base/ftstream.c5
-rw-r--r--thirdparty/freetype/src/base/ftstroke.c13
-rw-r--r--thirdparty/freetype/src/base/ftsynth.c13
-rw-r--r--thirdparty/freetype/src/base/ftsystem.c10
-rw-r--r--thirdparty/freetype/src/base/fttrigon.c7
-rw-r--r--thirdparty/freetype/src/base/fttype1.c9
-rw-r--r--thirdparty/freetype/src/base/ftutil.c9
-rw-r--r--thirdparty/freetype/src/base/ftver.rc4
-rw-r--r--thirdparty/freetype/src/base/ftwinfnt.c9
-rw-r--r--thirdparty/freetype/src/bdf/bdf.c1
-rw-r--r--thirdparty/freetype/src/bdf/bdf.h7
-rw-r--r--thirdparty/freetype/src/bdf/bdfdrivr.c44
-rw-r--r--thirdparty/freetype/src/bdf/bdfdrivr.h3
-rw-r--r--thirdparty/freetype/src/bdf/bdferror.h4
-rw-r--r--thirdparty/freetype/src/bdf/bdflib.c9
-rw-r--r--thirdparty/freetype/src/bzip2/ftbzip2.c13
-rw-r--r--thirdparty/freetype/src/cache/ftcache.c1
-rw-r--r--thirdparty/freetype/src/cache/ftcbasic.c15
-rw-r--r--thirdparty/freetype/src/cache/ftccache.c5
-rw-r--r--thirdparty/freetype/src/cache/ftccache.h2
-rw-r--r--thirdparty/freetype/src/cache/ftccback.h5
-rw-r--r--thirdparty/freetype/src/cache/ftccmap.c11
-rw-r--r--thirdparty/freetype/src/cache/ftcerror.h4
-rw-r--r--thirdparty/freetype/src/cache/ftcglyph.c7
-rw-r--r--thirdparty/freetype/src/cache/ftcglyph.h1
-rw-r--r--thirdparty/freetype/src/cache/ftcimage.c7
-rw-r--r--thirdparty/freetype/src/cache/ftcimage.h3
-rw-r--r--thirdparty/freetype/src/cache/ftcmanag.c9
-rw-r--r--thirdparty/freetype/src/cache/ftcmanag.h3
-rw-r--r--thirdparty/freetype/src/cache/ftcmru.c7
-rw-r--r--thirdparty/freetype/src/cache/ftcmru.h4
-rw-r--r--thirdparty/freetype/src/cache/ftcsbits.c9
-rw-r--r--thirdparty/freetype/src/cache/ftcsbits.h3
-rw-r--r--thirdparty/freetype/src/cff/cff.c1
-rw-r--r--thirdparty/freetype/src/cff/cffcmap.c3
-rw-r--r--thirdparty/freetype/src/cff/cffcmap.h6
-rw-r--r--thirdparty/freetype/src/cff/cffdrivr.c37
-rw-r--r--thirdparty/freetype/src/cff/cffdrivr.h3
-rw-r--r--thirdparty/freetype/src/cff/cfferrs.h4
-rw-r--r--thirdparty/freetype/src/cff/cffgload.c25
-rw-r--r--thirdparty/freetype/src/cff/cffgload.h5
-rw-r--r--thirdparty/freetype/src/cff/cffload.c58
-rw-r--r--thirdparty/freetype/src/cff/cffload.h5
-rw-r--r--thirdparty/freetype/src/cff/cffobjs.c93
-rw-r--r--thirdparty/freetype/src/cff/cffobjs.h1
-rw-r--r--thirdparty/freetype/src/cff/cffparse.c29
-rw-r--r--thirdparty/freetype/src/cff/cffparse.h5
-rw-r--r--thirdparty/freetype/src/cid/ciderrs.h4
-rw-r--r--thirdparty/freetype/src/cid/cidgload.c17
-rw-r--r--thirdparty/freetype/src/cid/cidgload.h1
-rw-r--r--thirdparty/freetype/src/cid/cidload.c16
-rw-r--r--thirdparty/freetype/src/cid/cidload.h3
-rw-r--r--thirdparty/freetype/src/cid/cidobjs.c16
-rw-r--r--thirdparty/freetype/src/cid/cidobjs.h4
-rw-r--r--thirdparty/freetype/src/cid/cidparse.c7
-rw-r--r--thirdparty/freetype/src/cid/cidparse.h7
-rw-r--r--thirdparty/freetype/src/cid/cidriver.c19
-rw-r--r--thirdparty/freetype/src/cid/cidriver.h3
-rw-r--r--thirdparty/freetype/src/cid/type1cid.c1
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvalid.c1
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvalid.h9
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvcommn.h5
-rw-r--r--thirdparty/freetype/src/gxvalid/gxverror.h4
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvjust.c2
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvkern.c4
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmod.c11
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmod.h3
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmort.h7
-rw-r--r--thirdparty/freetype/src/gxvalid/gxvmorx.h7
-rw-r--r--thirdparty/freetype/src/gzip/ftgzip.c13
-rw-r--r--thirdparty/freetype/src/lzw/ftlzw.c13
-rw-r--r--thirdparty/freetype/src/lzw/ftzopen.c6
-rw-r--r--thirdparty/freetype/src/lzw/ftzopen.h6
-rw-r--r--thirdparty/freetype/src/otvalid/otvalid.c1
-rw-r--r--thirdparty/freetype/src/otvalid/otvalid.h9
-rw-r--r--thirdparty/freetype/src/otvalid/otvcommn.h3
-rw-r--r--thirdparty/freetype/src/otvalid/otverror.h4
-rw-r--r--thirdparty/freetype/src/otvalid/otvmod.c11
-rw-r--r--thirdparty/freetype/src/otvalid/otvmod.h3
-rw-r--r--thirdparty/freetype/src/pcf/pcf.c1
-rw-r--r--thirdparty/freetype/src/pcf/pcf.h5
-rw-r--r--thirdparty/freetype/src/pcf/pcfdrivr.c36
-rw-r--r--thirdparty/freetype/src/pcf/pcfdrivr.h3
-rw-r--r--thirdparty/freetype/src/pcf/pcferror.h4
-rw-r--r--thirdparty/freetype/src/pcf/pcfread.c27
-rw-r--r--thirdparty/freetype/src/pcf/pcfread.h1
-rw-r--r--thirdparty/freetype/src/pcf/pcfutil.c1
-rw-r--r--thirdparty/freetype/src/pcf/pcfutil.h2
-rw-r--r--thirdparty/freetype/src/pfr/pfr.c1
-rw-r--r--thirdparty/freetype/src/pfr/pfrcmap.c3
-rw-r--r--thirdparty/freetype/src/pfr/pfrcmap.h3
-rw-r--r--thirdparty/freetype/src/pfr/pfrdrivr.c9
-rw-r--r--thirdparty/freetype/src/pfr/pfrdrivr.h3
-rw-r--r--thirdparty/freetype/src/pfr/pfrerror.h4
-rw-r--r--thirdparty/freetype/src/pfr/pfrgload.c6
-rw-r--r--thirdparty/freetype/src/pfr/pfrload.c4
-rw-r--r--thirdparty/freetype/src/pfr/pfrload.h2
-rw-r--r--thirdparty/freetype/src/pfr/pfrobjs.c8
-rw-r--r--thirdparty/freetype/src/pfr/pfrsbit.c6
-rw-r--r--thirdparty/freetype/src/pfr/pfrtypes.h3
-rw-r--r--thirdparty/freetype/src/psaux/afmparse.c7
-rw-r--r--thirdparty/freetype/src/psaux/afmparse.h3
-rw-r--r--thirdparty/freetype/src/psaux/cffdecode.c9
-rw-r--r--thirdparty/freetype/src/psaux/cffdecode.h3
-rw-r--r--thirdparty/freetype/src/psaux/psarrst.c2
-rw-r--r--thirdparty/freetype/src/psaux/psaux.c1
-rw-r--r--thirdparty/freetype/src/psaux/psauxerr.h4
-rw-r--r--thirdparty/freetype/src/psaux/psauxmod.c9
-rw-r--r--thirdparty/freetype/src/psaux/psauxmod.h19
-rw-r--r--thirdparty/freetype/src/psaux/psblues.c2
-rw-r--r--thirdparty/freetype/src/psaux/psconv.c5
-rw-r--r--thirdparty/freetype/src/psaux/psconv.h3
-rw-r--r--thirdparty/freetype/src/psaux/pserror.h5
-rw-r--r--thirdparty/freetype/src/psaux/psfont.c3
-rw-r--r--thirdparty/freetype/src/psaux/psfont.h2
-rw-r--r--thirdparty/freetype/src/psaux/psft.c8
-rw-r--r--thirdparty/freetype/src/psaux/psft.h6
-rw-r--r--thirdparty/freetype/src/psaux/pshints.c4
-rw-r--r--thirdparty/freetype/src/psaux/psintrp.c4
-rw-r--r--thirdparty/freetype/src/psaux/psobjs.c13
-rw-r--r--thirdparty/freetype/src/psaux/psobjs.h5
-rw-r--r--thirdparty/freetype/src/psaux/psread.c2
-rw-r--r--thirdparty/freetype/src/psaux/psstack.c14
-rw-r--r--thirdparty/freetype/src/psaux/psstack.h1
-rw-r--r--thirdparty/freetype/src/psaux/pstypes.h3
-rw-r--r--thirdparty/freetype/src/psaux/t1cmap.c2
-rw-r--r--thirdparty/freetype/src/psaux/t1cmap.h5
-rw-r--r--thirdparty/freetype/src/psaux/t1decode.c134
-rw-r--r--thirdparty/freetype/src/psaux/t1decode.h5
-rw-r--r--thirdparty/freetype/src/pshinter/pshalgo.c7
-rw-r--r--thirdparty/freetype/src/pshinter/pshglob.c7
-rw-r--r--thirdparty/freetype/src/pshinter/pshglob.h4
-rw-r--r--thirdparty/freetype/src/pshinter/pshinter.c1
-rw-r--r--thirdparty/freetype/src/pshinter/pshmod.c4
-rw-r--r--thirdparty/freetype/src/pshinter/pshmod.h3
-rw-r--r--thirdparty/freetype/src/pshinter/pshnterr.h4
-rw-r--r--thirdparty/freetype/src/pshinter/pshrec.c11
-rw-r--r--thirdparty/freetype/src/pshinter/pshrec.h3
-rw-r--r--thirdparty/freetype/src/psnames/psmodule.c7
-rw-r--r--thirdparty/freetype/src/psnames/psmodule.h3
-rw-r--r--thirdparty/freetype/src/psnames/psnamerr.h4
-rw-r--r--thirdparty/freetype/src/psnames/psnames.c1
-rw-r--r--thirdparty/freetype/src/raster/ftraster.c119
-rw-r--r--thirdparty/freetype/src/raster/ftraster.h3
-rw-r--r--thirdparty/freetype/src/raster/ftrend1.c7
-rw-r--r--thirdparty/freetype/src/raster/ftrend1.h3
-rw-r--r--thirdparty/freetype/src/raster/raster.c1
-rw-r--r--thirdparty/freetype/src/raster/rasterrs.h4
-rw-r--r--thirdparty/freetype/src/sfnt/pngshim.c28
-rw-r--r--thirdparty/freetype/src/sfnt/pngshim.h1
-rw-r--r--thirdparty/freetype/src/sfnt/sfdriver.c25
-rw-r--r--thirdparty/freetype/src/sfnt/sfdriver.h3
-rw-r--r--thirdparty/freetype/src/sfnt/sferrors.h4
-rw-r--r--thirdparty/freetype/src/sfnt/sfnt.c1
-rw-r--r--thirdparty/freetype/src/sfnt/sfobjs.c23
-rw-r--r--thirdparty/freetype/src/sfnt/sfobjs.h5
-rw-r--r--thirdparty/freetype/src/sfnt/sfwoff.c9
-rw-r--r--thirdparty/freetype/src/sfnt/sfwoff.h5
-rw-r--r--thirdparty/freetype/src/sfnt/sfwoff2.c107
-rw-r--r--thirdparty/freetype/src/sfnt/sfwoff2.h5
-rw-r--r--thirdparty/freetype/src/sfnt/ttbdf.c7
-rw-r--r--thirdparty/freetype/src/sfnt/ttbdf.h3
-rw-r--r--thirdparty/freetype/src/sfnt/ttcmap.c15
-rw-r--r--thirdparty/freetype/src/sfnt/ttcmap.h12
-rw-r--r--thirdparty/freetype/src/sfnt/ttcolr.c15
-rw-r--r--thirdparty/freetype/src/sfnt/ttcolr.h1
-rw-r--r--thirdparty/freetype/src/sfnt/ttcpal.c21
-rw-r--r--thirdparty/freetype/src/sfnt/ttcpal.h1
-rw-r--r--thirdparty/freetype/src/sfnt/ttkern.c7
-rw-r--r--thirdparty/freetype/src/sfnt/ttkern.h5
-rw-r--r--thirdparty/freetype/src/sfnt/ttload.c15
-rw-r--r--thirdparty/freetype/src/sfnt/ttload.h5
-rw-r--r--thirdparty/freetype/src/sfnt/ttmtx.c9
-rw-r--r--thirdparty/freetype/src/sfnt/ttmtx.h5
-rw-r--r--thirdparty/freetype/src/sfnt/ttpost.c11
-rw-r--r--thirdparty/freetype/src/sfnt/ttpost.h2
-rw-r--r--thirdparty/freetype/src/sfnt/ttsbit.c11
-rw-r--r--thirdparty/freetype/src/sfnt/ttsbit.h1
-rw-r--r--thirdparty/freetype/src/sfnt/woff2tags.c5
-rw-r--r--thirdparty/freetype/src/sfnt/woff2tags.h6
-rw-r--r--thirdparty/freetype/src/smooth/ftgrays.c11
-rw-r--r--thirdparty/freetype/src/smooth/ftgrays.h2
-rw-r--r--thirdparty/freetype/src/smooth/ftsmerrs.h4
-rw-r--r--thirdparty/freetype/src/smooth/ftsmooth.c697
-rw-r--r--thirdparty/freetype/src/smooth/ftsmooth.h7
-rw-r--r--thirdparty/freetype/src/smooth/module.mk4
-rw-r--r--thirdparty/freetype/src/smooth/smooth.c1
-rw-r--r--thirdparty/freetype/src/truetype/truetype.c1
-rw-r--r--thirdparty/freetype/src/truetype/ttdriver.c23
-rw-r--r--thirdparty/freetype/src/truetype/ttdriver.h3
-rw-r--r--thirdparty/freetype/src/truetype/tterrors.h4
-rw-r--r--thirdparty/freetype/src/truetype/ttgload.c49
-rw-r--r--thirdparty/freetype/src/truetype/ttgload.h1
-rw-r--r--thirdparty/freetype/src/truetype/ttgxvar.c16
-rw-r--r--thirdparty/freetype/src/truetype/ttgxvar.h1
-rw-r--r--thirdparty/freetype/src/truetype/ttinterp.c486
-rw-r--r--thirdparty/freetype/src/truetype/ttinterp.h3
-rw-r--r--thirdparty/freetype/src/truetype/ttobjs.c19
-rw-r--r--thirdparty/freetype/src/truetype/ttobjs.h5
-rw-r--r--thirdparty/freetype/src/truetype/ttpload.c25
-rw-r--r--thirdparty/freetype/src/truetype/ttpload.h3
-rw-r--r--thirdparty/freetype/src/truetype/ttsubpix.c15
-rw-r--r--thirdparty/freetype/src/truetype/ttsubpix.h1
-rw-r--r--thirdparty/freetype/src/type1/t1afm.c7
-rw-r--r--thirdparty/freetype/src/type1/t1afm.h3
-rw-r--r--thirdparty/freetype/src/type1/t1driver.c29
-rw-r--r--thirdparty/freetype/src/type1/t1driver.h3
-rw-r--r--thirdparty/freetype/src/type1/t1errors.h4
-rw-r--r--thirdparty/freetype/src/type1/t1gload.c17
-rw-r--r--thirdparty/freetype/src/type1/t1gload.h1
-rw-r--r--thirdparty/freetype/src/type1/t1load.c16
-rw-r--r--thirdparty/freetype/src/type1/t1load.h7
-rw-r--r--thirdparty/freetype/src/type1/t1objs.c19
-rw-r--r--thirdparty/freetype/src/type1/t1objs.h4
-rw-r--r--thirdparty/freetype/src/type1/t1parse.c7
-rw-r--r--thirdparty/freetype/src/type1/t1parse.h5
-rw-r--r--thirdparty/freetype/src/type1/type1.c1
-rw-r--r--thirdparty/freetype/src/type42/t42drivr.c10
-rw-r--r--thirdparty/freetype/src/type42/t42drivr.h3
-rw-r--r--thirdparty/freetype/src/type42/t42error.h4
-rw-r--r--thirdparty/freetype/src/type42/t42objs.c6
-rw-r--r--thirdparty/freetype/src/type42/t42objs.h15
-rw-r--r--thirdparty/freetype/src/type42/t42parse.c8
-rw-r--r--thirdparty/freetype/src/type42/t42parse.h2
-rw-r--r--thirdparty/freetype/src/type42/t42types.h9
-rw-r--r--thirdparty/freetype/src/type42/type42.c1
-rw-r--r--thirdparty/freetype/src/winfonts/fnterrs.h4
-rw-r--r--thirdparty/freetype/src/winfonts/winfnt.c15
-rw-r--r--thirdparty/freetype/src/winfonts/winfnt.h5
466 files changed, 5259 insertions, 5159 deletions
diff --git a/.github/workflows/android_builds.yml b/.github/workflows/android_builds.yml
index 3c1e6a6b72..3ce3765efc 100644
--- a/.github/workflows/android_builds.yml
+++ b/.github/workflows/android_builds.yml
@@ -23,20 +23,10 @@ jobs:
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
- # Install all packages (except scons)
- - name: Configure dependencies
- run: |
- sudo apt-get install openjdk-8-jdk
- echo 'JAVA_HOME=usr/lib/jvm/java-8-openjdk-amd64' >> $GITHUB_ENV
-
- - name: Install Android SDK and NDK
- run: |
- echo '/usr/lib/jvm/java-8-openjdk-amd64/jre/bin' >> $GITHUB_PATH
- java -version
- echo "ANDROID_HOME=$(pwd)/godot-dev/build-tools/android-sdk" >> $GITHUB_ENV
- echo "ANDROID_NDK_ROOT=$(pwd)/godot-dev/build-tools/android-ndk" >> $GITHUB_ENV
- misc/ci/android-tools-linux.sh
- source ~/.bashrc
+ - name: Set up Java 8
+ uses: actions/setup-java@v1
+ with:
+ java-version: 8
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
@@ -59,7 +49,6 @@ jobs:
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
- # You can test your matrix by printing the current Python version
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
@@ -70,8 +59,13 @@ jobs:
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
+ ANDROID_NDK_ROOT: /usr/local/lib/android/sdk/ndk-bundle
run: |
- scons target=release tools=no
+ scons target=release tools=no android_arch=armv7
+ scons target=release tools=no android_arch=arm64v8
+ cd platform/android/java
+ ./gradlew generateGodotTemplates
+ cd ../../..
ls -l bin/
- uses: actions/upload-artifact@v2
diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml
index 3dd1b755b8..b81c06e54d 100644
--- a/.github/workflows/linux_builds.yml
+++ b/.github/workflows/linux_builds.yml
@@ -98,7 +98,7 @@ jobs:
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
- id: linux-editor-cache
+ id: linux-sanitizers-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
@@ -191,7 +191,7 @@ jobs:
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
- scons target=release tools=no module_mono_enabled=yes mono_glue=no
+ scons target=release tools=no module_mono_enabled=yes mono_glue=no debug_symbols=no
ls -l bin/
- uses: actions/upload-artifact@v2
diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml
index 6a684872f2..5f9ad24ac7 100644
--- a/.github/workflows/macos_builds.yml
+++ b/.github/workflows/macos_builds.yml
@@ -104,7 +104,7 @@ jobs:
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
- scons target=release tools=no
+ scons target=release tools=no debug_symbols=no
ls -l bin/
- uses: actions/upload-artifact@v2
diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml
index 0af4d22b72..71a1b580b1 100644
--- a/.github/workflows/windows_builds.yml
+++ b/.github/workflows/windows_builds.yml
@@ -110,7 +110,7 @@ jobs:
env:
SCONS_CACHE: /.scons_cache/
run: |
- scons target=release tools=no
+ scons target=release tools=no debug_symbols=no
ls -l bin/
- uses: actions/upload-artifact@v2
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 90f56694c2..3829474626 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -629,19 +629,26 @@ Error ProjectSettings::_load_settings_text(const String &p_path) {
}
Error ProjectSettings::_load_settings_text_or_binary(const String &p_text_path, const String &p_bin_path) {
- // Attempt first to load the text-based project.godot file
- Error err_text = _load_settings_text(p_text_path);
- if (err_text == OK) {
+ // Attempt first to load the binary project.godot file.
+ Error err = _load_settings_binary(p_bin_path);
+ if (err == OK) {
+ return OK;
+ } else if (err != ERR_FILE_NOT_FOUND) {
+ // If the file exists but can't be loaded, we want to know it.
+ ERR_PRINT("Couldn't load file '" + p_bin_path + "', error code " + itos(err) + ".");
+ return err;
+ }
+
+ // Fallback to text-based project.godot file if binary was not found.
+ err = _load_settings_text(p_text_path);
+ if (err == OK) {
return OK;
- } else if (err_text != ERR_FILE_NOT_FOUND) {
- // If the text-based file exists but can't be loaded, we want to know it
- ERR_PRINT("Couldn't load file '" + p_text_path + "', error code " + itos(err_text) + ".");
- return err_text;
+ } else if (err != ERR_FILE_NOT_FOUND) {
+ ERR_PRINT("Couldn't load file '" + p_text_path + "', error code " + itos(err) + ".");
+ return err;
}
- // Fallback to binary project.binary file if text-based was not found
- Error err_bin = _load_settings_binary(p_bin_path);
- return err_bin;
+ return err;
}
int ProjectSettings::get_order(const String &p_name) const {
diff --git a/core/script_language.h b/core/script_language.h
index aa7014ed3e..a94c128932 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -255,6 +255,7 @@ struct ScriptCodeCompletionOption {
String insert_text;
Color font_color;
RES icon;
+ Variant default_value;
ScriptCodeCompletionOption() {}
diff --git a/core/variant.h b/core/variant.h
index 1f3ee8ec74..84e5427b21 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -415,6 +415,11 @@ public:
static void interpolate(const Variant &a, const Variant &b, float c, Variant &r_dst);
class InternalMethod {
+#ifdef DEBUG_ENABLED
+ protected:
+ StringName method_name;
+ Variant::Type base_type;
+#endif
public:
enum Flags {
FLAG_IS_CONST = 1,
@@ -430,6 +435,12 @@ public:
#ifdef DEBUG_ENABLED
virtual String get_argument_name(int p_arg) const = 0;
+ StringName get_name() const {
+ return method_name;
+ }
+ Variant::Type get_base_type() const {
+ return base_type;
+ }
#endif
virtual Vector<Variant> get_default_arguments() const = 0;
virtual void call(Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) = 0;
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 66c1987a58..6ffefccb67 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -111,13 +111,15 @@ struct _VariantCall {
InternalMethod(void (T::*p_method)(P...), const Vector<Variant> &p_default_args
#ifdef DEBUG_ENABLED
,
- const Vector<String> &p_arg_names
+ const Vector<String> &p_arg_names, const StringName &p_method_name, Variant::Type p_base_type
#endif
) {
method = p_method;
default_values = p_default_args;
#ifdef DEBUG_ENABLED
argument_names = p_arg_names;
+ method_name = p_method_name;
+ base_type = p_base_type;
#endif
}
};
@@ -175,13 +177,15 @@ struct _VariantCall {
InternalMethodR(R (T::*p_method)(P...), const Vector<Variant> &p_default_args
#ifdef DEBUG_ENABLED
,
- const Vector<String> &p_arg_names
+ const Vector<String> &p_arg_names, const StringName &p_method_name, Variant::Type p_base_type
#endif
) {
method = p_method;
default_values = p_default_args;
#ifdef DEBUG_ENABLED
argument_names = p_arg_names;
+ method_name = p_method_name;
+ base_type = p_base_type;
#endif
}
};
@@ -238,13 +242,15 @@ struct _VariantCall {
InternalMethodRC(R (T::*p_method)(P...) const, const Vector<Variant> &p_default_args
#ifdef DEBUG_ENABLED
,
- const Vector<String> &p_arg_names
+ const Vector<String> &p_arg_names, const StringName &p_method_name, Variant::Type p_base_type
#endif
) {
method = p_method;
default_values = p_default_args;
#ifdef DEBUG_ENABLED
argument_names = p_arg_names;
+ method_name = p_method_name;
+ base_type = p_base_type;
#endif
}
};
@@ -338,13 +344,15 @@ struct _VariantCall {
InternalMethodRS(R (*p_method)(T *, P...), const Vector<Variant> &p_default_args
#ifdef DEBUG_ENABLED
,
- const Vector<String> &p_arg_names
+ const Vector<String> &p_arg_names, const StringName &p_method_name, Variant::Type p_base_type
#endif
) {
method = p_method;
default_values = p_default_args;
#ifdef DEBUG_ENABLED
argument_names = p_arg_names;
+ method_name = p_method_name;
+ base_type = p_base_type;
#endif
}
};
@@ -397,7 +405,7 @@ struct _VariantCall {
InternalMethodVC(MethodVC p_method, uint32_t p_flags, const Vector<Variant::Type> &p_argument_types, const Variant::Type &p_return_type
#ifdef DEBUG_ENABLED
,
- const Vector<String> &p_arg_names
+ const Vector<String> &p_arg_names, const StringName &p_method_name, Variant::Type p_base_type
#endif
) {
methodvc = p_method;
@@ -406,6 +414,8 @@ struct _VariantCall {
base_flags = p_flags;
#ifdef DEBUG_ENABLED
argument_names = p_arg_names;
+ method_name = p_method_name;
+ base_type = p_base_type;
#endif
}
};
@@ -427,7 +437,7 @@ struct _VariantCall {
ERR_FAIL_COND(type_internal_methods[GetTypeInfo<T>::VARIANT_TYPE].has(p_name));
#endif
#ifdef DEBUG_ENABLED
- Variant::InternalMethod *m = memnew((InternalMethod<T, P...>)(p_method, p_default_args, p_argument_names));
+ Variant::InternalMethod *m = memnew((InternalMethod<T, P...>)(p_method, p_default_args, p_argument_names, p_name, GetTypeInfo<T>::VARIANT_TYPE));
#else
Variant::InternalMethod *m = memnew((InternalMethod<T, P...>)(p_method, p_default_args));
#endif
@@ -449,7 +459,7 @@ struct _VariantCall {
#endif
#ifdef DEBUG_ENABLED
- Variant::InternalMethod *m = memnew((InternalMethodRC<T, R, P...>)(p_method, p_default_args, p_argument_names));
+ Variant::InternalMethod *m = memnew((InternalMethodRC<T, R, P...>)(p_method, p_default_args, p_argument_names, p_name, GetTypeInfo<T>::VARIANT_TYPE));
#else
Variant::InternalMethod *m = memnew((InternalMethodRC<T, R, P...>)(p_method, p_default_args));
#endif
@@ -471,7 +481,7 @@ struct _VariantCall {
#endif
#ifdef DEBUG_ENABLED
- Variant::InternalMethod *m = memnew((InternalMethodR<T, R, P...>)(p_method, p_default_args, p_argument_names));
+ Variant::InternalMethod *m = memnew((InternalMethodR<T, R, P...>)(p_method, p_default_args, p_argument_names, p_name, GetTypeInfo<T>::VARIANT_TYPE));
#else
Variant::InternalMethod *m = memnew((InternalMethodR<T, R, P...>)(p_method, p_default_args));
#endif
@@ -504,7 +514,7 @@ struct _VariantCall {
#endif
#ifdef DEBUG_ENABLED
- Variant::InternalMethod *m = memnew((InternalMethodRS<T, R, P...>)(p_method, p_default_args, p_argument_names));
+ Variant::InternalMethod *m = memnew((InternalMethodRS<T, R, P...>)(p_method, p_default_args, p_argument_names, p_name, GetTypeInfo<T>::VARIANT_TYPE));
#else
Variant::InternalMethod *m = memnew((InternalMethodRS<T, R, P...>)(p_method, p_default_args));
#endif
@@ -527,7 +537,7 @@ struct _VariantCall {
) {
#ifdef DEBUG_ENABLED
- Variant::InternalMethod *m = memnew(InternalMethodVC(p_method, p_flags, p_argument_types, p_return_type, p_argument_names));
+ Variant::InternalMethod *m = memnew(InternalMethodVC(p_method, p_flags, p_argument_types, p_return_type, p_argument_names, p_name, p_type));
#else
Variant::InternalMethod *m = memnew(InternalMethodVC(p_method, p_flags, p_argument_types, p_return_type));
#endif
@@ -1354,7 +1364,7 @@ void register_variant_methods() {
bind_method(String, naturalnocasecmp_to, sarray("to"), varray());
bind_method(String, length, sarray(), varray());
bind_method(String, substr, sarray("from", "len"), varray(-1));
- bind_methodv("find", static_cast<int (String::*)(const String &, int) const>(&String::find), sarray("what", "from"), varray(0));
+ bind_methodv(find, static_cast<int (String::*)(const String &, int) const>(&String::find), sarray("what", "from"), varray(0));
bind_method(String, count, sarray("what", "from", "to"), varray(0, 0));
bind_method(String, countn, sarray("what", "from", "to"), varray(0, 0));
bind_method(String, findn, sarray("what", "from"), varray(0));
@@ -1362,7 +1372,7 @@ void register_variant_methods() {
bind_method(String, rfindn, sarray("what", "from"), varray(-1));
bind_method(String, match, sarray("expr"), varray());
bind_method(String, matchn, sarray("expr"), varray());
- bind_methodv("begins_with", static_cast<bool (String::*)(const String &) const>(&String::begins_with), sarray("text"), varray());
+ bind_methodv(begins_with, static_cast<bool (String::*)(const String &) const>(&String::begins_with), sarray("text"), varray());
bind_method(String, ends_with, sarray("text"), varray());
bind_method(String, is_subsequence_of, sarray("text"), varray());
bind_method(String, is_subsequence_ofi, sarray("text"), varray());
@@ -1370,7 +1380,7 @@ void register_variant_methods() {
bind_method(String, similarity, sarray("text"), varray());
bind_method(String, format, sarray("values", "placeholder"), varray("{_}"));
- bind_methodv("replace", static_cast<String (String::*)(const String &, const String &) const>(&String::replace), sarray("what", "forwhat"), varray());
+ bind_methodv(replace, static_cast<String (String::*)(const String &, const String &) const>(&String::replace), sarray("what", "forwhat"), varray());
bind_method(String, replacen, sarray("what", "forwhat"), varray());
bind_method(String, repeat, sarray("count"), varray());
bind_method(String, insert, sarray("position", "what"), varray());
@@ -1500,7 +1510,7 @@ void register_variant_methods() {
bind_method(Rect2, merge, sarray("b"), varray());
bind_method(Rect2, expand, sarray("to"), varray());
bind_method(Rect2, grow, sarray("by"), varray());
- bind_methodv("grow_margin", &Rect2::grow_margin_bind, sarray("margin", "by"), varray());
+ bind_methodv(grow_margin, &Rect2::grow_margin_bind, sarray("margin", "by"), varray());
bind_method(Rect2, grow_individual, sarray("left", "top", "right", "bottom"), varray());
bind_method(Rect2, abs, sarray(), varray());
@@ -1515,7 +1525,7 @@ void register_variant_methods() {
bind_method(Rect2i, merge, sarray("b"), varray());
bind_method(Rect2i, expand, sarray("to"), varray());
bind_method(Rect2i, grow, sarray("by"), varray());
- bind_methodv("grow_margin", &Rect2i::grow_margin_bind, sarray("margin", "by"), varray());
+ bind_methodv(grow_margin, &Rect2i::grow_margin_bind, sarray("margin", "by"), varray());
bind_method(Rect2i, grow_individual, sarray("left", "top", "right", "bottom"), varray());
bind_method(Rect2i, abs, sarray(), varray());
@@ -1571,9 +1581,9 @@ void register_variant_methods() {
bind_method(Plane, distance_to, sarray("point"), varray());
bind_method(Plane, has_point, sarray("point", "epsilon"), varray(CMP_EPSILON));
bind_method(Plane, project, sarray("point"), varray());
- bind_methodv("intersect_3", &Plane::intersect_3_bind, sarray("b", "c"), varray());
- bind_methodv("intersects_ray", &Plane::intersects_ray_bind, sarray("from", "dir"), varray());
- bind_methodv("intersects_segment", &Plane::intersects_segment_bind, sarray("from", "to"), varray());
+ bind_methodv(intersect_3, &Plane::intersect_3_bind, sarray("b", "c"), varray());
+ bind_methodv(intersects_ray, &Plane::intersects_ray_bind, sarray("from", "dir"), varray());
+ bind_methodv(intersects_segment, &Plane::intersects_segment_bind, sarray("from", "to"), varray());
/* Quaternion */
@@ -1686,7 +1696,7 @@ void register_variant_methods() {
bind_method(Basis, transposed, sarray(), varray());
bind_method(Basis, orthonormalized, sarray(), varray());
bind_method(Basis, determinant, sarray(), varray());
- bind_methodv("rotated", static_cast<Basis (Basis::*)(const Vector3 &, float) const>(&Basis::rotated), sarray("axis", "phi"), varray());
+ bind_methodv(rotated, static_cast<Basis (Basis::*)(const Vector3 &, float) const>(&Basis::rotated), sarray("axis", "phi"), varray());
bind_method(Basis, scaled, sarray("scale"), varray());
bind_method(Basis, get_scale, sarray(), varray());
bind_method(Basis, get_euler, sarray(), varray());
@@ -1724,8 +1734,8 @@ void register_variant_methods() {
bind_method(::AABB, get_shortest_axis_index, sarray(), varray());
bind_method(::AABB, get_shortest_axis_size, sarray(), varray());
bind_method(::AABB, get_endpoint, sarray("idx"), varray());
- bind_methodv("intersects_segment", &AABB::intersects_segment_bind, sarray("from", "to"), varray());
- bind_methodv("intersects_ray", &AABB::intersects_ray_bind, sarray("from", "dir"), varray());
+ bind_methodv(intersects_segment, &AABB::intersects_segment_bind, sarray("from", "to"), varray());
+ bind_methodv(intersects_ray, &AABB::intersects_ray_bind, sarray("from", "dir"), varray());
/* Transform */
diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml
index e3045f9611..378df1ce65 100644
--- a/doc/classes/BaseButton.xml
+++ b/doc/classes/BaseButton.xml
@@ -44,6 +44,9 @@
<member name="action_mode" type="int" setter="set_action_mode" getter="get_action_mode" enum="BaseButton.ActionMode" default="1">
Determines when the button is considered clicked, one of the [enum ActionMode] constants.
</member>
+ <member name="button_group" type="ButtonGroup" setter="set_button_group" getter="get_button_group">
+ The [ButtonGroup] associated with the button. Not to be confused with node groups.
+ </member>
<member name="button_mask" type="int" setter="set_button_mask" getter="get_button_mask" default="1">
Binary mask to choose which mouse buttons this button will respond to.
To allow both left-click and right-click, use [code]BUTTON_MASK_LEFT | BUTTON_MASK_RIGHT[/code].
@@ -52,9 +55,6 @@
If [code]true[/code], the button is in disabled state and can't be clicked or toggled.
</member>
<member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" override="true" enum="Control.FocusMode" default="2" />
- <member name="group" type="ButtonGroup" setter="set_button_group" getter="get_button_group">
- [ButtonGroup] associated to the button.
- </member>
<member name="keep_pressed_outside" type="bool" setter="set_keep_pressed_outside" getter="is_keep_pressed_outside" default="false">
If [code]true[/code], the button stays pressed when moving the cursor outside the button while pressing it.
[b]Note:[/b] This property only affects the button's visual appearance. Signals will be emitted at the same moment regardless of this property's value.
diff --git a/doc/classes/ButtonGroup.xml b/doc/classes/ButtonGroup.xml
index b7f3234b36..5aa2d699a8 100644
--- a/doc/classes/ButtonGroup.xml
+++ b/doc/classes/ButtonGroup.xml
@@ -14,7 +14,7 @@
<return type="Array">
</return>
<description>
- Returns an [Array] of [Button]s who have this as their [ButtonGroup] (see [member BaseButton.group]).
+ Returns an [Array] of [Button]s who have this as their [ButtonGroup] (see [member BaseButton.button_group]).
</description>
</method>
<method name="get_pressed_button">
diff --git a/doc/classes/ColorRect.xml b/doc/classes/ColorRect.xml
index 072759e383..7c0cd981e4 100644
--- a/doc/classes/ColorRect.xml
+++ b/doc/classes/ColorRect.xml
@@ -4,7 +4,7 @@
Colored rectangle.
</brief_description>
<description>
- Displays a colored rectangle.
+ Displays a rectangle filled with a solid [member color]. If you need to display the border alone, consider using [ReferenceRect] instead.
</description>
<tutorials>
<link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/515</link>
diff --git a/doc/classes/Gradient.xml b/doc/classes/Gradient.xml
index abb105a41c..4ccbdee144 100644
--- a/doc/classes/Gradient.xml
+++ b/doc/classes/Gradient.xml
@@ -4,7 +4,7 @@
A color interpolator resource which can be used to generate colors between user-defined color points.
</brief_description>
<description>
- Given a set of colors, this resource will interpolate them in order. This means that if you have color 1, color 2 and color 3, the ramp will interpolate from color 1 to color 2 and from color 2 to color 3. The ramp will initially have 2 colors (black and white), one (black) at ramp lower offset 0 and the other (white) at the ramp higher offset 1.
+ Given a set of colors, this resource will interpolate them in order. This means that if you have color 1, color 2 and color 3, the gradient will interpolate from color 1 to color 2 and from color 2 to color 3. The gradient will initially have 2 colors (black and white), one (black) at gradient lower offset 0 and the other (white) at the gradient higher offset 1.
</description>
<tutorials>
</tutorials>
@@ -17,7 +17,7 @@
<argument index="1" name="color" type="Color">
</argument>
<description>
- Adds the specified color to the end of the ramp, with the specified offset.
+ Adds the specified color to the end of the gradient, with the specified offset.
</description>
</method>
<method name="get_color">
@@ -26,7 +26,7 @@
<argument index="0" name="point" type="int">
</argument>
<description>
- Returns the color of the ramp color at index [code]point[/code].
+ Returns the color of the gradient color at index [code]point[/code].
</description>
</method>
<method name="get_offset">
@@ -35,14 +35,14 @@
<argument index="0" name="point" type="int">
</argument>
<description>
- Returns the offset of the ramp color at index [code]point[/code].
+ Returns the offset of the gradient color at index [code]point[/code].
</description>
</method>
<method name="get_point_count" qualifiers="const">
<return type="int">
</return>
<description>
- Returns the number of colors in the ramp.
+ Returns the number of colors in the gradient.
</description>
</method>
<method name="interpolate">
@@ -71,7 +71,7 @@
<argument index="1" name="color" type="Color">
</argument>
<description>
- Sets the color of the ramp color at index [code]point[/code].
+ Sets the color of the gradient color at index [code]point[/code].
</description>
</method>
<method name="set_offset">
@@ -82,7 +82,7 @@
<argument index="1" name="offset" type="float">
</argument>
<description>
- Sets the offset for the ramp color at index [code]point[/code].
+ Sets the offset for the gradient color at index [code]point[/code].
</description>
</method>
</methods>
diff --git a/doc/classes/ReferenceRect.xml b/doc/classes/ReferenceRect.xml
index 4f8f71b3db..1a3fbbdfc5 100644
--- a/doc/classes/ReferenceRect.xml
+++ b/doc/classes/ReferenceRect.xml
@@ -4,7 +4,7 @@
Reference frame for GUI.
</brief_description>
<description>
- A rectangle box that displays only a [member border_color] border color around its rectangle. [ReferenceRect] has no fill [Color].
+ A rectangle box that displays only a [member border_color] border color around its rectangle. [ReferenceRect] has no fill [Color]. If you need to display a rectangle filled with a solid color, consider using [ColorRect] instead.
</description>
<tutorials>
</tutorials>
@@ -14,6 +14,9 @@
<member name="border_color" type="Color" setter="set_border_color" getter="get_border_color" default="Color( 1, 0, 0, 1 )">
Sets the border [Color] of the [ReferenceRect].
</member>
+ <member name="border_width" type="float" setter="set_border_width" getter="get_border_width" default="1.0">
+ Sets the border width of the [ReferenceRect]. The border grows both inwards and outwards with respect to the rectangle box.
+ </member>
<member name="editor_only" type="bool" setter="set_editor_only" getter="get_editor_only" default="true">
If set to [code]true[/code], the [ReferenceRect] will only be visible while in editor. Otherwise, [ReferenceRect] will be visible in game.
</member>
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index 2cbb305153..92d7906b6c 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -3258,7 +3258,7 @@ VkRenderPass RenderingDeviceVulkan::_render_pass_create(const Vector<AttachmentF
render_pass_create_info.pAttachments = attachments.ptr();
render_pass_create_info.subpassCount = 1;
render_pass_create_info.pSubpasses = &subpass;
- render_pass_create_info.dependencyCount = 2;
+ render_pass_create_info.dependencyCount = 0; //2 - throws validation layer error
render_pass_create_info.pDependencies = dependencies;
VkRenderPass render_pass;
@@ -4312,8 +4312,10 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
}
pipeline_layout_create_info.pSetLayouts = layouts.ptr();
+ // Needs to be declared in this outer scope, otherwise it may not outlive its assignment
+ // to pipeline_layout_create_info.
+ VkPushConstantRange push_constant_range;
if (push_constant.push_constant_size) {
- VkPushConstantRange push_constant_range;
push_constant_range.stageFlags = push_constant.push_constants_vk_stage;
push_constant_range.offset = 0;
push_constant_range.size = push_constant.push_constant_size;
@@ -4610,12 +4612,12 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
}
}
ERR_FAIL_COND_V_MSG(uniform_idx == -1, RID(),
- "All the shader bindings for the given set must be covered by the uniforms provided. Binding (" + itos(set_uniform.binding) + ") was not provided.");
+ "All the shader bindings for the given set must be covered by the uniforms provided. Binding (" + itos(set_uniform.binding) + "), set (" + itos(p_shader_set) + ") was not provided.");
const Uniform &uniform = uniforms[uniform_idx];
ERR_FAIL_COND_V_MSG(uniform.type != set_uniform.type, RID(),
- "Mismatch uniform type for binding (" + itos(set_uniform.binding) + "). Expected '" + shader_uniform_names[set_uniform.type] + "', supplied: '" + shader_uniform_names[uniform.type] + "'.");
+ "Mismatch uniform type for binding (" + itos(set_uniform.binding) + "), set (" + itos(p_shader_set) + "). Expected '" + shader_uniform_names[set_uniform.type] + "', supplied: '" + shader_uniform_names[uniform.type] + "'.");
VkWriteDescriptorSet write; //common header
write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index e18e980fe2..668cce5b67 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -505,6 +505,7 @@ void EditorNode::_notification(int p_what) {
RS::get_singleton()->environment_set_volumetric_fog_filter_active(bool(GLOBAL_GET("rendering/volumetric_fog/use_filter")));
RS::get_singleton()->environment_set_volumetric_fog_directional_shadow_shrink_size(GLOBAL_GET("rendering/volumetric_fog/directional_shadow_shrink"));
RS::get_singleton()->environment_set_volumetric_fog_positional_shadow_shrink_size(GLOBAL_GET("rendering/volumetric_fog/positional_shadow_shrink"));
+ RS::get_singleton()->canvas_set_shadow_texture_size(GLOBAL_GET("rendering/quality/2d_shadow_atlas/size"));
}
ResourceImporterTexture::get_singleton()->update_imports();
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 48a9ca90c4..9e7ddd9fac 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -614,7 +614,7 @@ public:
const Ref<InputEventMouseButton> mb = p_ev;
- if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed() && hovered_index > 0) {
+ if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed() && hovered_index >= 0) {
// Toggle the flag.
// We base our choice on the hovered flag, so that it always matches the hovered flag.
if (value & (1 << hovered_index)) {
diff --git a/editor/icons/PaintVertex.svg b/editor/icons/PaintVertex.svg
deleted file mode 100644
index 5a13e4b7d0..0000000000
--- a/editor/icons/PaintVertex.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><ellipse cx="8.372881" cy="8.169492" fill="#fff" rx="6.677966" ry="6.067797"/></svg>
diff --git a/editor/icons/Rectangle.svg b/editor/icons/Rectangle.svg
new file mode 100644
index 0000000000..415940e68f
--- /dev/null
+++ b/editor/icons/Rectangle.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><rect fill="none" height="8" rx=".000017" stroke="#e0e0e0" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" width="12" x="2" y="4"/></svg>
diff --git a/editor/icons/RectangleShape2D.svg b/editor/icons/RectangleShape2D.svg
index 415940e68f..f0d6c54dc9 100644
--- a/editor/icons/RectangleShape2D.svg
+++ b/editor/icons/RectangleShape2D.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><rect fill="none" height="8" rx=".000017" stroke="#e0e0e0" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" width="12" x="2" y="4"/></svg>
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><rect fill="none" height="8" rx=".000017" stroke="#68b6ff" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" width="12" x="2" y="4"/></svg>
diff --git a/editor/icons/UnpaintVertex.svg b/editor/icons/UnpaintVertex.svg
deleted file mode 100644
index 059fcf6e25..0000000000
--- a/editor/icons/UnpaintVertex.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><ellipse cx="8.372881" cy="8.169492" rx="6.677966" ry="6.067797"/></svg>
diff --git a/editor/plugins/gradient_editor_plugin.h b/editor/plugins/gradient_editor_plugin.h
index 59cf787020..4d3fc0d8a9 100644
--- a/editor/plugins/gradient_editor_plugin.h
+++ b/editor/plugins/gradient_editor_plugin.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef TOOLS_EDITOR_PLUGINS_COLOR_RAMP_EDITOR_PLUGIN_H_
-#define TOOLS_EDITOR_PLUGINS_COLOR_RAMP_EDITOR_PLUGIN_H_
+#ifndef GRADIENT_EDITOR_PLUGIN_H
+#define GRADIENT_EDITOR_PLUGIN_H
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
@@ -65,9 +65,9 @@ class GradientEditorPlugin : public EditorPlugin {
GDCLASS(GradientEditorPlugin, EditorPlugin);
public:
- virtual String get_name() const override { return "ColorRamp"; }
+ virtual String get_name() const override { return "Gradient"; }
GradientEditorPlugin(EditorNode *p_node);
};
-#endif /* TOOLS_EDITOR_PLUGINS_COLOR_RAMP_EDITOR_PLUGIN_H_ */
+#endif // GRADIENT_EDITOR_PLUGIN_H
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index a4eab6ab4a..5038941784 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -6727,7 +6727,6 @@ void EditorNode3DGizmoPlugin::create_handle_material(const String &p_name, bool
handle_material->set_point_size(handle_t->get_width());
handle_material->set_texture(StandardMaterial3D::TEXTURE_ALBEDO, handle_t);
handle_material->set_albedo(Color(1, 1, 1));
- handle_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
handle_material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
handle_material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true);
handle_material->set_on_top_of_alpha();
@@ -6735,6 +6734,7 @@ void EditorNode3DGizmoPlugin::create_handle_material(const String &p_name, bool
handle_material->set_billboard_mode(StandardMaterial3D::BILLBOARD_ENABLED);
handle_material->set_on_top_of_alpha();
}
+ handle_material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
materials[p_name] = Vector<Ref<StandardMaterial3D>>();
materials[p_name].push_back(handle_material);
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index dd1194d020..ac90ee9570 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -79,8 +79,8 @@ void Polygon2DEditor::_notification(int p_what) {
uv_button[UV_MODE_SCALE]->set_icon(get_theme_icon("ToolScale", "EditorIcons"));
uv_button[UV_MODE_ADD_POLYGON]->set_icon(get_theme_icon("Edit", "EditorIcons"));
uv_button[UV_MODE_REMOVE_POLYGON]->set_icon(get_theme_icon("Close", "EditorIcons"));
- uv_button[UV_MODE_PAINT_WEIGHT]->set_icon(get_theme_icon("PaintVertex", "EditorIcons"));
- uv_button[UV_MODE_CLEAR_WEIGHT]->set_icon(get_theme_icon("UnpaintVertex", "EditorIcons"));
+ uv_button[UV_MODE_PAINT_WEIGHT]->set_icon(get_theme_icon("Bucket", "EditorIcons"));
+ uv_button[UV_MODE_CLEAR_WEIGHT]->set_icon(get_theme_icon("Clear", "EditorIcons"));
b_snap_grid->set_icon(get_theme_icon("Grid", "EditorIcons"));
b_snap_enable->set_icon(get_theme_icon("SnapGrid", "EditorIcons"));
@@ -1325,11 +1325,16 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
uv_main_hsc->add_child(uv_edit_draw);
uv_edit_draw->set_h_size_flags(SIZE_EXPAND_FILL);
uv_edit_draw->set_custom_minimum_size(Size2(200, 200) * EDSCALE);
+
+ Control *space = memnew(Control);
+ uv_mode_hb->add_child(space);
+ space->set_h_size_flags(SIZE_EXPAND_FILL);
+
uv_menu = memnew(MenuButton);
uv_mode_hb->add_child(uv_menu);
uv_menu->set_text(TTR("Edit"));
- uv_menu->get_popup()->add_item(TTR("Polygon->UV"), UVEDIT_POLYGON_TO_UV);
- uv_menu->get_popup()->add_item(TTR("UV->Polygon"), UVEDIT_UV_TO_POLYGON);
+ uv_menu->get_popup()->add_item(TTR("Copy Polygon to UV"), UVEDIT_POLYGON_TO_UV);
+ uv_menu->get_popup()->add_item(TTR("Copy UV to Polygon"), UVEDIT_UV_TO_POLYGON);
uv_menu->get_popup()->add_separator();
uv_menu->get_popup()->add_item(TTR("Clear UV"), UVEDIT_UV_CLEAR);
uv_menu->get_popup()->add_separator();
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 9261113706..e43b8c4b7f 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -65,7 +65,7 @@ void TileMapEditor::_notification(int p_what) {
paint_button->set_icon(get_theme_icon("Edit", "EditorIcons"));
line_button->set_icon(get_theme_icon("CurveLinear", "EditorIcons"));
- rectangle_button->set_icon(get_theme_icon("RectangleShape2D", "EditorIcons"));
+ rectangle_button->set_icon(get_theme_icon("Rectangle", "EditorIcons"));
bucket_fill_button->set_icon(get_theme_icon("Bucket", "EditorIcons"));
picker_button->set_icon(get_theme_icon("ColorPick", "EditorIcons"));
select_button->set_icon(get_theme_icon("ActionCopy", "EditorIcons"));
@@ -413,7 +413,9 @@ struct _PaletteEntry {
String name;
bool operator<(const _PaletteEntry &p_rhs) const {
- return name < p_rhs.name;
+ // Natural no case comparison will compare strings based on CharType
+ // order (except digits) and on numbers that start on the same position.
+ return name.naturalnocasecmp_to(p_rhs.name) < 0;
}
};
} // namespace
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 684d8f0f10..9c589267fc 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -60,7 +60,6 @@ void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) {
Sprite2D *mi = Object::cast_to<Sprite2D>(child);
Ref<Texture2D> texture = mi->get_texture();
- Ref<Texture2D> normal_map = mi->get_normal_map();
Ref<ShaderMaterial> material = mi->get_material();
if (texture.is_null()) {
@@ -75,7 +74,6 @@ void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) {
}
p_library->tile_set_texture(id, texture);
- p_library->tile_set_normal_map(id, normal_map);
p_library->tile_set_material(id, material);
p_library->tile_set_modulate(id, mi->get_modulate());
@@ -2368,7 +2366,6 @@ void TileSetEditor::_select_edited_shape_coord() {
void TileSetEditor::_undo_tile_removal(int p_id) {
undo_redo->add_undo_method(tileset.ptr(), "create_tile", p_id);
undo_redo->add_undo_method(tileset.ptr(), "tile_set_name", p_id, tileset->tile_get_name(p_id));
- undo_redo->add_undo_method(tileset.ptr(), "tile_set_normal_map", p_id, tileset->tile_get_normal_map(p_id));
undo_redo->add_undo_method(tileset.ptr(), "tile_set_texture_offset", p_id, tileset->tile_get_texture_offset(p_id));
undo_redo->add_undo_method(tileset.ptr(), "tile_set_material", p_id, tileset->tile_get_material(p_id));
undo_redo->add_undo_method(tileset.ptr(), "tile_set_modulate", p_id, tileset->tile_get_modulate(p_id));
@@ -3541,7 +3538,6 @@ void TilesetEditorContext::_get_property_list(List<PropertyInfo> *p_list) const
int id = tileset_editor->get_current_tile();
p_list->push_back(PropertyInfo(Variant::NIL, "Selected Tile", PROPERTY_HINT_NONE, "tile_", PROPERTY_USAGE_GROUP));
p_list->push_back(PropertyInfo(Variant::STRING, "tile_name"));
- p_list->push_back(PropertyInfo(Variant::OBJECT, "tile_normal_map", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"));
p_list->push_back(PropertyInfo(Variant::VECTOR2, "tile_tex_offset"));
p_list->push_back(PropertyInfo(Variant::OBJECT, "tile_material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial"));
p_list->push_back(PropertyInfo(Variant::COLOR, "tile_modulate"));
diff --git a/misc/ci/android-tools-linux.sh b/misc/ci/android-tools-linux.sh
deleted file mode 100755
index 6114551861..0000000000
--- a/misc/ci/android-tools-linux.sh
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/bin/bash
-
-# SDK
-# https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
-# SHA-256 444e22ce8ca0f67353bda4b85175ed3731cae3ffa695ca18119cbacef1c1bea0
-# latest version available here: https://developer.android.com/studio/index.html
-
-# NDK
-# https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip
-# SHA-1 0bf02d4e8b85fd770fd7b9b2cdec57f9441f27a2
-# latest version available here: https://developer.android.com/ndk/downloads/index.html
-
-BASH_RC=~/.bashrc
-GODOT_BUILD_TOOLS_PATH=./godot-dev/build-tools
-mkdir -p $GODOT_BUILD_TOOLS_PATH
-cd $GODOT_BUILD_TOOLS_PATH
-
-ANDROID_BASE_URL=http://dl.google.com/android/repository
-
-ANDROID_SDK_RELEASE=4333796
-ANDROID_SDK_DIR=android-sdk
-ANDROID_SDK_FILENAME=sdk-tools-linux-$ANDROID_SDK_RELEASE.zip
-ANDROID_SDK_URL=$ANDROID_BASE_URL/$ANDROID_SDK_FILENAME
-ANDROID_SDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_SDK_DIR
-ANDROID_SDK_SHA256=92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9
-
-ANDROID_NDK_RELEASE=r21
-ANDROID_NDK_DIR=android-ndk
-ANDROID_NDK_FILENAME=android-ndk-$ANDROID_NDK_RELEASE-linux-x86_64.zip
-ANDROID_NDK_URL=$ANDROID_BASE_URL/$ANDROID_NDK_FILENAME
-ANDROID_NDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_NDK_DIR
-ANDROID_NDK_SHA1=afc9c0b9faad222898ac8168c78ad4ccac8a1b5c
-
-echo
-echo "Download and install Android development tools ..."
-echo
-
-if [ ! -e $ANDROID_SDK_FILENAME ]; then
- echo "Downloading: Android SDK ..."
- curl -L -O $ANDROID_SDK_URL
-else
- echo $ANDROID_SDK_SHA1 $ANDROID_SDK_FILENAME > $ANDROID_SDK_FILENAME.sha1
- if [ $(shasum -a 256 < $ANDROID_SDK_FILENAME | awk '{print $1;}') != $ANDROID_SDK_SHA1 ]; then
- echo "Downloading: Android SDK ..."
- curl -L -O $ANDROID_SDK_URL
- fi
-fi
-
-if [ ! -d $ANDROID_SDK_DIR ]; then
- echo "Extracting: Android SDK ..."
- unzip -qq $ANDROID_SDK_FILENAME -d $ANDROID_SDK_DIR
- echo
-fi
-
-if [ ! -e $ANDROID_NDK_FILENAME ]; then
- echo "Downloading: Android NDK ..."
- curl -L -O $ANDROID_NDK_URL
-else
- echo $ANDROID_NDK_MD5 $ANDROID_NDK_FILENAME > $ANDROID_NDK_FILENAME.md5
- if [ $(shasum -a 1 < $ANDROID_NDK_FILENAME | awk '{print $1;}') != $ANDROID_NDK_SHA1 ]; then
- echo "Downloading: Android NDK ..."
- curl -L -O $ANDROID_NDK_URL
- fi
-fi
-
-if [ ! -d $ANDROID_NDK_DIR ]; then
- echo "Extracting: Android NDK ..."
- unzip -qq $ANDROID_NDK_FILENAME
- mv android-ndk-$ANDROID_NDK_RELEASE $ANDROID_NDK_DIR
- echo
-fi
-
-mkdir -p ~/.android && echo "count=0" > ~/.android/repositories.cfg
-echo "Installing: Accepting Licenses ..."
-yes | $ANDROID_SDK_DIR/tools/bin/sdkmanager --licenses > /dev/null
-echo "Installing: Android Build and Platform Tools ..."
-yes | $ANDROID_SDK_DIR/tools/bin/sdkmanager 'tools' > /dev/null
-yes | $ANDROID_SDK_DIR/tools/bin/sdkmanager 'platform-tools' > /dev/null
-yes | $ANDROID_SDK_DIR/tools/bin/sdkmanager 'build-tools;29.0.3' > /dev/null
-echo
-
-EXPORT_VAL="export ANDROID_HOME=$ANDROID_SDK_PATH"
-if ! grep -q "^$EXPORT_VAL" $BASH_RC; then
- echo $EXPORT_VAL >> $BASH_RC
-fi
-#eval $EXPORT_VAL
-
-EXPORT_VAL="export ANDROID_NDK_ROOT=$ANDROID_NDK_PATH"
-if ! grep -q "^$EXPORT_VAL" $BASH_RC; then
- echo $EXPORT_VAL >> $BASH_RC
-fi
-#eval $EXPORT_VAL
-
-EXPORT_VAL="export PATH=$PATH:$ANDROID_SDK_PATH/tools"
-if ! grep -q "^export PATH=.*$ANDROID_SDK_PATH/tools.*" $BASH_RC; then
- echo $EXPORT_VAL >> $BASH_RC
-fi
-#eval $EXPORT_VAL
-
-EXPORT_VAL="export PATH=$PATH:$ANDROID_SDK_PATH/tools/bin"
-if ! grep -q "^export PATH=.*$ANDROID_SDK_PATH/tools/bin.*" $BASH_RC; then
- echo $EXPORT_VAL >> $BASH_RC
-fi
-#eval $EXPORT_VAL
-
-echo
-echo "Done!"
-echo
diff --git a/modules/gdnative/xr/config.py b/modules/gdnative/xr/config.py
deleted file mode 100644
index d22f9454ed..0000000000
--- a/modules/gdnative/xr/config.py
+++ /dev/null
@@ -1,6 +0,0 @@
-def can_build(env, platform):
- return True
-
-
-def configure(env):
- pass
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 2e372575da..aec05b6771 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -792,6 +792,9 @@ static void _find_identifiers_in_class(const GDScriptParser::ClassNode *p_class,
continue;
}
option = ScriptCodeCompletionOption(member.constant->identifier->name, ScriptCodeCompletionOption::KIND_CONSTANT);
+ if (member.constant->initializer) {
+ option.default_value = member.constant->initializer->reduced_value;
+ }
break;
case GDScriptParser::ClassNode::Member::CLASS:
if (p_only_functions) {
@@ -2404,6 +2407,11 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path
Variant::get_constants_for_type(completion_context.builtin_type, &constants);
for (const List<StringName>::Element *E = constants.front(); E != nullptr; E = E->next()) {
ScriptCodeCompletionOption option(E->get(), ScriptCodeCompletionOption::KIND_CONSTANT);
+ bool valid = false;
+ Variant default_value = Variant::get_constant_value(completion_context.builtin_type, E->get(), &valid);
+ if (valid) {
+ option.default_value = default_value;
+ }
options.insert(option.display, option);
}
} break;
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index ccf1e49693..21fa83278b 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -706,7 +706,7 @@ void GridMap::_update_visibility() {
Octant *octant = e->value();
for (int i = 0; i < octant->multimesh_instances.size(); i++) {
const Octant::MultimeshInstance &mi = octant->multimesh_instances[i];
- RS::get_singleton()->instance_set_visible(mi.instance, is_visible());
+ RS::get_singleton()->instance_set_visible(mi.instance, is_visible_in_tree());
}
}
}
diff --git a/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs b/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs
index 5edf72d63e..9b7b422276 100644
--- a/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs
+++ b/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs
@@ -15,14 +15,14 @@ namespace GodotTools.BuildLogger
public void Initialize(IEventSource eventSource)
{
if (null == Parameters)
- throw new LoggerException("Log directory was not set.");
+ throw new LoggerException("Log directory parameter not specified.");
var parameters = Parameters.Split(new[] { ';' });
string logDir = parameters[0];
if (string.IsNullOrEmpty(logDir))
- throw new LoggerException("Log directory was not set.");
+ throw new LoggerException("Log directory parameter is empty.");
if (parameters.Length > 1)
throw new LoggerException("Too many parameters passed.");
@@ -51,22 +51,31 @@ namespace GodotTools.BuildLogger
{
throw new LoggerException("Failed to create log file: " + ex.Message);
}
- else
- {
- // Unexpected failure
- throw;
- }
+
+ // Unexpected failure
+ throw;
}
eventSource.ProjectStarted += eventSource_ProjectStarted;
- eventSource.TaskStarted += eventSource_TaskStarted;
+ eventSource.ProjectFinished += eventSource_ProjectFinished;
eventSource.MessageRaised += eventSource_MessageRaised;
eventSource.WarningRaised += eventSource_WarningRaised;
eventSource.ErrorRaised += eventSource_ErrorRaised;
- eventSource.ProjectFinished += eventSource_ProjectFinished;
}
- void eventSource_ErrorRaised(object sender, BuildErrorEventArgs e)
+ private void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e)
+ {
+ WriteLine(e.Message);
+ indent++;
+ }
+
+ private void eventSource_ProjectFinished(object sender, ProjectFinishedEventArgs e)
+ {
+ indent--;
+ WriteLine(e.Message);
+ }
+
+ private void eventSource_ErrorRaised(object sender, BuildErrorEventArgs e)
{
string line = $"{e.File}({e.LineNumber},{e.ColumnNumber}): error {e.Code}: {e.Message}";
@@ -81,7 +90,7 @@ namespace GodotTools.BuildLogger
issuesStreamWriter.WriteLine(errorLine);
}
- void eventSource_WarningRaised(object sender, BuildWarningEventArgs e)
+ private void eventSource_WarningRaised(object sender, BuildWarningEventArgs e)
{
string line = $"{e.File}({e.LineNumber},{e.ColumnNumber}): warning {e.Code}: {e.Message}";
@@ -108,40 +117,6 @@ namespace GodotTools.BuildLogger
}
}
- private void eventSource_TaskStarted(object sender, TaskStartedEventArgs e)
- {
- // TaskStartedEventArgs adds ProjectFile, TaskFile, TaskName
- // To keep this log clean, this logger will ignore these events.
- }
-
- private void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e)
- {
- WriteLine(e.Message);
- indent++;
- }
-
- private void eventSource_ProjectFinished(object sender, ProjectFinishedEventArgs e)
- {
- indent--;
- WriteLine(e.Message);
- }
-
- /// <summary>
- /// Write a line to the log, adding the SenderName
- /// </summary>
- private void WriteLineWithSender(string line, BuildEventArgs e)
- {
- if (0 == string.Compare(e.SenderName, "MSBuild", StringComparison.OrdinalIgnoreCase))
- {
- // Well, if the sender name is MSBuild, let's leave it out for prettiness
- WriteLine(line);
- }
- else
- {
- WriteLine(e.SenderName + ": " + line);
- }
- }
-
/// <summary>
/// Write a line to the log, adding the SenderName and Message
/// (these parameters are on all MSBuild event argument objects)
diff --git a/modules/mono/editor/GodotTools/GodotTools/BottomPanel.cs b/modules/mono/editor/GodotTools/GodotTools/BottomPanel.cs
deleted file mode 100644
index 3ab669a9f3..0000000000
--- a/modules/mono/editor/GodotTools/GodotTools/BottomPanel.cs
+++ /dev/null
@@ -1,339 +0,0 @@
-using Godot;
-using System;
-using System.IO;
-using Godot.Collections;
-using GodotTools.Internals;
-using static GodotTools.Internals.Globals;
-using File = GodotTools.Utils.File;
-using Path = System.IO.Path;
-
-namespace GodotTools
-{
- public class BottomPanel : VBoxContainer
- {
- private EditorInterface editorInterface;
-
- private TabContainer panelTabs;
-
- private VBoxContainer panelBuildsTab;
-
- private ItemList buildTabsList;
- private TabContainer buildTabs;
-
- private Button warningsBtn;
- private Button errorsBtn;
- private Button viewLogBtn;
-
- private void _UpdateBuildTab(int index, int? currentTab)
- {
- var tab = (BuildTab)buildTabs.GetChild(index);
-
- string itemName = Path.GetFileNameWithoutExtension(tab.BuildInfo.Solution);
- itemName += " [" + tab.BuildInfo.Configuration + "]";
-
- buildTabsList.AddItem(itemName, tab.IconTexture);
-
- string itemTooltip = "Solution: " + tab.BuildInfo.Solution;
- itemTooltip += "\nConfiguration: " + tab.BuildInfo.Configuration;
- itemTooltip += "\nStatus: ";
-
- if (tab.BuildExited)
- itemTooltip += tab.BuildResult == BuildTab.BuildResults.Success ? "Succeeded" : "Errored";
- else
- itemTooltip += "Running";
-
- if (!tab.BuildExited || tab.BuildResult == BuildTab.BuildResults.Error)
- itemTooltip += $"\nErrors: {tab.ErrorCount}";
-
- itemTooltip += $"\nWarnings: {tab.WarningCount}";
-
- buildTabsList.SetItemTooltip(index, itemTooltip);
-
- // If this tab was already selected before the changes or if no tab was selected
- if (currentTab == null || currentTab == index)
- {
- buildTabsList.Select(index);
- _BuildTabsItemSelected(index);
- }
- }
-
- private void _UpdateBuildTabsList()
- {
- buildTabsList.Clear();
-
- int? currentTab = buildTabs.CurrentTab;
-
- if (currentTab < 0 || currentTab >= buildTabs.GetTabCount())
- currentTab = null;
-
- for (int i = 0; i < buildTabs.GetChildCount(); i++)
- _UpdateBuildTab(i, currentTab);
- }
-
- public BuildTab GetBuildTabFor(BuildInfo buildInfo)
- {
- foreach (var buildTab in new Array<BuildTab>(buildTabs.GetChildren()))
- {
- if (buildTab.BuildInfo.Equals(buildInfo))
- return buildTab;
- }
-
- var newBuildTab = new BuildTab(buildInfo);
- AddBuildTab(newBuildTab);
-
- return newBuildTab;
- }
-
- private void _BuildTabsItemSelected(int idx)
- {
- if (idx < 0 || idx >= buildTabs.GetTabCount())
- throw new IndexOutOfRangeException();
-
- buildTabs.CurrentTab = idx;
- if (!buildTabs.Visible)
- buildTabs.Visible = true;
-
- warningsBtn.Visible = true;
- errorsBtn.Visible = true;
- viewLogBtn.Visible = true;
- }
-
- private void _BuildTabsNothingSelected()
- {
- if (buildTabs.GetTabCount() != 0)
- {
- // just in case
- buildTabs.Visible = false;
-
- // This callback is called when clicking on the empty space of the list.
- // ItemList won't deselect the items automatically, so we must do it ourselves.
- buildTabsList.UnselectAll();
- }
-
- warningsBtn.Visible = false;
- errorsBtn.Visible = false;
- viewLogBtn.Visible = false;
- }
-
- private void _WarningsToggled(bool pressed)
- {
- int currentTab = buildTabs.CurrentTab;
-
- if (currentTab < 0 || currentTab >= buildTabs.GetTabCount())
- throw new InvalidOperationException("No tab selected");
-
- var buildTab = (BuildTab)buildTabs.GetChild(currentTab);
- buildTab.WarningsVisible = pressed;
- buildTab.UpdateIssuesList();
- }
-
- private void _ErrorsToggled(bool pressed)
- {
- int currentTab = buildTabs.CurrentTab;
-
- if (currentTab < 0 || currentTab >= buildTabs.GetTabCount())
- throw new InvalidOperationException("No tab selected");
-
- var buildTab = (BuildTab)buildTabs.GetChild(currentTab);
- buildTab.ErrorsVisible = pressed;
- buildTab.UpdateIssuesList();
- }
-
- public void BuildProjectPressed()
- {
- if (!File.Exists(GodotSharpDirs.ProjectSlnPath))
- return; // No solution to build
-
- string editorScriptsMetadataPath = Path.Combine(GodotSharpDirs.ResMetadataDir, "scripts_metadata.editor");
- string playerScriptsMetadataPath = Path.Combine(GodotSharpDirs.ResMetadataDir, "scripts_metadata.editor_player");
-
- CsProjOperations.GenerateScriptsMetadata(GodotSharpDirs.ProjectCsProjPath, editorScriptsMetadataPath);
-
- if (File.Exists(editorScriptsMetadataPath))
- {
- try
- {
- File.Copy(editorScriptsMetadataPath, playerScriptsMetadataPath);
- }
- catch (IOException e)
- {
- GD.PushError($"Failed to copy scripts metadata file. Exception message: {e.Message}");
- return;
- }
- }
-
- bool buildSuccess = BuildManager.BuildProjectBlocking("Debug");
-
- if (!buildSuccess)
- return;
-
- // Notify running game for hot-reload
- Internal.EditorDebuggerNodeReloadScripts();
-
- // Hot-reload in the editor
- GodotSharpEditor.Instance.GetNode<HotReloadAssemblyWatcher>("HotReloadAssemblyWatcher").RestartTimer();
-
- if (Internal.IsAssembliesReloadingNeeded())
- Internal.ReloadAssemblies(softReload: false);
- }
-
- private void _ViewLogPressed()
- {
- if (!buildTabsList.IsAnythingSelected())
- return;
-
- var selectedItems = buildTabsList.GetSelectedItems();
-
- if (selectedItems.Length != 1)
- throw new InvalidOperationException($"Expected 1 selected item, got {selectedItems.Length}");
-
- int selectedItem = selectedItems[0];
-
- var buildTab = (BuildTab)buildTabs.GetTabControl(selectedItem);
-
- OS.ShellOpen(Path.Combine(buildTab.BuildInfo.LogsDirPath, BuildManager.MsBuildLogFileName));
- }
-
- public override void _Notification(int what)
- {
- base._Notification(what);
-
- if (what == EditorSettings.NotificationEditorSettingsChanged)
- {
- var editorBaseControl = editorInterface.GetBaseControl();
- panelTabs.AddThemeStyleboxOverride("panel", editorBaseControl.GetThemeStylebox("DebuggerPanel", "EditorStyles"));
- panelTabs.AddThemeStyleboxOverride("tab_fg", editorBaseControl.GetThemeStylebox("DebuggerTabFG", "EditorStyles"));
- panelTabs.AddThemeStyleboxOverride("tab_bg", editorBaseControl.GetThemeStylebox("DebuggerTabBG", "EditorStyles"));
- }
- }
-
- public void AddBuildTab(BuildTab buildTab)
- {
- buildTabs.AddChild(buildTab);
- RaiseBuildTab(buildTab);
- }
-
- public void RaiseBuildTab(BuildTab buildTab)
- {
- if (buildTab.GetParent() != buildTabs)
- throw new InvalidOperationException("Build tab is not in the tabs list");
-
- buildTabs.MoveChild(buildTab, 0);
- _UpdateBuildTabsList();
- }
-
- public void ShowBuildTab()
- {
- for (int i = 0; i < panelTabs.GetTabCount(); i++)
- {
- if (panelTabs.GetTabControl(i) == panelBuildsTab)
- {
- panelTabs.CurrentTab = i;
- GodotSharpEditor.Instance.MakeBottomPanelItemVisible(this);
- return;
- }
- }
-
- GD.PushError("Builds tab not found");
- }
-
- public override void _Ready()
- {
- base._Ready();
-
- editorInterface = GodotSharpEditor.Instance.GetEditorInterface();
-
- var editorBaseControl = editorInterface.GetBaseControl();
-
- SizeFlagsVertical = (int)SizeFlags.ExpandFill;
- SetAnchorsAndMarginsPreset(LayoutPreset.Wide);
-
- panelTabs = new TabContainer
- {
- TabAlign = TabContainer.TabAlignEnum.Left,
- RectMinSize = new Vector2(0, 228) * EditorScale,
- SizeFlagsVertical = (int)SizeFlags.ExpandFill
- };
- panelTabs.AddThemeStyleboxOverride("panel", editorBaseControl.GetThemeStylebox("DebuggerPanel", "EditorStyles"));
- panelTabs.AddThemeStyleboxOverride("tab_fg", editorBaseControl.GetThemeStylebox("DebuggerTabFG", "EditorStyles"));
- panelTabs.AddThemeStyleboxOverride("tab_bg", editorBaseControl.GetThemeStylebox("DebuggerTabBG", "EditorStyles"));
- AddChild(panelTabs);
-
- {
- // Builds tab
- panelBuildsTab = new VBoxContainer
- {
- Name = "Builds".TTR(),
- SizeFlagsHorizontal = (int)SizeFlags.ExpandFill
- };
- panelTabs.AddChild(panelBuildsTab);
-
- var toolBarHBox = new HBoxContainer {SizeFlagsHorizontal = (int)SizeFlags.ExpandFill};
- panelBuildsTab.AddChild(toolBarHBox);
-
- var buildProjectBtn = new Button
- {
- Text = "Build Project".TTR(),
- FocusMode = FocusModeEnum.None
- };
- buildProjectBtn.PressedSignal += BuildProjectPressed;
- toolBarHBox.AddChild(buildProjectBtn);
-
- toolBarHBox.AddSpacer(begin: false);
-
- warningsBtn = new Button
- {
- Text = "Warnings".TTR(),
- ToggleMode = true,
- Pressed = true,
- Visible = false,
- FocusMode = FocusModeEnum.None
- };
- warningsBtn.Toggled += _WarningsToggled;
- toolBarHBox.AddChild(warningsBtn);
-
- errorsBtn = new Button
- {
- Text = "Errors".TTR(),
- ToggleMode = true,
- Pressed = true,
- Visible = false,
- FocusMode = FocusModeEnum.None
- };
- errorsBtn.Toggled += _ErrorsToggled;
- toolBarHBox.AddChild(errorsBtn);
-
- toolBarHBox.AddSpacer(begin: false);
-
- viewLogBtn = new Button
- {
- Text = "View log".TTR(),
- FocusMode = FocusModeEnum.None,
- Visible = false
- };
- viewLogBtn.PressedSignal += _ViewLogPressed;
- toolBarHBox.AddChild(viewLogBtn);
-
- var hsc = new HSplitContainer
- {
- SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
- SizeFlagsVertical = (int)SizeFlags.ExpandFill
- };
- panelBuildsTab.AddChild(hsc);
-
- buildTabsList = new ItemList {SizeFlagsHorizontal = (int)SizeFlags.ExpandFill};
- buildTabsList.ItemSelected += _BuildTabsItemSelected;
- buildTabsList.NothingSelected += _BuildTabsNothingSelected;
- hsc.AddChild(buildTabsList);
-
- buildTabs = new TabContainer
- {
- TabAlign = TabContainer.TabAlignEnum.Left,
- SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
- TabsVisible = false
- };
- hsc.AddChild(buildTabs);
- }
- }
- }
-}
diff --git a/modules/mono/editor/GodotTools/GodotTools/BuildInfo.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs
index ab090c46e7..51055dc9b9 100644
--- a/modules/mono/editor/GodotTools/GodotTools/BuildInfo.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs
@@ -4,7 +4,7 @@ using Godot.Collections;
using GodotTools.Internals;
using Path = System.IO.Path;
-namespace GodotTools
+namespace GodotTools.Build
{
[Serializable]
public sealed class BuildInfo : Reference // TODO Remove Reference once we have proper serialization
@@ -20,7 +20,9 @@ namespace GodotTools
public override bool Equals(object obj)
{
if (obj is BuildInfo other)
- return other.Solution == Solution && other.Configuration == Configuration;
+ return other.Solution == Solution && other.Targets == Targets &&
+ other.Configuration == Configuration && other.Restore == Restore &&
+ other.CustomProperties == CustomProperties && other.LogsDirPath == LogsDirPath;
return false;
}
@@ -31,7 +33,11 @@ namespace GodotTools
{
int hash = 17;
hash = hash * 29 + Solution.GetHashCode();
+ hash = hash * 29 + Targets.GetHashCode();
hash = hash * 29 + Configuration.GetHashCode();
+ hash = hash * 29 + Restore.GetHashCode();
+ hash = hash * 29 + CustomProperties.GetHashCode();
+ hash = hash * 29 + LogsDirPath.GetHashCode();
return hash;
}
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs
index ff7ce97c47..9b512d90f5 100644
--- a/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs
@@ -1,20 +1,19 @@
using System;
-using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
-using GodotTools.Build;
using GodotTools.Ides.Rider;
using GodotTools.Internals;
-using GodotTools.Utils;
using JetBrains.Annotations;
using static GodotTools.Internals.Globals;
using File = GodotTools.Utils.File;
+using OS = GodotTools.Utils.OS;
+using Path = System.IO.Path;
-namespace GodotTools
+namespace GodotTools.Build
{
public static class BuildManager
{
- private static readonly List<BuildInfo> BuildsInProgress = new List<BuildInfo>();
+ private static BuildInfo _buildInProgress;
public const string PropNameMSBuildMono = "MSBuild (Mono)";
public const string PropNameMSBuildVs = "MSBuild (VS Build Tools)";
@@ -24,6 +23,14 @@ namespace GodotTools
public const string MsBuildIssuesFileName = "msbuild_issues.csv";
public const string MsBuildLogFileName = "msbuild_log.txt";
+ public delegate void BuildLaunchFailedEventHandler(BuildInfo buildInfo, string reason);
+
+ public static event BuildLaunchFailedEventHandler BuildLaunchFailed;
+ public static event Action<BuildInfo> BuildStarted;
+ public static event Action<BuildResult> BuildFinished;
+ public static event Action<string> StdOutputReceived;
+ public static event Action<string> StdErrorReceived;
+
private static void RemoveOldIssuesFile(BuildInfo buildInfo)
{
var issuesFile = GetIssuesFilePath(buildInfo);
@@ -36,12 +43,13 @@ namespace GodotTools
private static void ShowBuildErrorDialog(string message)
{
- GodotSharpEditor.Instance.ShowErrorDialog(message, "Build error");
- GodotSharpEditor.Instance.BottomPanel.ShowBuildTab();
+ var plugin = GodotSharpEditor.Instance;
+ plugin.ShowErrorDialog(message, "Build error");
+ plugin.MakeBottomPanelItemVisible(plugin.MSBuildPanel);
}
- public static void RestartBuild(BuildTab buildTab) => throw new NotImplementedException();
- public static void StopBuild(BuildTab buildTab) => throw new NotImplementedException();
+ public static void RestartBuild(BuildOutputView buildOutputView) => throw new NotImplementedException();
+ public static void StopBuild(BuildOutputView buildOutputView) => throw new NotImplementedException();
private static string GetLogFilePath(BuildInfo buildInfo)
{
@@ -61,15 +69,14 @@ namespace GodotTools
public static bool Build(BuildInfo buildInfo)
{
- if (BuildsInProgress.Contains(buildInfo))
+ if (_buildInProgress != null)
throw new InvalidOperationException("A build is already in progress");
- BuildsInProgress.Add(buildInfo);
+ _buildInProgress = buildInfo;
try
{
- BuildTab buildTab = GodotSharpEditor.Instance.BottomPanel.GetBuildTabFor(buildInfo);
- buildTab.OnBuildStart();
+ BuildStarted?.Invoke(buildInfo);
// Required in order to update the build tasks list
Internal.GodotMainIteration();
@@ -80,44 +87,44 @@ namespace GodotTools
}
catch (IOException e)
{
- buildTab.OnBuildExecFailed($"Cannot remove issues file: {GetIssuesFilePath(buildInfo)}");
+ BuildLaunchFailed?.Invoke(buildInfo, $"Cannot remove issues file: {GetIssuesFilePath(buildInfo)}");
Console.Error.WriteLine(e);
}
try
{
- int exitCode = BuildSystem.Build(buildInfo);
+ int exitCode = BuildSystem.Build(buildInfo, StdOutputReceived, StdErrorReceived);
if (exitCode != 0)
PrintVerbose($"MSBuild exited with code: {exitCode}. Log file: {GetLogFilePath(buildInfo)}");
- buildTab.OnBuildExit(exitCode == 0 ? BuildTab.BuildResults.Success : BuildTab.BuildResults.Error);
+ BuildFinished?.Invoke(exitCode == 0 ? BuildResult.Success : BuildResult.Error);
return exitCode == 0;
}
catch (Exception e)
{
- buildTab.OnBuildExecFailed($"The build method threw an exception.\n{e.GetType().FullName}: {e.Message}");
+ BuildLaunchFailed?.Invoke(buildInfo, $"The build method threw an exception.\n{e.GetType().FullName}: {e.Message}");
Console.Error.WriteLine(e);
return false;
}
}
finally
{
- BuildsInProgress.Remove(buildInfo);
+ _buildInProgress = null;
}
}
public static async Task<bool> BuildAsync(BuildInfo buildInfo)
{
- if (BuildsInProgress.Contains(buildInfo))
+ if (_buildInProgress != null)
throw new InvalidOperationException("A build is already in progress");
- BuildsInProgress.Add(buildInfo);
+ _buildInProgress = buildInfo;
try
{
- BuildTab buildTab = GodotSharpEditor.Instance.BottomPanel.GetBuildTabFor(buildInfo);
+ BuildStarted?.Invoke(buildInfo);
try
{
@@ -125,43 +132,57 @@ namespace GodotTools
}
catch (IOException e)
{
- buildTab.OnBuildExecFailed($"Cannot remove issues file: {GetIssuesFilePath(buildInfo)}");
+ BuildLaunchFailed?.Invoke(buildInfo, $"Cannot remove issues file: {GetIssuesFilePath(buildInfo)}");
Console.Error.WriteLine(e);
}
try
{
- int exitCode = await BuildSystem.BuildAsync(buildInfo);
+ int exitCode = await BuildSystem.BuildAsync(buildInfo, StdOutputReceived, StdErrorReceived);
if (exitCode != 0)
PrintVerbose($"MSBuild exited with code: {exitCode}. Log file: {GetLogFilePath(buildInfo)}");
- buildTab.OnBuildExit(exitCode == 0 ? BuildTab.BuildResults.Success : BuildTab.BuildResults.Error);
+ BuildFinished?.Invoke(exitCode == 0 ? BuildResult.Success : BuildResult.Error);
return exitCode == 0;
}
catch (Exception e)
{
- buildTab.OnBuildExecFailed($"The build method threw an exception.\n{e.GetType().FullName}: {e.Message}");
+ BuildLaunchFailed?.Invoke(buildInfo, $"The build method threw an exception.\n{e.GetType().FullName}: {e.Message}");
Console.Error.WriteLine(e);
return false;
}
}
finally
{
- BuildsInProgress.Remove(buildInfo);
+ _buildInProgress = null;
}
}
- public static bool BuildProjectBlocking(string config, [CanBeNull] string platform = null)
+ public static bool BuildProjectBlocking(string config, [CanBeNull] string[] targets = null, [CanBeNull] string platform = null)
{
- if (!File.Exists(GodotSharpDirs.ProjectSlnPath))
+ var buildInfo = new BuildInfo(GodotSharpDirs.ProjectSlnPath, targets ?? new[] {"Build"}, config, restore: true);
+
+ // If a platform was not specified, try determining the current one. If that fails, let MSBuild auto-detect it.
+ if (platform != null || OS.PlatformNameMap.TryGetValue(Godot.OS.GetName(), out platform))
+ buildInfo.CustomProperties.Add($"GodotTargetPlatform={platform}");
+
+ if (Internal.GodotIsRealTDouble())
+ buildInfo.CustomProperties.Add("GodotRealTIsDouble=true");
+
+ return BuildProjectBlocking(buildInfo);
+ }
+
+ private static bool BuildProjectBlocking(BuildInfo buildInfo)
+ {
+ if (!File.Exists(buildInfo.Solution))
return true; // No solution to build
// Make sure the API assemblies are up to date before building the project.
// We may not have had the chance to update the release API assemblies, and the debug ones
// may have been deleted by the user at some point after they were loaded by the Godot editor.
- string apiAssembliesUpdateError = Internal.UpdateApiAssembliesFromPrebuilt(config == "ExportRelease" ? "Release" : "Debug");
+ string apiAssembliesUpdateError = Internal.UpdateApiAssembliesFromPrebuilt(buildInfo.Configuration == "ExportRelease" ? "Release" : "Debug");
if (!string.IsNullOrEmpty(apiAssembliesUpdateError))
{
@@ -173,15 +194,6 @@ namespace GodotTools
{
pr.Step("Building project solution", 0);
- var buildInfo = new BuildInfo(GodotSharpDirs.ProjectSlnPath, targets: new[] {"Build"}, config, restore: true);
-
- // If a platform was not specified, try determining the current one. If that fails, let MSBuild auto-detect it.
- if (platform != null || OS.PlatformNameMap.TryGetValue(Godot.OS.GetName(), out platform))
- buildInfo.CustomProperties.Add($"GodotTargetPlatform={platform}");
-
- if (Internal.GodotIsRealTDouble())
- buildInfo.CustomProperties.Add("GodotRealTIsDouble=true");
-
if (!Build(buildInfo))
{
ShowBuildErrorDialog("Failed to build project solution");
@@ -197,18 +209,41 @@ namespace GodotTools
if (!File.Exists(GodotSharpDirs.ProjectSlnPath))
return true; // No solution to build
+ GenerateEditorScriptMetadata();
+
+ if (GodotSharpEditor.Instance.SkipBuildBeforePlaying)
+ return true; // Requested play from an external editor/IDE which already built the project
+
+ return BuildProjectBlocking("Debug");
+ }
+
+ // NOTE: This will be replaced with C# source generators in 4.0
+ public static void GenerateEditorScriptMetadata()
+ {
string editorScriptsMetadataPath = Path.Combine(GodotSharpDirs.ResMetadataDir, "scripts_metadata.editor");
string playerScriptsMetadataPath = Path.Combine(GodotSharpDirs.ResMetadataDir, "scripts_metadata.editor_player");
CsProjOperations.GenerateScriptsMetadata(GodotSharpDirs.ProjectCsProjPath, editorScriptsMetadataPath);
- if (File.Exists(editorScriptsMetadataPath))
- File.Copy(editorScriptsMetadataPath, playerScriptsMetadataPath);
+ if (!File.Exists(editorScriptsMetadataPath))
+ return;
- if (GodotSharpEditor.Instance.SkipBuildBeforePlaying)
- return true; // Requested play from an external editor/IDE which already built the project
+ try
+ {
+ File.Copy(editorScriptsMetadataPath, playerScriptsMetadataPath);
+ }
+ catch (IOException e)
+ {
+ throw new IOException("Failed to copy scripts metadata file.", innerException: e);
+ }
+ }
- return BuildProjectBlocking("Debug");
+ // NOTE: This will be replaced with C# source generators in 4.0
+ public static string GenerateExportedGameScriptMetadata(bool isDebug)
+ {
+ string scriptsMetadataPath = Path.Combine(GodotSharpDirs.ResMetadataDir, $"scripts_metadata.{(isDebug ? "debug" : "release")}");
+ CsProjOperations.GenerateScriptsMetadata(GodotSharpDirs.ProjectCsProjPath, scriptsMetadataPath);
+ return scriptsMetadataPath;
}
public static void Initialize()
@@ -254,8 +289,6 @@ namespace GodotTools
["hint"] = Godot.PropertyHint.Enum,
["hint_string"] = hintString
});
-
- EditorDef("mono/builds/print_build_output", false);
}
}
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/BuildTab.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
index 8596cd24af..9514cc9622 100644
--- a/modules/mono/editor/GodotTools/GodotTools/BuildTab.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
@@ -5,16 +5,10 @@ using GodotTools.Internals;
using File = GodotTools.Utils.File;
using Path = System.IO.Path;
-namespace GodotTools
+namespace GodotTools.Build
{
- public class BuildTab : VBoxContainer
+ public class BuildOutputView : VBoxContainer, ISerializationListener
{
- public enum BuildResults
- {
- Error,
- Success
- }
-
[Serializable]
private class BuildIssue : Reference // TODO Remove Reference once we have proper serialization
{
@@ -29,10 +23,14 @@ namespace GodotTools
private readonly Array<BuildIssue> issues = new Array<BuildIssue>(); // TODO Use List once we have proper serialization
private ItemList issuesList;
+ private TextEdit buildLog;
+ private PopupMenu issuesListContextMenu;
- public bool BuildExited { get; private set; } = false;
+ [Signal] public event Action BuildStateChanged;
- public BuildResults? BuildResult { get; private set; } = null;
+ public bool HasBuildExited { get; private set; } = false;
+
+ public BuildResult? BuildResult { get; private set; } = null;
public int ErrorCount { get; private set; } = 0;
@@ -41,23 +39,31 @@ namespace GodotTools
public bool ErrorsVisible { get; set; } = true;
public bool WarningsVisible { get; set; } = true;
- public Texture2D IconTexture
+ public Texture2D BuildStateIcon
{
get
{
- if (!BuildExited)
+ if (!HasBuildExited)
return GetThemeIcon("Stop", "EditorIcons");
- if (BuildResult == BuildResults.Error)
- return GetThemeIcon("StatusError", "EditorIcons");
+ if (BuildResult == Build.BuildResult.Error)
+ return GetThemeIcon("Error", "EditorIcons");
+
+ if (WarningCount > 1)
+ return GetThemeIcon("Warning", "EditorIcons");
- return GetThemeIcon("StatusSuccess", "EditorIcons");
+ return null;
}
}
- public BuildInfo BuildInfo { get; private set; }
+ private BuildInfo BuildInfo { get; set; }
- private void _LoadIssuesFromFile(string csvFile)
+ public bool LogVisible
+ {
+ set => buildLog.Visible = value;
+ }
+
+ private void LoadIssuesFromFile(string csvFile)
{
using (var file = new Godot.File())
{
@@ -107,7 +113,7 @@ namespace GodotTools
}
}
- private void _IssueActivated(int idx)
+ private void IssueActivated(int idx)
{
if (idx < 0 || idx >= issuesList.GetItemCount())
throw new IndexOutOfRangeException("Item list index out of range");
@@ -190,49 +196,79 @@ namespace GodotTools
}
}
- public void OnBuildStart()
+ private void BuildLaunchFailed(BuildInfo buildInfo, string cause)
+ {
+ HasBuildExited = true;
+ BuildResult = Build.BuildResult.Error;
+
+ issuesList.Clear();
+
+ var issue = new BuildIssue {Message = cause, Warning = false};
+
+ ErrorCount += 1;
+ issues.Add(issue);
+
+ UpdateIssuesList();
+
+ EmitSignal(nameof(BuildStateChanged));
+ }
+
+ private void BuildStarted(BuildInfo buildInfo)
{
- BuildExited = false;
+ BuildInfo = buildInfo;
+ HasBuildExited = false;
issues.Clear();
WarningCount = 0;
ErrorCount = 0;
+ buildLog.Text = string.Empty;
+
UpdateIssuesList();
- GodotSharpEditor.Instance.BottomPanel.RaiseBuildTab(this);
+ EmitSignal(nameof(BuildStateChanged));
}
- public void OnBuildExit(BuildResults result)
+ private void BuildFinished(BuildResult result)
{
- BuildExited = true;
+ HasBuildExited = true;
BuildResult = result;
- _LoadIssuesFromFile(Path.Combine(BuildInfo.LogsDirPath, BuildManager.MsBuildIssuesFileName));
+ LoadIssuesFromFile(Path.Combine(BuildInfo.LogsDirPath, BuildManager.MsBuildIssuesFileName));
+
UpdateIssuesList();
- GodotSharpEditor.Instance.BottomPanel.RaiseBuildTab(this);
+ EmitSignal(nameof(BuildStateChanged));
}
- public void OnBuildExecFailed(string cause)
+ private void StdOutputReceived(string text)
{
- BuildExited = true;
- BuildResult = BuildResults.Error;
-
- issuesList.Clear();
+ buildLog.Text += text + "\n";
+ ScrollToLastNonEmptyLogLine();
+ }
- var issue = new BuildIssue { Message = cause, Warning = false };
+ private void StdErrorReceived(string text)
+ {
+ buildLog.Text += text + "\n";
+ ScrollToLastNonEmptyLogLine();
+ }
- ErrorCount += 1;
- issues.Add(issue);
+ private void ScrollToLastNonEmptyLogLine()
+ {
+ int line;
+ for (line = buildLog.GetLineCount(); line > 0; line--)
+ {
+ string lineText = buildLog.GetLine(line);
- UpdateIssuesList();
+ if (!string.IsNullOrEmpty(lineText) || !string.IsNullOrEmpty(lineText?.Trim()))
+ break;
+ }
- GodotSharpEditor.Instance.BottomPanel.RaiseBuildTab(this);
+ buildLog.CursorSetLine(line);
}
public void RestartBuild()
{
- if (!BuildExited)
+ if (!HasBuildExited)
throw new InvalidOperationException("Build already started");
BuildManager.RestartBuild(this);
@@ -240,28 +276,118 @@ namespace GodotTools
public void StopBuild()
{
- if (!BuildExited)
+ if (!HasBuildExited)
throw new InvalidOperationException("Build is not in progress");
BuildManager.StopBuild(this);
}
+ private enum IssuesContextMenuOption
+ {
+ Copy
+ }
+
+ private void IssuesListContextOptionPressed(int id)
+ {
+ switch ((IssuesContextMenuOption)id)
+ {
+ case IssuesContextMenuOption.Copy:
+ {
+ // We don't allow multi-selection but just in case that changes later...
+ string text = null;
+
+ foreach (int issueIndex in issuesList.GetSelectedItems())
+ {
+ if (text != null)
+ text += "\n";
+ text += issuesList.GetItemText(issueIndex);
+ }
+
+ if (text != null)
+ DisplayServer.ClipboardSet(text);
+ break;
+ }
+ default:
+ throw new ArgumentOutOfRangeException(nameof(id), id, "Invalid issue context menu option");
+ }
+ }
+
+ private void IssuesListRmbSelected(int index, Vector2 atPosition)
+ {
+ _ = index; // Unused
+
+ issuesListContextMenu.Clear();
+ issuesListContextMenu.Size = new Vector2i(1, 1);
+
+ if (issuesList.IsAnythingSelected())
+ {
+ // Add menu entries for the selected item
+ issuesListContextMenu.AddIconItem(GetThemeIcon("ActionCopy", "EditorIcons"),
+ label: "Copy Error".TTR(), (int)IssuesContextMenuOption.Copy);
+ }
+
+ if (issuesListContextMenu.GetItemCount() > 0)
+ {
+ issuesListContextMenu.Position = (Vector2i)(issuesList.RectGlobalPosition + atPosition);
+ issuesListContextMenu.Popup();
+ }
+ }
+
public override void _Ready()
{
base._Ready();
- issuesList = new ItemList { SizeFlagsVertical = (int)SizeFlags.ExpandFill };
- issuesList.ItemActivated += _IssueActivated;
- AddChild(issuesList);
+ SizeFlagsVertical = (int)SizeFlags.ExpandFill;
+
+ var hsc = new HSplitContainer
+ {
+ SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
+ SizeFlagsVertical = (int)SizeFlags.ExpandFill
+ };
+ AddChild(hsc);
+
+ issuesList = new ItemList
+ {
+ SizeFlagsVertical = (int)SizeFlags.ExpandFill,
+ SizeFlagsHorizontal = (int)SizeFlags.ExpandFill // Avoid being squashed by the build log
+ };
+ issuesList.ItemActivated += IssueActivated;
+ issuesList.AllowRmbSelect = true;
+ issuesList.ItemRmbSelected += IssuesListRmbSelected;
+ hsc.AddChild(issuesList);
+
+ issuesListContextMenu = new PopupMenu();
+ issuesListContextMenu.IdPressed += IssuesListContextOptionPressed;
+ issuesList.AddChild(issuesListContextMenu);
+
+ buildLog = new TextEdit
+ {
+ Readonly = true,
+ SizeFlagsVertical = (int)SizeFlags.ExpandFill,
+ SizeFlagsHorizontal = (int)SizeFlags.ExpandFill // Avoid being squashed by the issues list
+ };
+ hsc.AddChild(buildLog);
+
+ AddBuildEventListeners();
}
- private BuildTab()
+ private void AddBuildEventListeners()
{
+ BuildManager.BuildLaunchFailed += BuildLaunchFailed;
+ BuildManager.BuildStarted += BuildStarted;
+ BuildManager.BuildFinished += BuildFinished;
+ // StdOutput/Error can be received from different threads, so we need to use CallDeferred
+ BuildManager.StdOutputReceived += line => CallDeferred(nameof(StdOutputReceived), line);
+ BuildManager.StdErrorReceived += line => CallDeferred(nameof(StdErrorReceived), line);
}
- public BuildTab(BuildInfo buildInfo)
+ public void OnBeforeSerialize()
{
- BuildInfo = buildInfo;
+ }
+
+ public void OnAfterDeserialize()
+ {
+ AddBuildEventListeners(); // Re-add them
}
}
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildResult.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildResult.cs
new file mode 100644
index 0000000000..59055b60c3
--- /dev/null
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildResult.cs
@@ -0,0 +1,8 @@
+namespace GodotTools.Build
+{
+ public enum BuildResult
+ {
+ Error,
+ Success
+ }
+}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs
index d9862ae361..bac7a2e6db 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs
@@ -44,10 +44,7 @@ namespace GodotTools.Build
}
}
- private static bool PrintBuildOutput =>
- (bool)EditorSettings.GetSetting("mono/builds/print_build_output");
-
- private static Process LaunchBuild(BuildInfo buildInfo)
+ private static Process LaunchBuild(BuildInfo buildInfo, Action<string> stdOutHandler, Action<string> stdErrHandler)
{
(string msbuildPath, BuildTool buildTool) = MsBuildFinder.FindMsBuild();
@@ -58,13 +55,13 @@ namespace GodotTools.Build
var startInfo = new ProcessStartInfo(msbuildPath, compilerArgs);
- bool redirectOutput = !IsDebugMsBuildRequested() && !PrintBuildOutput;
-
- if (!redirectOutput || Godot.OS.IsStdoutVerbose())
- Console.WriteLine($"Running: \"{startInfo.FileName}\" {startInfo.Arguments}");
+ string launchMessage = $"Running: \"{startInfo.FileName}\" {startInfo.Arguments}";
+ stdOutHandler?.Invoke(launchMessage);
+ if (Godot.OS.IsStdoutVerbose())
+ Console.WriteLine(launchMessage);
- startInfo.RedirectStandardOutput = redirectOutput;
- startInfo.RedirectStandardError = redirectOutput;
+ startInfo.RedirectStandardOutput = true;
+ startInfo.RedirectStandardError = true;
startInfo.UseShellExecute = false;
if (UsingMonoMsBuildOnWindows)
@@ -82,20 +79,22 @@ namespace GodotTools.Build
var process = new Process {StartInfo = startInfo};
+ if (stdOutHandler != null)
+ process.OutputDataReceived += (s, e) => stdOutHandler.Invoke(e.Data);
+ if (stdErrHandler != null)
+ process.ErrorDataReceived += (s, e) => stdErrHandler.Invoke(e.Data);
+
process.Start();
- if (redirectOutput)
- {
- process.BeginOutputReadLine();
- process.BeginErrorReadLine();
- }
+ process.BeginOutputReadLine();
+ process.BeginErrorReadLine();
return process;
}
- public static int Build(BuildInfo buildInfo)
+ public static int Build(BuildInfo buildInfo, Action<string> stdOutHandler, Action<string> stdErrHandler)
{
- using (var process = LaunchBuild(buildInfo))
+ using (var process = LaunchBuild(buildInfo, stdOutHandler, stdErrHandler))
{
process.WaitForExit();
@@ -103,9 +102,9 @@ namespace GodotTools.Build
}
}
- public static async Task<int> BuildAsync(BuildInfo buildInfo)
+ public static async Task<int> BuildAsync(BuildInfo buildInfo, Action<string> stdOutHandler, Action<string> stdErrHandler)
{
- using (var process = LaunchBuild(buildInfo))
+ using (var process = LaunchBuild(buildInfo, stdOutHandler, stdErrHandler))
{
await process.WaitForExitAsync();
@@ -152,10 +151,5 @@ namespace GodotTools.Build
foreach (string env in platformEnvironmentVariables)
environmentVariables.Remove(env);
}
-
- private static bool IsDebugMsBuildRequested()
- {
- return Environment.GetEnvironmentVariable("GODOT_DEBUG_MSBUILD")?.Trim() == "1";
- }
}
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs b/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs
new file mode 100644
index 0000000000..c22dce005c
--- /dev/null
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs
@@ -0,0 +1,165 @@
+using System;
+using Godot;
+using GodotTools.Internals;
+using JetBrains.Annotations;
+using static GodotTools.Internals.Globals;
+using File = GodotTools.Utils.File;
+
+namespace GodotTools.Build
+{
+ public class MSBuildPanel : VBoxContainer
+ {
+ public BuildOutputView BuildOutputView { get; private set; }
+
+ private Button errorsBtn;
+ private Button warningsBtn;
+ private Button viewLogBtn;
+
+ private void WarningsToggled(bool pressed)
+ {
+ BuildOutputView.WarningsVisible = pressed;
+ BuildOutputView.UpdateIssuesList();
+ }
+
+ private void ErrorsToggled(bool pressed)
+ {
+ BuildOutputView.ErrorsVisible = pressed;
+ BuildOutputView.UpdateIssuesList();
+ }
+
+ [UsedImplicitly]
+ public void BuildSolution()
+ {
+ if (!File.Exists(GodotSharpDirs.ProjectSlnPath))
+ return; // No solution to build
+
+ BuildManager.GenerateEditorScriptMetadata();
+
+ if (!BuildManager.BuildProjectBlocking("Debug"))
+ return; // Build failed
+
+ // Notify running game for hot-reload
+ Internal.EditorDebuggerNodeReloadScripts();
+
+ // Hot-reload in the editor
+ GodotSharpEditor.Instance.GetNode<HotReloadAssemblyWatcher>("HotReloadAssemblyWatcher").RestartTimer();
+
+ if (Internal.IsAssembliesReloadingNeeded())
+ Internal.ReloadAssemblies(softReload: false);
+ }
+
+ [UsedImplicitly]
+ private void RebuildSolution()
+ {
+ if (!File.Exists(GodotSharpDirs.ProjectSlnPath))
+ return; // No solution to build
+
+ BuildManager.GenerateEditorScriptMetadata();
+
+ if (!BuildManager.BuildProjectBlocking("Debug", targets: new[] {"Rebuild"}))
+ return; // Build failed
+
+ // Notify running game for hot-reload
+ Internal.EditorDebuggerNodeReloadScripts();
+
+ // Hot-reload in the editor
+ GodotSharpEditor.Instance.GetNode<HotReloadAssemblyWatcher>("HotReloadAssemblyWatcher").RestartTimer();
+
+ if (Internal.IsAssembliesReloadingNeeded())
+ Internal.ReloadAssemblies(softReload: false);
+ }
+
+ [UsedImplicitly]
+ private void CleanSolution()
+ {
+ if (!File.Exists(GodotSharpDirs.ProjectSlnPath))
+ return; // No solution to build
+
+ BuildManager.BuildProjectBlocking("Debug", targets: new[] {"Clean"});
+ }
+
+ private void ViewLogToggled(bool pressed) => BuildOutputView.LogVisible = pressed;
+
+ private void BuildMenuOptionPressed(int id)
+ {
+ switch ((BuildMenuOptions)id)
+ {
+ case BuildMenuOptions.BuildSolution:
+ BuildSolution();
+ break;
+ case BuildMenuOptions.RebuildSolution:
+ RebuildSolution();
+ break;
+ case BuildMenuOptions.CleanSolution:
+ CleanSolution();
+ break;
+ default:
+ throw new ArgumentOutOfRangeException(nameof(id), id, "Invalid build menu option");
+ }
+ }
+
+ private enum BuildMenuOptions
+ {
+ BuildSolution,
+ RebuildSolution,
+ CleanSolution
+ }
+
+ public override void _Ready()
+ {
+ base._Ready();
+
+ RectMinSize = new Vector2(0, 228) * EditorScale;
+ SizeFlagsVertical = (int)SizeFlags.ExpandFill;
+
+ var toolBarHBox = new HBoxContainer {SizeFlagsHorizontal = (int)SizeFlags.ExpandFill};
+ AddChild(toolBarHBox);
+
+ var buildMenuBtn = new MenuButton {Text = "Build", Icon = GetThemeIcon("Play", "EditorIcons")};
+ toolBarHBox.AddChild(buildMenuBtn);
+
+ var buildMenu = buildMenuBtn.GetPopup();
+ buildMenu.AddItem("Build Solution".TTR(), (int)BuildMenuOptions.BuildSolution);
+ buildMenu.AddItem("Rebuild Solution".TTR(), (int)BuildMenuOptions.RebuildSolution);
+ buildMenu.AddItem("Clean Solution".TTR(), (int)BuildMenuOptions.CleanSolution);
+ buildMenu.IdPressed += BuildMenuOptionPressed;
+
+ errorsBtn = new Button
+ {
+ HintTooltip = "Show Errors".TTR(),
+ Icon = GetThemeIcon("StatusError", "EditorIcons"),
+ ExpandIcon = false,
+ ToggleMode = true,
+ Pressed = true,
+ FocusMode = FocusModeEnum.None
+ };
+ errorsBtn.Toggled += ErrorsToggled;
+ toolBarHBox.AddChild(errorsBtn);
+
+ warningsBtn = new Button
+ {
+ HintTooltip = "Show Warnings".TTR(),
+ Icon = GetThemeIcon("NodeWarning", "EditorIcons"),
+ ExpandIcon = false,
+ ToggleMode = true,
+ Pressed = true,
+ FocusMode = FocusModeEnum.None
+ };
+ warningsBtn.Toggled += WarningsToggled;
+ toolBarHBox.AddChild(warningsBtn);
+
+ viewLogBtn = new Button
+ {
+ Text = "Show Output".TTR(),
+ ToggleMode = true,
+ Pressed = true,
+ FocusMode = FocusModeEnum.None
+ };
+ viewLogBtn.Toggled += ViewLogToggled;
+ toolBarHBox.AddChild(viewLogBtn);
+
+ BuildOutputView = new BuildOutputView();
+ AddChild(BuildOutputView);
+ }
+ }
+}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs b/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs
index 93aae2e03e..e2feb66e35 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs
@@ -31,7 +31,7 @@ namespace GodotTools.Build
string dotnetCliPath = OS.PathWhich("dotnet");
if (!string.IsNullOrEmpty(dotnetCliPath))
return (dotnetCliPath, BuildTool.DotnetCli);
- GD.PushError("Cannot find dotnet CLI executable. Fallback to MSBuild from Visual Studio.");
+ GD.PushError($"Cannot find executable for '{BuildManager.PropNameDotnetCli}'. Fallback to MSBuild from Visual Studio.");
goto case BuildTool.MsBuildVs;
}
case BuildTool.MsBuildVs:
@@ -89,7 +89,7 @@ namespace GodotTools.Build
string dotnetCliPath = OS.PathWhich("dotnet");
if (!string.IsNullOrEmpty(dotnetCliPath))
return (dotnetCliPath, BuildTool.DotnetCli);
- GD.PushError("Cannot find dotnet CLI executable. Fallback to MSBuild from Mono.");
+ GD.PushError($"Cannot find executable for '{BuildManager.PropNameDotnetCli}'. Fallback to MSBuild from Mono.");
goto case BuildTool.MsBuildMono;
}
case BuildTool.MsBuildMono:
@@ -161,7 +161,7 @@ namespace GodotTools.Build
// Try to find 15.0 with vswhere
- var envNames = Internal.GodotIs32Bits() ? new[] { "ProgramFiles", "ProgramW6432" } : new[] { "ProgramFiles(x86)", "ProgramFiles" };
+ var envNames = Internal.GodotIs32Bits() ? new[] {"ProgramFiles", "ProgramW6432"} : new[] {"ProgramFiles(x86)", "ProgramFiles"};
string vsWherePath = null;
foreach (var envName in envNames)
diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
index cd188509b4..e18ed7f107 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
@@ -5,6 +5,7 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
+using GodotTools.Build;
using GodotTools.Core;
using GodotTools.Internals;
using JetBrains.Annotations;
@@ -143,6 +144,8 @@ namespace GodotTools.Export
private void _ExportBeginImpl(string[] features, bool isDebug, string path, int flags)
{
+ _ = flags; // Unused
+
if (!File.Exists(GodotSharpDirs.ProjectSlnPath))
return;
@@ -154,12 +157,10 @@ namespace GodotTools.Export
string buildConfig = isDebug ? "ExportDebug" : "ExportRelease";
- string scriptsMetadataPath = Path.Combine(GodotSharpDirs.ResMetadataDir, $"scripts_metadata.{(isDebug ? "debug" : "release")}");
- CsProjOperations.GenerateScriptsMetadata(GodotSharpDirs.ProjectCsProjPath, scriptsMetadataPath);
-
+ string scriptsMetadataPath = BuildManager.GenerateExportedGameScriptMetadata(isDebug);
AddFile(scriptsMetadataPath, scriptsMetadataPath);
- if (!BuildManager.BuildProjectBlocking(buildConfig, platform))
+ if (!BuildManager.BuildProjectBlocking(buildConfig, platform: platform))
throw new Exception("Failed to build project");
// Add dependency assemblies
diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
index 57d334b93e..f5c99e87ef 100644
--- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
@@ -4,9 +4,9 @@ using GodotTools.Export;
using GodotTools.Utils;
using System;
using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
+using GodotTools.Build;
using GodotTools.Ides;
using GodotTools.Ides.Rider;
using GodotTools.Internals;
@@ -19,7 +19,6 @@ using Path = System.IO.Path;
namespace GodotTools
{
- [SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
public class GodotSharpEditor : EditorPlugin, ISerializationListener
{
private EditorSettings editorSettings;
@@ -37,7 +36,7 @@ namespace GodotTools
private WeakRef exportPluginWeak; // TODO Use WeakReference once we have proper serialization
- public BottomPanel BottomPanel { get; private set; }
+ public MSBuildPanel MSBuildPanel { get; private set; }
public bool SkipBuildBeforePlaying { get; set; } = false;
@@ -153,7 +152,7 @@ namespace GodotTools
}
}
- private void _BuildSolutionPressed()
+ private void BuildSolutionPressed()
{
if (!File.Exists(GodotSharpDirs.ProjectSlnPath))
{
@@ -161,23 +160,22 @@ namespace GodotTools
return; // Failed to create solution
}
- Instance.BottomPanel.BuildProjectPressed();
+ Instance.MSBuildPanel.BuildSolution();
}
- public override void _Notification(int what)
+ public override void _Ready()
{
- base._Notification(what);
+ base._Ready();
- if (what == NotificationReady)
+ MSBuildPanel.BuildOutputView.BuildStateChanged += BuildStateChanged;
+
+ bool showInfoDialog = (bool)editorSettings.GetSetting("mono/editor/show_info_on_start");
+ if (showInfoDialog)
{
- bool showInfoDialog = (bool)editorSettings.GetSetting("mono/editor/show_info_on_start");
- if (showInfoDialog)
- {
- aboutDialog.Exclusive = true;
- _ShowAboutDialog();
- // Once shown a first time, it can be seen again via the Mono menu - it doesn't have to be exclusive from that time on.
- aboutDialog.Exclusive = false;
- }
+ aboutDialog.Exclusive = true;
+ _ShowAboutDialog();
+ // Once shown a first time, it can be seen again via the Mono menu - it doesn't have to be exclusive from that time on.
+ aboutDialog.Exclusive = false;
}
}
@@ -393,6 +391,12 @@ namespace GodotTools
}
}
+ private void BuildStateChanged()
+ {
+ if (bottomPanelBtn != null)
+ bottomPanelBtn.Icon = MSBuildPanel.BuildOutputView.BuildStateIcon;
+ }
+
public override void EnablePlugin()
{
base.EnablePlugin();
@@ -409,16 +413,15 @@ namespace GodotTools
errorDialog = new AcceptDialog();
editorBaseControl.AddChild(errorDialog);
- BottomPanel = new BottomPanel();
-
- bottomPanelBtn = AddControlToBottomPanel(BottomPanel, "Mono".TTR());
+ MSBuildPanel = new MSBuildPanel();
+ bottomPanelBtn = AddControlToBottomPanel(MSBuildPanel, "MSBuild".TTR());
AddChild(new HotReloadAssemblyWatcher {Name = "HotReloadAssemblyWatcher"});
menuPopup = new PopupMenu();
menuPopup.Hide();
- AddToolSubmenuItem("Mono", menuPopup);
+ AddToolSubmenuItem("C#", menuPopup);
// TODO: Remove or edit this info dialog once Mono support is no longer in alpha
{
@@ -476,7 +479,7 @@ namespace GodotTools
HintTooltip = "Build solution",
FocusMode = Control.FocusModeEnum.None
};
- toolBarBuildButton.PressedSignal += _BuildSolutionPressed;
+ toolBarBuildButton.PressedSignal += BuildSolutionPressed;
AddControlToContainer(CustomControlContainer.Toolbar, toolBarBuildButton);
if (File.Exists(GodotSharpDirs.ProjectSlnPath) && File.Exists(GodotSharpDirs.ProjectCsProjPath))
@@ -570,6 +573,7 @@ namespace GodotTools
public static GodotSharpEditor Instance { get; private set; }
+ [UsedImplicitly]
private GodotSharpEditor()
{
}
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 5e6cc3e4e2..37da1dbd4d 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -592,7 +592,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
zipfi.tmz_date.tm_hour = time.hour;
zipfi.tmz_date.tm_mday = date.day;
zipfi.tmz_date.tm_min = time.min;
- zipfi.tmz_date.tm_mon = date.month;
+ zipfi.tmz_date.tm_mon = date.month - 1; // tm_mon is zero indexed
zipfi.tmz_date.tm_sec = time.sec;
zipfi.tmz_date.tm_year = date.year;
zipfi.dosDate = 0;
diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp
index b3370863e1..127748cdd5 100644
--- a/scene/2d/animated_sprite_2d.cpp
+++ b/scene/2d/animated_sprite_2d.cpp
@@ -33,9 +33,6 @@
#include "core/os/os.h"
#include "scene/scene_string_names.h"
-#define NORMAL_SUFFIX "_normal"
-#define SPECULAR_SUFFIX "_specular"
-
#ifdef TOOLS_ENABLED
Dictionary AnimatedSprite2D::_edit_get_state() const {
Dictionary state = Node2D::_edit_get_state();
@@ -152,8 +149,6 @@ void SpriteFrames::add_animation(const StringName &p_anim) {
ERR_FAIL_COND_MSG(animations.has(p_anim), "SpriteFrames already has animation '" + p_anim + "'.");
animations[p_anim] = Anim();
- animations[p_anim].normal_name = String(p_anim) + NORMAL_SUFFIX;
- animations[p_anim].specular_name = String(p_anim) + SPECULAR_SUFFIX;
}
bool SpriteFrames::has_animation(const StringName &p_anim) const {
@@ -171,8 +166,6 @@ void SpriteFrames::rename_animation(const StringName &p_prev, const StringName &
Anim anim = animations[p_prev];
animations.erase(p_prev);
animations[p_next] = anim;
- animations[p_next].normal_name = String(p_next) + NORMAL_SUFFIX;
- animations[p_next].specular_name = String(p_next) + SPECULAR_SUFFIX;
}
Vector<String> SpriteFrames::_get_animation_list() const {
@@ -441,9 +434,6 @@ void AnimatedSprite2D::_notification(int p_what) {
return;
}
- Ref<Texture2D> normal = frames->get_normal_frame(animation, frame);
- Ref<Texture2D> specular = frames->get_specular_frame(animation, frame);
-
RID ci = get_canvas_item();
Size2i s;
@@ -465,7 +455,7 @@ void AnimatedSprite2D::_notification(int p_what) {
dst_rect.size.y = -dst_rect.size.y;
}
- texture->draw_rect_region(ci, dst_rect, Rect2(Vector2(), texture->get_size()), Color(1, 1, 1), false, normal, specular, Color(specular_color.r, specular_color.g, specular_color.b, shininess));
+ texture->draw_rect_region(ci, dst_rect, Rect2(Vector2(), texture->get_size()), Color(1, 1, 1), false);
} break;
}
@@ -672,24 +662,6 @@ String AnimatedSprite2D::get_configuration_warning() const {
return warning;
}
-void AnimatedSprite2D::set_specular_color(const Color &p_color) {
- specular_color = p_color;
- update();
-}
-
-Color AnimatedSprite2D::get_specular_color() const {
- return specular_color;
-}
-
-void AnimatedSprite2D::set_shininess(float p_shininess) {
- shininess = CLAMP(p_shininess, 0.0, 1.0);
- update();
-}
-
-float AnimatedSprite2D::get_shininess() const {
- return shininess;
-}
-
void AnimatedSprite2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames"), &AnimatedSprite2D::set_sprite_frames);
ClassDB::bind_method(D_METHOD("get_sprite_frames"), &AnimatedSprite2D::get_sprite_frames);
@@ -722,12 +694,6 @@ void AnimatedSprite2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_speed_scale", "speed_scale"), &AnimatedSprite2D::set_speed_scale);
ClassDB::bind_method(D_METHOD("get_speed_scale"), &AnimatedSprite2D::get_speed_scale);
- ClassDB::bind_method(D_METHOD("set_specular_color", "color"), &AnimatedSprite2D::set_specular_color);
- ClassDB::bind_method(D_METHOD("get_specular_color"), &AnimatedSprite2D::get_specular_color);
-
- ClassDB::bind_method(D_METHOD("set_shininess", "shininess"), &AnimatedSprite2D::set_shininess);
- ClassDB::bind_method(D_METHOD("get_shininess"), &AnimatedSprite2D::get_shininess);
-
ADD_SIGNAL(MethodInfo("frame_changed"));
ADD_SIGNAL(MethodInfo("animation_finished"));
@@ -737,9 +703,6 @@ void AnimatedSprite2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "frame"), "set_frame", "get_frame");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "speed_scale"), "set_speed_scale", "get_speed_scale");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing"), "_set_playing", "_is_playing");
- ADD_GROUP("Lighting", "");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "specular_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_specular_color", "get_specular_color");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "shininess", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_shininess", "get_shininess");
ADD_GROUP("Offset", "");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "centered"), "set_centered", "is_centered");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_offset", "get_offset");
@@ -759,6 +722,4 @@ AnimatedSprite2D::AnimatedSprite2D() {
animation = "default";
timeout = 0;
is_over = false;
- specular_color = Color(1, 1, 1, 1);
- shininess = 1.0;
}
diff --git a/scene/2d/animated_sprite_2d.h b/scene/2d/animated_sprite_2d.h
index cefed56620..fddbf39be2 100644
--- a/scene/2d/animated_sprite_2d.h
+++ b/scene/2d/animated_sprite_2d.h
@@ -46,14 +46,8 @@ class SpriteFrames : public Resource {
loop = true;
speed = 5;
}
-
- StringName normal_name;
- StringName specular_name;
};
- Color specular_color;
- float shininess;
-
Map<StringName, Anim> animations;
Array _get_frames() const;
@@ -95,34 +89,6 @@ public:
return E->get().frames[p_idx];
}
- _FORCE_INLINE_ Ref<Texture2D> get_normal_frame(const StringName &p_anim, int p_idx) const {
- const Map<StringName, Anim>::Element *E = animations.find(p_anim);
- ERR_FAIL_COND_V_MSG(!E, Ref<Texture2D>(), "Animation '" + String(p_anim) + "' doesn't exist.");
- ERR_FAIL_COND_V(p_idx < 0, Ref<Texture2D>());
-
- const Map<StringName, Anim>::Element *EN = animations.find(E->get().normal_name);
-
- if (!EN || p_idx >= EN->get().frames.size()) {
- return Ref<Texture2D>();
- }
-
- return EN->get().frames[p_idx];
- }
-
- _FORCE_INLINE_ Ref<Texture2D> get_specular_frame(const StringName &p_anim, int p_idx) const {
- const Map<StringName, Anim>::Element *E = animations.find(p_anim);
- ERR_FAIL_COND_V(!E, Ref<Texture2D>());
- ERR_FAIL_COND_V(p_idx < 0, Ref<Texture2D>());
-
- const Map<StringName, Anim>::Element *EN = animations.find(E->get().specular_name);
-
- if (!EN || p_idx >= EN->get().frames.size()) {
- return Ref<Texture2D>();
- }
-
- return EN->get().frames[p_idx];
- }
-
void set_frame(const StringName &p_anim, int p_idx, const Ref<Texture2D> &p_frame) {
Map<StringName, Anim>::Element *E = animations.find(p_anim);
ERR_FAIL_COND_MSG(!E, "Animation '" + String(p_anim) + "' doesn't exist.");
@@ -166,9 +132,6 @@ class AnimatedSprite2D : public Node2D {
bool _is_playing() const;
Rect2 _get_rect() const;
- Color specular_color;
- float shininess;
-
protected:
static void _bind_methods();
void _notification(int p_what);
@@ -216,12 +179,6 @@ public:
void set_flip_v(bool p_flip);
bool is_flipped_v() const;
- void set_specular_color(const Color &p_color);
- Color get_specular_color() const;
-
- void set_shininess(float p_shininess);
- float get_shininess() const;
-
virtual String get_configuration_warning() const override;
AnimatedSprite2D();
};
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index 8d1162b7e3..ef2a9a4911 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -228,15 +228,6 @@ Ref<Texture2D> CPUParticles2D::get_texture() const {
return texture;
}
-void CPUParticles2D::set_normalmap(const Ref<Texture2D> &p_normalmap) {
- normalmap = p_normalmap;
- update();
-}
-
-Ref<Texture2D> CPUParticles2D::get_normalmap() const {
- return normalmap;
-}
-
void CPUParticles2D::set_fixed_fps(int p_count) {
fixed_fps = p_count;
}
@@ -1060,12 +1051,7 @@ void CPUParticles2D::_notification(int p_what) {
texrid = texture->get_rid();
}
- RID normrid;
- if (normalmap.is_valid()) {
- normrid = normalmap->get_rid();
- }
-
- RS::get_singleton()->canvas_item_add_multimesh(get_canvas_item(), multimesh, texrid, normrid);
+ RS::get_singleton()->canvas_item_add_multimesh(get_canvas_item(), multimesh, texrid);
}
if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
@@ -1214,9 +1200,6 @@ void CPUParticles2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_texture", "texture"), &CPUParticles2D::set_texture);
ClassDB::bind_method(D_METHOD("get_texture"), &CPUParticles2D::get_texture);
- ClassDB::bind_method(D_METHOD("set_normalmap", "normalmap"), &CPUParticles2D::set_normalmap);
- ClassDB::bind_method(D_METHOD("get_normalmap"), &CPUParticles2D::get_normalmap);
-
ClassDB::bind_method(D_METHOD("restart"), &CPUParticles2D::restart);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emitting"), "set_emitting", "is_emitting");
@@ -1236,7 +1219,6 @@ void CPUParticles2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "local_coords"), "set_use_local_coordinates", "get_use_local_coordinates");
ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_order", PROPERTY_HINT_ENUM, "Index,Lifetime"), "set_draw_order", "get_draw_order");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "normalmap", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_normalmap", "get_normalmap");
BIND_ENUM_CONSTANT(DRAW_ORDER_INDEX);
BIND_ENUM_CONSTANT(DRAW_ORDER_LIFETIME);
diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h
index dfc875ceb0..5b405246e2 100644
--- a/scene/2d/cpu_particles_2d.h
+++ b/scene/2d/cpu_particles_2d.h
@@ -147,7 +147,6 @@ private:
DrawOrder draw_order;
Ref<Texture2D> texture;
- Ref<Texture2D> normalmap;
////////
@@ -232,9 +231,6 @@ public:
void set_texture(const Ref<Texture2D> &p_texture);
Ref<Texture2D> get_texture() const;
- void set_normalmap(const Ref<Texture2D> &p_normalmap);
- Ref<Texture2D> get_normalmap() const;
-
///////////////////
void set_direction(Vector2 p_direction);
diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp
index 01da36ec34..a9fdb103b2 100644
--- a/scene/2d/gpu_particles_2d.cpp
+++ b/scene/2d/gpu_particles_2d.cpp
@@ -267,15 +267,6 @@ Ref<Texture2D> GPUParticles2D::get_texture() const {
return texture;
}
-void GPUParticles2D::set_normal_map(const Ref<Texture2D> &p_normal_map) {
- normal_map = p_normal_map;
- update();
-}
-
-Ref<Texture2D> GPUParticles2D::get_normal_map() const {
- return normal_map;
-}
-
void GPUParticles2D::_validate_property(PropertyInfo &property) const {
}
@@ -290,12 +281,8 @@ void GPUParticles2D::_notification(int p_what) {
if (texture.is_valid()) {
texture_rid = texture->get_rid();
}
- RID normal_rid;
- if (normal_map.is_valid()) {
- normal_rid = normal_map->get_rid();
- }
- RS::get_singleton()->canvas_item_add_particles(get_canvas_item(), particles, texture_rid, normal_rid);
+ RS::get_singleton()->canvas_item_add_particles(get_canvas_item(), particles, texture_rid);
#ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint() && (this == get_tree()->get_edited_scene_root() || get_tree()->get_edited_scene_root()->is_a_parent_of(this))) {
@@ -359,9 +346,6 @@ void GPUParticles2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_texture", "texture"), &GPUParticles2D::set_texture);
ClassDB::bind_method(D_METHOD("get_texture"), &GPUParticles2D::get_texture);
- ClassDB::bind_method(D_METHOD("set_normal_map", "texture"), &GPUParticles2D::set_normal_map);
- ClassDB::bind_method(D_METHOD("get_normal_map"), &GPUParticles2D::get_normal_map);
-
ClassDB::bind_method(D_METHOD("capture_rect"), &GPUParticles2D::capture_rect);
ClassDB::bind_method(D_METHOD("restart"), &GPUParticles2D::restart);
@@ -385,7 +369,6 @@ void GPUParticles2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "process_material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,ParticlesMaterial"), "set_process_material", "get_process_material");
ADD_GROUP("Textures", "");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "normal_map", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_normal_map", "get_normal_map");
BIND_ENUM_CONSTANT(DRAW_ORDER_INDEX);
BIND_ENUM_CONSTANT(DRAW_ORDER_LIFETIME);
diff --git a/scene/2d/gpu_particles_2d.h b/scene/2d/gpu_particles_2d.h
index 3258237f92..f1001a39fe 100644
--- a/scene/2d/gpu_particles_2d.h
+++ b/scene/2d/gpu_particles_2d.h
@@ -65,7 +65,6 @@ private:
DrawOrder draw_order;
Ref<Texture2D> texture;
- Ref<Texture2D> normal_map;
void _update_particle_emission_transform();
@@ -111,9 +110,6 @@ public:
void set_texture(const Ref<Texture2D> &p_texture);
Ref<Texture2D> get_texture() const;
- void set_normal_map(const Ref<Texture2D> &p_normal_map);
- Ref<Texture2D> get_normal_map() const;
-
virtual String get_configuration_warning() const override;
void restart();
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index 217a210342..4fc0882fdd 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -262,15 +262,6 @@ bool Light2D::is_shadow_enabled() const {
return shadow;
}
-void Light2D::set_shadow_buffer_size(int p_size) {
- shadow_buffer_size = p_size;
- RS::get_singleton()->canvas_light_set_shadow_buffer_size(canvas_light, shadow_buffer_size);
-}
-
-int Light2D::get_shadow_buffer_size() const {
- return shadow_buffer_size;
-}
-
void Light2D::set_shadow_filter(ShadowFilter p_filter) {
ERR_FAIL_INDEX(p_filter, SHADOW_FILTER_MAX);
shadow_filter = p_filter;
@@ -380,9 +371,6 @@ void Light2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_shadow_enabled", "enabled"), &Light2D::set_shadow_enabled);
ClassDB::bind_method(D_METHOD("is_shadow_enabled"), &Light2D::is_shadow_enabled);
- ClassDB::bind_method(D_METHOD("set_shadow_buffer_size", "size"), &Light2D::set_shadow_buffer_size);
- ClassDB::bind_method(D_METHOD("get_shadow_buffer_size"), &Light2D::get_shadow_buffer_size);
-
ClassDB::bind_method(D_METHOD("set_shadow_smooth", "smooth"), &Light2D::set_shadow_smooth);
ClassDB::bind_method(D_METHOD("get_shadow_smooth"), &Light2D::get_shadow_smooth);
@@ -411,7 +399,6 @@ void Light2D::_bind_methods() {
ADD_GROUP("Shadow", "shadow_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shadow_enabled"), "set_shadow_enabled", "is_shadow_enabled");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "shadow_color"), "set_shadow_color", "get_shadow_color");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "shadow_buffer_size", PROPERTY_HINT_RANGE, "32,16384,1"), "set_shadow_buffer_size", "get_shadow_buffer_size");
ADD_PROPERTY(PropertyInfo(Variant::INT, "shadow_filter", PROPERTY_HINT_ENUM, "None,PCF5,PCF13"), "set_shadow_filter", "get_shadow_filter");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "shadow_filter_smooth", PROPERTY_HINT_RANGE, "0,64,0.1"), "set_shadow_smooth", "get_shadow_smooth");
ADD_PROPERTY(PropertyInfo(Variant::INT, "shadow_item_cull_mask", PROPERTY_HINT_LAYERS_2D_RENDER), "set_item_shadow_cull_mask", "get_item_shadow_cull_mask");
@@ -441,7 +428,6 @@ Light2D::Light2D() {
item_mask = 1;
item_shadow_mask = 1;
mode = MODE_ADD;
- shadow_buffer_size = 2048;
energy = 1.0;
shadow_color = Color(0, 0, 0, 0);
shadow_filter = SHADOW_FILTER_NONE;
diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h
index 45444800fe..095cb05635 100644
--- a/scene/2d/light_2d.h
+++ b/scene/2d/light_2d.h
@@ -67,7 +67,6 @@ private:
int layer_max;
int item_mask;
int item_shadow_mask;
- int shadow_buffer_size;
float shadow_smooth;
Mode mode;
Ref<Texture2D> texture;
@@ -142,9 +141,6 @@ public:
void set_shadow_enabled(bool p_enabled);
bool is_shadow_enabled() const;
- void set_shadow_buffer_size(int p_size);
- int get_shadow_buffer_size() const;
-
void set_shadow_filter(ShadowFilter p_filter);
ShadowFilter get_shadow_filter() const;
diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp
index b120b115b0..e990e9f53e 100644
--- a/scene/2d/line_2d.cpp
+++ b/scene/2d/line_2d.cpp
@@ -177,7 +177,7 @@ void Line2D::set_gradient(const Ref<Gradient> &p_gradient) {
_gradient = p_gradient;
- // Connect to the gradient so the line will update when the ColorRamp is changed
+ // Connect to the gradient so the line will update when the Gradient is changed
if (_gradient.is_valid()) {
_gradient->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Line2D::_gradient_changed));
}
diff --git a/scene/2d/mesh_instance_2d.cpp b/scene/2d/mesh_instance_2d.cpp
index 897595ad1f..037e423ce9 100644
--- a/scene/2d/mesh_instance_2d.cpp
+++ b/scene/2d/mesh_instance_2d.cpp
@@ -33,7 +33,7 @@
void MeshInstance2D::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
if (mesh.is_valid()) {
- draw_mesh(mesh, texture, normal_map);
+ draw_mesh(mesh, texture);
}
}
}
diff --git a/scene/2d/multimesh_instance_2d.cpp b/scene/2d/multimesh_instance_2d.cpp
index b99c0a3fa9..c258e30eab 100644
--- a/scene/2d/multimesh_instance_2d.cpp
+++ b/scene/2d/multimesh_instance_2d.cpp
@@ -33,7 +33,7 @@
void MultiMeshInstance2D::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
if (multimesh.is_valid()) {
- draw_multimesh(multimesh, texture, normal_map);
+ draw_multimesh(multimesh, texture);
}
}
}
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index 13b62816a4..26340bb861 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -302,7 +302,7 @@ void Polygon2D::_notification(int p_what) {
if (invert || polygons.size() == 0) {
Vector<int> indices = Geometry2D::triangulate_polygon(points);
if (indices.size()) {
- RS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID(), -1, normal_map.is_valid() ? normal_map->get_rid() : RID(), specular_map.is_valid() ? specular_map->get_rid() : RID(), Color(specular_color.r, specular_color.g, specular_color.b, shininess));
+ RS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID(), -1);
}
} else {
//draw individual polygons
@@ -417,42 +417,6 @@ Ref<Texture2D> Polygon2D::get_texture() const {
return texture;
}
-void Polygon2D::set_normal_map(const Ref<Texture2D> &p_normal_map) {
- normal_map = p_normal_map;
- update();
-}
-
-Ref<Texture2D> Polygon2D::get_normal_map() const {
- return normal_map;
-}
-
-void Polygon2D::set_specular_map(const Ref<Texture2D> &p_specular_map) {
- specular_map = p_specular_map;
- update();
-}
-
-Ref<Texture2D> Polygon2D::get_specular_map() const {
- return specular_map;
-}
-
-void Polygon2D::set_specular_color(const Color &p_specular_color) {
- specular_color = p_specular_color;
- update();
-}
-
-Color Polygon2D::get_specular_color() const {
- return specular_color;
-}
-
-void Polygon2D::set_shininess(float p_shininess) {
- shininess = CLAMP(p_shininess, 0.0, 1.0);
- update();
-}
-
-float Polygon2D::get_shininess() const {
- return shininess;
-}
-
void Polygon2D::set_texture_offset(const Vector2 &p_offset) {
tex_ofs = p_offset;
update();
@@ -616,18 +580,6 @@ void Polygon2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Polygon2D::set_texture);
ClassDB::bind_method(D_METHOD("get_texture"), &Polygon2D::get_texture);
- ClassDB::bind_method(D_METHOD("set_normal_map", "normal_map"), &Polygon2D::set_normal_map);
- ClassDB::bind_method(D_METHOD("get_normal_map"), &Polygon2D::get_normal_map);
-
- ClassDB::bind_method(D_METHOD("set_specular_map", "specular_map"), &Polygon2D::set_specular_map);
- ClassDB::bind_method(D_METHOD("get_specular_map"), &Polygon2D::get_specular_map);
-
- ClassDB::bind_method(D_METHOD("set_specular_color", "specular_color"), &Polygon2D::set_specular_color);
- ClassDB::bind_method(D_METHOD("get_specular_color"), &Polygon2D::get_specular_color);
-
- ClassDB::bind_method(D_METHOD("set_shininess", "shininess"), &Polygon2D::set_shininess);
- ClassDB::bind_method(D_METHOD("get_shininess"), &Polygon2D::get_shininess);
-
ClassDB::bind_method(D_METHOD("set_texture_offset", "texture_offset"), &Polygon2D::set_texture_offset);
ClassDB::bind_method(D_METHOD("get_texture_offset"), &Polygon2D::get_texture_offset);
@@ -680,11 +632,6 @@ void Polygon2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "texture_scale"), "set_texture_scale", "get_texture_scale");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "texture_rotation_degrees", PROPERTY_HINT_RANGE, "-360,360,0.1,or_lesser,or_greater"), "set_texture_rotation_degrees", "get_texture_rotation_degrees");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "texture_rotation", PROPERTY_HINT_NONE, "", 0), "set_texture_rotation", "get_texture_rotation");
- ADD_GROUP("Lighting", "");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "normal_map", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_normal_map", "get_normal_map");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "specular_map", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_specular_map", "get_specular_map");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "specular_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_specular_color", "get_specular_color");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "shininess", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_shininess", "get_shininess");
ADD_GROUP("Skeleton", "");
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "skeleton", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Skeleton2D"), "set_skeleton", "get_skeleton");
@@ -711,7 +658,4 @@ Polygon2D::Polygon2D() {
color = Color(1, 1, 1);
rect_cache_dirty = true;
internal_vertices = 0;
-
- specular_color = Color(1, 1, 1, 1);
- shininess = 1.0;
}
diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h
index c5ff05aace..e2a8db414a 100644
--- a/scene/2d/polygon_2d.h
+++ b/scene/2d/polygon_2d.h
@@ -51,10 +51,6 @@ class Polygon2D : public Node2D {
Color color;
Ref<Texture2D> texture;
- Ref<Texture2D> normal_map;
- Ref<Texture2D> specular_map;
- Color specular_color;
- float shininess;
Size2 tex_scale;
Vector2 tex_ofs;
@@ -115,18 +111,6 @@ public:
void set_texture(const Ref<Texture2D> &p_texture);
Ref<Texture2D> get_texture() const;
- void set_normal_map(const Ref<Texture2D> &p_normal_map);
- Ref<Texture2D> get_normal_map() const;
-
- void set_specular_map(const Ref<Texture2D> &p_specular_map);
- Ref<Texture2D> get_specular_map() const;
-
- void set_specular_color(const Color &p_specular_color);
- Color get_specular_color() const;
-
- void set_shininess(float p_shininess);
- float get_shininess() const;
-
void set_texture_offset(const Vector2 &p_offset);
Vector2 get_texture_offset() const;
diff --git a/scene/2d/sprite_2d.cpp b/scene/2d/sprite_2d.cpp
index d1be93e55d..5178d2f850 100644
--- a/scene/2d/sprite_2d.cpp
+++ b/scene/2d/sprite_2d.cpp
@@ -130,8 +130,8 @@ void Sprite2D::_notification(int p_what) {
Rect2 src_rect, dst_rect;
bool filter_clip;
_get_rects(src_rect, dst_rect, filter_clip);
- texture->draw_rect_region(ci, dst_rect, src_rect, Color(1, 1, 1), false, normal_map, specular, Color(specular_color.r, specular_color.g, specular_color.b, shininess), RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, filter_clip);
+ texture->draw_rect_region(ci, dst_rect, src_rect, Color(1, 1, 1), false, filter_clip);
} break;
}
}
@@ -157,42 +157,6 @@ void Sprite2D::set_texture(const Ref<Texture2D> &p_texture) {
_change_notify("texture");
}
-void Sprite2D::set_normal_map(const Ref<Texture2D> &p_texture) {
- normal_map = p_texture;
- update();
-}
-
-Ref<Texture2D> Sprite2D::get_normal_map() const {
- return normal_map;
-}
-
-void Sprite2D::set_specular_map(const Ref<Texture2D> &p_texture) {
- specular = p_texture;
- update();
-}
-
-Ref<Texture2D> Sprite2D::get_specular_map() const {
- return specular;
-}
-
-void Sprite2D::set_specular_color(const Color &p_color) {
- specular_color = p_color;
- update();
-}
-
-Color Sprite2D::get_specular_color() const {
- return specular_color;
-}
-
-void Sprite2D::set_shininess(float p_shininess) {
- shininess = CLAMP(p_shininess, 0.0, 1.0);
- update();
-}
-
-float Sprite2D::get_shininess() const {
- return shininess;
-}
-
Ref<Texture2D> Sprite2D::get_texture() const {
return texture;
}
@@ -434,18 +398,6 @@ void Sprite2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Sprite2D::set_texture);
ClassDB::bind_method(D_METHOD("get_texture"), &Sprite2D::get_texture);
- ClassDB::bind_method(D_METHOD("set_normal_map", "normal_map"), &Sprite2D::set_normal_map);
- ClassDB::bind_method(D_METHOD("get_normal_map"), &Sprite2D::get_normal_map);
-
- ClassDB::bind_method(D_METHOD("set_specular_map", "specular_map"), &Sprite2D::set_specular_map);
- ClassDB::bind_method(D_METHOD("get_specular_map"), &Sprite2D::get_specular_map);
-
- ClassDB::bind_method(D_METHOD("set_specular_color", "specular_color"), &Sprite2D::set_specular_color);
- ClassDB::bind_method(D_METHOD("get_specular_color"), &Sprite2D::get_specular_color);
-
- ClassDB::bind_method(D_METHOD("set_shininess", "shininess"), &Sprite2D::set_shininess);
- ClassDB::bind_method(D_METHOD("get_shininess"), &Sprite2D::get_shininess);
-
ClassDB::bind_method(D_METHOD("set_centered", "centered"), &Sprite2D::set_centered);
ClassDB::bind_method(D_METHOD("is_centered"), &Sprite2D::is_centered);
@@ -487,11 +439,6 @@ void Sprite2D::_bind_methods() {
ADD_SIGNAL(MethodInfo("texture_changed"));
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture");
- ADD_GROUP("Lighting", "");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "normal_map", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_normal_map", "get_normal_map");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "specular_map", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_specular_map", "get_specular_map");
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "specular_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_specular_color", "get_specular_color");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "shininess", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_shininess", "get_shininess");
ADD_GROUP("Offset", "");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "centered"), "set_centered", "is_centered");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_offset", "get_offset");
@@ -515,8 +462,6 @@ Sprite2D::Sprite2D() {
vflip = false;
region = false;
region_filter_clip = false;
- shininess = 1.0;
- specular_color = Color(1, 1, 1, 1);
frame = 0;
diff --git a/scene/2d/sprite_2d.h b/scene/2d/sprite_2d.h
index f6b752575f..2875d333bb 100644
--- a/scene/2d/sprite_2d.h
+++ b/scene/2d/sprite_2d.h
@@ -38,8 +38,6 @@ class Sprite2D : public Node2D {
GDCLASS(Sprite2D, Node2D);
Ref<Texture2D> texture;
- Ref<Texture2D> normal_map;
- Ref<Texture2D> specular;
Color specular_color;
float shininess;
@@ -87,18 +85,6 @@ public:
void set_texture(const Ref<Texture2D> &p_texture);
Ref<Texture2D> get_texture() const;
- void set_normal_map(const Ref<Texture2D> &p_texture);
- Ref<Texture2D> get_normal_map() const;
-
- void set_specular_map(const Ref<Texture2D> &p_texture);
- Ref<Texture2D> get_specular_map() const;
-
- void set_specular_color(const Color &p_color);
- Color get_specular_color() const;
-
- void set_shininess(float p_shininess);
- float get_shininess() const;
-
void set_centered(bool p_center);
bool is_centered() const;
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 94ec0998fa..bff191a2bf 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -528,15 +528,14 @@ void TileMap::update_dirty_quadrants() {
rect.position += tile_ofs;
}
- Ref<Texture2D> normal_map = tile_set->tile_get_normal_map(c.id);
Color modulate = tile_set->tile_get_modulate(c.id);
Color self_modulate = get_self_modulate();
modulate = Color(modulate.r * self_modulate.r, modulate.g * self_modulate.g,
modulate.b * self_modulate.b, modulate.a * self_modulate.a);
if (r == Rect2()) {
- tex->draw_rect(canvas_item, rect, false, modulate, c.transpose, normal_map);
+ tex->draw_rect(canvas_item, rect, false, modulate, c.transpose);
} else {
- tex->draw_rect_region(canvas_item, rect, r, modulate, c.transpose, normal_map, Ref<Texture2D>(), Color(1, 1, 1, 1), RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, clip_uv);
+ tex->draw_rect_region(canvas_item, rect, r, modulate, c.transpose, clip_uv);
}
Vector<TileSet::ShapeData> shapes = tile_set->tile_get_shapes(c.id);
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index a759e329da..1a19c75d27 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -401,7 +401,7 @@ void BaseButton::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "button_mask", PROPERTY_HINT_FLAGS, "Mouse Left, Mouse Right, Mouse Middle"), "set_button_mask", "get_button_mask");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_pressed_outside"), "set_keep_pressed_outside", "is_keep_pressed_outside");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "Shortcut"), "set_shortcut", "get_shortcut");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "group", PROPERTY_HINT_RESOURCE_TYPE, "ButtonGroup"), "set_button_group", "get_button_group");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "button_group", PROPERTY_HINT_RESOURCE_TYPE, "ButtonGroup"), "set_button_group", "get_button_group");
BIND_ENUM_CONSTANT(DRAW_NORMAL);
BIND_ENUM_CONSTANT(DRAW_PRESSED);
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index 1eb45d7fc6..f6f52fbf55 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -341,7 +341,10 @@ void CodeEdit::_gutter_clicked(int p_line, int p_gutter) {
}
if (p_gutter == line_number_gutter) {
- cursor_set_line(p_line);
+ set_selection_mode(TextEdit::SelectionMode::SELECTION_MODE_LINE, p_line, 0);
+ select(p_line, 0, p_line + 1, 0);
+ cursor_set_line(p_line + 1);
+ cursor_set_column(0);
return;
}
diff --git a/scene/gui/reference_rect.cpp b/scene/gui/reference_rect.cpp
index 27c57c684a..32ec0049f0 100644
--- a/scene/gui/reference_rect.cpp
+++ b/scene/gui/reference_rect.cpp
@@ -38,7 +38,7 @@ void ReferenceRect::_notification(int p_what) {
return;
}
if (Engine::get_singleton()->is_editor_hint() || !editor_only) {
- draw_rect(Rect2(Point2(), get_size()), border_color, false);
+ draw_rect(Rect2(Point2(), get_size()), border_color, false, border_width);
}
}
}
@@ -52,6 +52,15 @@ Color ReferenceRect::get_border_color() const {
return border_color;
}
+void ReferenceRect::set_border_width(float p_width) {
+ border_width = MAX(0.0, p_width);
+ update();
+}
+
+float ReferenceRect::get_border_width() const {
+ return border_width;
+}
+
void ReferenceRect::set_editor_only(const bool &p_enabled) {
editor_only = p_enabled;
update();
@@ -65,14 +74,13 @@ void ReferenceRect::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_border_color"), &ReferenceRect::get_border_color);
ClassDB::bind_method(D_METHOD("set_border_color", "color"), &ReferenceRect::set_border_color);
+ ClassDB::bind_method(D_METHOD("get_border_width"), &ReferenceRect::get_border_width);
+ ClassDB::bind_method(D_METHOD("set_border_width", "width"), &ReferenceRect::set_border_width);
+
ClassDB::bind_method(D_METHOD("get_editor_only"), &ReferenceRect::get_editor_only);
ClassDB::bind_method(D_METHOD("set_editor_only", "enabled"), &ReferenceRect::set_editor_only);
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "border_color"), "set_border_color", "get_border_color");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "border_width", PROPERTY_HINT_RANGE, "0.0,5.0,0.1,or_greater"), "set_border_width", "get_border_width");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_only"), "set_editor_only", "get_editor_only");
}
-
-ReferenceRect::ReferenceRect() {
- border_color = Color(1, 0, 0);
- editor_only = true;
-}
diff --git a/scene/gui/reference_rect.h b/scene/gui/reference_rect.h
index db2f4269f3..becbbf47c5 100644
--- a/scene/gui/reference_rect.h
+++ b/scene/gui/reference_rect.h
@@ -35,19 +35,22 @@
class ReferenceRect : public Control {
GDCLASS(ReferenceRect, Control);
- Color border_color;
- bool editor_only;
+
+ Color border_color = Color(1, 0, 0);
+ float border_width = 1.0;
+ bool editor_only = true;
protected:
void _notification(int p_what);
static void _bind_methods();
public:
- ReferenceRect();
-
void set_border_color(const Color &p_color);
Color get_border_color() const;
+ void set_border_width(float p_width);
+ float get_border_width() const;
+
void set_editor_only(const bool &p_enabled);
bool get_editor_only() const;
};
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index dc21980473..00ead64e59 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -318,15 +318,15 @@ void TextEdit::_click_selection_held() {
// Warning: is_mouse_button_pressed(BUTTON_LEFT) returns false for double+ clicks, so this doesn't work for MODE_WORD
// and MODE_LINE. However, moving the mouse triggers _gui_input, which calls these functions too, so that's not a huge problem.
// I'm unsure if there's an actual fix that doesn't have a ton of side effects.
- if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT) && selection.selecting_mode != Selection::MODE_NONE) {
+ if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT) && selection.selecting_mode != SelectionMode::SELECTION_MODE_NONE) {
switch (selection.selecting_mode) {
- case Selection::MODE_POINTER: {
+ case SelectionMode::SELECTION_MODE_POINTER: {
_update_selection_mode_pointer();
} break;
- case Selection::MODE_WORD: {
+ case SelectionMode::SELECTION_MODE_WORD: {
_update_selection_mode_word();
} break;
- case Selection::MODE_LINE: {
+ case SelectionMode::SELECTION_MODE_LINE: {
_update_selection_mode_line();
} break;
default: {
@@ -1367,6 +1367,10 @@ void TextEdit::_notification(int p_what) {
int scrollw = get_theme_constant("completion_scroll_width");
Color scrollc = get_theme_color("completion_scroll_color");
+#ifdef TOOLS_ENABLED
+ scrollw *= EDSCALE;
+#endif
+
const int completion_options_size = completion_options.size();
int lines = MIN(completion_options_size, maxlines);
int w = 0;
@@ -1389,6 +1393,17 @@ void TextEdit::_notification(int p_what) {
Size2 icon_area_size(get_row_height(), get_row_height());
w += icon_area_size.width + icon_hsep;
+ int line_from = CLAMP(completion_index - lines / 2, 0, completion_options_size - lines);
+
+ for (int i = 0; i < lines; i++) {
+ int l = line_from + i;
+ ERR_CONTINUE(l < 0 || l >= completion_options_size);
+ if (completion_options[l].default_value.get_type() == Variant::COLOR) {
+ w += icon_area_size.width;
+ break;
+ }
+ }
+
int th = h + csb->get_minimum_size().y;
if (cursor_pos.y + get_row_height() + th > get_size().height) {
@@ -1415,7 +1430,6 @@ void TextEdit::_notification(int p_what) {
if (cache.completion_background_color.a > 0.01) {
RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(completion_rect.position, completion_rect.size + Size2(scrollw, 0)), cache.completion_background_color);
}
- int line_from = CLAMP(completion_index - lines / 2, 0, completion_options_size - lines);
RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(completion_rect.position.x, completion_rect.position.y + (completion_index - line_from) * get_row_height()), Size2(completion_rect.size.width, get_row_height())), cache.completion_selected_color);
draw_rect(Rect2(completion_rect.position + Vector2(icon_area_size.x + icon_hsep, 0), Size2(MIN(nofs, completion_rect.size.width - (icon_area_size.x + icon_hsep)), completion_rect.size.height)), cache.completion_existing_color);
@@ -1437,6 +1451,11 @@ void TextEdit::_notification(int p_what) {
}
title_pos.x = icon_area.position.x + icon_area.size.width + icon_hsep;
+
+ if (completion_options[l].default_value.get_type() == Variant::COLOR) {
+ draw_rect(Rect2(Point2(completion_rect.position.x + completion_rect.size.width - icon_area_size.x, icon_area.position.y), icon_area_size), (Color)completion_options[l].default_value);
+ }
+
draw_string(cache.font, title_pos, completion_options[l].display, completion_options[l].font_color, completion_rect.size.width - (icon_area_size.x + icon_hsep));
}
@@ -2146,7 +2165,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (mb->get_shift() && (cursor.column != prev_col || cursor.line != prev_line)) {
if (!selection.active) {
selection.active = true;
- selection.selecting_mode = Selection::MODE_POINTER;
+ selection.selecting_mode = SelectionMode::SELECTION_MODE_POINTER;
selection.from_column = prev_col;
selection.from_line = prev_line;
selection.to_column = cursor.column;
@@ -2190,19 +2209,19 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
} else {
selection.active = false;
- selection.selecting_mode = Selection::MODE_POINTER;
+ selection.selecting_mode = SelectionMode::SELECTION_MODE_POINTER;
selection.selecting_line = row;
selection.selecting_column = col;
}
if (!mb->is_doubleclick() && (OS::get_singleton()->get_ticks_msec() - last_dblclk) < 600 && cursor.line == prev_line) {
// Triple-click select line.
- selection.selecting_mode = Selection::MODE_LINE;
+ selection.selecting_mode = SelectionMode::SELECTION_MODE_LINE;
_update_selection_mode_line();
last_dblclk = 0;
} else if (mb->is_doubleclick() && text[cursor.line].length()) {
// Double-click select word.
- selection.selecting_mode = Selection::MODE_WORD;
+ selection.selecting_mode = SelectionMode::SELECTION_MODE_WORD;
_update_selection_mode_word();
last_dblclk = OS::get_singleton()->get_ticks_msec();
}
@@ -2302,13 +2321,13 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (!dragging_minimap) {
switch (selection.selecting_mode) {
- case Selection::MODE_POINTER: {
+ case SelectionMode::SELECTION_MODE_POINTER: {
_update_selection_mode_pointer();
} break;
- case Selection::MODE_WORD: {
+ case SelectionMode::SELECTION_MODE_WORD: {
_update_selection_mode_word();
} break;
- case Selection::MODE_LINE: {
+ case SelectionMode::SELECTION_MODE_LINE: {
_update_selection_mode_line();
} break;
default: {
@@ -2585,7 +2604,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (unselect) {
selection.active = false;
- selection.selecting_mode = Selection::MODE_NONE;
+ selection.selecting_mode = SelectionMode::SELECTION_MODE_NONE;
update();
}
if (clear) {
@@ -3613,17 +3632,17 @@ void TextEdit::_scroll_down(real_t p_delta) {
}
void TextEdit::_pre_shift_selection() {
- if (!selection.active || selection.selecting_mode == Selection::MODE_NONE) {
+ if (!selection.active || selection.selecting_mode == SelectionMode::SELECTION_MODE_NONE) {
selection.selecting_line = cursor.line;
selection.selecting_column = cursor.column;
selection.active = true;
}
- selection.selecting_mode = Selection::MODE_SHIFT;
+ selection.selecting_mode = SelectionMode::SELECTION_MODE_SHIFT;
}
void TextEdit::_post_shift_selection() {
- if (selection.active && selection.selecting_mode == Selection::MODE_SHIFT) {
+ if (selection.active && selection.selecting_mode == SelectionMode::SELECTION_MODE_SHIFT) {
select(selection.selecting_line, selection.selecting_column, cursor.line, cursor.column);
update();
}
@@ -4333,6 +4352,30 @@ bool TextEdit::is_right_click_moving_caret() const {
return right_click_moves_caret;
}
+TextEdit::SelectionMode TextEdit::get_selection_mode() const {
+ return selection.selecting_mode;
+}
+
+void TextEdit::set_selection_mode(SelectionMode p_mode, int p_line, int p_column) {
+ selection.selecting_mode = p_mode;
+ if (p_line >= 0) {
+ ERR_FAIL_INDEX(p_line, text.size());
+ selection.selecting_line = p_line;
+ }
+ if (p_column >= 0) {
+ ERR_FAIL_INDEX(p_line, text[selection.selecting_line].length());
+ selection.selecting_column = p_column;
+ }
+}
+
+int TextEdit::get_selection_line() const {
+ return selection.selecting_line;
+};
+
+int TextEdit::get_selection_column() const {
+ return selection.selecting_column;
+};
+
void TextEdit::_v_scroll_input() {
scrolling = false;
minimap_clicked = false;
@@ -4476,7 +4519,7 @@ void TextEdit::insert_text_at_cursor(const String &p_text) {
_remove_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column);
selection.active = false;
- selection.selecting_mode = Selection::MODE_NONE;
+ selection.selecting_mode = SelectionMode::SELECTION_MODE_NONE;
}
_insert_text_at_cursor(p_text);
@@ -4985,7 +5028,7 @@ void TextEdit::cut() {
cursor_set_column(selection.from_column);
selection.active = false;
- selection.selecting_mode = Selection::MODE_NONE;
+ selection.selecting_mode = SelectionMode::SELECTION_MODE_NONE;
update();
cut_copy_line = "";
}
@@ -5011,7 +5054,7 @@ void TextEdit::paste() {
begin_complex_operation();
if (selection.active) {
selection.active = false;
- selection.selecting_mode = Selection::MODE_NONE;
+ selection.selecting_mode = SelectionMode::SELECTION_MODE_NONE;
_remove_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column);
cursor_set_line(selection.from_line);
cursor_set_column(selection.from_column);
@@ -5043,7 +5086,7 @@ void TextEdit::select_all() {
selection.selecting_column = 0;
selection.to_line = text.size() - 1;
selection.to_column = text[selection.to_line].length();
- selection.selecting_mode = Selection::MODE_SHIFT;
+ selection.selecting_mode = SelectionMode::SELECTION_MODE_SHIFT;
selection.shiftclick_left = true;
cursor_set_line(selection.to_line, false);
cursor_set_column(selection.to_column, false);
@@ -6594,6 +6637,12 @@ void TextEdit::_bind_methods() {
BIND_ENUM_CONSTANT(SEARCH_WHOLE_WORDS);
BIND_ENUM_CONSTANT(SEARCH_BACKWARDS);
+ BIND_ENUM_CONSTANT(SELECTION_MODE_NONE);
+ BIND_ENUM_CONSTANT(SELECTION_MODE_SHIFT);
+ BIND_ENUM_CONSTANT(SELECTION_MODE_POINTER);
+ BIND_ENUM_CONSTANT(SELECTION_MODE_WORD);
+ BIND_ENUM_CONSTANT(SELECTION_MODE_LINE);
+
/*
ClassDB::bind_method(D_METHOD("delete_char"),&TextEdit::delete_char);
ClassDB::bind_method(D_METHOD("delete_line"),&TextEdit::delete_line);
@@ -6623,6 +6672,11 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_right_click_moves_caret", "enable"), &TextEdit::set_right_click_moves_caret);
ClassDB::bind_method(D_METHOD("is_right_click_moving_caret"), &TextEdit::is_right_click_moving_caret);
+ ClassDB::bind_method(D_METHOD("get_selection_mode"), &TextEdit::get_selection_mode);
+ ClassDB::bind_method(D_METHOD("set_selection_mode", "mode", "line", "column"), &TextEdit::set_selection_mode, DEFVAL(-1), DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("get_selection_line"), &TextEdit::get_selection_line);
+ ClassDB::bind_method(D_METHOD("get_selection_column"), &TextEdit::get_selection_column);
+
ClassDB::bind_method(D_METHOD("set_readonly", "enable"), &TextEdit::set_readonly);
ClassDB::bind_method(D_METHOD("is_readonly"), &TextEdit::is_readonly);
@@ -6831,7 +6885,7 @@ TextEdit::TextEdit() {
cursor_changed_dirty = false;
text_changed_dirty = false;
- selection.selecting_mode = Selection::MODE_NONE;
+ selection.selecting_mode = SelectionMode::SELECTION_MODE_NONE;
selection.selecting_line = 0;
selection.selecting_column = 0;
selection.selecting_text = false;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 562f4768ae..5cfa70bc55 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -47,6 +47,14 @@ public:
GUTTER_TPYE_CUSTOM
};
+ enum SelectionMode {
+ SELECTION_MODE_NONE,
+ SELECTION_MODE_SHIFT,
+ SELECTION_MODE_POINTER,
+ SELECTION_MODE_WORD,
+ SELECTION_MODE_LINE
+ };
+
private:
struct GutterInfo {
GutterType type = GutterType::GUTTER_TYPE_STRING;
@@ -157,16 +165,7 @@ private:
} cursor;
struct Selection {
- enum Mode {
-
- MODE_NONE,
- MODE_SHIFT,
- MODE_POINTER,
- MODE_WORD,
- MODE_LINE
- };
-
- Mode selecting_mode;
+ SelectionMode selecting_mode;
int selecting_line, selecting_column;
int selected_word_beg, selected_word_end, selected_word_origin;
bool selecting_text;
@@ -178,7 +177,7 @@ private:
bool shiftclick_left;
Selection() {
- selecting_mode = MODE_NONE;
+ selecting_mode = SelectionMode::SELECTION_MODE_NONE;
selecting_line = 0;
selecting_column = 0;
selected_word_beg = 0;
@@ -636,6 +635,11 @@ public:
void set_right_click_moves_caret(bool p_enable);
bool is_right_click_moving_caret() const;
+ SelectionMode get_selection_mode() const;
+ void set_selection_mode(SelectionMode p_mode, int p_line = -1, int p_column = -1);
+ int get_selection_line() const;
+ int get_selection_column() const;
+
void set_readonly(bool p_readonly);
bool is_readonly() const;
@@ -761,6 +765,7 @@ public:
};
VARIANT_ENUM_CAST(TextEdit::GutterType);
+VARIANT_ENUM_CAST(TextEdit::SelectionMode);
VARIANT_ENUM_CAST(TextEdit::MenuItems);
VARIANT_ENUM_CAST(TextEdit::SearchFlags);
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index 718d805bdd..c9a83f98a0 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -831,25 +831,25 @@ void CanvasItem::draw_circle(const Point2 &p_pos, float p_radius, const Color &p
RenderingServer::get_singleton()->canvas_item_add_circle(canvas_item, p_pos, p_radius, p_color);
}
-void CanvasItem::draw_texture(const Ref<Texture2D> &p_texture, const Point2 &p_pos, const Color &p_modulate, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) {
+void CanvasItem::draw_texture(const Ref<Texture2D> &p_texture, const Point2 &p_pos, const Color &p_modulate) {
ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
ERR_FAIL_COND(p_texture.is_null());
- p_texture->draw(canvas_item, p_pos, p_modulate, false, p_normal_map, p_specular_map, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat));
+ p_texture->draw(canvas_item, p_pos, p_modulate, false);
}
-void CanvasItem::draw_texture_rect(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) {
+void CanvasItem::draw_texture_rect(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose) {
ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
ERR_FAIL_COND(p_texture.is_null());
- p_texture->draw_rect(canvas_item, p_rect, p_tile, p_modulate, p_transpose, p_normal_map, p_specular_map, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat));
+ p_texture->draw_rect(canvas_item, p_rect, p_tile, p_modulate, p_transpose);
}
-void CanvasItem::draw_texture_rect_region(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, bool p_clip_uv, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) {
+void CanvasItem::draw_texture_rect_region(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, bool p_clip_uv) {
ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
ERR_FAIL_COND(p_texture.is_null());
- p_texture->draw_rect_region(canvas_item, p_rect, p_src_rect, p_modulate, p_transpose, p_normal_map, p_specular_map, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat), p_clip_uv);
+ p_texture->draw_rect_region(canvas_item, p_rect, p_src_rect, p_modulate, p_transpose, p_clip_uv);
}
void CanvasItem::draw_style_box(const Ref<StyleBox> &p_style_box, const Rect2 &p_rect) {
@@ -860,14 +860,11 @@ void CanvasItem::draw_style_box(const Ref<StyleBox> &p_style_box, const Rect2 &p
p_style_box->draw(canvas_item, p_rect);
}
-void CanvasItem::draw_primitive(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture2D> p_texture, float p_width, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) {
+void CanvasItem::draw_primitive(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture2D> p_texture, float p_width) {
ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
- RID rid_normal = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID rid_specular = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
-
- RenderingServer::get_singleton()->canvas_item_add_primitive(canvas_item, p_points, p_colors, p_uvs, rid, p_width, rid_normal, rid_specular, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat));
+ RenderingServer::get_singleton()->canvas_item_add_primitive(canvas_item, p_points, p_colors, p_uvs, rid, p_width);
}
void CanvasItem::draw_set_transform(const Point2 &p_offset, float p_rot, const Size2 &p_scale) {
@@ -884,44 +881,34 @@ void CanvasItem::draw_set_transform_matrix(const Transform2D &p_matrix) {
RenderingServer::get_singleton()->canvas_item_add_set_transform(canvas_item, p_matrix);
}
-void CanvasItem::draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture2D> p_texture, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) {
+void CanvasItem::draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture2D> p_texture) {
ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
- RID rid_normal = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID rid_specular = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, p_colors, p_uvs, rid, rid_normal, rid_specular, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat));
+ RenderingServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, p_colors, p_uvs, rid);
}
-void CanvasItem::draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs, Ref<Texture2D> p_texture, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) {
+void CanvasItem::draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs, Ref<Texture2D> p_texture) {
ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
Vector<Color> colors;
colors.push_back(p_color);
RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
- RID rid_normal = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID rid_specular = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
-
- RenderingServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, colors, p_uvs, rid, rid_normal, rid_specular, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat));
+ RenderingServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, colors, p_uvs, rid);
}
-void CanvasItem::draw_mesh(const Ref<Mesh> &p_mesh, const Ref<Texture2D> &p_texture, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, const Transform2D &p_transform, const Color &p_modulate, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) {
+void CanvasItem::draw_mesh(const Ref<Mesh> &p_mesh, const Ref<Texture2D> &p_texture, const Transform2D &p_transform, const Color &p_modulate) {
ERR_FAIL_COND(p_mesh.is_null());
RID texture_rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
- RID normal_map_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_map_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_mesh(canvas_item, p_mesh->get_rid(), p_transform, p_modulate, texture_rid, normal_map_rid, specular_map_rid, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat));
+ RenderingServer::get_singleton()->canvas_item_add_mesh(canvas_item, p_mesh->get_rid(), p_transform, p_modulate, texture_rid);
}
-void CanvasItem::draw_multimesh(const Ref<MultiMesh> &p_multimesh, const Ref<Texture2D> &p_texture, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) {
+void CanvasItem::draw_multimesh(const Ref<MultiMesh> &p_multimesh, const Ref<Texture2D> &p_texture) {
ERR_FAIL_COND(p_multimesh.is_null());
RID texture_rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
- RID normal_map_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_map_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
-
- RenderingServer::get_singleton()->canvas_item_add_multimesh(canvas_item, p_multimesh->get_rid(), texture_rid, normal_map_rid, specular_map_rid, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat));
+ RenderingServer::get_singleton()->canvas_item_add_multimesh(canvas_item, p_multimesh->get_rid(), texture_rid);
}
void CanvasItem::draw_string(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_text, const Color &p_modulate, int p_clip_w) {
@@ -1161,17 +1148,17 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw_multiline_colors", "points", "colors", "width"), &CanvasItem::draw_multiline_colors, DEFVAL(1.0));
ClassDB::bind_method(D_METHOD("draw_rect", "rect", "color", "filled", "width"), &CanvasItem::draw_rect, DEFVAL(true), DEFVAL(1.0));
ClassDB::bind_method(D_METHOD("draw_circle", "position", "radius", "color"), &CanvasItem::draw_circle);
- ClassDB::bind_method(D_METHOD("draw_texture", "texture", "position", "modulate", "normal_map", "specular_map", "specular_shininess", "texture_filter", "texture_repeat"), &CanvasItem::draw_texture, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE));
- ClassDB::bind_method(D_METHOD("draw_texture_rect", "texture", "rect", "tile", "modulate", "transpose", "normal_map", "specular_map", "specular_shininess", "texture_filter", "texture_repeat"), &CanvasItem::draw_texture_rect, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(false), DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE));
- ClassDB::bind_method(D_METHOD("draw_texture_rect_region", "texture", "rect", "src_rect", "modulate", "transpose", "normal_map", "specular_map", "specular_shininess", "clip_uv", "texture_filter", "texture_repeat"), &CanvasItem::draw_texture_rect_region, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(false), DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(true), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE));
+ ClassDB::bind_method(D_METHOD("draw_texture", "texture", "position", "modulate"), &CanvasItem::draw_texture, DEFVAL(Color(1, 1, 1, 1)));
+ ClassDB::bind_method(D_METHOD("draw_texture_rect", "texture", "rect", "tile", "modulate", "transpose"), &CanvasItem::draw_texture_rect, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("draw_texture_rect_region", "texture", "rect", "src_rect", "modulate", "transpose", "clip_uv"), &CanvasItem::draw_texture_rect_region, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(false), DEFVAL(true));
ClassDB::bind_method(D_METHOD("draw_style_box", "style_box", "rect"), &CanvasItem::draw_style_box);
- ClassDB::bind_method(D_METHOD("draw_primitive", "points", "colors", "uvs", "texture", "width", "normal_map", "specular_map", "specular_shininess", "texture_filter", "texture_repeat"), &CanvasItem::draw_primitive, DEFVAL(Ref<Texture2D>()), DEFVAL(1.0), DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE));
- ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture", "normal_map", "specular_map", "specular_shininess", "texture_filter", "texture_repeat"), &CanvasItem::draw_polygon, DEFVAL(PackedVector2Array()), DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE));
- ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture", "normal_map", "specular_map", "specular_shininess", "texture_filter", "texture_repeat"), &CanvasItem::draw_colored_polygon, DEFVAL(PackedVector2Array()), DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE));
+ ClassDB::bind_method(D_METHOD("draw_primitive", "points", "colors", "uvs", "texture", "width"), &CanvasItem::draw_primitive, DEFVAL(Ref<Texture2D>()), DEFVAL(1.0));
+ ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture"), &CanvasItem::draw_polygon, DEFVAL(PackedVector2Array()), DEFVAL(Ref<Texture2D>()));
+ ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture"), &CanvasItem::draw_colored_polygon, DEFVAL(PackedVector2Array()), DEFVAL(Ref<Texture2D>()));
ClassDB::bind_method(D_METHOD("draw_string", "font", "position", "text", "modulate", "clip_w"), &CanvasItem::draw_string, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("draw_char", "font", "position", "char", "next", "modulate"), &CanvasItem::draw_char, DEFVAL(Color(1, 1, 1, 1)));
- ClassDB::bind_method(D_METHOD("draw_mesh", "mesh", "texture", "normal_map", "specular_map", "specular_shininess", "transform", "modulate", "texture_filter", "texture_repeat"), &CanvasItem::draw_mesh, DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(Transform2D()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE));
- ClassDB::bind_method(D_METHOD("draw_multimesh", "multimesh", "texture", "normal_map", "specular_map", "specular_shininess", "texture_filter", "texture_repeat"), &CanvasItem::draw_multimesh, DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE));
+ ClassDB::bind_method(D_METHOD("draw_mesh", "mesh", "texture", "transform", "modulate"), &CanvasItem::draw_mesh, DEFVAL(Transform2D()), DEFVAL(Color(1, 1, 1, 1)));
+ ClassDB::bind_method(D_METHOD("draw_multimesh", "multimesh", "texture"), &CanvasItem::draw_multimesh);
ClassDB::bind_method(D_METHOD("draw_set_transform", "position", "rotation", "scale"), &CanvasItem::draw_set_transform, DEFVAL(0.0), DEFVAL(Size2(1.0, 1.0)));
ClassDB::bind_method(D_METHOD("draw_set_transform_matrix", "xform"), &CanvasItem::draw_set_transform_matrix);
@@ -1327,23 +1314,7 @@ void CanvasItem::_update_texture_filter_changed(bool p_propagate) {
if (parent_item) {
texture_filter_cache = parent_item->texture_filter_cache;
} else {
- //from viewport
- switch (get_viewport()->get_default_canvas_item_texture_filter()) {
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST:
- texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST;
- break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR:
- texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
- break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
- texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS;
- break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
- texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS;
- break;
- default: {
- }
- }
+ texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT;
}
} else {
texture_filter_cache = RS::CanvasItemTextureFilter(texture_filter);
@@ -1384,20 +1355,7 @@ void CanvasItem::_update_texture_repeat_changed(bool p_propagate) {
if (parent_item) {
texture_repeat_cache = parent_item->texture_repeat_cache;
} else {
- //from viewport
- switch (get_viewport()->get_default_canvas_item_texture_repeat()) {
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED:
- texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
- break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED:
- texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED;
- break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR:
- texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_MIRROR;
- break;
- default: {
- }
- }
+ texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT;
}
} else {
texture_repeat_cache = RS::CanvasItemTextureRepeat(texture_repeat);
@@ -1457,3 +1415,154 @@ CanvasItem::CanvasItem() :
CanvasItem::~CanvasItem() {
RenderingServer::get_singleton()->free(canvas_item);
}
+
+///////////////////////////////////////////////////////////////////
+
+void CanvasTexture::set_diffuse_texture(const Ref<Texture2D> &p_diffuse) {
+ ERR_FAIL_COND_MSG(Object::cast_to<CanvasTexture>(p_diffuse.ptr()) != nullptr, "Cant self-assign a CanvasTexture");
+ diffuse_texture = p_diffuse;
+
+ RID tex_rid = diffuse_texture.is_valid() ? diffuse_texture->get_rid() : RID();
+ RS::get_singleton()->canvas_texture_set_channel(canvas_texture, RS::CANVAS_TEXTURE_CHANNEL_DIFFUSE, tex_rid);
+ emit_changed();
+}
+Ref<Texture2D> CanvasTexture::get_diffuse_texture() const {
+ return diffuse_texture;
+}
+
+void CanvasTexture::set_normal_texture(const Ref<Texture2D> &p_normal) {
+ ERR_FAIL_COND_MSG(Object::cast_to<CanvasTexture>(p_normal.ptr()) != nullptr, "Cant self-assign a CanvasTexture");
+ normal_texture = p_normal;
+ RID tex_rid = normal_texture.is_valid() ? normal_texture->get_rid() : RID();
+ RS::get_singleton()->canvas_texture_set_channel(canvas_texture, RS::CANVAS_TEXTURE_CHANNEL_NORMAL, tex_rid);
+}
+Ref<Texture2D> CanvasTexture::get_normal_texture() const {
+ return normal_texture;
+}
+
+void CanvasTexture::set_specular_texture(const Ref<Texture2D> &p_specular) {
+ ERR_FAIL_COND_MSG(Object::cast_to<CanvasTexture>(p_specular.ptr()) != nullptr, "Cant self-assign a CanvasTexture");
+ specular_texture = p_specular;
+ RID tex_rid = specular_texture.is_valid() ? specular_texture->get_rid() : RID();
+ RS::get_singleton()->canvas_texture_set_channel(canvas_texture, RS::CANVAS_TEXTURE_CHANNEL_SPECULAR, tex_rid);
+}
+Ref<Texture2D> CanvasTexture::get_specular_texture() const {
+ return specular_texture;
+}
+
+void CanvasTexture::set_specular_color(const Color &p_color) {
+ specular = p_color;
+ RS::get_singleton()->canvas_texture_set_shading_parameters(canvas_texture, specular, shininess);
+}
+Color CanvasTexture::get_specular_color() const {
+ return specular;
+}
+
+void CanvasTexture::set_specular_shininess(float p_shininess) {
+ shininess = p_shininess;
+ RS::get_singleton()->canvas_texture_set_shading_parameters(canvas_texture, specular, shininess);
+}
+float CanvasTexture::get_specular_shininess() const {
+ return shininess;
+}
+
+void CanvasTexture::set_texture_filter(CanvasItem::TextureFilter p_filter) {
+ texture_filter = p_filter;
+ RS::get_singleton()->canvas_texture_set_texture_filter(canvas_texture, RS::CanvasItemTextureFilter(p_filter));
+}
+CanvasItem::TextureFilter CanvasTexture::get_texture_filter() const {
+ return texture_filter;
+}
+
+void CanvasTexture::set_texture_repeat(CanvasItem::TextureRepeat p_repeat) {
+ texture_repeat = p_repeat;
+ RS::get_singleton()->canvas_texture_set_texture_repeat(canvas_texture, RS::CanvasItemTextureRepeat(p_repeat));
+}
+CanvasItem::TextureRepeat CanvasTexture::get_texture_repeat() const {
+ return texture_repeat;
+}
+
+int CanvasTexture::get_width() const {
+ if (diffuse_texture.is_valid()) {
+ return diffuse_texture->get_width();
+ } else {
+ return 1;
+ }
+}
+int CanvasTexture::get_height() const {
+ if (diffuse_texture.is_valid()) {
+ return diffuse_texture->get_height();
+ } else {
+ return 1;
+ }
+}
+
+bool CanvasTexture::is_pixel_opaque(int p_x, int p_y) const {
+ if (diffuse_texture.is_valid()) {
+ return diffuse_texture->is_pixel_opaque(p_x, p_y);
+ } else {
+ return false;
+ }
+}
+
+bool CanvasTexture::has_alpha() const {
+ if (diffuse_texture.is_valid()) {
+ return diffuse_texture->has_alpha();
+ } else {
+ return false;
+ }
+}
+
+Ref<Image> CanvasTexture::get_data() const {
+ if (diffuse_texture.is_valid()) {
+ return diffuse_texture->get_data();
+ } else {
+ return Ref<Image>();
+ }
+}
+
+RID CanvasTexture::get_rid() const {
+ return canvas_texture;
+}
+
+void CanvasTexture::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_diffuse_texture", "texture"), &CanvasTexture::set_diffuse_texture);
+ ClassDB::bind_method(D_METHOD("get_diffuse_texture"), &CanvasTexture::get_diffuse_texture);
+
+ ClassDB::bind_method(D_METHOD("set_normal_texture", "texture"), &CanvasTexture::set_normal_texture);
+ ClassDB::bind_method(D_METHOD("get_normal_texture"), &CanvasTexture::get_normal_texture);
+
+ ClassDB::bind_method(D_METHOD("set_specular_texture", "texture"), &CanvasTexture::set_specular_texture);
+ ClassDB::bind_method(D_METHOD("get_specular_texture"), &CanvasTexture::get_specular_texture);
+
+ ClassDB::bind_method(D_METHOD("set_specular_color", "color"), &CanvasTexture::set_specular_color);
+ ClassDB::bind_method(D_METHOD("get_specular_color"), &CanvasTexture::get_specular_color);
+
+ ClassDB::bind_method(D_METHOD("set_specular_shininess", "shininess"), &CanvasTexture::set_specular_shininess);
+ ClassDB::bind_method(D_METHOD("get_specular_shininess"), &CanvasTexture::get_specular_shininess);
+
+ ClassDB::bind_method(D_METHOD("set_texture_filter", "filter"), &CanvasTexture::set_texture_filter);
+ ClassDB::bind_method(D_METHOD("get_texture_filter"), &CanvasTexture::get_texture_filter);
+
+ ClassDB::bind_method(D_METHOD("set_texture_repeat", "repeat"), &CanvasTexture::set_texture_repeat);
+ ClassDB::bind_method(D_METHOD("get_texture_repeat"), &CanvasTexture::get_texture_repeat);
+
+ ADD_GROUP("Diffuse", "diffuse_");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "diffuse_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_diffuse_texture", "get_diffuse_texture");
+ ADD_GROUP("Normalmap", "normal_");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "normal_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_normal_texture", "get_normal_texture");
+ ADD_GROUP("Specular", "specular_");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "specular_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_specular_texture", "get_specular_texture");
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "specular_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_specular_color", "get_specular_color");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "specular_shininess", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_specular_shininess", "get_specular_shininess");
+ ADD_GROUP("Texture", "texture_");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_filter", PROPERTY_HINT_ENUM, "Inherit,Nearest,Linear,MipmapNearest,MipmapLinear,MipmapNearestAniso,MipmapLinearAniso"), "set_texture_filter", "get_texture_filter");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_repeat", PROPERTY_HINT_ENUM, "Inherit,Disabled,Enabled,Mirror"), "set_texture_repeat", "get_texture_repeat");
+}
+
+CanvasTexture::CanvasTexture() {
+ canvas_texture = RS::get_singleton()->canvas_texture_create();
+}
+CanvasTexture::~CanvasTexture() {
+ RS::get_singleton()->free(canvas_texture);
+}
diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h
index a331cb96a9..092fd17df3 100644
--- a/scene/main/canvas_item.h
+++ b/scene/main/canvas_item.h
@@ -334,16 +334,16 @@ public:
void draw_multiline_colors(const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0);
void draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_filled = true, float p_width = 1.0);
void draw_circle(const Point2 &p_pos, float p_radius, const Color &p_color);
- void draw_texture(const Ref<Texture2D> &p_texture, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1, 1), const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), TextureFilter p_texture_filter = TEXTURE_FILTER_PARENT_NODE, TextureRepeat p_texture_repeat = TEXTURE_REPEAT_PARENT_NODE);
- void draw_texture_rect(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), TextureFilter p_texture_filter = TEXTURE_FILTER_PARENT_NODE, TextureRepeat p_texture_repeat = TEXTURE_REPEAT_PARENT_NODE);
- void draw_texture_rect_region(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), bool p_clip_uv = false, TextureFilter p_texture_filter = TEXTURE_FILTER_PARENT_NODE, TextureRepeat p_texture_repeat = TEXTURE_REPEAT_PARENT_NODE);
+ void draw_texture(const Ref<Texture2D> &p_texture, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1, 1));
+ void draw_texture_rect(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false);
+ void draw_texture_rect_region(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, bool p_clip_uv = false);
void draw_style_box(const Ref<StyleBox> &p_style_box, const Rect2 &p_rect);
- void draw_primitive(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture2D> p_texture = Ref<Texture2D>(), float p_width = 1, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), TextureFilter p_texture_filter = TEXTURE_FILTER_PARENT_NODE, TextureRepeat p_texture_repeat = TEXTURE_REPEAT_PARENT_NODE);
- void draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture2D> p_texture = Ref<Texture2D>(), const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), TextureFilter p_texture_filter = TEXTURE_FILTER_PARENT_NODE, TextureRepeat p_texture_repeat = TEXTURE_REPEAT_PARENT_NODE);
- void draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture2D> p_texture = Ref<Texture2D>(), const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), TextureFilter p_texture_filter = TEXTURE_FILTER_PARENT_NODE, TextureRepeat p_texture_repeat = TEXTURE_REPEAT_PARENT_NODE);
+ void draw_primitive(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture2D> p_texture = Ref<Texture2D>(), float p_width = 1);
+ void draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture2D> p_texture = Ref<Texture2D>());
+ void draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs = Vector<Point2>(), Ref<Texture2D> p_texture = Ref<Texture2D>());
- void draw_mesh(const Ref<Mesh> &p_mesh, const Ref<Texture2D> &p_texture, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), const Transform2D &p_transform = Transform2D(), const Color &p_modulate = Color(1, 1, 1), TextureFilter p_texture_filter = TEXTURE_FILTER_PARENT_NODE, TextureRepeat p_texture_repeat = TEXTURE_REPEAT_PARENT_NODE);
- void draw_multimesh(const Ref<MultiMesh> &p_multimesh, const Ref<Texture2D> &p_texture, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), TextureFilter p_texture_filter = TEXTURE_FILTER_PARENT_NODE, TextureRepeat p_texture_repeat = TEXTURE_REPEAT_PARENT_NODE);
+ void draw_mesh(const Ref<Mesh> &p_mesh, const Ref<Texture2D> &p_texture, const Transform2D &p_transform = Transform2D(), const Color &p_modulate = Color(1, 1, 1));
+ void draw_multimesh(const Ref<MultiMesh> &p_multimesh, const Ref<Texture2D> &p_texture);
void draw_string(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_text, const Color &p_modulate = Color(1, 1, 1), int p_clip_w = -1);
float draw_char(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_char, const String &p_next = "", const Color &p_modulate = Color(1, 1, 1));
@@ -423,4 +423,58 @@ public:
VARIANT_ENUM_CAST(CanvasItem::TextureFilter)
VARIANT_ENUM_CAST(CanvasItem::TextureRepeat)
+class CanvasTexture : public Texture2D {
+ GDCLASS(CanvasTexture, Texture2D);
+ OBJ_SAVE_TYPE(Texture2D); // Saves derived classes with common type so they can be interchanged.
+
+ Ref<Texture2D> diffuse_texture;
+ Ref<Texture2D> normal_texture;
+ Ref<Texture2D> specular_texture;
+ Color specular = Color(1, 1, 1, 1);
+ float shininess = 1.0;
+
+ RID canvas_texture;
+
+ CanvasItem::TextureFilter texture_filter = CanvasItem::TEXTURE_FILTER_PARENT_NODE;
+ CanvasItem::TextureRepeat texture_repeat = CanvasItem::TEXTURE_REPEAT_PARENT_NODE;
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_diffuse_texture(const Ref<Texture2D> &p_diffuse);
+ Ref<Texture2D> get_diffuse_texture() const;
+
+ void set_normal_texture(const Ref<Texture2D> &p_normal);
+ Ref<Texture2D> get_normal_texture() const;
+
+ void set_specular_texture(const Ref<Texture2D> &p_specular);
+ Ref<Texture2D> get_specular_texture() const;
+
+ void set_specular_color(const Color &p_color);
+ Color get_specular_color() const;
+
+ void set_specular_shininess(float p_shininess);
+ float get_specular_shininess() const;
+
+ void set_texture_filter(CanvasItem::TextureFilter p_filter);
+ CanvasItem::TextureFilter get_texture_filter() const;
+
+ void set_texture_repeat(CanvasItem::TextureRepeat p_repeat);
+ CanvasItem::TextureRepeat get_texture_repeat() const;
+
+ virtual int get_width() const override;
+ virtual int get_height() const override;
+
+ virtual bool is_pixel_opaque(int p_x, int p_y) const override;
+ virtual bool has_alpha() const override;
+
+ virtual Ref<Image> get_data() const override;
+
+ virtual RID get_rid() const override;
+
+ CanvasTexture();
+ ~CanvasTexture();
+};
+
#endif // CANVAS_ITEM_H
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 414e488244..ba78f8dc2d 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -3224,11 +3224,28 @@ void Viewport::_validate_property(PropertyInfo &property) const {
}
void Viewport::set_default_canvas_item_texture_filter(DefaultCanvasItemTextureFilter p_filter) {
+ ERR_FAIL_INDEX(p_filter, DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_MAX);
+
if (default_canvas_item_texture_filter == p_filter) {
return;
}
default_canvas_item_texture_filter = p_filter;
- _propagate_update_default_filter(this);
+ switch (default_canvas_item_texture_filter) {
+ case DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST:
+ RS::get_singleton()->viewport_set_default_canvas_item_texture_filter(viewport, RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST);
+ break;
+ case DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR:
+ RS::get_singleton()->viewport_set_default_canvas_item_texture_filter(viewport, RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR);
+ break;
+ case DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
+ RS::get_singleton()->viewport_set_default_canvas_item_texture_filter(viewport, RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS);
+ break;
+ case DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
+ RS::get_singleton()->viewport_set_default_canvas_item_texture_filter(viewport, RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS);
+ break;
+ default: {
+ }
+ }
}
Viewport::DefaultCanvasItemTextureFilter Viewport::get_default_canvas_item_texture_filter() const {
@@ -3236,37 +3253,31 @@ Viewport::DefaultCanvasItemTextureFilter Viewport::get_default_canvas_item_textu
}
void Viewport::set_default_canvas_item_texture_repeat(DefaultCanvasItemTextureRepeat p_repeat) {
+ ERR_FAIL_INDEX(p_repeat, DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MAX);
+
if (default_canvas_item_texture_repeat == p_repeat) {
return;
}
- default_canvas_item_texture_repeat = p_repeat;
- _propagate_update_default_repeat(this);
-}
-
-Viewport::DefaultCanvasItemTextureRepeat Viewport::get_default_canvas_item_texture_repeat() const {
- return default_canvas_item_texture_repeat;
-}
-void Viewport::_propagate_update_default_filter(Node *p_node) {
- CanvasItem *ci = Object::cast_to<CanvasItem>(p_node);
- if (ci) {
- ci->_update_texture_filter_changed(false);
- }
+ default_canvas_item_texture_repeat = p_repeat;
- for (int i = 0; i < p_node->get_child_count(); i++) {
- _propagate_update_default_filter(p_node->get_child(i));
+ switch (default_canvas_item_texture_repeat) {
+ case DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED:
+ RS::get_singleton()->viewport_set_default_canvas_item_texture_repeat(viewport, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ break;
+ case DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED:
+ RS::get_singleton()->viewport_set_default_canvas_item_texture_repeat(viewport, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ break;
+ case DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR:
+ RS::get_singleton()->viewport_set_default_canvas_item_texture_repeat(viewport, RS::CANVAS_ITEM_TEXTURE_REPEAT_MIRROR);
+ break;
+ default: {
+ }
}
}
-void Viewport::_propagate_update_default_repeat(Node *p_node) {
- CanvasItem *ci = Object::cast_to<CanvasItem>(p_node);
- if (ci) {
- ci->_update_texture_repeat_changed(false);
- }
-
- for (int i = 0; i < p_node->get_child_count(); i++) {
- _propagate_update_default_repeat(p_node->get_child(i));
- }
+Viewport::DefaultCanvasItemTextureRepeat Viewport::get_default_canvas_item_texture_repeat() const {
+ return default_canvas_item_texture_repeat;
}
DisplayServer::WindowID Viewport::get_window_id() const {
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index f7457f8ab2..9238f7637c 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -357,9 +357,6 @@ private:
DefaultCanvasItemTextureFilter default_canvas_item_texture_filter;
DefaultCanvasItemTextureRepeat default_canvas_item_texture_repeat;
- void _propagate_update_default_filter(Node *p_node);
- void _propagate_update_default_repeat(Node *p_node);
-
bool disable_input;
void _gui_call_input(Control *p_control, const Ref<InputEvent> &p_input);
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 14fa6c54ea..76b68c8da8 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -594,6 +594,7 @@ void register_scene_types() {
ClassDB::register_class<ShaderMaterial>();
ClassDB::register_virtual_class<CanvasItem>();
+ ClassDB::register_class<CanvasTexture>();
ClassDB::register_class<CanvasItemMaterial>();
SceneTree::add_idle_callback(CanvasItemMaterial::flush_changes);
CanvasItemMaterial::init_shaders();
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index bc983c1d7e..ad9d888480 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -347,7 +347,7 @@ float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2 &p_pos, char3
modulate.r = modulate.g = modulate.b = 1.0;
}
RID texture = font->textures[ch->texture_idx].texture->get_rid();
- RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, ch->rect.size), texture, ch->rect_uv, modulate, false, RID(), RID(), Color(1, 1, 1, 1), false);
+ RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, ch->rect.size), texture, ch->rect_uv, modulate, false, false);
}
advance = ch->advance;
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index b75657c2c2..7bda889e46 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -549,7 +549,7 @@ float BitmapFont::draw_char(RID p_canvas_item, const Point2 &p_pos, char32_t p_c
cpos.x += c->h_align;
cpos.y -= ascent;
cpos.y += c->v_align;
- RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, c->rect.size), textures[c->texture_idx]->get_rid(), c->rect, p_modulate, false, RID(), RID(), Color(1, 1, 1, 1), false);
+ RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, c->rect.size), textures[c->texture_idx]->get_rid(), c->rect, p_modulate, false, false);
}
return get_char_size(p_char, p_next).width;
diff --git a/scene/resources/gradient.cpp b/scene/resources/gradient.cpp
index b720653f91..6b41b97e45 100644
--- a/scene/resources/gradient.cpp
+++ b/scene/resources/gradient.cpp
@@ -32,14 +32,8 @@
#include "core/core_string_names.h"
-//setter and getter names for property serialization
-#define COLOR_RAMP_GET_OFFSETS "get_offsets"
-#define COLOR_RAMP_GET_COLORS "get_colors"
-#define COLOR_RAMP_SET_OFFSETS "set_offsets"
-#define COLOR_RAMP_SET_COLORS "set_colors"
-
Gradient::Gradient() {
- //Set initial color ramp transition from black to white
+ //Set initial gradient transition from black to white
points.resize(2);
points.write[0].color = Color(0, 0, 0, 1);
points.write[0].offset = 0;
@@ -65,14 +59,14 @@ void Gradient::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_point_count"), &Gradient::get_points_count);
- ClassDB::bind_method(D_METHOD(COLOR_RAMP_SET_OFFSETS, "offsets"), &Gradient::set_offsets);
- ClassDB::bind_method(D_METHOD(COLOR_RAMP_GET_OFFSETS), &Gradient::get_offsets);
+ ClassDB::bind_method(D_METHOD("set_offsets", "offsets"), &Gradient::set_offsets);
+ ClassDB::bind_method(D_METHOD("get_offsets"), &Gradient::get_offsets);
- ClassDB::bind_method(D_METHOD(COLOR_RAMP_SET_COLORS, "colors"), &Gradient::set_colors);
- ClassDB::bind_method(D_METHOD(COLOR_RAMP_GET_COLORS), &Gradient::get_colors);
+ ClassDB::bind_method(D_METHOD("set_colors", "colors"), &Gradient::set_colors);
+ ClassDB::bind_method(D_METHOD("get_colors"), &Gradient::get_colors);
- ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT32_ARRAY, "offsets"), COLOR_RAMP_SET_OFFSETS, COLOR_RAMP_GET_OFFSETS);
- ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "colors"), COLOR_RAMP_SET_COLORS, COLOR_RAMP_GET_COLORS);
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT32_ARRAY, "offsets"), "set_offsets", "get_offsets");
+ ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "colors"), "set_colors", "get_colors");
}
Vector<float> Gradient::get_offsets() const {
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index cdb0ec5111..a8bf44c5c0 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -130,18 +130,6 @@ Ref<Texture2D> StyleBoxTexture::get_texture() const {
return texture;
}
-void StyleBoxTexture::set_normal_map(Ref<Texture2D> p_normal_map) {
- if (normal_map == p_normal_map) {
- return;
- }
- normal_map = p_normal_map;
- emit_changed();
-}
-
-Ref<Texture2D> StyleBoxTexture::get_normal_map() const {
- return normal_map;
-}
-
void StyleBoxTexture::set_margin_size(Margin p_margin, float p_size) {
ERR_FAIL_INDEX((int)p_margin, 4);
@@ -187,12 +175,7 @@ void StyleBoxTexture::draw(RID p_canvas_item, const Rect2 &p_rect) const {
rect.size.x += expand_margin[MARGIN_LEFT] + expand_margin[MARGIN_RIGHT];
rect.size.y += expand_margin[MARGIN_TOP] + expand_margin[MARGIN_BOTTOM];
- RID normal_rid;
- if (normal_map.is_valid()) {
- normal_rid = normal_map->get_rid();
- }
-
- RenderingServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), RS::NinePatchAxisMode(axis_h), RS::NinePatchAxisMode(axis_v), draw_center, modulate, normal_rid);
+ RenderingServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), RS::NinePatchAxisMode(axis_h), RS::NinePatchAxisMode(axis_v), draw_center, modulate);
}
void StyleBoxTexture::set_draw_center(bool p_enabled) {
@@ -288,9 +271,6 @@ void StyleBoxTexture::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_texture", "texture"), &StyleBoxTexture::set_texture);
ClassDB::bind_method(D_METHOD("get_texture"), &StyleBoxTexture::get_texture);
- ClassDB::bind_method(D_METHOD("set_normal_map", "normal_map"), &StyleBoxTexture::set_normal_map);
- ClassDB::bind_method(D_METHOD("get_normal_map"), &StyleBoxTexture::get_normal_map);
-
ClassDB::bind_method(D_METHOD("set_margin_size", "margin", "size"), &StyleBoxTexture::set_margin_size);
ClassDB::bind_method(D_METHOD("get_margin_size", "margin"), &StyleBoxTexture::get_margin_size);
@@ -317,7 +297,6 @@ void StyleBoxTexture::_bind_methods() {
ADD_SIGNAL(MethodInfo("texture_changed"));
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "normal_map", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_normal_map", "get_normal_map");
ADD_PROPERTY(PropertyInfo(Variant::RECT2, "region_rect"), "set_region_rect", "get_region_rect");
ADD_GROUP("Margin", "margin_");
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "margin_left", PROPERTY_HINT_RANGE, "0,2048,1"), "set_margin_size", "get_margin_size", MARGIN_LEFT);
diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h
index 3d29e3bd0f..c5caab1b5a 100644
--- a/scene/resources/style_box.h
+++ b/scene/resources/style_box.h
@@ -90,7 +90,6 @@ private:
float margin[4];
Rect2 region_rect;
Ref<Texture2D> texture;
- Ref<Texture2D> normal_map;
bool draw_center;
Color modulate;
AxisStretchMode axis_h;
@@ -115,9 +114,6 @@ public:
void set_texture(Ref<Texture2D> p_texture);
Ref<Texture2D> get_texture() const;
- void set_normal_map(Ref<Texture2D> p_normal_map);
- Ref<Texture2D> get_normal_map() const;
-
void set_draw_center(bool p_enabled);
bool is_draw_center_enabled() const;
virtual Size2 get_center_size() const override;
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 6291d2dddb..39ef6eeafa 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -45,28 +45,21 @@ bool Texture2D::is_pixel_opaque(int p_x, int p_y) const {
return true;
}
-void Texture2D::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const {
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, Rect2(p_pos, get_size()), get_rid(), false, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat);
+void Texture2D::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose) const {
+ RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, Rect2(p_pos, get_size()), get_rid(), false, p_modulate, p_transpose);
}
-void Texture2D::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const {
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, p_rect, get_rid(), p_tile, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat);
+void Texture2D::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose) const {
+ RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, p_rect, get_rid(), p_tile, p_modulate, p_transpose);
}
-void Texture2D::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const {
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, get_rid(), p_src_rect, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_clip_uv, p_texture_filter, p_texture_repeat);
+void Texture2D::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, bool p_clip_uv) const {
+ RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, get_rid(), p_src_rect, p_modulate, p_transpose, p_clip_uv);
}
bool Texture2D::get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const {
r_rect = p_rect;
r_src_rect = p_src_rect;
-
return true;
}
@@ -75,9 +68,9 @@ void Texture2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_height"), &Texture2D::get_height);
ClassDB::bind_method(D_METHOD("get_size"), &Texture2D::get_size);
ClassDB::bind_method(D_METHOD("has_alpha"), &Texture2D::has_alpha);
- ClassDB::bind_method(D_METHOD("draw", "canvas_item", "position", "modulate", "transpose", "normal_map", "specular_map", "specular_color_shininess", "texture_filter", "texture_repeat"), &Texture2D::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT), DEFVAL(RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT));
- ClassDB::bind_method(D_METHOD("draw_rect", "canvas_item", "rect", "tile", "modulate", "transpose", "normal_map", "specular_map", "specular_color_shininess", "texture_filter", "texture_repeat"), &Texture2D::draw_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT), DEFVAL(RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT));
- ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map", "specular_map", "specular_color_shininess", "texture_filter", "texture_repeat", "clip_uv"), &Texture2D::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT), DEFVAL(RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT), DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("draw", "canvas_item", "position", "modulate", "transpose"), &Texture2D::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("draw_rect", "canvas_item", "rect", "tile", "modulate", "transpose"), &Texture2D::draw_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "clip_uv"), &Texture2D::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(true));
ClassDB::bind_method(D_METHOD("get_data"), &Texture2D::get_data);
ADD_GROUP("", "");
@@ -232,31 +225,25 @@ bool ImageTexture::has_alpha() const {
return (format == Image::FORMAT_LA8 || format == Image::FORMAT_RGBA8);
}
-void ImageTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const {
+void ImageTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose) const {
if ((w | h) == 0) {
return;
}
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, Rect2(p_pos, Size2(w, h)), texture, false, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat);
+ RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, Rect2(p_pos, Size2(w, h)), texture, false, p_modulate, p_transpose);
}
-void ImageTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const {
+void ImageTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose) const {
if ((w | h) == 0) {
return;
}
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, p_rect, texture, p_tile, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat);
+ RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, p_rect, texture, p_tile, p_modulate, p_transpose);
}
-void ImageTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const {
+void ImageTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, bool p_clip_uv) const {
if ((w | h) == 0) {
return;
}
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, texture, p_src_rect, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_clip_uv, p_texture_filter, p_texture_repeat);
+ RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, texture, p_src_rect, p_modulate, p_transpose, p_clip_uv);
}
bool ImageTexture::is_pixel_opaque(int p_x, int p_y) const {
@@ -651,31 +638,25 @@ RID StreamTexture2D::get_rid() const {
return texture;
}
-void StreamTexture2D::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const {
+void StreamTexture2D::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose) const {
if ((w | h) == 0) {
return;
}
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, Rect2(p_pos, Size2(w, h)), texture, false, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat);
+ RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, Rect2(p_pos, Size2(w, h)), texture, false, p_modulate, p_transpose);
}
-void StreamTexture2D::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const {
+void StreamTexture2D::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose) const {
if ((w | h) == 0) {
return;
}
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, p_rect, texture, p_tile, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat);
+ RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, p_rect, texture, p_tile, p_modulate, p_transpose);
}
-void StreamTexture2D::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const {
+void StreamTexture2D::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, bool p_clip_uv) const {
if ((w | h) == 0) {
return;
}
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, texture, p_src_rect, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_clip_uv, p_texture_filter, p_texture_repeat);
+ RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, texture, p_src_rect, p_modulate, p_transpose, p_clip_uv);
}
bool StreamTexture2D::has_alpha() const {
@@ -1203,7 +1184,7 @@ void AtlasTexture::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_clip"), "set_filter_clip", "has_filter_clip");
}
-void AtlasTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const {
+void AtlasTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose) const {
if (!atlas.is_valid()) {
return;
}
@@ -1218,12 +1199,10 @@ void AtlasTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_m
rc.size.height = atlas->get_height();
}
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(p_pos + margin.position, rc.size), atlas->get_rid(), rc, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, filter_clip, p_texture_filter, p_texture_repeat);
+ RS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(p_pos + margin.position, rc.size), atlas->get_rid(), rc, p_modulate, p_transpose, filter_clip);
}
-void AtlasTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const {
+void AtlasTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose) const {
if (!atlas.is_valid()) {
return;
}
@@ -1241,12 +1220,10 @@ void AtlasTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile
Vector2 scale = p_rect.size / (region.size + margin.size);
Rect2 dr(p_rect.position + margin.position * scale, rc.size * scale);
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), rc, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, filter_clip, p_texture_filter, p_texture_repeat);
+ RS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), rc, p_modulate, p_transpose, filter_clip);
}
-void AtlasTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const {
+void AtlasTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, bool p_clip_uv) const {
//this might not necessarily work well if using a rect, needs to be fixed properly
if (!atlas.is_valid()) {
return;
@@ -1256,9 +1233,7 @@ void AtlasTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, cons
Rect2 src_c;
get_rect_region(p_rect, p_src_rect, dr, src_c);
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), src_c, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, filter_clip, p_texture_filter, p_texture_repeat);
+ RS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), src_c, p_modulate, p_transpose, filter_clip);
}
bool AtlasTexture::get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const {
@@ -1363,7 +1338,7 @@ Ref<Texture2D> MeshTexture::get_base_texture() const {
return base_texture;
}
-void MeshTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const {
+void MeshTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose) const {
if (mesh.is_null() || base_texture.is_null()) {
return;
}
@@ -1373,12 +1348,10 @@ void MeshTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_mo
SWAP(xform.elements[0][1], xform.elements[1][0]);
SWAP(xform.elements[0][0], xform.elements[1][1]);
}
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_mesh(p_canvas_item, mesh->get_rid(), xform, p_modulate, base_texture->get_rid(), normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat);
+ RenderingServer::get_singleton()->canvas_item_add_mesh(p_canvas_item, mesh->get_rid(), xform, p_modulate, base_texture->get_rid());
}
-void MeshTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const {
+void MeshTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose) const {
if (mesh.is_null() || base_texture.is_null()) {
return;
}
@@ -1397,12 +1370,10 @@ void MeshTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile,
SWAP(xform.elements[0][1], xform.elements[1][0]);
SWAP(xform.elements[0][0], xform.elements[1][1]);
}
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_mesh(p_canvas_item, mesh->get_rid(), xform, p_modulate, base_texture->get_rid(), normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat);
+ RenderingServer::get_singleton()->canvas_item_add_mesh(p_canvas_item, mesh->get_rid(), xform, p_modulate, base_texture->get_rid());
}
-void MeshTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const {
+void MeshTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, bool p_clip_uv) const {
if (mesh.is_null() || base_texture.is_null()) {
return;
}
@@ -1421,9 +1392,7 @@ void MeshTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const
SWAP(xform.elements[0][1], xform.elements[1][0]);
SWAP(xform.elements[0][0], xform.elements[1][1]);
}
- RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID();
- RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID();
- RenderingServer::get_singleton()->canvas_item_add_mesh(p_canvas_item, mesh->get_rid(), xform, p_modulate, base_texture->get_rid(), normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat);
+ RenderingServer::get_singleton()->canvas_item_add_mesh(p_canvas_item, mesh->get_rid(), xform, p_modulate, base_texture->get_rid());
}
bool MeshTexture::get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const {
@@ -1568,14 +1537,14 @@ void LargeTexture::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data");
}
-void LargeTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const {
+void LargeTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose) const {
for (int i = 0; i < pieces.size(); i++) {
// TODO
- pieces[i].texture->draw(p_canvas_item, pieces[i].offset + p_pos, p_modulate, p_transpose, p_normal_map, p_specular_map, p_specular_color_shininess, p_texture_filter, p_texture_repeat);
+ pieces[i].texture->draw(p_canvas_item, pieces[i].offset + p_pos, p_modulate, p_transpose);
}
}
-void LargeTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const {
+void LargeTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose) const {
//tiling not supported for this
if (size.x == 0 || size.y == 0) {
return;
@@ -1585,11 +1554,11 @@ void LargeTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile
for (int i = 0; i < pieces.size(); i++) {
// TODO
- pieces[i].texture->draw_rect(p_canvas_item, Rect2(pieces[i].offset * scale + p_rect.position, pieces[i].texture->get_size() * scale), false, p_modulate, p_transpose, p_normal_map, p_specular_map, p_specular_color_shininess, p_texture_filter, p_texture_repeat);
+ pieces[i].texture->draw_rect(p_canvas_item, Rect2(pieces[i].offset * scale + p_rect.position, pieces[i].texture->get_size() * scale), false, p_modulate, p_transpose);
}
}
-void LargeTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const {
+void LargeTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, bool p_clip_uv) const {
//tiling not supported for this
if (p_src_rect.size.x == 0 || p_src_rect.size.y == 0) {
return;
@@ -1608,7 +1577,7 @@ void LargeTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, cons
target.size *= scale;
target.position = p_rect.position + (p_src_rect.position + rect.position) * scale;
local.position -= rect.position;
- pieces[i].texture->draw_rect_region(p_canvas_item, target, local, p_modulate, p_transpose, p_normal_map, p_specular_map, p_specular_color_shininess, p_texture_filter, p_texture_repeat, false);
+ pieces[i].texture->draw_rect_region(p_canvas_item, target, local, p_modulate, p_transpose, false);
}
}
@@ -1738,12 +1707,6 @@ CurveTexture::~CurveTexture() {
//////////////////
-//setter and getter names for property serialization
-#define COLOR_RAMP_GET_OFFSETS "get_offsets"
-#define COLOR_RAMP_GET_COLORS "get_colors"
-#define COLOR_RAMP_SET_OFFSETS "set_offsets"
-#define COLOR_RAMP_SET_COLORS "set_colors"
-
GradientTexture::GradientTexture() {
update_pending = false;
width = 2048;
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index eebbf4f233..fd48afccda 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -66,9 +66,9 @@ public:
virtual bool has_alpha() const = 0;
- virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const;
- virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const;
- virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const;
+ virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const;
+ virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const;
+ virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, bool p_clip_uv = true) const;
virtual bool get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const;
virtual Ref<Image> get_data() const { return Ref<Image>(); }
@@ -115,9 +115,9 @@ public:
virtual RID get_rid() const override;
bool has_alpha() const override;
- virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const override;
- virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const override;
- virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const override;
+ virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const override;
+ virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const override;
+ virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, bool p_clip_uv = true) const override;
bool is_pixel_opaque(int p_x, int p_y) const override;
@@ -194,9 +194,9 @@ public:
virtual void set_path(const String &p_path, bool p_take_over) override;
- virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const override;
- virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const override;
- virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const override;
+ virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const override;
+ virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const override;
+ virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, bool p_clip_uv = true) const override;
virtual bool has_alpha() const override;
bool is_pixel_opaque(int p_x, int p_y) const override;
@@ -246,9 +246,9 @@ public:
void set_filter_clip(const bool p_enable);
bool has_filter_clip() const;
- virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const override;
- virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const override;
- virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const override;
+ virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const override;
+ virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const override;
+ virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, bool p_clip_uv = true) const override;
virtual bool get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const override;
bool is_pixel_opaque(int p_x, int p_y) const override;
@@ -285,9 +285,9 @@ public:
void set_base_texture(const Ref<Texture2D> &p_texture);
Ref<Texture2D> get_base_texture() const;
- virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const override;
- virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const override;
- virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const override;
+ virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const override;
+ virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const override;
+ virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, bool p_clip_uv = true) const override;
virtual bool get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const override;
bool is_pixel_opaque(int p_x, int p_y) const override;
@@ -331,9 +331,9 @@ public:
Ref<Texture2D> get_piece_texture(int p_idx) const;
Ref<Image> to_image() const;
- virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const override;
- virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const override;
- virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const override;
+ virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const override;
+ virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const override;
+ virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, bool p_clip_uv = true) const override;
bool is_pixel_opaque(int p_x, int p_y) const override;
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 84b067d1e2..dcd8f11400 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -51,8 +51,6 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) {
tile_set_name(id, p_value);
} else if (what == "texture") {
tile_set_texture(id, p_value);
- } else if (what == "normal_map") {
- tile_set_normal_map(id, p_value);
} else if (what == "tex_offset") {
tile_set_texture_offset(id, p_value);
} else if (what == "material") {
@@ -226,8 +224,6 @@ bool TileSet::_get(const StringName &p_name, Variant &r_ret) const {
r_ret = tile_get_name(id);
} else if (what == "texture") {
r_ret = tile_get_texture(id);
- } else if (what == "normal_map") {
- r_ret = tile_get_normal_map(id);
} else if (what == "tex_offset") {
r_ret = tile_get_texture_offset(id);
} else if (what == "material") {
@@ -331,7 +327,6 @@ void TileSet::_get_property_list(List<PropertyInfo> *p_list) const {
String pre = itos(id) + "/";
p_list->push_back(PropertyInfo(Variant::STRING, pre + "name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", PROPERTY_USAGE_NOEDITOR));
- p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "normal_map", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", PROPERTY_USAGE_NOEDITOR));
p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "tex_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial", PROPERTY_USAGE_NOEDITOR));
p_list->push_back(PropertyInfo(Variant::COLOR, pre + "modulate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
@@ -402,17 +397,6 @@ Ref<Texture2D> TileSet::tile_get_texture(int p_id) const {
return tile_map[p_id].texture;
}
-void TileSet::tile_set_normal_map(int p_id, const Ref<Texture2D> &p_normal_map) {
- ERR_FAIL_COND(!tile_map.has(p_id));
- tile_map[p_id].normal_map = p_normal_map;
- emit_changed();
-}
-
-Ref<Texture2D> TileSet::tile_get_normal_map(int p_id) const {
- ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Texture2D>());
- return tile_map[p_id].normal_map;
-}
-
void TileSet::tile_set_material(int p_id, const Ref<ShaderMaterial> &p_material) {
ERR_FAIL_COND(!tile_map.has(p_id));
tile_map[p_id].material = p_material;
@@ -1128,8 +1112,6 @@ void TileSet::_bind_methods() {
ClassDB::bind_method(D_METHOD("tile_get_name", "id"), &TileSet::tile_get_name);
ClassDB::bind_method(D_METHOD("tile_set_texture", "id", "texture"), &TileSet::tile_set_texture);
ClassDB::bind_method(D_METHOD("tile_get_texture", "id"), &TileSet::tile_get_texture);
- ClassDB::bind_method(D_METHOD("tile_set_normal_map", "id", "normal_map"), &TileSet::tile_set_normal_map);
- ClassDB::bind_method(D_METHOD("tile_get_normal_map", "id"), &TileSet::tile_get_normal_map);
ClassDB::bind_method(D_METHOD("tile_set_material", "id", "material"), &TileSet::tile_set_material);
ClassDB::bind_method(D_METHOD("tile_get_material", "id"), &TileSet::tile_get_material);
ClassDB::bind_method(D_METHOD("tile_set_modulate", "id", "color"), &TileSet::tile_set_modulate);
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h
index 78f34e46ce..aab428aa21 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -106,7 +106,6 @@ private:
struct TileData {
String name;
Ref<Texture2D> texture;
- Ref<Texture2D> normal_map;
Vector2 offset;
Rect2i region;
Vector<ShapeData> shapes_data;
@@ -149,9 +148,6 @@ public:
void tile_set_texture(int p_id, const Ref<Texture2D> &p_texture);
Ref<Texture2D> tile_get_texture(int p_id) const;
- void tile_set_normal_map(int p_id, const Ref<Texture2D> &p_normal_map);
- Ref<Texture2D> tile_get_normal_map(int p_id) const;
-
void tile_set_texture_offset(int p_id, const Vector2 &p_offset);
Vector2 tile_get_texture_offset(int p_id) const;
diff --git a/servers/rendering/rasterizer.h b/servers/rendering/rasterizer.h
index cecd313fbd..4ece811a1e 100644
--- a/servers/rendering/rasterizer.h
+++ b/servers/rendering/rasterizer.h
@@ -351,10 +351,6 @@ public:
virtual void texture_replace(RID p_texture, RID p_by_texture) = 0;
virtual void texture_set_size_override(RID p_texture, int p_width, int p_height) = 0;
-// FIXME: Disabled during Vulkan refactoring, should be ported.
-#if 0
- virtual void texture_bind(RID p_texture, uint32_t p_texture_no) = 0;
-#endif
virtual void texture_set_path(RID p_texture, const String &p_path) = 0;
virtual String texture_get_path(RID p_texture) const = 0;
@@ -372,6 +368,15 @@ public:
virtual void texture_add_to_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) = 0;
virtual void texture_remove_from_decal_atlas(RID p_texture, bool p_panorama_to_dp = false) = 0;
+ /* CANVAS TEXTURE API */
+
+ virtual RID canvas_texture_create() = 0;
+ virtual void canvas_texture_set_channel(RID p_canvas_texture, RS::CanvasTextureChannel p_channel, RID p_texture) = 0;
+ virtual void canvas_texture_set_shading_parameters(RID p_canvas_texture, const Color &p_base_color, float p_shininess) = 0;
+
+ virtual void canvas_texture_set_texture_filter(RID p_item, RS::CanvasItemTextureFilter p_filter) = 0;
+ virtual void canvas_texture_set_texture_repeat(RID p_item, RS::CanvasItemTextureRepeat p_repeat) = 0;
+
/* SHADER API */
virtual RID shader_create() = 0;
@@ -882,39 +887,10 @@ public:
}
};
- typedef uint64_t TextureBindingID;
-
- virtual TextureBindingID request_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, RS::CanvasItemTextureFilter p_filter, RS::CanvasItemTextureRepeat p_repeat, RID p_multimesh) = 0;
- virtual void free_texture_binding(TextureBindingID p_binding) = 0;
-
//easier wrap to avoid mistakes
struct Item;
- struct TextureBinding {
- TextureBindingID binding_id;
-
- _FORCE_INLINE_ void create(RS::CanvasItemTextureFilter p_item_filter, RS::CanvasItemTextureRepeat p_item_repeat, RID p_texture, RID p_normalmap, RID p_specular, RS::CanvasItemTextureFilter p_filter, RS::CanvasItemTextureRepeat p_repeat, RID p_multimesh) {
- if (p_filter == RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT) {
- p_filter = p_item_filter;
- }
- if (p_repeat == RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) {
- p_repeat = p_item_repeat;
- }
- if (p_texture != RID() || p_normalmap != RID() || p_specular != RID() || p_filter != RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT || p_repeat != RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT || p_multimesh.is_valid()) {
- ERR_FAIL_COND(binding_id != 0);
- binding_id = singleton->request_texture_binding(p_texture, p_normalmap, p_specular, p_filter, p_repeat, p_multimesh);
- }
- }
-
- _FORCE_INLINE_ TextureBinding() { binding_id = 0; }
- _FORCE_INLINE_ ~TextureBinding() {
- if (binding_id) {
- singleton->free_texture_binding(binding_id);
- }
- }
- };
-
typedef uint64_t PolygonID;
virtual PolygonID request_polygon(const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>()) = 0;
virtual void free_polygon(PolygonID p_polygon) = 0;
@@ -984,9 +960,8 @@ public:
Color modulate;
Rect2 source;
uint8_t flags;
- Color specular_shininess;
- TextureBinding texture_binding;
+ RID texture;
CommandRect() {
flags = 0;
@@ -1002,8 +977,9 @@ public:
Color color;
RS::NinePatchAxisMode axis_x;
RS::NinePatchAxisMode axis_y;
- Color specular_shininess;
- TextureBinding texture_binding;
+
+ RID texture;
+
CommandNinePatch() {
draw_center = true;
type = TYPE_NINEPATCH;
@@ -1013,8 +989,9 @@ public:
struct CommandPolygon : public Command {
RS::PrimitiveType primitive;
Polygon polygon;
- Color specular_shininess;
- TextureBinding texture_binding;
+
+ RID texture;
+
CommandPolygon() {
type = TYPE_POLYGON;
}
@@ -1025,8 +1002,9 @@ public:
Vector2 points[4];
Vector2 uvs[4];
Color colors[4];
- Color specular_shininess;
- TextureBinding texture_binding;
+
+ RID texture;
+
CommandPrimitive() {
type = TYPE_PRIMITIVE;
}
@@ -1036,22 +1014,25 @@ public:
RID mesh;
Transform2D transform;
Color modulate;
- Color specular_shininess;
- TextureBinding texture_binding;
+
+ RID texture;
+
CommandMesh() { type = TYPE_MESH; }
};
struct CommandMultiMesh : public Command {
RID multimesh;
- Color specular_shininess;
- TextureBinding texture_binding;
+
+ RID texture;
+
CommandMultiMesh() { type = TYPE_MULTIMESH; }
};
struct CommandParticles : public Command {
RID particles;
- Color specular_shininess;
- TextureBinding texture_binding;
+
+ RID texture;
+
CommandParticles() { type = TYPE_PARTICLES; }
};
@@ -1260,12 +1241,6 @@ public:
return command;
}
- struct CustomData {
- virtual ~CustomData() {}
- };
-
- mutable CustomData *custom_data; //implementation dependent
-
void clear() {
Command *c = commands;
while (c) {
@@ -1295,6 +1270,10 @@ public:
material_owner = nullptr;
light_masked = false;
}
+
+ RS::CanvasItemTextureFilter texture_filter;
+ RS::CanvasItemTextureRepeat texture_repeat;
+
Item() {
commands = nullptr;
last_command = nullptr;
@@ -1315,7 +1294,8 @@ public:
light_masked = false;
update_when_visible = false;
z_final = 0;
- custom_data = nullptr;
+ texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT;
+ texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT;
}
virtual ~Item() {
clear();
@@ -1325,13 +1305,10 @@ public:
if (copy_back_buffer) {
memdelete(copy_back_buffer);
}
- if (custom_data) {
- memdelete(custom_data);
- }
}
};
- virtual void canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, const Transform2D &p_canvas_transform) = 0;
+ virtual void canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, const Transform2D &p_canvas_transform, RS::CanvasItemTextureFilter p_default_filter, RS::CanvasItemTextureRepeat p_default_repeat) = 0;
virtual void canvas_debug_viewport_shadows(Light *p_lights_with_shadow) = 0;
struct LightOccluderInstance {
@@ -1357,12 +1334,13 @@ public:
virtual RID light_create() = 0;
virtual void light_set_texture(RID p_rid, RID p_texture) = 0;
- virtual void light_set_use_shadow(RID p_rid, bool p_enable, int p_resolution) = 0;
- virtual void light_update_shadow(RID p_rid, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders) = 0;
+ virtual void light_set_use_shadow(RID p_rid, bool p_enable) = 0;
+ virtual void light_update_shadow(RID p_rid, int p_shadow_index, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders) = 0;
virtual RID occluder_polygon_create() = 0;
virtual void occluder_polygon_set_shape_as_lines(RID p_occluder, const Vector<Vector2> &p_lines) = 0;
virtual void occluder_polygon_set_cull_mode(RID p_occluder, RS::CanvasOccluderPolygonCullMode p_mode) = 0;
+ virtual void set_shadow_texture_size(int p_size) = 0;
virtual void draw_window_margins(int *p_margins, RID *p_margin_textures) = 0;
diff --git a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp
index aad2be45c6..28674b118c 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp
@@ -92,152 +92,6 @@ void RasterizerCanvasRD::_update_transform_to_mat4(const Transform &p_transform,
p_mat4[15] = 1;
}
-void RasterizerCanvasRD::_update_specular_shininess(const Color &p_transform, uint32_t *r_ss) {
- *r_ss = uint32_t(CLAMP(p_transform.a * 255.0, 0, 255)) << 24;
- *r_ss |= uint32_t(CLAMP(p_transform.b * 255.0, 0, 255)) << 16;
- *r_ss |= uint32_t(CLAMP(p_transform.g * 255.0, 0, 255)) << 8;
- *r_ss |= uint32_t(CLAMP(p_transform.r * 255.0, 0, 255));
-}
-
-RID RasterizerCanvasRD::_create_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat, RID p_multimesh) {
- Vector<RD::Uniform> uniform_set;
-
- { // COLOR TEXTURE
- RD::Uniform u;
- u.type = RD::UNIFORM_TYPE_TEXTURE;
- u.binding = 1;
- RID texture = storage->texture_get_rd_texture(p_texture);
- if (!texture.is_valid()) {
- //use default white texture
- texture = storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE);
- }
- u.ids.push_back(texture);
- uniform_set.push_back(u);
- }
-
- { // NORMAL TEXTURE
- RD::Uniform u;
- u.type = RD::UNIFORM_TYPE_TEXTURE;
- u.binding = 2;
- RID texture = storage->texture_get_rd_texture(p_normalmap);
- if (!texture.is_valid()) {
- //use default normal texture
- texture = storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_NORMAL);
- }
- u.ids.push_back(texture);
- uniform_set.push_back(u);
- }
-
- { // SPECULAR TEXTURE
- RD::Uniform u;
- u.type = RD::UNIFORM_TYPE_TEXTURE;
- u.binding = 3;
- RID texture = storage->texture_get_rd_texture(p_specular);
- if (!texture.is_valid()) {
- //use default white texture
- texture = storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE);
- }
- u.ids.push_back(texture);
- uniform_set.push_back(u);
- }
-
- { // SAMPLER
- RD::Uniform u;
- u.type = RD::UNIFORM_TYPE_SAMPLER;
- u.binding = 4;
- RID sampler = storage->sampler_rd_get_default(p_filter, p_repeat);
- ERR_FAIL_COND_V(sampler.is_null(), RID());
- u.ids.push_back(sampler);
- uniform_set.push_back(u);
- }
-
- { // MULTIMESH TEXTURE BUFFER
- RD::Uniform u;
- u.type = RD::UNIFORM_TYPE_TEXTURE_BUFFER;
- u.binding = 5;
- u.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_MULTIMESH_BUFFER));
- uniform_set.push_back(u);
- }
-
- return RD::get_singleton()->uniform_set_create(uniform_set, shader.default_version_rd_shader, 0);
-}
-
-RasterizerCanvas::TextureBindingID RasterizerCanvasRD::request_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat, RID p_multimesh) {
- if (p_filter == RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT) {
- p_filter = default_samplers.default_filter;
- }
-
- if (p_repeat == RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) {
- p_repeat = default_samplers.default_repeat;
- }
-
- TextureBindingKey key;
- key.texture = p_texture;
- key.normalmap = p_normalmap;
- key.specular = p_specular;
- key.multimesh = p_multimesh;
- key.texture_filter = p_filter;
- key.texture_repeat = p_repeat;
-
- TextureBinding *binding;
- TextureBindingID id;
- {
- TextureBindingID *idptr = bindings.texture_key_bindings.getptr(key);
-
- if (!idptr) {
- id = bindings.id_generator++;
- bindings.texture_key_bindings[key] = id;
- binding = memnew(TextureBinding);
- binding->key = key;
- binding->id = id;
-
- bindings.texture_bindings[id] = binding;
-
- } else {
- id = *idptr;
- binding = bindings.texture_bindings[id];
- }
- }
-
- binding->reference_count++;
-
- if (binding->to_dispose.in_list()) {
- //was queued for disposal previously, but ended up reused.
- bindings.to_dispose_list.remove(&binding->to_dispose);
- }
-
- if (binding->uniform_set.is_null() || !RD::get_singleton()->uniform_set_is_valid(binding->uniform_set)) {
- binding->uniform_set = _create_texture_binding(p_texture, p_normalmap, p_specular, p_filter, p_repeat, p_multimesh);
- }
-
- return id;
-}
-
-void RasterizerCanvasRD::free_texture_binding(TextureBindingID p_binding) {
- TextureBinding **binding_ptr = bindings.texture_bindings.getptr(p_binding);
- ERR_FAIL_COND(!binding_ptr);
- TextureBinding *binding = *binding_ptr;
- ERR_FAIL_COND(binding->reference_count == 0);
- binding->reference_count--;
- if (binding->reference_count == 0) {
- bindings.to_dispose_list.add(&binding->to_dispose);
- }
-}
-
-void RasterizerCanvasRD::_dispose_bindings() {
- while (bindings.to_dispose_list.first()) {
- TextureBinding *binding = bindings.to_dispose_list.first()->self();
- if (binding->uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(binding->uniform_set)) {
- RD::get_singleton()->free(binding->uniform_set);
- }
-
- bindings.texture_key_bindings.erase(binding->key);
- bindings.texture_bindings.erase(binding->id);
- bindings.to_dispose_list.remove(&binding->to_dispose);
- memdelete(binding);
- }
-}
-
RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, const Vector<int> &p_bones, const Vector<float> &p_weights) {
// Care must be taken to generate array formats
// in ways where they could be reused, so we will
@@ -457,36 +311,72 @@ void RasterizerCanvasRD::free_polygon(PolygonID p_polygon) {
polygon_buffers.polygons.erase(p_polygon);
}
-Size2i RasterizerCanvasRD::_bind_texture_binding(TextureBindingID p_binding, RD::DrawListID p_draw_list, uint32_t &flags) {
- TextureBinding **texture_binding_ptr = bindings.texture_bindings.getptr(p_binding);
- ERR_FAIL_COND_V(!texture_binding_ptr, Size2i());
- TextureBinding *texture_binding = *texture_binding_ptr;
+////////////////////
+
+void RasterizerCanvasRD::_bind_canvas_texture(RD::DrawListID p_draw_list, RID p_texture, RS::CanvasItemTextureFilter p_base_filter, RS::CanvasItemTextureRepeat p_base_repeat, RID &r_last_texture, PushConstant &push_constant, Size2 &r_texpixel_size) {
+ if (p_texture == RID()) {
+ p_texture = default_canvas_texture;
+ }
- if (texture_binding->key.normalmap.is_valid()) {
- flags |= FLAGS_DEFAULT_NORMAL_MAP_USED;
+ if (r_last_texture == p_texture) {
+ return; //nothing to do, its the same
}
- if (texture_binding->key.specular.is_valid()) {
- flags |= FLAGS_DEFAULT_SPECULAR_MAP_USED;
+
+ RID uniform_set;
+ Color specular_shininess;
+ Size2i size;
+ bool use_normal;
+ bool use_specular;
+
+ bool success = storage->canvas_texture_get_unifom_set(p_texture, p_base_filter, p_base_repeat, shader.default_version_rd_shader, CANVAS_TEXTURE_UNIFORM_SET, uniform_set, size, specular_shininess, use_normal, use_specular);
+ //something odd happened
+ if (!success) {
+ _bind_canvas_texture(p_draw_list, default_canvas_texture, p_base_filter, p_base_repeat, r_last_texture, push_constant, r_texpixel_size);
+ return;
}
- if (!RD::get_singleton()->uniform_set_is_valid(texture_binding->uniform_set)) {
- //texture may have changed (erased or replaced, see if we can fix)
- texture_binding->uniform_set = _create_texture_binding(texture_binding->key.texture, texture_binding->key.normalmap, texture_binding->key.specular, texture_binding->key.texture_filter, texture_binding->key.texture_repeat, texture_binding->key.multimesh);
- ERR_FAIL_COND_V(!texture_binding->uniform_set.is_valid(), Size2i(1, 1));
+ RD::get_singleton()->draw_list_bind_uniform_set(p_draw_list, uniform_set, CANVAS_TEXTURE_UNIFORM_SET);
+
+ if (specular_shininess.a < 0.999) {
+ push_constant.flags |= FLAGS_DEFAULT_SPECULAR_MAP_USED;
+ } else {
+ push_constant.flags &= ~FLAGS_DEFAULT_SPECULAR_MAP_USED;
}
- RD::get_singleton()->draw_list_bind_uniform_set(p_draw_list, texture_binding->uniform_set, 0);
- if (texture_binding->key.texture.is_valid()) {
- return storage->texture_2d_get_size(texture_binding->key.texture);
+ if (use_normal) {
+ push_constant.flags |= FLAGS_DEFAULT_NORMAL_MAP_USED;
} else {
- return Size2i(1, 1);
+ push_constant.flags &= ~FLAGS_DEFAULT_NORMAL_MAP_USED;
}
+
+ push_constant.specular_shininess = uint32_t(CLAMP(specular_shininess.a * 255.0, 0, 255)) << 24;
+ push_constant.specular_shininess |= uint32_t(CLAMP(specular_shininess.b * 255.0, 0, 255)) << 16;
+ push_constant.specular_shininess |= uint32_t(CLAMP(specular_shininess.g * 255.0, 0, 255)) << 8;
+ push_constant.specular_shininess |= uint32_t(CLAMP(specular_shininess.r * 255.0, 0, 255));
+
+ r_texpixel_size.x = 1.0 / float(size.x);
+ r_texpixel_size.y = 1.0 / float(size.y);
+
+ push_constant.color_texture_pixel_size[0] = r_texpixel_size.x;
+ push_constant.color_texture_pixel_size[1] = r_texpixel_size.y;
+
+ r_last_texture = p_texture;
}
-////////////////////
void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_item, RD::FramebufferFormatID p_framebuffer_format, const Transform2D &p_canvas_transform_inverse, Item *&current_clip, Light *p_lights, PipelineVariants *p_pipeline_variants) {
//create an empty push constant
+ RS::CanvasItemTextureFilter current_filter = default_filter;
+ RS::CanvasItemTextureRepeat current_repeat = default_repeat;
+
+ if (p_item->texture_filter != RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT) {
+ current_filter = p_item->texture_filter;
+ }
+
+ if (p_item->texture_repeat != RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) {
+ current_repeat = p_item->texture_repeat;
+ }
+
PushConstant push_constant;
Transform2D base_transform = p_canvas_transform_inverse * p_item->final_transform;
_update_transform_2d_to_mat2x3(base_transform, push_constant.world);
@@ -513,16 +403,6 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
uint32_t base_flags = 0;
- bool light_uniform_set_dirty = false;
-
- if (!p_item->custom_data) {
- p_item->custom_data = memnew(ItemStateData);
- light_uniform_set_dirty = true;
- }
-
- ItemStateData *state_data = (ItemStateData *)p_item->custom_data;
-
- Light *light_cache[DEFAULT_MAX_LIGHTS_PER_ITEM];
uint16_t light_count = 0;
PipelineLightMode light_mode;
@@ -534,160 +414,34 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
uint32_t light_index = light->render_index_cache;
push_constant.lights[light_count >> 2] |= light_index << ((light_count & 3) * 8);
- if (!light_uniform_set_dirty && (state_data->light_cache[light_count].light != light || state_data->light_cache[light_count].light_version != light->version)) {
- light_uniform_set_dirty = true;
- }
-
- light_cache[light_count] = light;
-
light_count++;
+
if (light->mode == RS::CANVAS_LIGHT_MODE_MASK) {
base_flags |= FLAGS_USING_LIGHT_MASK;
}
- if (light_count == state.max_lights_per_item) {
+
+ if (light_count == MAX_LIGHTS_PER_ITEM) {
break;
}
}
light = light->next_ptr;
}
- if (light_count != state_data->light_cache_count) {
- light_uniform_set_dirty = true;
- }
base_flags |= light_count << FLAGS_LIGHT_COUNT_SHIFT;
}
- {
- RID &canvas_item_state = light_count ? state_data->state_uniform_set_with_light : state_data->state_uniform_set;
-
- bool invalid_uniform = canvas_item_state.is_valid() && !RD::get_singleton()->uniform_set_is_valid(canvas_item_state);
-
- if (canvas_item_state.is_null() || invalid_uniform || (light_count > 0 && light_uniform_set_dirty)) {
- //re create canvas state
- Vector<RD::Uniform> uniforms;
-
- if (state_data->state_uniform_set_with_light.is_valid() && !invalid_uniform) {
- RD::get_singleton()->free(canvas_item_state);
- }
-
- {
- RD::Uniform u;
- u.type = RD::UNIFORM_TYPE_UNIFORM_BUFFER;
- u.binding = 0;
- u.ids.push_back(state.canvas_state_buffer);
- uniforms.push_back(u);
- }
-
- if (false && p_item->skeleton.is_valid()) {
- //bind skeleton stuff
- } else {
- //bind default
-
- {
- RD::Uniform u;
- u.type = RD::UNIFORM_TYPE_TEXTURE_BUFFER;
- u.binding = 1;
- u.ids.push_back(shader.default_skeleton_texture_buffer);
- uniforms.push_back(u);
- }
-
- {
- RD::Uniform u;
- u.type = RD::UNIFORM_TYPE_UNIFORM_BUFFER;
- u.binding = 2;
- u.ids.push_back(shader.default_skeleton_uniform_buffer);
- uniforms.push_back(u);
- }
- }
-
- {
- RD::Uniform u;
- u.type = RD::UNIFORM_TYPE_STORAGE_BUFFER;
- u.binding = 7;
- u.ids.push_back(storage->global_variables_get_storage_buffer());
- uniforms.push_back(u);
- }
-
- //validate and update lighs if they are being used
-
- if (light_count > 0) {
- //recreate uniform set
-
- {
- RD::Uniform u;
- u.type = RD::UNIFORM_TYPE_UNIFORM_BUFFER;
- u.binding = 3;
- u.ids.push_back(state.lights_uniform_buffer);
- uniforms.push_back(u);
- }
-
- {
- RD::Uniform u_lights;
- u_lights.type = RD::UNIFORM_TYPE_TEXTURE;
- u_lights.binding = 4;
-
- RD::Uniform u_shadows;
- u_shadows.type = RD::UNIFORM_TYPE_TEXTURE;
- u_shadows.binding = 5;
-
- //lights
- for (uint32_t i = 0; i < state.max_lights_per_item; i++) {
- if (i < light_count) {
- CanvasLight *cl = canvas_light_owner.getornull(light_cache[i]->light_internal);
- ERR_CONTINUE(!cl);
-
- RID rd_texture;
-
- if (cl->texture.is_valid()) {
- rd_texture = storage->texture_get_rd_texture(cl->texture);
- }
- if (rd_texture.is_valid()) {
- u_lights.ids.push_back(rd_texture);
- } else {
- u_lights.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE));
- }
- if (cl->shadow.texture.is_valid()) {
- u_shadows.ids.push_back(cl->shadow.texture);
- } else {
- u_shadows.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_BLACK));
- }
- } else {
- u_lights.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE));
- u_shadows.ids.push_back(storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_BLACK));
- }
- }
-
- uniforms.push_back(u_lights);
- uniforms.push_back(u_shadows);
- }
-
- {
- RD::Uniform u;
- u.type = RD::UNIFORM_TYPE_SAMPLER;
- u.binding = 6;
- u.ids.push_back(state.shadow_sampler);
- uniforms.push_back(u);
- }
-
- canvas_item_state = RD::get_singleton()->uniform_set_create(uniforms, shader.default_version_rd_shader_light, 2);
- } else {
- canvas_item_state = RD::get_singleton()->uniform_set_create(uniforms, shader.default_version_rd_shader, 2);
- }
- }
-
- RD::get_singleton()->draw_list_bind_uniform_set(p_draw_list, canvas_item_state, 2);
- }
-
light_mode = light_count > 0 ? PIPELINE_LIGHT_MODE_ENABLED : PIPELINE_LIGHT_MODE_DISABLED;
PipelineVariants *pipeline_variants = p_pipeline_variants;
bool reclip = false;
+ RID last_texture;
+ Size2 texpixel_size;
+
const Item::Command *c = p_item->commands;
while (c) {
- push_constant.flags = base_flags; //reset on each command for sanity
- push_constant.specular_shininess = 0xFFFFFFFF;
+ push_constant.flags = base_flags | (push_constant.flags & (FLAGS_DEFAULT_NORMAL_MAP_USED | FLAGS_DEFAULT_SPECULAR_MAP_USED)); //reset on each command for sanity, keep canvastexture binding config
switch (c->type) {
case Item::Command::TYPE_RECT: {
@@ -701,26 +455,12 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
//bind textures
- Size2 texpixel_size;
- {
- texpixel_size = _bind_texture_binding(rect->texture_binding.binding_id, p_draw_list, push_constant.flags);
- texpixel_size.x = 1.0 / texpixel_size.x;
- texpixel_size.y = 1.0 / texpixel_size.y;
- }
-
- if (rect->specular_shininess.a < 0.999) {
- push_constant.flags |= FLAGS_DEFAULT_SPECULAR_MAP_USED;
- }
-
- _update_specular_shininess(rect->specular_shininess, &push_constant.specular_shininess);
+ _bind_canvas_texture(p_draw_list, rect->texture, current_filter, current_repeat, last_texture, push_constant, texpixel_size);
Rect2 src_rect;
Rect2 dst_rect;
- if (texpixel_size != Vector2()) {
- push_constant.color_texture_pixel_size[0] = texpixel_size.x;
- push_constant.color_texture_pixel_size[1] = texpixel_size.y;
-
+ if (rect->texture != RID()) {
src_rect = (rect->flags & CANVAS_RECT_REGION) ? Rect2(rect->source.position * texpixel_size, rect->source.size * texpixel_size) : Rect2(0, 0, 1, 1);
dst_rect = Rect2(rect->rect.position, rect->rect.size);
@@ -762,7 +502,6 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
}
src_rect = Rect2(0, 0, 1, 1);
- texpixel_size = Vector2(1, 1);
}
push_constant.modulation[0] = rect->modulate.r * base_color.r;
@@ -780,9 +519,6 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
push_constant.dst_rect[2] = dst_rect.size.width;
push_constant.dst_rect[3] = dst_rect.size.height;
- push_constant.color_texture_pixel_size[0] = texpixel_size.x;
- push_constant.color_texture_pixel_size[1] = texpixel_size.y;
-
RD::get_singleton()->draw_list_set_push_constant(p_draw_list, &push_constant, sizeof(PushConstant));
RD::get_singleton()->draw_list_bind_index_array(p_draw_list, shader.quad_index_array);
RD::get_singleton()->draw_list_draw(p_draw_list, true);
@@ -800,30 +536,21 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
//bind textures
- Size2 texpixel_size;
- {
- texpixel_size = _bind_texture_binding(np->texture_binding.binding_id, p_draw_list, push_constant.flags);
- texpixel_size.x = 1.0 / texpixel_size.x;
- texpixel_size.y = 1.0 / texpixel_size.y;
- }
-
- if (np->specular_shininess.a < 0.999) {
- push_constant.flags |= FLAGS_DEFAULT_SPECULAR_MAP_USED;
- }
-
- _update_specular_shininess(np->specular_shininess, &push_constant.specular_shininess);
+ _bind_canvas_texture(p_draw_list, np->texture, current_filter, current_repeat, last_texture, push_constant, texpixel_size);
Rect2 src_rect;
Rect2 dst_rect(np->rect.position.x, np->rect.position.y, np->rect.size.x, np->rect.size.y);
- if (texpixel_size == Size2()) {
+ if (np->texture == RID()) {
texpixel_size = Size2(1, 1);
src_rect = Rect2(0, 0, 1, 1);
} else {
if (np->source != Rect2()) {
src_rect = Rect2(np->source.position.x * texpixel_size.width, np->source.position.y * texpixel_size.height, np->source.size.x * texpixel_size.width, np->source.size.y * texpixel_size.height);
- texpixel_size = Size2(1.0 / np->source.size.width, 1.0 / np->source.size.height);
+ push_constant.color_texture_pixel_size[0] = 1.0 / np->source.size.width;
+ push_constant.color_texture_pixel_size[1] = 1.0 / np->source.size.height;
+
} else {
src_rect = Rect2(0, 0, 1, 1);
}
@@ -844,9 +571,6 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
push_constant.dst_rect[2] = dst_rect.size.width;
push_constant.dst_rect[3] = dst_rect.size.height;
- push_constant.color_texture_pixel_size[0] = texpixel_size.x;
- push_constant.color_texture_pixel_size[1] = texpixel_size.y;
-
push_constant.flags |= int(np->axis_x) << FLAGS_NINEPATCH_H_MODE_SHIFT;
push_constant.flags |= int(np->axis_y) << FLAGS_NINEPATCH_V_MODE_SHIFT;
@@ -863,6 +587,10 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
RD::get_singleton()->draw_list_bind_index_array(p_draw_list, shader.quad_index_array);
RD::get_singleton()->draw_list_draw(p_draw_list, true);
+ //restore if overrided
+ push_constant.color_texture_pixel_size[0] = texpixel_size.x;
+ push_constant.color_texture_pixel_size[1] = texpixel_size.y;
+
} break;
case Item::Command::TYPE_POLYGON: {
const Item::CommandPolygon *polygon = static_cast<const Item::CommandPolygon *>(c);
@@ -884,18 +612,7 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
//bind textures
- Size2 texpixel_size;
- {
- texpixel_size = _bind_texture_binding(polygon->texture_binding.binding_id, p_draw_list, push_constant.flags);
- texpixel_size.x = 1.0 / texpixel_size.x;
- texpixel_size.y = 1.0 / texpixel_size.y;
- }
-
- if (polygon->specular_shininess.a < 0.999) {
- push_constant.flags |= FLAGS_DEFAULT_SPECULAR_MAP_USED;
- }
-
- _update_specular_shininess(polygon->specular_shininess, &push_constant.specular_shininess);
+ _bind_canvas_texture(p_draw_list, polygon->texture, current_filter, current_repeat, last_texture, push_constant, texpixel_size);
push_constant.modulation[0] = base_color.r;
push_constant.modulation[1] = base_color.g;
@@ -908,9 +625,6 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
push_constant.ninepatch_margins[j] = 0;
}
- push_constant.color_texture_pixel_size[0] = texpixel_size.x;
- push_constant.color_texture_pixel_size[1] = texpixel_size.y;
-
RD::get_singleton()->draw_list_set_push_constant(p_draw_list, &push_constant, sizeof(PushConstant));
RD::get_singleton()->draw_list_bind_vertex_array(p_draw_list, pb->vertex_array);
if (pb->indices.is_valid()) {
@@ -932,15 +646,7 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
//bind textures
- {
- _bind_texture_binding(primitive->texture_binding.binding_id, p_draw_list, push_constant.flags);
- }
-
- if (primitive->specular_shininess.a < 0.999) {
- push_constant.flags |= FLAGS_DEFAULT_SPECULAR_MAP_USED;
- }
-
- _update_specular_shininess(primitive->specular_shininess, &push_constant.specular_shininess);
+ _bind_canvas_texture(p_draw_list, RID(), current_filter, current_repeat, last_texture, push_constant, texpixel_size);
RD::get_singleton()->draw_list_bind_index_array(p_draw_list, primitive_arrays.index_array[MIN(3, primitive->point_count) - 1]);
@@ -1295,7 +1001,108 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
}
}
-void RasterizerCanvasRD::_render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights, RID p_screen_uniform_set) {
+RID RasterizerCanvasRD::_create_base_uniform_set(RID p_to_render_target, bool p_backbuffer) {
+ //re create canvas state
+ Vector<RD::Uniform> uniforms;
+
+ {
+ RD::Uniform u;
+ u.type = RD::UNIFORM_TYPE_UNIFORM_BUFFER;
+ u.binding = 1;
+ u.ids.push_back(state.canvas_state_buffer);
+ uniforms.push_back(u);
+ }
+
+ {
+ RD::Uniform u;
+ u.type = RD::UNIFORM_TYPE_UNIFORM_BUFFER;
+ u.binding = 2;
+ u.ids.push_back(state.lights_uniform_buffer);
+ uniforms.push_back(u);
+ }
+
+ {
+ RD::Uniform u;
+ u.type = RD::UNIFORM_TYPE_TEXTURE;
+ u.binding = 3;
+ u.ids.push_back(storage->decal_atlas_get_texture());
+ uniforms.push_back(u);
+ }
+
+ {
+ RD::Uniform u;
+ u.type = RD::UNIFORM_TYPE_TEXTURE;
+ u.binding = 4;
+ u.ids.push_back(state.shadow_texture);
+ uniforms.push_back(u);
+ }
+
+ {
+ RD::Uniform u;
+ u.type = RD::UNIFORM_TYPE_SAMPLER;
+ u.binding = 5;
+ u.ids.push_back(state.shadow_sampler);
+ uniforms.push_back(u);
+ }
+
+ {
+ RD::Uniform u;
+ u.type = RD::UNIFORM_TYPE_TEXTURE;
+ u.binding = 6;
+ RID screen;
+ if (p_backbuffer) {
+ screen = storage->render_target_get_rd_texture(p_to_render_target);
+ } else {
+ screen = storage->render_target_get_rd_backbuffer(p_to_render_target);
+ if (screen.is_null()) { //unallocated backbuffer
+ screen = storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_WHITE);
+ }
+ }
+ u.ids.push_back(screen);
+ uniforms.push_back(u);
+ }
+
+ {
+ //needs samplers for the material (uses custom textures) create them
+ RD::Uniform u;
+ u.type = RD::UNIFORM_TYPE_SAMPLER;
+ u.binding = 7;
+ u.ids.resize(12);
+ RID *ids_ptr = u.ids.ptrw();
+ ids_ptr[0] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[1] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[2] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[3] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[4] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[5] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[6] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[7] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[8] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[9] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[10] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[11] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ uniforms.push_back(u);
+ }
+
+ {
+ RD::Uniform u;
+ u.type = RD::UNIFORM_TYPE_STORAGE_BUFFER;
+ u.binding = 8;
+ u.ids.push_back(storage->global_variables_get_storage_buffer());
+ uniforms.push_back(u);
+ }
+
+ RID uniform_set = RD::get_singleton()->uniform_set_create(uniforms, shader.default_version_rd_shader, BASE_UNIFORM_SET);
+ if (p_backbuffer) {
+ storage->render_target_set_backbuffer_uniform_set(p_to_render_target, uniform_set);
+ } else {
+ storage->render_target_set_framebuffer_uniform_set(p_to_render_target, uniform_set);
+ }
+
+ return uniform_set;
+}
+
+void RasterizerCanvasRD::_render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights) {
Item *current_clip = nullptr;
Transform2D canvas_transform_inverse = p_canvas_transform_inverse;
@@ -1313,13 +1120,19 @@ void RasterizerCanvasRD::_render_items(RID p_to_render_target, int p_item_count,
#warning TODO obtain from framebuffer format eventually when this is implemented
#endif
+ RID fb_uniform_set = storage->render_target_get_framebuffer_uniform_set(p_to_render_target);
+
+ if (fb_uniform_set.is_null() || !RD::get_singleton()->uniform_set_is_valid(fb_uniform_set)) {
+ fb_uniform_set = _create_base_uniform_set(p_to_render_target, false);
+ }
+
RD::FramebufferFormatID fb_format = RD::get_singleton()->framebuffer_get_format(framebuffer);
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(framebuffer, clear ? RD::INITIAL_ACTION_CLEAR : RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_DISCARD, clear_colors);
- if (p_screen_uniform_set.is_valid()) {
- RD::get_singleton()->draw_list_bind_uniform_set(draw_list, p_screen_uniform_set, 3);
- }
+ RD::get_singleton()->draw_list_bind_uniform_set(draw_list, fb_uniform_set, BASE_UNIFORM_SET);
+ RD::get_singleton()->draw_list_bind_uniform_set(draw_list, state.default_transforms_uniform_set, TRANSFORMS_UNIFORM_SET);
+
RID prev_material;
PipelineVariants *pipeline_variants = &shader.pipeline_variants;
@@ -1349,7 +1162,7 @@ void RasterizerCanvasRD::_render_items(RID p_to_render_target, int p_item_count,
if (material_data->shader_data->version.is_valid() && material_data->shader_data->valid) {
pipeline_variants = &material_data->shader_data->pipeline_variants;
if (material_data->uniform_set.is_valid()) {
- RD::get_singleton()->draw_list_bind_uniform_set(draw_list, material_data->uniform_set, 1);
+ RD::get_singleton()->draw_list_bind_uniform_set(draw_list, material_data->uniform_set, MATERIAL_UNIFORM_SET);
}
} else {
pipeline_variants = &shader.pipeline_variants;
@@ -1367,7 +1180,7 @@ void RasterizerCanvasRD::_render_items(RID p_to_render_target, int p_item_count,
RD::get_singleton()->draw_list_end();
}
-void RasterizerCanvasRD::canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, const Transform2D &p_canvas_transform) {
+void RasterizerCanvasRD::canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, const Transform2D &p_canvas_transform, RenderingServer::CanvasItemTextureFilter p_default_filter, RenderingServer::CanvasItemTextureRepeat p_default_repeat) {
int item_count = 0;
//setup canvas state uniforms if needed
@@ -1435,24 +1248,42 @@ void RasterizerCanvasRD::canvas_render_items(RID p_to_render_target, Item *p_ite
state.light_uniforms[index].height = l->height * (p_canvas_transform.elements[0].length() + p_canvas_transform.elements[1].length()) * 0.5; //approximate height conversion to the canvas size, since all calculations are done in canvas coords to avoid precision loss
for (int i = 0; i < 4; i++) {
- state.light_uniforms[index].shadow_color[i] = l->shadow_color[i];
+ state.light_uniforms[index].shadow_color[i] = uint8_t(CLAMP(int32_t(l->shadow_color[i] * 255.0), 0, 255));
state.light_uniforms[index].color[i] = l->color[i];
}
state.light_uniforms[index].color[3] = l->energy; //use alpha for energy, so base color can go separate
- if (clight->shadow.texture.is_valid()) {
- state.light_uniforms[index].shadow_pixel_size = (1.0 / clight->shadow.size) * (1.0 + l->shadow_smooth);
+ if (state.shadow_fb.is_valid()) {
+ state.light_uniforms[index].shadow_pixel_size = (1.0 / state.shadow_texture_size) * (1.0 + l->shadow_smooth);
+ state.light_uniforms[index].shadow_z_far_inv = 1.0 / clight->shadow.z_far;
+ state.light_uniforms[index].shadow_y_ofs = clight->shadow.y_offset;
} else {
state.light_uniforms[index].shadow_pixel_size = 1.0;
+ state.light_uniforms[index].shadow_z_far_inv = 1.0;
+ state.light_uniforms[index].shadow_y_ofs = 0;
}
state.light_uniforms[index].flags |= l->mode << LIGHT_FLAGS_BLEND_SHIFT;
state.light_uniforms[index].flags |= l->shadow_filter << LIGHT_FLAGS_FILTER_SHIFT;
- if (clight->shadow.texture.is_valid()) {
+ if (clight->shadow.enabled) {
state.light_uniforms[index].flags |= LIGHT_FLAGS_HAS_SHADOW;
}
+ if (clight->texture.is_valid()) {
+ Rect2 atlas_rect = storage->decal_atlas_get_texture_rect(clight->texture);
+ state.light_uniforms[index].atlas_rect[0] = atlas_rect.position.x;
+ state.light_uniforms[index].atlas_rect[1] = atlas_rect.position.y;
+ state.light_uniforms[index].atlas_rect[2] = atlas_rect.size.width;
+ state.light_uniforms[index].atlas_rect[3] = atlas_rect.size.height;
+
+ } else {
+ state.light_uniforms[index].atlas_rect[0] = 0;
+ state.light_uniforms[index].atlas_rect[1] = 0;
+ state.light_uniforms[index].atlas_rect[2] = 0;
+ state.light_uniforms[index].atlas_rect[3] = 0;
+ }
+
l->render_index_cache = index;
index++;
@@ -1464,12 +1295,16 @@ void RasterizerCanvasRD::canvas_render_items(RID p_to_render_target, Item *p_ite
}
}
+ { //default filter/repeat
+ default_filter = p_default_filter;
+ default_repeat = p_default_repeat;
+ }
+
//fill the list until rendering is possible.
bool material_screen_texture_found = false;
Item *ci = p_item_list;
Rect2 back_buffer_rect;
bool backbuffer_copy = false;
- RID screen_uniform_set;
while (ci) {
if (ci->copy_back_buffer) {
@@ -1490,10 +1325,6 @@ void RasterizerCanvasRD::canvas_render_items(RID p_to_render_target, Item *p_ite
backbuffer_copy = true;
back_buffer_rect = Rect2();
}
- if (screen_uniform_set.is_null()) {
- RID backbuffer_shader = shader.canvas_shader.version_get_shader(md->shader_data->version, 0); //any version is fine
- screen_uniform_set = storage->render_target_get_back_buffer_uniform_set(p_to_render_target, backbuffer_shader);
- }
}
if (md->last_frame != RasterizerRD::singleton->get_frame_number()) {
@@ -1509,7 +1340,7 @@ void RasterizerCanvasRD::canvas_render_items(RID p_to_render_target, Item *p_ite
if (backbuffer_copy) {
//render anything pending, including clearing if no items
- _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, screen_uniform_set);
+ _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list);
item_count = 0;
storage->render_target_copy_to_back_buffer(p_to_render_target, back_buffer_rect);
@@ -1521,7 +1352,7 @@ void RasterizerCanvasRD::canvas_render_items(RID p_to_render_target, Item *p_ite
items[item_count++] = ci;
if (!ci->next || item_count == MAX_RENDER_ITEMS - 1) {
- _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, screen_uniform_set);
+ _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list);
//then reset
item_count = 0;
}
@@ -1532,7 +1363,6 @@ void RasterizerCanvasRD::canvas_render_items(RID p_to_render_target, Item *p_ite
RID RasterizerCanvasRD::light_create() {
CanvasLight canvas_light;
- canvas_light.shadow.size = 0;
return canvas_light_owner.make_rid(canvas_light);
}
@@ -1542,71 +1372,71 @@ void RasterizerCanvasRD::light_set_texture(RID p_rid, RID p_texture) {
if (cl->texture == p_texture) {
return;
}
-
+ if (cl->texture.is_valid()) {
+ storage->texture_remove_from_decal_atlas(cl->texture);
+ }
cl->texture = p_texture;
+
+ if (cl->texture.is_valid()) {
+ storage->texture_add_to_decal_atlas(cl->texture);
+ }
}
-void RasterizerCanvasRD::light_set_use_shadow(RID p_rid, bool p_enable, int p_resolution) {
+void RasterizerCanvasRD::light_set_use_shadow(RID p_rid, bool p_enable) {
CanvasLight *cl = canvas_light_owner.getornull(p_rid);
ERR_FAIL_COND(!cl);
- ERR_FAIL_COND(p_resolution < 64);
- if (cl->shadow.texture.is_valid() == p_enable && p_resolution == cl->shadow.size) {
- return;
- }
- if (cl->shadow.texture.is_valid()) {
- RD::get_singleton()->free(cl->shadow.fb);
- RD::get_singleton()->free(cl->shadow.depth);
- RD::get_singleton()->free(cl->shadow.texture);
- cl->shadow.fb = RID();
- cl->shadow.texture = RID();
- cl->shadow.depth = RID();
- }
+ cl->shadow.enabled = p_enable;
+}
+
+void RasterizerCanvasRD::light_update_shadow(RID p_rid, int p_shadow_index, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders) {
+ CanvasLight *cl = canvas_light_owner.getornull(p_rid);
+ ERR_FAIL_COND(!cl->shadow.enabled);
+
+ if (state.shadow_fb == RID()) {
+ //ah, we lack the shadow texture..
+ RD::get_singleton()->free(state.shadow_texture); //erase placeholder
- if (p_enable) {
Vector<RID> fb_textures;
{ //texture
RD::TextureFormat tf;
tf.type = RD::TEXTURE_TYPE_2D;
- tf.width = p_resolution;
- tf.height = 1;
+ tf.width = state.shadow_texture_size;
+ tf.height = state.max_lights_per_render * 2;
tf.usage_bits = RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT;
tf.format = RD::DATA_FORMAT_R32_SFLOAT;
- cl->shadow.texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
- fb_textures.push_back(cl->shadow.texture);
+ state.shadow_texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
+ fb_textures.push_back(state.shadow_texture);
}
{
RD::TextureFormat tf;
tf.type = RD::TEXTURE_TYPE_2D;
- tf.width = p_resolution;
- tf.height = 1;
+ tf.width = state.shadow_texture_size;
+ tf.height = state.max_lights_per_render * 2;
tf.usage_bits = RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
- tf.format = RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_X8_D24_UNORM_PACK32, RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) ? RD::DATA_FORMAT_X8_D24_UNORM_PACK32 : RD::DATA_FORMAT_D32_SFLOAT;
+ tf.format = RD::DATA_FORMAT_D32_SFLOAT;
//chunks to write
- cl->shadow.depth = RD::get_singleton()->texture_create(tf, RD::TextureView());
- fb_textures.push_back(cl->shadow.depth);
+ state.shadow_depth_texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
+ fb_textures.push_back(state.shadow_depth_texture);
}
- cl->shadow.fb = RD::get_singleton()->framebuffer_create(fb_textures);
+ state.shadow_fb = RD::get_singleton()->framebuffer_create(fb_textures);
}
- cl->shadow.size = p_resolution;
-}
-
-void RasterizerCanvasRD::light_update_shadow(RID p_rid, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders) {
- CanvasLight *cl = canvas_light_owner.getornull(p_rid);
- ERR_FAIL_COND(cl->shadow.texture.is_null());
+ cl->shadow.z_far = p_far;
+ cl->shadow.y_offset = float(p_shadow_index * 2 + 1) / float(state.max_lights_per_render * 2);
+ Vector<Color> cc;
+ cc.push_back(Color(p_far, p_far, p_far, 1.0));
for (int i = 0; i < 4; i++) {
//make sure it remains orthogonal, makes easy to read angle later
//light.basis.scale(Vector3(to_light.elements[0].length(),to_light.elements[1].length(),1));
- Vector<Color> cc;
- cc.push_back(Color(p_far, p_far, p_far, 1.0));
- RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(cl->shadow.fb, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_DISCARD, cc, 1.0, 0, Rect2i((cl->shadow.size / 4) * i, 0, (cl->shadow.size / 4), 1));
+ Rect2i rect((state.shadow_texture_size / 4) * i, p_shadow_index * 2, (state.shadow_texture_size / 4), 2);
+ RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(state.shadow_fb, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_DISCARD, cc, 1.0, 0, rect);
CameraMatrix projection;
{
@@ -1635,8 +1465,8 @@ void RasterizerCanvasRD::light_update_shadow(RID p_rid, const Transform2D &p_lig
static const Vector2 directions[4] = { Vector2(1, 0), Vector2(0, 1), Vector2(-1, 0), Vector2(0, -1) };
push_constant.direction[0] = directions[i].x;
push_constant.direction[1] = directions[i].y;
- push_constant.pad[0] = 0;
- push_constant.pad[1] = 0;
+ push_constant.z_far = p_far;
+ push_constant.pad = 0;
/*if (i == 0)
*p_xform_cache = projection;*/
@@ -1774,7 +1604,6 @@ void RasterizerCanvasRD::ShaderData::set_code(const String &p_code) {
ubo_size = 0;
uniforms.clear();
uses_screen_texture = false;
- uses_material_samplers = false;
if (code == String()) {
return; //just invalid, but no error
@@ -1812,10 +1641,6 @@ void RasterizerCanvasRD::ShaderData::set_code(const String &p_code) {
version = canvas_singleton->shader.canvas_shader.version_create();
}
- if (gen_code.texture_uniforms.size() || uses_screen_texture) { //requires the samplers
- gen_code.defines.push_back("\n#define USE_MATERIAL_SAMPLERS\n");
- uses_material_samplers = true;
- }
#if 0
print_line("**compiling shader:");
print_line("**defines:\n");
@@ -2022,7 +1847,6 @@ Variant RasterizerCanvasRD::ShaderData::get_default_parameter(const StringName &
RasterizerCanvasRD::ShaderData::ShaderData() {
valid = false;
uses_screen_texture = false;
- uses_material_samplers = false;
}
RasterizerCanvasRD::ShaderData::~ShaderData() {
@@ -2085,7 +1909,7 @@ void RasterizerCanvasRD::MaterialData::update_parameters(const Map<StringName, V
update_textures(p_parameters, shader_data->default_texture_params, shader_data->texture_uniforms, texture_cache.ptrw(), false);
}
- if (shader_data->ubo_size == 0 && !shader_data->uses_material_samplers) {
+ if (shader_data->ubo_size == 0) {
// This material does not require an uniform set, so don't create it.
return;
}
@@ -2098,32 +1922,10 @@ void RasterizerCanvasRD::MaterialData::update_parameters(const Map<StringName, V
Vector<RD::Uniform> uniforms;
{
- if (shader_data->uses_material_samplers) {
- //needs samplers for the material (uses custom textures) create them
- RD::Uniform u;
- u.type = RD::UNIFORM_TYPE_SAMPLER;
- u.binding = 0;
- u.ids.resize(12);
- RID *ids_ptr = u.ids.ptrw();
- ids_ptr[0] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[1] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[2] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[3] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[4] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[5] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[6] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[7] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[8] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[9] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[10] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[11] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- uniforms.push_back(u);
- }
-
if (shader_data->ubo_size) {
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_UNIFORM_BUFFER;
- u.binding = 1;
+ u.binding = 0;
u.ids.push_back(uniform_buffer);
uniforms.push_back(u);
}
@@ -2132,13 +1934,13 @@ void RasterizerCanvasRD::MaterialData::update_parameters(const Map<StringName, V
for (uint32_t i = 0; i < tex_uniform_count; i++) {
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_TEXTURE;
- u.binding = 2 + i;
+ u.binding = 1 + i;
u.ids.push_back(textures[i]);
uniforms.push_back(u);
}
}
- uniform_set = RD::get_singleton()->uniform_set_create(uniforms, canvas_singleton->shader.canvas_shader.version_get_shader(shader_data->version, 0), 1);
+ uniform_set = RD::get_singleton()->uniform_set_create(uniforms, canvas_singleton->shader.canvas_shader.version_get_shader(shader_data->version, 0), MATERIAL_UNIFORM_SET);
}
RasterizerCanvasRD::MaterialData::~MaterialData() {
@@ -2164,7 +1966,6 @@ void RasterizerCanvasRD::set_time(double p_time) {
}
void RasterizerCanvasRD::update() {
- _dispose_bindings();
}
RasterizerCanvasRD::RasterizerCanvasRD(RasterizerStorageRD *p_storage) {
@@ -2178,22 +1979,7 @@ RasterizerCanvasRD::RasterizerCanvasRD(RasterizerStorageRD *p_storage) {
{ //shader variants
- uint32_t textures_per_stage = RD::get_singleton()->limit_get(RD::LIMIT_MAX_TEXTURES_PER_SHADER_STAGE);
-
String global_defines;
- if (textures_per_stage <= 16) {
- //ARM pretty much, and very old Intel GPUs under Linux
- state.max_lights_per_item = 4; //sad
- global_defines += "#define MAX_LIGHT_TEXTURES 4\n";
- } else if (textures_per_stage <= 32) {
- //Apple (Metal)
- state.max_lights_per_item = 8; //sad
- global_defines += "#define MAX_LIGHT_TEXTURES 8\n";
- } else {
- //Anything else (16 lights per item)
- state.max_lights_per_item = DEFAULT_MAX_LIGHTS_PER_ITEM;
- global_defines += "#define MAX_LIGHT_TEXTURES " + itos(DEFAULT_MAX_LIGHTS_PER_ITEM) + "\n";
- }
uint32_t uniform_max_size = RD::get_singleton()->limit_get(RD::LIMIT_MAX_UNIFORM_BUFFER_SIZE);
if (uniform_max_size < 65536) {
@@ -2226,7 +2012,6 @@ RasterizerCanvasRD::RasterizerCanvasRD(RasterizerStorageRD *p_storage) {
shader.default_version = shader.canvas_shader.version_create();
shader.default_version_rd_shader = shader.canvas_shader.version_get_shader(shader.default_version, SHADER_VARIANT_QUAD);
- shader.default_version_rd_shader_light = shader.canvas_shader.version_get_shader(shader.default_version, SHADER_VARIANT_QUAD_LIGHT);
for (int i = 0; i < PIPELINE_LIGHT_MODE_MAX; i++) {
for (int j = 0; j < PIPELINE_VARIANT_MAX; j++) {
@@ -2327,8 +2112,8 @@ RasterizerCanvasRD::RasterizerCanvasRD(RasterizerStorageRD *p_storage) {
actions.custom_samplers["SPECULAR_SHININESS_TEXTURE"] = "texture_sampler";
actions.custom_samplers["SCREEN_TEXTURE"] = "material_samplers[3]"; //mipmap and filter for screen texture
actions.sampler_array_name = "material_samplers";
- actions.base_texture_binding_index = 2;
- actions.texture_layout_set = 1;
+ actions.base_texture_binding_index = 1;
+ actions.texture_layout_set = MATERIAL_UNIFORM_SET;
actions.base_uniform_string = "material.";
actions.default_filter = ShaderLanguage::FILTER_LINEAR;
actions.default_repeat = ShaderLanguage::REPEAT_DISABLE;
@@ -2354,7 +2139,7 @@ RasterizerCanvasRD::RasterizerCanvasRD(RasterizerStorageRD *p_storage) {
attachments.push_back(af_color);
RD::AttachmentFormat af_depth;
- af_depth.format = RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_D32_SFLOAT, RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) ? RD::DATA_FORMAT_D32_SFLOAT : RD::DATA_FORMAT_X8_D24_UNORM_PACK32;
+ af_depth.format = RD::DATA_FORMAT_D32_SFLOAT;
af_depth.usage_flags = RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
attachments.push_back(af_depth);
@@ -2386,21 +2171,17 @@ RasterizerCanvasRD::RasterizerCanvasRD(RasterizerStorageRD *p_storage) {
}
{ //bindings
- bindings.id_generator = 0;
- //generate for 0
- bindings.default_empty = request_texture_binding(RID(), RID(), RID(), RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, RID());
-
- { //state allocate
- state.canvas_state_buffer = RD::get_singleton()->uniform_buffer_create(sizeof(State::Buffer));
- state.lights_uniform_buffer = RD::get_singleton()->uniform_buffer_create(sizeof(LightUniform) * state.max_lights_per_render);
-
- RD::SamplerState shadow_sampler_state;
- shadow_sampler_state.mag_filter = RD::SAMPLER_FILTER_LINEAR;
- shadow_sampler_state.min_filter = RD::SAMPLER_FILTER_LINEAR;
- shadow_sampler_state.repeat_u = RD::SAMPLER_REPEAT_MODE_REPEAT; //shadow wrap around
- shadow_sampler_state.compare_op = RD::COMPARE_OP_GREATER;
- state.shadow_sampler = RD::get_singleton()->sampler_create(shadow_sampler_state);
- }
+
+ state.canvas_state_buffer = RD::get_singleton()->uniform_buffer_create(sizeof(State::Buffer));
+ state.lights_uniform_buffer = RD::get_singleton()->uniform_buffer_create(sizeof(LightUniform) * state.max_lights_per_render);
+
+ RD::SamplerState shadow_sampler_state;
+ shadow_sampler_state.mag_filter = RD::SAMPLER_FILTER_LINEAR;
+ shadow_sampler_state.min_filter = RD::SAMPLER_FILTER_LINEAR;
+ shadow_sampler_state.repeat_u = RD::SAMPLER_REPEAT_MODE_REPEAT; //shadow wrap around
+ shadow_sampler_state.compare_op = RD::COMPARE_OP_GREATER;
+ shadow_sampler_state.enable_compare = true;
+ state.shadow_sampler = RD::get_singleton()->sampler_create(shadow_sampler_state);
}
{
@@ -2443,6 +2224,35 @@ RasterizerCanvasRD::RasterizerCanvasRD(RasterizerStorageRD *p_storage) {
shader.default_skeleton_texture_buffer = RD::get_singleton()->texture_buffer_create(32, RD::DATA_FORMAT_R32G32B32A32_SFLOAT);
}
+ {
+ //default shadow texture to keep uniform set happy
+ RD::TextureFormat tf;
+ tf.type = RD::TEXTURE_TYPE_2D;
+ tf.width = 4;
+ tf.height = 4;
+ tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT;
+ tf.format = RD::DATA_FORMAT_R32_SFLOAT;
+
+ state.shadow_texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
+ }
+
+ {
+ Vector<RD::Uniform> uniforms;
+
+ {
+ RD::Uniform u;
+ u.type = RD::UNIFORM_TYPE_STORAGE_BUFFER;
+ u.binding = 0;
+ u.ids.push_back(storage->get_default_rd_storage_buffer());
+ uniforms.push_back(u);
+ }
+
+ state.default_transforms_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, shader.default_version_rd_shader, TRANSFORMS_UNIFORM_SET);
+ }
+
+ default_canvas_texture = storage->canvas_texture_create();
+
+ state.shadow_texture_size = GLOBAL_GET("rendering/quality/2d_shadow_atlas/size");
//create functions for shader and material
storage->shader_set_data_request_function(RasterizerStorageRD::SHADER_TYPE_2D, _create_shader_funcs);
@@ -2457,7 +2267,7 @@ bool RasterizerCanvasRD::free(RID p_rid) {
if (canvas_light_owner.owns(p_rid)) {
CanvasLight *cl = canvas_light_owner.getornull(p_rid);
ERR_FAIL_COND_V(!cl, false);
- light_set_use_shadow(p_rid, false, 64);
+ light_set_use_shadow(p_rid, false);
canvas_light_owner.free(p_rid);
} else if (occluder_polygon_owner.owns(p_rid)) {
occluder_polygon_set_shape_as_lines(p_rid, Vector<Vector2>());
@@ -2469,6 +2279,31 @@ bool RasterizerCanvasRD::free(RID p_rid) {
return true;
}
+void RasterizerCanvasRD::set_shadow_texture_size(int p_size) {
+ p_size = nearest_power_of_2_templated(p_size);
+ if (p_size == state.shadow_texture_size) {
+ return;
+ }
+ state.shadow_texture_size = p_size;
+ if (state.shadow_fb.is_valid()) {
+ RD::get_singleton()->free(state.shadow_texture);
+ RD::get_singleton()->free(state.shadow_depth_texture);
+ state.shadow_fb = RID();
+
+ {
+ //create a default shadow texture to keep uniform set happy (and that it gets erased when a new one is created)
+ RD::TextureFormat tf;
+ tf.type = RD::TEXTURE_TYPE_2D;
+ tf.width = 4;
+ tf.height = 4;
+ tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT;
+ tf.format = RD::DATA_FORMAT_R32_SFLOAT;
+
+ state.shadow_texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
+ }
+ }
+}
+
RasterizerCanvasRD::~RasterizerCanvasRD() {
//canvas state
@@ -2490,24 +2325,6 @@ RasterizerCanvasRD::~RasterizerCanvasRD() {
RD::get_singleton()->free(state.shadow_sampler);
}
//bindings
- {
- free_texture_binding(bindings.default_empty);
-
- //dispose pending
- _dispose_bindings();
- //anything remains?
- if (bindings.texture_bindings.size()) {
- ERR_PRINT("Some texture bindings were not properly freed (leaked CanvasItems?)");
- const TextureBindingID *key = nullptr;
- while ((key = bindings.texture_bindings.next(key))) {
- TextureBinding *tb = bindings.texture_bindings[*key];
- tb->reference_count = 1;
- free_texture_binding(*key);
- }
- //dispose pending
- _dispose_bindings();
- }
- }
//shaders
@@ -2520,5 +2337,13 @@ RasterizerCanvasRD::~RasterizerCanvasRD() {
//primitives are erase by dependency
}
+ if (state.shadow_fb.is_valid()) {
+ RD::get_singleton()->free(state.shadow_depth_texture);
+ }
+ RD::get_singleton()->free(state.shadow_texture);
+
+ storage->free(default_canvas_texture);
//pipelines don't need freeing, they are all gone after shaders are gone
+
+ RD::get_singleton()->free(state.default_transforms_uniform_set);
}
diff --git a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h
index bfe4e61f47..5791efa4e5 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h
@@ -42,6 +42,13 @@
class RasterizerCanvasRD : public RasterizerCanvas {
RasterizerStorageRD *storage;
+ enum {
+ BASE_UNIFORM_SET = 0,
+ MATERIAL_UNIFORM_SET = 1,
+ TRANSFORMS_UNIFORM_SET = 2,
+ CANVAS_TEXTURE_UNIFORM_SET = 3,
+ };
+
enum ShaderVariant {
SHADER_VARIANT_QUAD,
SHADER_VARIANT_NINEPATCH,
@@ -100,7 +107,7 @@ class RasterizerCanvasRD : public RasterizerCanvas {
enum {
MAX_RENDER_ITEMS = 256 * 1024,
MAX_LIGHT_TEXTURES = 1024,
- DEFAULT_MAX_LIGHTS_PER_ITEM = 16,
+ MAX_LIGHTS_PER_ITEM = 16,
DEFAULT_MAX_LIGHTS_PER_RENDER = 256
};
@@ -135,7 +142,6 @@ class RasterizerCanvasRD : public RasterizerCanvas {
CanvasShaderRD canvas_shader;
RID default_version;
RID default_version_rd_shader;
- RID default_version_rd_shader_light;
RID quad_index_buffer;
RID quad_index_array;
PipelineVariants pipeline_variants;
@@ -178,7 +184,6 @@ class RasterizerCanvasRD : public RasterizerCanvas {
Map<StringName, RID> default_texture_params;
bool uses_screen_texture;
- bool uses_material_samplers;
virtual void set_code(const String &p_Code);
virtual void set_default_texture_param(const StringName &p_name, RID p_texture);
@@ -218,60 +223,9 @@ class RasterizerCanvasRD : public RasterizerCanvas {
}
/**************************/
- /**** TEXTURE BINDINGS ****/
+ /**** CANVAS TEXTURES *****/
/**************************/
- // bindings used to render commands,
- // cached for performance.
-
- struct TextureBindingKey {
- RID texture;
- RID normalmap;
- RID specular;
- RID multimesh;
- RS::CanvasItemTextureFilter texture_filter;
- RS::CanvasItemTextureRepeat texture_repeat;
- bool operator==(const TextureBindingKey &p_key) const {
- return texture == p_key.texture && normalmap == p_key.normalmap && specular == p_key.specular && multimesh == p_key.specular && texture_filter == p_key.texture_filter && texture_repeat == p_key.texture_repeat;
- }
- };
-
- struct TextureBindingKeyHasher {
- static _FORCE_INLINE_ uint32_t hash(const TextureBindingKey &p_key) {
- uint32_t hash = hash_djb2_one_64(p_key.texture.get_id());
- hash = hash_djb2_one_64(p_key.normalmap.get_id(), hash);
- hash = hash_djb2_one_64(p_key.specular.get_id(), hash);
- hash = hash_djb2_one_64(p_key.multimesh.get_id(), hash);
- hash = hash_djb2_one_32(uint32_t(p_key.texture_filter) << 16 | uint32_t(p_key.texture_repeat), hash);
- return hash;
- }
- };
-
- struct TextureBinding {
- TextureBindingID id;
- TextureBindingKey key;
- SelfList<TextureBinding> to_dispose;
- uint32_t reference_count;
- RID uniform_set;
- TextureBinding() :
- to_dispose(this) {
- reference_count = 0;
- }
- };
-
- struct {
- SelfList<TextureBinding>::List to_dispose_list;
-
- TextureBindingID id_generator;
- HashMap<TextureBindingKey, TextureBindingID, TextureBindingKeyHasher> texture_key_bindings;
- HashMap<TextureBindingID, TextureBinding *> texture_bindings;
-
- TextureBindingID default_empty;
- } bindings;
-
- RID _create_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat, RID p_multimesh);
- void _dispose_bindings();
-
struct {
RS::CanvasItemTextureFilter default_filter;
RS::CanvasItemTextureRepeat default_repeat;
@@ -313,10 +267,9 @@ class RasterizerCanvasRD : public RasterizerCanvas {
struct CanvasLight {
RID texture;
struct {
- int size;
- RID texture;
- RID depth;
- RID fb;
+ bool enabled = false;
+ float z_far;
+ float y_offset;
} shadow;
};
@@ -326,7 +279,8 @@ class RasterizerCanvasRD : public RasterizerCanvas {
float projection[16];
float modelview[8];
float direction[2];
- float pad[2];
+ float z_far;
+ float pad;
};
struct OccluderPolygon {
@@ -342,12 +296,17 @@ class RasterizerCanvasRD : public RasterizerCanvas {
float matrix[8]; //light to texture coordinate matrix
float shadow_matrix[8]; //light to shadow coordinate matrix
float color[4];
- float shadow_color[4];
- float position[2];
+
+ uint8_t shadow_color[4];
uint32_t flags; //index to light texture
- float height;
float shadow_pixel_size;
- float pad[3];
+ float height;
+
+ float position[2];
+ float shadow_z_far_inv;
+ float shadow_y_ofs;
+
+ float atlas_rect[4];
};
RID_Owner<OccluderPolygon> occluder_polygon_owner;
@@ -366,34 +325,6 @@ class RasterizerCanvasRD : public RasterizerCanvas {
//state that does not vary across rendering all items
- struct ItemStateData : public Item::CustomData {
- struct LightCache {
- uint64_t light_version;
- Light *light;
- };
-
- LightCache light_cache[DEFAULT_MAX_LIGHTS_PER_ITEM];
- uint32_t light_cache_count;
- RID state_uniform_set_with_light;
- RID state_uniform_set;
- ItemStateData() {
- for (int i = 0; i < DEFAULT_MAX_LIGHTS_PER_ITEM; i++) {
- light_cache[i].light_version = 0;
- light_cache[i].light = nullptr;
- }
- light_cache_count = 0xFFFFFFFF;
- }
-
- ~ItemStateData() {
- if (state_uniform_set_with_light.is_valid() && RD::get_singleton()->uniform_set_is_valid(state_uniform_set_with_light)) {
- RD::get_singleton()->free(state_uniform_set_with_light);
- }
- if (state_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(state_uniform_set)) {
- RD::get_singleton()->free(state_uniform_set);
- }
- }
- };
-
struct State {
//state buffer
struct Buffer {
@@ -414,6 +345,12 @@ class RasterizerCanvasRD : public RasterizerCanvas {
RID lights_uniform_buffer;
RID canvas_state_buffer;
RID shadow_sampler;
+ RID shadow_texture;
+ RID shadow_depth_texture;
+ RID shadow_fb;
+ int shadow_texture_size = 2048;
+
+ RID default_transforms_uniform_set;
uint32_t max_lights_per_render;
uint32_t max_lights_per_item;
@@ -452,9 +389,16 @@ class RasterizerCanvasRD : public RasterizerCanvas {
Item *items[MAX_RENDER_ITEMS];
- Size2i _bind_texture_binding(TextureBindingID p_binding, RenderingDevice::DrawListID p_draw_list, uint32_t &flags);
+ RID default_canvas_texture;
+
+ RS::CanvasItemTextureFilter default_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
+ RS::CanvasItemTextureRepeat default_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
+
+ RID _create_base_uniform_set(RID p_to_render_target, bool p_backbuffer);
+
+ inline void _bind_canvas_texture(RD::DrawListID p_draw_list, RID p_texture, RS::CanvasItemTextureFilter p_base_filter, RS::CanvasItemTextureRepeat p_base_repeat, RID &r_last_texture, PushConstant &push_constant, Size2 &r_texpixel_size); //recursive, so regular inline used instead.
void _render_item(RenderingDevice::DrawListID p_draw_list, const Item *p_item, RenderingDevice::FramebufferFormatID p_framebuffer_format, const Transform2D &p_canvas_transform_inverse, Item *&current_clip, Light *p_lights, PipelineVariants *p_pipeline_variants);
- void _render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights, RID p_screen_uniform_set);
+ void _render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights);
_FORCE_INLINE_ void _update_transform_2d_to_mat2x4(const Transform2D &p_transform, float *p_mat2x4);
_FORCE_INLINE_ void _update_transform_2d_to_mat2x3(const Transform2D &p_transform, float *p_mat2x3);
@@ -462,30 +406,27 @@ class RasterizerCanvasRD : public RasterizerCanvas {
_FORCE_INLINE_ void _update_transform_2d_to_mat4(const Transform2D &p_transform, float *p_mat4);
_FORCE_INLINE_ void _update_transform_to_mat4(const Transform &p_transform, float *p_mat4);
- _FORCE_INLINE_ void _update_specular_shininess(const Color &p_transform, uint32_t *r_ss);
-
public:
- TextureBindingID request_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, RS::CanvasItemTextureFilter p_filter, RS::CanvasItemTextureRepeat p_repeat, RID p_multimesh);
- void free_texture_binding(TextureBindingID p_binding);
-
PolygonID request_polygon(const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>());
void free_polygon(PolygonID p_polygon);
RID light_create();
void light_set_texture(RID p_rid, RID p_texture);
- void light_set_use_shadow(RID p_rid, bool p_enable, int p_resolution);
- void light_update_shadow(RID p_rid, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders);
+ void light_set_use_shadow(RID p_rid, bool p_enable);
+ void light_update_shadow(RID p_rid, int p_shadow_index, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders);
RID occluder_polygon_create();
void occluder_polygon_set_shape_as_lines(RID p_occluder, const Vector<Vector2> &p_lines);
void occluder_polygon_set_cull_mode(RID p_occluder, RS::CanvasOccluderPolygonCullMode p_mode);
- void canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, const Transform2D &p_canvas_transform);
+ void canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, const Transform2D &p_canvas_transform, RS::CanvasItemTextureFilter p_default_filter, RS::CanvasItemTextureRepeat p_default_repeat);
void canvas_debug_viewport_shadows(Light *p_lights_with_shadow) {}
void draw_window_margins(int *p_margins, RID *p_margin_textures) {}
+ virtual void set_shadow_texture_size(int p_size);
+
void set_time(double p_time);
void update();
bool free(RID p_rid);
diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
index f708b6ce00..0cae141138 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
@@ -8334,8 +8334,8 @@ RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) {
{
RD::SamplerState sampler;
- sampler.mag_filter = RD::SAMPLER_FILTER_LINEAR;
- sampler.min_filter = RD::SAMPLER_FILTER_LINEAR;
+ sampler.mag_filter = RD::SAMPLER_FILTER_NEAREST;
+ sampler.min_filter = RD::SAMPLER_FILTER_NEAREST;
sampler.enable_compare = true;
sampler.compare_op = RD::COMPARE_OP_LESS;
shadow_sampler = RD::get_singleton()->sampler_create(sampler);
diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
index e723028e56..b47d724147 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
@@ -1118,6 +1118,11 @@ void RasterizerStorageRD::texture_replace(RID p_texture, RID p_by_texture) {
}
RD::get_singleton()->free(tex->rd_texture);
+ if (tex->canvas_texture) {
+ memdelete(tex->canvas_texture);
+ tex->canvas_texture = nullptr;
+ }
+
Vector<RID> proxies_to_update = tex->proxies;
Vector<RID> proxies_to_redirect = by_tex->proxies;
@@ -1125,6 +1130,10 @@ void RasterizerStorageRD::texture_replace(RID p_texture, RID p_by_texture) {
tex->proxies = proxies_to_update; //restore proxies, so they can be updated
+ if (tex->canvas_texture) {
+ tex->canvas_texture->diffuse = p_texture; //update
+ }
+
for (int i = 0; i < proxies_to_update.size(); i++) {
texture_proxy_update(proxies_to_update[i], p_texture);
}
@@ -1193,6 +1202,167 @@ Size2 RasterizerStorageRD::texture_size_with_proxy(RID p_proxy) {
return texture_2d_get_size(p_proxy);
}
+/* CANVAS TEXTURE */
+
+void RasterizerStorageRD::CanvasTexture::clear_sets() {
+ if (cleared_cache) {
+ return;
+ }
+ for (int i = 1; i < RS::CANVAS_ITEM_TEXTURE_FILTER_MAX; i++) {
+ for (int j = 1; j < RS::CANVAS_ITEM_TEXTURE_REPEAT_MAX; j++) {
+ if (RD::get_singleton()->uniform_set_is_valid(uniform_sets[i][j])) {
+ RD::get_singleton()->free(uniform_sets[i][j]);
+ uniform_sets[i][j] = RID();
+ }
+ }
+ }
+ cleared_cache = true;
+}
+
+RasterizerStorageRD::CanvasTexture::~CanvasTexture() {
+ clear_sets();
+}
+
+RID RasterizerStorageRD::canvas_texture_create() {
+ return canvas_texture_owner.make_rid(memnew(CanvasTexture));
+}
+
+void RasterizerStorageRD::canvas_texture_set_channel(RID p_canvas_texture, RS::CanvasTextureChannel p_channel, RID p_texture) {
+ CanvasTexture *ct = canvas_texture_owner.getornull(p_canvas_texture);
+ switch (p_channel) {
+ case RS::CANVAS_TEXTURE_CHANNEL_DIFFUSE: {
+ ct->diffuse = p_texture;
+ } break;
+ case RS::CANVAS_TEXTURE_CHANNEL_NORMAL: {
+ ct->normalmap = p_texture;
+ } break;
+ case RS::CANVAS_TEXTURE_CHANNEL_SPECULAR: {
+ ct->specular = p_texture;
+ } break;
+ }
+
+ ct->clear_sets();
+}
+
+void RasterizerStorageRD::canvas_texture_set_shading_parameters(RID p_canvas_texture, const Color &p_specular_color, float p_shininess) {
+ CanvasTexture *ct = canvas_texture_owner.getornull(p_canvas_texture);
+ ct->specular_color.r = p_specular_color.r;
+ ct->specular_color.g = p_specular_color.g;
+ ct->specular_color.b = p_specular_color.b;
+ ct->specular_color.a = p_shininess;
+ ct->clear_sets();
+}
+
+void RasterizerStorageRD::canvas_texture_set_texture_filter(RID p_canvas_texture, RS::CanvasItemTextureFilter p_filter) {
+ CanvasTexture *ct = canvas_texture_owner.getornull(p_canvas_texture);
+ ct->texture_filter = p_filter;
+ ct->clear_sets();
+}
+
+void RasterizerStorageRD::canvas_texture_set_texture_repeat(RID p_canvas_texture, RS::CanvasItemTextureRepeat p_repeat) {
+ CanvasTexture *ct = canvas_texture_owner.getornull(p_canvas_texture);
+ ct->texture_repeat = p_repeat;
+ ct->clear_sets();
+}
+
+bool RasterizerStorageRD::canvas_texture_get_unifom_set(RID p_texture, RS::CanvasItemTextureFilter p_base_filter, RS::CanvasItemTextureRepeat p_base_repeat, RID p_base_shader, int p_base_set, RID &r_uniform_set, Size2i &r_size, Color &r_specular_shininess, bool &r_use_normal, bool &r_use_specular) {
+ CanvasTexture *ct = nullptr;
+
+ Texture *t = texture_owner.getornull(p_texture);
+
+ if (t) {
+ //regular texture
+ if (!t->canvas_texture) {
+ t->canvas_texture = memnew(CanvasTexture);
+ t->canvas_texture->diffuse = p_texture;
+ }
+
+ ct = t->canvas_texture;
+ } else {
+ ct = canvas_texture_owner.getornull(p_texture);
+ }
+
+ if (!ct) {
+ return false; //invalid texture RID
+ }
+
+ RS::CanvasItemTextureFilter filter = ct->texture_filter != RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT ? ct->texture_filter : p_base_filter;
+ ERR_FAIL_COND_V(filter == RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, false);
+
+ RS::CanvasItemTextureRepeat repeat = ct->texture_repeat != RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT ? ct->texture_repeat : p_base_repeat;
+ ERR_FAIL_COND_V(repeat == RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, false);
+
+ RID uniform_set = ct->uniform_sets[filter][repeat];
+ if (!RD::get_singleton()->uniform_set_is_valid(uniform_set)) {
+ //create and update
+ Vector<RD::Uniform> uniforms;
+ { //diffuse
+ RD::Uniform u;
+ u.type = RD::UNIFORM_TYPE_TEXTURE;
+ u.binding = 0;
+
+ t = texture_owner.getornull(ct->diffuse);
+ if (!t) {
+ u.ids.push_back(texture_rd_get_default(DEFAULT_RD_TEXTURE_WHITE));
+ ct->size_cache = Size2i(1, 1);
+ } else {
+ u.ids.push_back(t->rd_texture);
+ ct->size_cache = Size2i(t->width_2d, t->height_2d);
+ }
+ uniforms.push_back(u);
+ }
+ { //normal
+ RD::Uniform u;
+ u.type = RD::UNIFORM_TYPE_TEXTURE;
+ u.binding = 1;
+
+ t = texture_owner.getornull(ct->normalmap);
+ if (!t) {
+ u.ids.push_back(texture_rd_get_default(DEFAULT_RD_TEXTURE_NORMAL));
+ ct->use_normal_cache = false;
+ } else {
+ u.ids.push_back(t->rd_texture);
+ ct->use_normal_cache = true;
+ }
+ uniforms.push_back(u);
+ }
+ { //specular
+ RD::Uniform u;
+ u.type = RD::UNIFORM_TYPE_TEXTURE;
+ u.binding = 2;
+
+ t = texture_owner.getornull(ct->specular);
+ if (!t) {
+ u.ids.push_back(texture_rd_get_default(DEFAULT_RD_TEXTURE_WHITE));
+ ct->use_specular_cache = false;
+ } else {
+ u.ids.push_back(t->rd_texture);
+ ct->use_specular_cache = true;
+ }
+ uniforms.push_back(u);
+ }
+ { //sampler
+ RD::Uniform u;
+ u.type = RD::UNIFORM_TYPE_SAMPLER;
+ u.binding = 3;
+ u.ids.push_back(sampler_rd_get_default(filter, repeat));
+ uniforms.push_back(u);
+ }
+
+ uniform_set = RD::get_singleton()->uniform_set_create(uniforms, p_base_shader, p_base_set);
+ ct->uniform_sets[filter][repeat] = uniform_set;
+ ct->cleared_cache = false;
+ }
+
+ r_uniform_set = uniform_set;
+ r_size = ct->size_cache;
+ r_specular_shininess = ct->specular_color;
+ r_use_normal = ct->use_normal_cache;
+ r_use_specular = ct->use_specular_cache;
+
+ return true;
+}
+
/* SHADER API */
RID RasterizerStorageRD::shader_create() {
@@ -5842,6 +6012,7 @@ void RasterizerStorageRD::_clear_render_target(RenderTarget *rt) {
//free in reverse dependency order
if (rt->framebuffer.is_valid()) {
RD::get_singleton()->free(rt->framebuffer);
+ rt->framebuffer_uniform_set = RID(); //chain deleted
}
if (rt->color.is_valid()) {
@@ -5856,10 +6027,7 @@ void RasterizerStorageRD::_clear_render_target(RenderTarget *rt) {
RD::get_singleton()->free(rt->backbuffer_mipmaps[i].mipmap_copy);
}
rt->backbuffer_mipmaps.clear();
- if (rt->backbuffer_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(rt->backbuffer_uniform_set)) {
- RD::get_singleton()->free(rt->backbuffer_uniform_set);
- }
- rt->backbuffer_uniform_set = RID();
+ rt->backbuffer_uniform_set = RID(); //chain deleted
}
rt->framebuffer = RID();
@@ -5969,6 +6137,11 @@ void RasterizerStorageRD::_create_render_target_backbuffer(RenderTarget *rt) {
rt->backbuffer = RD::get_singleton()->texture_create(tf, RD::TextureView());
rt->backbuffer_mipmap0 = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), rt->backbuffer, 0, 0);
+ if (rt->framebuffer_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(rt->framebuffer_uniform_set)) {
+ //the new one will require the backbuffer.
+ RD::get_singleton()->free(rt->framebuffer_uniform_set);
+ rt->framebuffer_uniform_set = RID();
+ }
//create mipmaps
for (uint32_t i = 1; i < mipmaps_required; i++) {
RenderTarget::BackbufferMipmap mm;
@@ -6066,6 +6239,12 @@ RID RasterizerStorageRD::render_target_get_rd_texture(RID p_render_target) {
return rt->color;
}
+RID RasterizerStorageRD::render_target_get_rd_backbuffer(RID p_render_target) {
+ RenderTarget *rt = render_target_owner.getornull(p_render_target);
+ ERR_FAIL_COND_V(!rt, RID());
+ return rt->backbuffer;
+}
+
void RasterizerStorageRD::render_target_request_clear(RID p_render_target, const Color &p_clear_color) {
RenderTarget *rt = render_target_owner.getornull(p_render_target);
ERR_FAIL_COND(!rt);
@@ -6135,32 +6314,28 @@ void RasterizerStorageRD::render_target_copy_to_back_buffer(RID p_render_target,
}
}
-RID RasterizerStorageRD::render_target_get_back_buffer_uniform_set(RID p_render_target, RID p_base_shader) {
+RID RasterizerStorageRD::render_target_get_framebuffer_uniform_set(RID p_render_target) {
+ RenderTarget *rt = render_target_owner.getornull(p_render_target);
+ ERR_FAIL_COND_V(!rt, RID());
+ return rt->framebuffer_uniform_set;
+}
+RID RasterizerStorageRD::render_target_get_backbuffer_uniform_set(RID p_render_target) {
RenderTarget *rt = render_target_owner.getornull(p_render_target);
ERR_FAIL_COND_V(!rt, RID());
-
- if (!rt->backbuffer.is_valid()) {
- _create_render_target_backbuffer(rt);
- }
-
- if (rt->backbuffer_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(rt->backbuffer_uniform_set)) {
- return rt->backbuffer_uniform_set; //if still valid, return/reuse it.
- }
-
- //create otherwise
- Vector<RD::Uniform> uniforms;
- RD::Uniform u;
- u.type = RD::UNIFORM_TYPE_TEXTURE;
- u.binding = 0;
- u.ids.push_back(rt->backbuffer);
- uniforms.push_back(u);
-
- rt->backbuffer_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, p_base_shader, 3);
- ERR_FAIL_COND_V(!rt->backbuffer_uniform_set.is_valid(), RID());
-
return rt->backbuffer_uniform_set;
}
+void RasterizerStorageRD::render_target_set_framebuffer_uniform_set(RID p_render_target, RID p_uniform_set) {
+ RenderTarget *rt = render_target_owner.getornull(p_render_target);
+ ERR_FAIL_COND(!rt);
+ rt->framebuffer_uniform_set = p_uniform_set;
+}
+void RasterizerStorageRD::render_target_set_backbuffer_uniform_set(RID p_render_target, RID p_uniform_set) {
+ RenderTarget *rt = render_target_owner.getornull(p_render_target);
+ ERR_FAIL_COND(!rt);
+ rt->backbuffer_uniform_set = p_uniform_set;
+}
+
void RasterizerStorageRD::base_update_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {
if (mesh_owner.owns(p_base)) {
Mesh *mesh = mesh_owner.getornull(p_base);
@@ -7192,8 +7367,16 @@ bool RasterizerStorageRD::free(RID p_rid) {
p->rd_texture = RID();
p->rd_texture_srgb = RID();
}
+
+ if (t->canvas_texture) {
+ memdelete(t->canvas_texture);
+ }
texture_owner.free(p_rid);
+ } else if (canvas_texture_owner.owns(p_rid)) {
+ CanvasTexture *ct = canvas_texture_owner.getornull(p_rid);
+ memdelete(ct);
+ canvas_texture_owner.free(p_rid);
} else if (shader_owner.owns(p_rid)) {
Shader *shader = shader_owner.getornull(p_rid);
//make material unreference this
diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
index b03a26e200..7caafca2e0 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
@@ -174,6 +174,29 @@ public:
};
private:
+ /* CANVAS TEXTURE API (2D) */
+
+ struct CanvasTexture {
+ RID diffuse;
+ RID normalmap;
+ RID specular;
+ Color specular_color = Color(1, 1, 1, 1);
+ float shininess = 1.0;
+
+ RS::CanvasItemTextureFilter texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT;
+ RS::CanvasItemTextureRepeat texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT;
+ RID uniform_sets[RS::CANVAS_ITEM_TEXTURE_FILTER_MAX][RS::CANVAS_ITEM_TEXTURE_REPEAT_MAX];
+
+ Size2i size_cache = Size2i(1, 1);
+ bool use_normal_cache = false;
+ bool use_specular_cache = false;
+ bool cleared_cache = true;
+ void clear_sets();
+ ~CanvasTexture();
+ };
+
+ RID_PtrOwner<CanvasTexture> canvas_texture_owner;
+
/* TEXTURE API */
struct Texture {
enum Type {
@@ -231,6 +254,8 @@ private:
RS::TextureDetectRoughnessCallback detect_roughness_callback = nullptr;
void *detect_roughness_callback_ud = nullptr;
+
+ CanvasTexture *canvas_texture = nullptr;
};
struct TextureToRDFormat {
@@ -972,6 +997,8 @@ private:
};
Vector<BackbufferMipmap> backbuffer_mipmaps;
+
+ RID framebuffer_uniform_set;
RID backbuffer_uniform_set;
//texture generated for this owner (nor RD).
@@ -1147,6 +1174,18 @@ public:
return default_rd_samplers[p_filter][p_repeat];
}
+ /* CANVAS TEXTURE API */
+
+ virtual RID canvas_texture_create();
+
+ virtual void canvas_texture_set_channel(RID p_canvas_texture, RS::CanvasTextureChannel p_channel, RID p_texture);
+ virtual void canvas_texture_set_shading_parameters(RID p_canvas_texture, const Color &p_specular_color, float p_shininess);
+
+ virtual void canvas_texture_set_texture_filter(RID p_canvas_texture, RS::CanvasItemTextureFilter p_filter);
+ virtual void canvas_texture_set_texture_repeat(RID p_canvas_texture, RS::CanvasItemTextureRepeat p_repeat);
+
+ bool canvas_texture_get_unifom_set(RID p_texture, RS::CanvasItemTextureFilter p_base_filter, RS::CanvasItemTextureRepeat p_base_repeat, RID p_base_shader, int p_base_set, RID &r_uniform_set, Size2i &r_size, Color &r_specular_shininess, bool &r_use_normal, bool &r_use_specular);
+
/* SHADER API */
RID shader_create();
@@ -1878,6 +1917,7 @@ public:
bool render_target_was_used(RID p_render_target);
void render_target_set_as_unused(RID p_render_target);
void render_target_copy_to_back_buffer(RID p_render_target, const Rect2i &p_region);
+
RID render_target_get_back_buffer_uniform_set(RID p_render_target, RID p_base_shader);
virtual void render_target_request_clear(RID p_render_target, const Color &p_clear_color);
@@ -1889,6 +1929,13 @@ public:
Size2 render_target_get_size(RID p_render_target);
RID render_target_get_rd_framebuffer(RID p_render_target);
RID render_target_get_rd_texture(RID p_render_target);
+ RID render_target_get_rd_backbuffer(RID p_render_target);
+
+ RID render_target_get_framebuffer_uniform_set(RID p_render_target);
+ RID render_target_get_backbuffer_uniform_set(RID p_render_target);
+
+ void render_target_set_framebuffer_uniform_set(RID p_render_target, RID p_uniform_set);
+ void render_target_set_backbuffer_uniform_set(RID p_render_target, RID p_uniform_set);
RS::InstanceType get_base_type(RID p_rid) const;
@@ -1916,6 +1963,8 @@ public:
virtual uint64_t get_captured_timestamp_cpu_time(uint32_t p_index) const;
virtual String get_captured_timestamp_name(uint32_t p_index) const;
+ RID get_default_rd_storage_buffer() { return default_rd_storage_buffer; }
+
static RasterizerStorageRD *base_singleton;
RasterizerEffectsRD *get_effects();
diff --git a/servers/rendering/rasterizer_rd/shaders/canvas.glsl b/servers/rendering/rasterizer_rd/shaders/canvas.glsl
index 4a40584e16..04a37e501f 100644
--- a/servers/rendering/rasterizer_rd/shaders/canvas.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/canvas.glsl
@@ -26,7 +26,7 @@ layout(location = 3) out vec2 pixel_size_interp;
#endif
#ifdef USE_MATERIAL_UNIFORMS
-layout(set = 1, binding = 1, std140) uniform MaterialUniforms{
+layout(set = 1, binding = 0, std140) uniform MaterialUniforms{
/* clang-format off */
MATERIAL_UNIFORMS
/* clang-format on */
@@ -226,7 +226,7 @@ layout(location = 3) in vec2 pixel_size_interp;
layout(location = 0) out vec4 frag_color;
#ifdef USE_MATERIAL_UNIFORMS
-layout(set = 1, binding = 1, std140) uniform MaterialUniforms{
+layout(set = 1, binding = 0, std140) uniform MaterialUniforms{
/* clang-format off */
MATERIAL_UNIFORMS
/* clang-format on */
@@ -408,7 +408,7 @@ FRAGMENT_SHADER_CODE
color *= canvas_data.canvas_modulation;
#ifdef USE_LIGHTING
- for (uint i = 0; i < MAX_LIGHT_TEXTURES; i++) {
+ for (uint i = 0; i < MAX_LIGHTS_PER_ITEM; i++) {
if (i >= light_count) {
break;
}
@@ -430,7 +430,8 @@ FRAGMENT_SHADER_CODE
light_base &= 0xFF;
vec2 tex_uv = (vec4(vertex, 0.0, 1.0) * mat4(light_array.data[light_base].texture_matrix[0], light_array.data[light_base].texture_matrix[1], vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0))).xy; //multiply inverse given its transposed. Optimizer removes useless operations.
- vec4 light_color = texture(sampler2D(light_textures[i], texture_sampler), tex_uv);
+ vec2 tex_uv_atlas = tex_uv * light_array.data[light_base].atlas_rect.zw + light_array.data[light_base].atlas_rect.xy;
+ vec4 light_color = textureLod(sampler2D(atlas_texture, texture_sampler), tex_uv_atlas, 0.0);
vec4 light_base_color = light_array.data[light_base].color;
#ifdef LIGHT_SHADER_CODE_USED
@@ -502,47 +503,53 @@ FRAGMENT_SHADER_CODE
}
}
+ distance *= light_array.data[light_base].shadow_zfar_inv;
+
//float distance = length(shadow_pos);
float shadow;
uint shadow_mode = light_array.data[light_base].flags & LIGHT_FLAGS_FILTER_MASK;
- vec4 shadow_uv = vec4(tex_ofs, 0.0, distance, 1.0);
+ vec4 shadow_uv = vec4(tex_ofs, light_array.data[light_base].shadow_y_ofs, distance, 1.0);
if (shadow_mode == LIGHT_FLAGS_SHADOW_NEAREST) {
- shadow = textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv).x;
+ shadow = textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv, 0.0).x;
} else if (shadow_mode == LIGHT_FLAGS_SHADOW_PCF5) {
vec4 shadow_pixel_size = vec4(light_array.data[light_base].shadow_pixel_size, 0.0, 0.0, 0.0);
shadow = 0.0;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv - shadow_pixel_size * 2.0).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv - shadow_pixel_size).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv + shadow_pixel_size).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv + shadow_pixel_size * 2.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv - shadow_pixel_size * 2.0, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv - shadow_pixel_size, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv + shadow_pixel_size, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv + shadow_pixel_size * 2.0, 0.0).x;
shadow /= 5.0;
} else { //PCF13
vec4 shadow_pixel_size = vec4(light_array.data[light_base].shadow_pixel_size, 0.0, 0.0, 0.0);
shadow = 0.0;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv - shadow_pixel_size * 6.0).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv - shadow_pixel_size * 5.0).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv - shadow_pixel_size * 4.0).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv - shadow_pixel_size * 3.0).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv - shadow_pixel_size * 2.0).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv - shadow_pixel_size).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv + shadow_pixel_size).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv + shadow_pixel_size * 2.0).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv + shadow_pixel_size * 3.0).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv + shadow_pixel_size * 4.0).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv + shadow_pixel_size * 5.0).x;
- shadow += textureProj(sampler2DShadow(shadow_textures[i], shadow_sampler), shadow_uv + shadow_pixel_size * 6.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv - shadow_pixel_size * 6.0, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv - shadow_pixel_size * 5.0, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv - shadow_pixel_size * 4.0, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv - shadow_pixel_size * 3.0, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv - shadow_pixel_size * 2.0, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv - shadow_pixel_size, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv + shadow_pixel_size, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv + shadow_pixel_size * 2.0, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv + shadow_pixel_size * 3.0, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv + shadow_pixel_size * 4.0, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv + shadow_pixel_size * 5.0, 0.0).x;
+ shadow += textureProjLod(sampler2DShadow(shadow_atlas_texture, shadow_sampler), shadow_uv + shadow_pixel_size * 6.0, 0.0).x;
shadow /= 13.0;
}
- vec4 shadow_color = light_array.data[light_base].shadow_color;
+ vec4 shadow_color = unpackUnorm4x8(light_array.data[light_base].shadow_color);
#ifdef LIGHT_SHADER_CODE_USED
shadow_color *= shadow_modulate;
#endif
+
+ shadow_color.a *= light_color.a; //respect light alpha
+
light_color = mix(light_color, shadow_color, shadow);
+ //light_color = mix(light_color, shadow_color, shadow);
}
uint blend_mode = light_array.data[light_base].flags & LIGHT_FLAGS_BLEND_MASK;
diff --git a/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl
index 99e70a1976..421282cd4d 100644
--- a/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl
@@ -8,7 +8,8 @@ layout(push_constant, binding = 0, std430) uniform Constants {
mat4 projection;
mat2x4 modelview;
vec2 direction;
- vec2 pad;
+ float z_far;
+ float pad;
}
constants;
@@ -25,9 +26,18 @@ void main() {
#version 450
+layout(push_constant, binding = 0, std430) uniform Constants {
+ mat4 projection;
+ mat2x4 modelview;
+ vec2 direction;
+ float z_far;
+ float pad;
+}
+constants;
+
layout(location = 0) in highp float depth;
layout(location = 0) out highp float distance_buf;
void main() {
- distance_buf = depth;
+ distance_buf = depth / constants.z_far;
}
diff --git a/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl b/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl
index a39866004b..e4dc326af6 100644
--- a/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl
@@ -1,3 +1,6 @@
+
+#define MAX_LIGHTS_PER_ITEM 16
+
#define M_PI 3.14159265359
#define FLAGS_INSTANCING_STRIDE_MASK 0xF
@@ -22,13 +25,7 @@
#define FLAGS_DEFAULT_NORMAL_MAP_USED (1 << 26)
#define FLAGS_DEFAULT_SPECULAR_MAP_USED (1 << 27)
-// In vulkan, sets should always be ordered using the following logic:
-// Lower Sets: Sets that change format and layout less often
-// Higher sets: Sets that change format and layout very often
-// This is because changing a set for another with a different layout or format,
-// invalidates all the upper ones.
-
-/* SET0: Draw Primitive */
+// Push Constant
layout(push_constant, binding = 0, std430) uniform DrawData {
vec2 world_x;
@@ -53,26 +50,17 @@ layout(push_constant, binding = 0, std430) uniform DrawData {
}
draw_data;
-// The values passed per draw primitives are cached within it
-
-layout(set = 0, binding = 1) uniform texture2D color_texture;
-layout(set = 0, binding = 2) uniform texture2D normal_texture;
-layout(set = 0, binding = 3) uniform texture2D specular_texture;
-layout(set = 0, binding = 4) uniform sampler texture_sampler;
-
-layout(set = 0, binding = 5) uniform textureBuffer instancing_buffer;
-
-/* SET1: Is reserved for the material */
-
-#ifdef USE_MATERIAL_SAMPLERS
-
-layout(set = 1, binding = 0) uniform sampler material_samplers[12];
+// In vulkan, sets should always be ordered using the following logic:
+// Lower Sets: Sets that change format and layout less often
+// Higher sets: Sets that change format and layout very often
+// This is because changing a set for another with a different layout or format,
+// invalidates all the upper ones (as likely internal base offset changes)
-#endif
+/* SET0: Globals */
-/* SET2: Canvas Item State (including lighting) */
+// The values passed per draw primitives are cached within it
-layout(set = 2, binding = 0, std140) uniform CanvasData {
+layout(set = 0, binding = 1, std140) uniform CanvasData {
mat4 canvas_transform;
mat4 screen_transform;
mat4 canvas_normal_transform;
@@ -84,16 +72,6 @@ layout(set = 2, binding = 0, std140) uniform CanvasData {
}
canvas_data;
-layout(set = 2, binding = 1) uniform textureBuffer skeleton_buffer;
-
-layout(set = 2, binding = 2, std140) uniform SkeletonData {
- mat4 skeleton_transform; //in world coordinates
- mat4 skeleton_transform_inverse;
-}
-skeleton_data;
-
-#ifdef USE_LIGHTING
-
#define LIGHT_FLAGS_BLEND_MASK (3 << 16)
#define LIGHT_FLAGS_BLEND_MODE_ADD (0 << 16)
#define LIGHT_FLAGS_BLEND_MODE_SUB (1 << 16)
@@ -110,37 +88,52 @@ struct Light {
mat2x4 texture_matrix; //light to texture coordinate matrix (transposed)
mat2x4 shadow_matrix; //light to shadow coordinate matrix (transposed)
vec4 color;
- vec4 shadow_color;
- vec2 position;
+
+ uint shadow_color; // packed
uint flags; //index to light texture
- float height;
float shadow_pixel_size;
- float pad0;
- float pad1;
- float pad2;
+ float height;
+
+ vec2 position;
+ float shadow_zfar_inv;
+ float shadow_y_ofs;
+
+ vec4 atlas_rect;
};
-layout(set = 2, binding = 3, std140) uniform LightData {
+layout(set = 0, binding = 2, std140) uniform LightData {
Light data[MAX_LIGHTS];
}
light_array;
-layout(set = 2, binding = 4) uniform texture2D light_textures[MAX_LIGHT_TEXTURES];
-layout(set = 2, binding = 5) uniform texture2D shadow_textures[MAX_LIGHT_TEXTURES];
+layout(set = 0, binding = 3) uniform texture2D atlas_texture;
+layout(set = 0, binding = 4) uniform texture2D shadow_atlas_texture;
-layout(set = 2, binding = 6) uniform sampler shadow_sampler;
+layout(set = 0, binding = 5) uniform sampler shadow_sampler;
-#endif
+layout(set = 0, binding = 6) uniform texture2D screen_texture;
+
+layout(set = 0, binding = 7) uniform sampler material_samplers[12];
-layout(set = 2, binding = 7, std430) restrict readonly buffer GlobalVariableData {
+layout(set = 0, binding = 8, std430) restrict readonly buffer GlobalVariableData {
vec4 data[];
}
global_variables;
-/* SET3: Render Target Data */
+/* SET1: Is reserved for the material */
-#ifdef SCREEN_TEXTURE_USED
+//
-layout(set = 3, binding = 0) uniform texture2D screen_texture;
+/* SET2: Instancing and Skeleton */
-#endif
+layout(set = 2, binding = 0, std430) restrict readonly buffer Transforms {
+ vec4 data[];
+}
+transforms;
+
+/* SET3: Texture */
+
+layout(set = 3, binding = 0) uniform texture2D color_texture;
+layout(set = 3, binding = 1) uniform texture2D normal_texture;
+layout(set = 3, binding = 2) uniform texture2D specular_texture;
+layout(set = 3, binding = 3) uniform sampler texture_sampler;
diff --git a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl
index 341cdab1ef..4cc4fd3f64 100644
--- a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl
@@ -293,9 +293,8 @@ vec3 do_fxaa(vec3 color, float exposure, vec2 uv_interp) {
dir * rcpDirMin)) *
params.pixel_size;
- vec3 rgbA = 0.5 * (textureLod(source_color, uv_interp + dir * (1.0 / 3.0 - 0.5), 0.0).xyz * exposure + textureLod(source_color, uv_interp + dir * (2.0 / 3.0 - 0.5), 0.0).xyz) * exposure;
- vec3 rgbB = rgbA * 0.5 + 0.25 * (textureLod(source_color, uv_interp + dir * -0.5, 0.0).xyz * exposure +
- textureLod(source_color, uv_interp + dir * 0.5, 0.0).xyz * exposure);
+ vec3 rgbA = 0.5 * exposure * (textureLod(source_color, uv_interp + dir * (1.0 / 3.0 - 0.5), 0.0).xyz + textureLod(source_color, uv_interp + dir * (2.0 / 3.0 - 0.5), 0.0).xyz);
+ vec3 rgbB = rgbA * 0.5 + 0.25 * exposure * (textureLod(source_color, uv_interp + dir * -0.5, 0.0).xyz + textureLod(source_color, uv_interp + dir * 0.5, 0.0).xyz);
float lumaB = dot(rgbB, luma);
if ((lumaB < lumaMin) || (lumaB > lumaMax)) {
diff --git a/servers/rendering/rendering_server_canvas.cpp b/servers/rendering/rendering_server_canvas.cpp
index b3d5b0ad83..b0bff8b2c2 100644
--- a/servers/rendering/rendering_server_canvas.cpp
+++ b/servers/rendering/rendering_server_canvas.cpp
@@ -37,7 +37,7 @@
static const int z_range = RS::CANVAS_ITEM_Z_MAX - RS::CANVAS_ITEM_Z_MIN + 1;
-void RenderingServerCanvas::_render_canvas_item_tree(RID p_to_render_target, Canvas::ChildItem *p_child_items, int p_child_item_count, Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, RasterizerCanvas::Light *p_lights) {
+void RenderingServerCanvas::_render_canvas_item_tree(RID p_to_render_target, Canvas::ChildItem *p_child_items, int p_child_item_count, Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, RasterizerCanvas::Light *p_lights, RenderingServer::CanvasItemTextureFilter p_default_filter, RenderingServer::CanvasItemTextureRepeat p_default_repeat) {
RENDER_TIMESTAMP("Cull CanvasItem Tree");
memset(z_list, 0, z_range * sizeof(RasterizerCanvas::Item *));
@@ -68,7 +68,7 @@ void RenderingServerCanvas::_render_canvas_item_tree(RID p_to_render_target, Can
RENDER_TIMESTAMP("Render Canvas Items");
- RSG::canvas_render->canvas_render_items(p_to_render_target, list, p_modulate, p_lights, p_transform);
+ RSG::canvas_render->canvas_render_items(p_to_render_target, list, p_modulate, p_lights, p_transform, p_default_filter, p_default_repeat);
}
void _collect_ysort_children(RenderingServerCanvas::Item *p_canvas_item, Transform2D p_transform, RenderingServerCanvas::Item *p_material_owner, RenderingServerCanvas::Item **r_items, int &r_index) {
@@ -243,7 +243,7 @@ void RenderingServerCanvas::_light_mask_canvas_items(int p_z, RasterizerCanvas::
}
}
-void RenderingServerCanvas::render_canvas(RID p_render_target, Canvas *p_canvas, const Transform2D &p_transform, RasterizerCanvas::Light *p_lights, RasterizerCanvas::Light *p_masked_lights, const Rect2 &p_clip_rect) {
+void RenderingServerCanvas::render_canvas(RID p_render_target, Canvas *p_canvas, const Transform2D &p_transform, RasterizerCanvas::Light *p_lights, RasterizerCanvas::Light *p_masked_lights, const Rect2 &p_clip_rect, RenderingServer::CanvasItemTextureFilter p_default_filter, RenderingServer::CanvasItemTextureRepeat p_default_repeat) {
RENDER_TIMESTAMP(">Render Canvas");
if (p_canvas->children_order_dirty) {
@@ -263,26 +263,26 @@ void RenderingServerCanvas::render_canvas(RID p_render_target, Canvas *p_canvas,
}
if (!has_mirror) {
- _render_canvas_item_tree(p_render_target, ci, l, nullptr, p_transform, p_clip_rect, p_canvas->modulate, p_lights);
+ _render_canvas_item_tree(p_render_target, ci, l, nullptr, p_transform, p_clip_rect, p_canvas->modulate, p_lights, p_default_filter, p_default_repeat);
} else {
//used for parallaxlayer mirroring
for (int i = 0; i < l; i++) {
const Canvas::ChildItem &ci2 = p_canvas->child_items[i];
- _render_canvas_item_tree(p_render_target, nullptr, 0, ci2.item, p_transform, p_clip_rect, p_canvas->modulate, p_lights);
+ _render_canvas_item_tree(p_render_target, nullptr, 0, ci2.item, p_transform, p_clip_rect, p_canvas->modulate, p_lights, p_default_filter, p_default_repeat);
//mirroring (useful for scrolling backgrounds)
if (ci2.mirror.x != 0) {
Transform2D xform2 = p_transform * Transform2D(0, Vector2(ci2.mirror.x, 0));
- _render_canvas_item_tree(p_render_target, nullptr, 0, ci2.item, xform2, p_clip_rect, p_canvas->modulate, p_lights);
+ _render_canvas_item_tree(p_render_target, nullptr, 0, ci2.item, xform2, p_clip_rect, p_canvas->modulate, p_lights, p_default_filter, p_default_repeat);
}
if (ci2.mirror.y != 0) {
Transform2D xform2 = p_transform * Transform2D(0, Vector2(0, ci2.mirror.y));
- _render_canvas_item_tree(p_render_target, nullptr, 0, ci2.item, xform2, p_clip_rect, p_canvas->modulate, p_lights);
+ _render_canvas_item_tree(p_render_target, nullptr, 0, ci2.item, xform2, p_clip_rect, p_canvas->modulate, p_lights, p_default_filter, p_default_repeat);
}
if (ci2.mirror.y != 0 && ci2.mirror.x != 0) {
Transform2D xform2 = p_transform * Transform2D(0, ci2.mirror);
- _render_canvas_item_tree(p_render_target, nullptr, 0, ci2.item, xform2, p_clip_rect, p_canvas->modulate, p_lights);
+ _render_canvas_item_tree(p_render_target, nullptr, 0, ci2.item, xform2, p_clip_rect, p_canvas->modulate, p_lights, p_default_filter, p_default_repeat);
}
}
}
@@ -451,18 +451,6 @@ void RenderingServerCanvas::canvas_item_set_update_when_visible(RID p_item, bool
canvas_item->update_when_visible = p_update;
}
-void RenderingServerCanvas::canvas_item_set_default_texture_filter(RID p_item, RS::CanvasItemTextureFilter p_filter) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
- ERR_FAIL_COND(!canvas_item);
- canvas_item->texture_filter = p_filter;
-}
-
-void RenderingServerCanvas::canvas_item_set_default_texture_repeat(RID p_item, RS::CanvasItemTextureRepeat p_repeat) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
- ERR_FAIL_COND(!canvas_item);
- canvas_item->texture_repeat = p_repeat;
-}
-
void RenderingServerCanvas::canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -484,7 +472,6 @@ void RenderingServerCanvas::canvas_item_add_line(RID p_item, const Point2 &p_fro
for (uint32_t i = 0; i < line->point_count; i++) {
line->colors[i] = p_color;
}
- line->specular_shininess = Color(1, 1, 1, 1);
}
void RenderingServerCanvas::canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width) {
@@ -495,8 +482,6 @@ void RenderingServerCanvas::canvas_item_add_polyline(RID p_item, const Vector<Po
Item::CommandPolygon *pline = canvas_item->alloc_command<Item::CommandPolygon>();
ERR_FAIL_COND(!pline);
- pline->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, RID(), RID(), RID(), RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED, RID());
-
if (true || p_width <= 1) {
#define TODO make thick lines possible
Vector<int> indices;
@@ -511,7 +496,6 @@ void RenderingServerCanvas::canvas_item_add_polyline(RID p_item, const Vector<Po
}
pline->primitive = RS::PRIMITIVE_LINES;
- pline->specular_shininess = Color(1, 1, 1, 1);
pline->polygon.create(indices, p_points, p_colors);
} else {
#if 0
@@ -586,13 +570,10 @@ void RenderingServerCanvas::canvas_item_add_multiline(RID p_item, const Vector<P
Item::CommandPolygon *pline = canvas_item->alloc_command<Item::CommandPolygon>();
ERR_FAIL_COND(!pline);
- pline->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, RID(), RID(), RID(), RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED, RID());
-
if (true || p_width <= 1) {
#define TODO make thick lines possible
pline->primitive = RS::PRIMITIVE_LINES;
- pline->specular_shininess = Color(1, 1, 1, 1);
pline->polygon.create(Vector<int>(), p_points, p_colors);
} else {
}
@@ -615,10 +596,7 @@ void RenderingServerCanvas::canvas_item_add_circle(RID p_item, const Point2 &p_p
Item::CommandPolygon *circle = canvas_item->alloc_command<Item::CommandPolygon>();
ERR_FAIL_COND(!circle);
- circle->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, RID(), RID(), RID(), RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED, RID());
-
circle->primitive = RS::PRIMITIVE_TRIANGLES;
- circle->specular_shininess = Color(1, 1, 1, 1);
Vector<int> indices;
Vector<Vector2> points;
@@ -645,7 +623,7 @@ void RenderingServerCanvas::canvas_item_add_circle(RID p_item, const Point2 &p_p
circle->polygon.create(indices, points, color);
}
-void RenderingServerCanvas::canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile, const Color &p_modulate, bool p_transpose, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile, const Color &p_modulate, bool p_transpose) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -672,11 +650,11 @@ void RenderingServerCanvas::canvas_item_add_texture_rect(RID p_item, const Rect2
rect->flags |= RasterizerCanvas::CANVAS_RECT_TRANSPOSE;
SWAP(rect->rect.size.x, rect->rect.size.y);
}
- rect->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, p_texture, p_normal_map, p_specular_map, p_filter, p_repeat, RID());
- rect->specular_shininess = p_specular_color_shininess;
+
+ rect->texture = p_texture;
}
-void RenderingServerCanvas::canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, bool p_clip_uv, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, bool p_clip_uv) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -684,8 +662,9 @@ void RenderingServerCanvas::canvas_item_add_texture_rect_region(RID p_item, cons
ERR_FAIL_COND(!rect);
rect->modulate = p_modulate;
rect->rect = p_rect;
- rect->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, p_texture, p_normal_map, p_specular_map, p_filter, p_repeat, RID());
- rect->specular_shininess = p_specular_color_shininess;
+
+ rect->texture = p_texture;
+
rect->source = p_src_rect;
rect->flags = RasterizerCanvas::CANVAS_RECT_REGION;
@@ -716,14 +695,15 @@ void RenderingServerCanvas::canvas_item_add_texture_rect_region(RID p_item, cons
}
}
-void RenderingServerCanvas::canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, RS::NinePatchAxisMode p_x_axis_mode, RS::NinePatchAxisMode p_y_axis_mode, bool p_draw_center, const Color &p_modulate, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, RS::NinePatchAxisMode p_x_axis_mode, RS::NinePatchAxisMode p_y_axis_mode, bool p_draw_center, const Color &p_modulate) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandNinePatch *style = canvas_item->alloc_command<Item::CommandNinePatch>();
ERR_FAIL_COND(!style);
- style->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, p_texture, p_normal_map, p_specular_map, p_filter, p_repeat, RID());
- style->specular_shininess = p_specular_color_shininess;
+
+ style->texture = p_texture;
+
style->rect = p_rect;
style->source = p_source;
style->draw_center = p_draw_center;
@@ -736,7 +716,7 @@ void RenderingServerCanvas::canvas_item_add_nine_patch(RID p_item, const Rect2 &
style->axis_y = p_y_axis_mode;
}
-void RenderingServerCanvas::canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width) {
uint32_t pc = p_points.size();
ERR_FAIL_COND(pc == 0 || pc > 4);
@@ -762,11 +742,10 @@ void RenderingServerCanvas::canvas_item_add_primitive(RID p_item, const Vector<P
prim->point_count = p_points.size();
- prim->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, p_texture, p_normal_map, p_specular_map, p_filter, p_repeat, RID());
- prim->specular_shininess = p_specular_color_shininess;
+ prim->texture = p_texture;
}
-void RenderingServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
#ifdef DEBUG_ENABLED
@@ -783,12 +762,11 @@ void RenderingServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Poi
Item::CommandPolygon *polygon = canvas_item->alloc_command<Item::CommandPolygon>();
ERR_FAIL_COND(!polygon);
polygon->primitive = RS::PRIMITIVE_TRIANGLES;
- polygon->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, p_texture, p_normal_map, p_specular_map, p_filter, p_repeat, RID());
- polygon->specular_shininess = p_specular_color_shininess;
+ polygon->texture = p_texture;
polygon->polygon.create(indices, p_points, p_colors, p_uvs);
}
-void RenderingServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, const Vector<int> &p_bones, const Vector<float> &p_weights, RID p_texture, int p_count, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, const Vector<int> &p_bones, const Vector<float> &p_weights, RID p_texture, int p_count) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -803,8 +781,9 @@ void RenderingServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vec
Item::CommandPolygon *polygon = canvas_item->alloc_command<Item::CommandPolygon>();
ERR_FAIL_COND(!polygon);
- polygon->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, p_texture, p_normal_map, p_specular_map, p_filter, p_repeat, RID());
- polygon->specular_shininess = p_specular_color_shininess;
+
+ polygon->texture = p_texture;
+
polygon->polygon.create(indices, p_points, p_colors, p_uvs, p_bones, p_weights);
polygon->primitive = RS::PRIMITIVE_TRIANGLES;
@@ -819,42 +798,43 @@ void RenderingServerCanvas::canvas_item_add_set_transform(RID p_item, const Tran
tr->xform = p_transform;
}
-void RenderingServerCanvas::canvas_item_add_mesh(RID p_item, const RID &p_mesh, const Transform2D &p_transform, const Color &p_modulate, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_mesh(RID p_item, const RID &p_mesh, const Transform2D &p_transform, const Color &p_modulate, RID p_texture) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandMesh *m = canvas_item->alloc_command<Item::CommandMesh>();
ERR_FAIL_COND(!m);
m->mesh = p_mesh;
- m->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, p_texture, p_normal_map, p_specular_map, p_filter, p_repeat, RID());
- m->specular_shininess = p_specular_color_shininess;
+
+ m->texture = p_texture;
+
m->transform = p_transform;
m->modulate = p_modulate;
}
-void RenderingServerCanvas::canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandParticles *part = canvas_item->alloc_command<Item::CommandParticles>();
ERR_FAIL_COND(!part);
part->particles = p_particles;
- part->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, p_texture, p_normal_map, p_specular_map, p_filter, p_repeat, RID());
- part->specular_shininess = p_specular_color_shininess;
+
+ part->texture = p_texture;
//take the chance and request processing for them, at least once until they become visible again
RSG::storage->particles_request_process(p_particles);
}
-void RenderingServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandMultiMesh *mm = canvas_item->alloc_command<Item::CommandMultiMesh>();
ERR_FAIL_COND(!mm);
mm->multimesh = p_mesh;
- mm->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, p_texture, p_normal_map, p_specular_map, p_filter, p_repeat, mm->multimesh);
- mm->specular_shininess = p_specular_color_shininess;
+
+ mm->texture = p_texture;
}
void RenderingServerCanvas::canvas_item_add_clip_ignore(RID p_item, bool p_ignore) {
@@ -1007,6 +987,9 @@ void RenderingServerCanvas::canvas_light_set_texture(RID p_light, RID p_texture)
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
+ if (clight->texture == p_texture) {
+ return;
+ }
clight->texture = p_texture;
clight->version++;
RSG::canvas_render->light_set_texture(clight->light_internal, p_texture);
@@ -1086,24 +1069,7 @@ void RenderingServerCanvas::canvas_light_set_shadow_enabled(RID p_light, bool p_
}
clight->use_shadow = p_enabled;
clight->version++;
- RSG::canvas_render->light_set_use_shadow(clight->light_internal, clight->use_shadow, clight->shadow_buffer_size);
-}
-
-void RenderingServerCanvas::canvas_light_set_shadow_buffer_size(RID p_light, int p_size) {
- ERR_FAIL_COND(p_size < 32 || p_size > 16384);
-
- RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
- ERR_FAIL_COND(!clight);
-
- int new_size = next_power_of_2(p_size);
- if (new_size == clight->shadow_buffer_size) {
- return;
- }
-
- clight->shadow_buffer_size = next_power_of_2(p_size);
- clight->version++;
-
- RSG::canvas_render->light_set_use_shadow(clight->light_internal, clight->use_shadow, clight->shadow_buffer_size);
+ RSG::canvas_render->light_set_use_shadow(clight->light_internal, clight->use_shadow);
}
void RenderingServerCanvas::canvas_light_set_shadow_filter(RID p_light, RS::CanvasLightShadowFilter p_filter) {
@@ -1271,6 +1237,41 @@ void RenderingServerCanvas::canvas_occluder_polygon_set_cull_mode(RID p_occluder
}
}
+void RenderingServerCanvas::canvas_set_shadow_texture_size(int p_size) {
+ RSG::canvas_render->set_shadow_texture_size(p_size);
+}
+
+RID RenderingServerCanvas::canvas_texture_create() {
+ return RSG::storage->canvas_texture_create();
+}
+
+void RenderingServerCanvas::canvas_texture_set_channel(RID p_canvas_texture, RS::CanvasTextureChannel p_channel, RID p_texture) {
+ RSG::storage->canvas_texture_set_channel(p_canvas_texture, p_channel, p_texture);
+}
+
+void RenderingServerCanvas::canvas_texture_set_shading_parameters(RID p_canvas_texture, const Color &p_base_color, float p_shininess) {
+ RSG::storage->canvas_texture_set_shading_parameters(p_canvas_texture, p_base_color, p_shininess);
+}
+
+void RenderingServerCanvas::canvas_texture_set_texture_filter(RID p_canvas_texture, RS::CanvasItemTextureFilter p_filter) {
+ RSG::storage->canvas_texture_set_texture_filter(p_canvas_texture, p_filter);
+}
+
+void RenderingServerCanvas::canvas_texture_set_texture_repeat(RID p_canvas_texture, RS::CanvasItemTextureRepeat p_repeat) {
+ RSG::storage->canvas_texture_set_texture_repeat(p_canvas_texture, p_repeat);
+}
+
+void RenderingServerCanvas::canvas_item_set_default_texture_filter(RID p_item, RS::CanvasItemTextureFilter p_filter) {
+ Item *ci = canvas_item_owner.getornull(p_item);
+ ERR_FAIL_COND(!ci);
+ ci->texture_filter = p_filter;
+}
+void RenderingServerCanvas::canvas_item_set_default_texture_repeat(RID p_item, RS::CanvasItemTextureRepeat p_repeat) {
+ Item *ci = canvas_item_owner.getornull(p_item);
+ ERR_FAIL_COND(!ci);
+ ci->texture_repeat = p_repeat;
+}
+
bool RenderingServerCanvas::free(RID p_rid) {
if (canvas_owner.owns(p_rid)) {
Canvas *canvas = canvas_owner.getornull(p_rid);
diff --git a/servers/rendering/rendering_server_canvas.h b/servers/rendering/rendering_server_canvas.h
index cebe32fba0..16edfd54e1 100644
--- a/servers/rendering/rendering_server_canvas.h
+++ b/servers/rendering/rendering_server_canvas.h
@@ -52,8 +52,6 @@ public:
Transform2D ysort_xform;
Vector2 ysort_pos;
int ysort_index;
- RS::CanvasItemTextureFilter texture_filter;
- RS::CanvasItemTextureRepeat texture_repeat;
Vector<Item *> child_items;
@@ -71,8 +69,6 @@ public:
ysort_xform = Transform2D();
ysort_pos = Vector2();
ysort_index = 0;
- texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT;
- texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT;
}
};
@@ -158,7 +154,7 @@ public:
bool disable_scale;
private:
- void _render_canvas_item_tree(RID p_to_render_target, Canvas::ChildItem *p_child_items, int p_child_item_count, Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, RasterizerCanvas::Light *p_lights);
+ void _render_canvas_item_tree(RID p_to_render_target, Canvas::ChildItem *p_child_items, int p_child_item_count, Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, RasterizerCanvas::Light *p_lights, RS::CanvasItemTextureFilter p_default_filter, RS::CanvasItemTextureRepeat p_default_repeat);
void _cull_canvas_item(Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, int p_z, RasterizerCanvas::Item **z_list, RasterizerCanvas::Item **z_last_list, Item *p_canvas_clip, Item *p_material_owner);
void _light_mask_canvas_items(int p_z, RasterizerCanvas::Item *p_canvas_item, RasterizerCanvas::Light *p_masked_lights);
@@ -166,7 +162,7 @@ private:
RasterizerCanvas::Item **z_last_list;
public:
- void render_canvas(RID p_render_target, Canvas *p_canvas, const Transform2D &p_transform, RasterizerCanvas::Light *p_lights, RasterizerCanvas::Light *p_masked_lights, const Rect2 &p_clip_rect);
+ void render_canvas(RID p_render_target, Canvas *p_canvas, const Transform2D &p_transform, RasterizerCanvas::Light *p_lights, RasterizerCanvas::Light *p_masked_lights, const Rect2 &p_clip_rect, RS::CanvasItemTextureFilter p_default_filter, RS::CanvasItemTextureRepeat p_default_repeat);
RID canvas_create();
void canvas_set_item_mirroring(RID p_canvas, RID p_item, const Point2 &p_mirroring);
@@ -191,23 +187,20 @@ public:
void canvas_item_set_update_when_visible(RID p_item, bool p_update);
- void canvas_item_set_default_texture_filter(RID p_item, RS::CanvasItemTextureFilter p_filter);
- void canvas_item_set_default_texture_repeat(RID p_item, RS::CanvasItemTextureRepeat p_repeat);
-
void canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width = 1.0);
void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0);
void canvas_item_add_multiline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0);
void canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color);
void canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color);
- void canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), bool p_clip_uv = false, RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, RS::NinePatchAxisMode p_x_axis_mode = RS::NINE_PATCH_STRETCH, RS::NinePatchAxisMode p_y_axis_mode = RS::NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_mesh(RID p_item, const RID &p_mesh, const Transform2D &p_transform = Transform2D(), const Color &p_modulate = Color(1, 1, 1), RID p_texture = RID(), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture = RID(), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal_map, RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
+ void canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false);
+ void canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, bool p_clip_uv = false);
+ void canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, RS::NinePatchAxisMode p_x_axis_mode = RS::NINE_PATCH_STRETCH, RS::NinePatchAxisMode p_y_axis_mode = RS::NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1));
+ void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0);
+ void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID());
+ void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>(), RID p_texture = RID(), int p_count = -1);
+ void canvas_item_add_mesh(RID p_item, const RID &p_mesh, const Transform2D &p_transform = Transform2D(), const Color &p_modulate = Color(1, 1, 1), RID p_texture = RID());
+ void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture = RID());
+ void canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture);
void canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform);
void canvas_item_add_clip_ignore(RID p_item, bool p_ignore);
void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable);
@@ -241,7 +234,6 @@ public:
void canvas_light_set_mode(RID p_light, RS::CanvasLightMode p_mode);
void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled);
- void canvas_light_set_shadow_buffer_size(RID p_light, int p_size);
void canvas_light_set_shadow_filter(RID p_light, RS::CanvasLightShadowFilter p_filter);
void canvas_light_set_shadow_color(RID p_light, const Color &p_color);
void canvas_light_set_shadow_smooth(RID p_light, float p_smooth);
@@ -259,6 +251,18 @@ public:
void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon, RS::CanvasOccluderPolygonCullMode p_mode);
+ void canvas_set_shadow_texture_size(int p_size);
+
+ RID canvas_texture_create();
+ void canvas_texture_set_channel(RID p_canvas_texture, RS::CanvasTextureChannel p_channel, RID p_texture);
+ void canvas_texture_set_shading_parameters(RID p_canvas_texture, const Color &p_base_color, float p_shininess);
+
+ void canvas_texture_set_texture_filter(RID p_item, RS::CanvasItemTextureFilter p_filter);
+ void canvas_texture_set_texture_repeat(RID p_item, RS::CanvasItemTextureRepeat p_repeat);
+
+ void canvas_item_set_default_texture_filter(RID p_item, RS::CanvasItemTextureFilter p_filter);
+ void canvas_item_set_default_texture_repeat(RID p_item, RS::CanvasItemTextureRepeat p_repeat);
+
bool free(RID p_rid);
RenderingServerCanvas();
~RenderingServerCanvas();
diff --git a/servers/rendering/rendering_server_raster.h b/servers/rendering/rendering_server_raster.h
index 97477f1d3e..5744b40321 100644
--- a/servers/rendering/rendering_server_raster.h
+++ b/servers/rendering/rendering_server_raster.h
@@ -529,6 +529,9 @@ public:
BIND3(viewport_set_canvas_transform, RID, RID, const Transform2D &)
BIND2(viewport_set_transparent_background, RID, bool)
+ BIND2(viewport_set_default_canvas_item_texture_filter, RID, CanvasItemTextureFilter)
+ BIND2(viewport_set_default_canvas_item_texture_repeat, RID, CanvasItemTextureRepeat)
+
BIND2(viewport_set_global_canvas_transform, RID, const Transform2D &)
BIND4(viewport_set_canvas_stacking, RID, RID, int, int)
BIND2(viewport_set_shadow_atlas_size, RID, int)
@@ -684,9 +687,19 @@ public:
BIND3(canvas_set_parent, RID, RID, float)
BIND1(canvas_set_disable_scale, bool)
+ BIND0R(RID, canvas_texture_create)
+ BIND3(canvas_texture_set_channel, RID, CanvasTextureChannel, RID)
+ BIND3(canvas_texture_set_shading_parameters, RID, const Color &, float)
+
+ BIND2(canvas_texture_set_texture_filter, RID, CanvasItemTextureFilter)
+ BIND2(canvas_texture_set_texture_repeat, RID, CanvasItemTextureRepeat)
+
BIND0R(RID, canvas_item_create)
BIND2(canvas_item_set_parent, RID, RID)
+ BIND2(canvas_item_set_default_texture_filter, RID, CanvasItemTextureFilter)
+ BIND2(canvas_item_set_default_texture_repeat, RID, CanvasItemTextureRepeat)
+
BIND2(canvas_item_set_visible, RID, bool)
BIND2(canvas_item_set_light_mask, RID, int)
@@ -701,23 +714,20 @@ public:
BIND2(canvas_item_set_draw_behind_parent, RID, bool)
- BIND2(canvas_item_set_default_texture_filter, RID, CanvasItemTextureFilter)
- BIND2(canvas_item_set_default_texture_repeat, RID, CanvasItemTextureRepeat)
-
BIND5(canvas_item_add_line, RID, const Point2 &, const Point2 &, const Color &, float)
BIND4(canvas_item_add_polyline, RID, const Vector<Point2> &, const Vector<Color> &, float)
BIND4(canvas_item_add_multiline, RID, const Vector<Point2> &, const Vector<Color> &, float)
BIND3(canvas_item_add_rect, RID, const Rect2 &, const Color &)
BIND4(canvas_item_add_circle, RID, const Point2 &, float, const Color &)
- BIND11(canvas_item_add_texture_rect, RID, const Rect2 &, RID, bool, const Color &, bool, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- BIND12(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, RID, RID, const Color &, bool, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- BIND15(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- BIND11(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- BIND10(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- BIND14(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, const Vector<int> &, const Vector<float> &, RID, int, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- BIND10(canvas_item_add_mesh, RID, const RID &, const Transform2D &, const Color &, RID, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- BIND8(canvas_item_add_multimesh, RID, RID, RID, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- BIND8(canvas_item_add_particles, RID, RID, RID, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
+ BIND6(canvas_item_add_texture_rect, RID, const Rect2 &, RID, bool, const Color &, bool)
+ BIND7(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, bool)
+ BIND10(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &)
+ BIND6(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float)
+ BIND5(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID)
+ BIND9(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, const Vector<int> &, const Vector<float> &, RID, int)
+ BIND5(canvas_item_add_mesh, RID, const RID &, const Transform2D &, const Color &, RID)
+ BIND3(canvas_item_add_multimesh, RID, RID, RID)
+ BIND3(canvas_item_add_particles, RID, RID, RID)
BIND2(canvas_item_add_set_transform, RID, const Transform2D &)
BIND2(canvas_item_add_clip_ignore, RID, bool)
BIND2(canvas_item_set_sort_children_by_y, RID, bool)
@@ -751,7 +761,6 @@ public:
BIND2(canvas_light_set_mode, RID, CanvasLightMode)
BIND2(canvas_light_set_shadow_enabled, RID, bool)
- BIND2(canvas_light_set_shadow_buffer_size, RID, int)
BIND2(canvas_light_set_shadow_filter, RID, CanvasLightShadowFilter)
BIND2(canvas_light_set_shadow_color, RID, const Color &)
BIND2(canvas_light_set_shadow_smooth, RID, float)
@@ -769,6 +778,8 @@ public:
BIND2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode)
+ BIND1(canvas_set_shadow_texture_size, int)
+
/* GLOBAL VARIABLES */
#undef BINDBASE
diff --git a/servers/rendering/rendering_server_viewport.cpp b/servers/rendering/rendering_server_viewport.cpp
index bd9aa32147..a8dbe1e254 100644
--- a/servers/rendering/rendering_server_viewport.cpp
+++ b/servers/rendering/rendering_server_viewport.cpp
@@ -136,6 +136,7 @@ void RenderingServerViewport::_draw_viewport(Viewport *p_viewport, XRInterface::
Rect2 shadow_rect;
int light_count = 0;
+ int shadow_count = 0;
RENDER_TIMESTAMP("Cull Canvas Lights");
for (Map<RID, Viewport::CanvasData>::Element *E = p_viewport->canvas_map.front(); E; E = E->next()) {
@@ -221,7 +222,7 @@ void RenderingServerViewport::_draw_viewport(Viewport *p_viewport, XRInterface::
while (light) {
RENDER_TIMESTAMP("Render Shadow");
- RSG::canvas_render->light_update_shadow(light->light_internal, light->xform_cache.affine_inverse(), light->item_shadow_mask, light->radius_cache / 1000.0, light->radius_cache * 1.1, occluders);
+ RSG::canvas_render->light_update_shadow(light->light_internal, shadow_count++, light->xform_cache.affine_inverse(), light->item_shadow_mask, light->radius_cache / 1000.0, light->radius_cache * 1.1, occluders);
light = light->shadows_next_ptr;
}
@@ -254,7 +255,7 @@ void RenderingServerViewport::_draw_viewport(Viewport *p_viewport, XRInterface::
ptr = ptr->filter_next_ptr;
}
- RSG::canvas->render_canvas(p_viewport->render_target, canvas, xform, canvas_lights, lights_with_mask, clip_rect);
+ RSG::canvas->render_canvas(p_viewport->render_target, canvas, xform, canvas_lights, lights_with_mask, clip_rect, p_viewport->texture_filter, p_viewport->texture_repeat);
i++;
if (scenario_draw_canvas_bg && E->key().get_layer() >= scenario_canvas_max_layer) {
@@ -773,6 +774,21 @@ float RenderingServerViewport::viewport_get_measured_render_time_gpu(RID p_viewp
return double((viewport->time_gpu_end - viewport->time_gpu_begin) / 1000) / 1000.0;
}
+void RenderingServerViewport::viewport_set_default_canvas_item_texture_filter(RID p_viewport, RS::CanvasItemTextureFilter p_filter) {
+ ERR_FAIL_COND_MSG(p_filter == RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, "Viewport does not accept DEFAULT as texture filter (it's the topmost choice already).)");
+ Viewport *viewport = viewport_owner.getornull(p_viewport);
+ ERR_FAIL_COND(!viewport);
+
+ viewport->texture_filter = p_filter;
+}
+void RenderingServerViewport::viewport_set_default_canvas_item_texture_repeat(RID p_viewport, RS::CanvasItemTextureRepeat p_repeat) {
+ ERR_FAIL_COND_MSG(p_repeat == RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, "Viewport does not accept DEFAULT as texture repeat (it's the topmost choice already).)");
+ Viewport *viewport = viewport_owner.getornull(p_viewport);
+ ERR_FAIL_COND(!viewport);
+
+ viewport->texture_repeat = p_repeat;
+}
+
bool RenderingServerViewport::free(RID p_rid) {
if (viewport_owner.owns(p_rid)) {
Viewport *viewport = viewport_owner.getornull(p_rid);
diff --git a/servers/rendering/rendering_server_viewport.h b/servers/rendering/rendering_server_viewport.h
index ed251f5da0..161ae94fb0 100644
--- a/servers/rendering/rendering_server_viewport.h
+++ b/servers/rendering/rendering_server_viewport.h
@@ -86,6 +86,9 @@ public:
RS::ViewportClearMode clear_mode;
+ RS::CanvasItemTextureFilter texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
+ RS::CanvasItemTextureRepeat texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
+
bool transparent_bg;
struct CanvasKey {
@@ -217,6 +220,9 @@ public:
float viewport_get_measured_render_time_cpu(RID p_viewport) const;
float viewport_get_measured_render_time_gpu(RID p_viewport) const;
+ void viewport_set_default_canvas_item_texture_filter(RID p_viewport, RS::CanvasItemTextureFilter p_filter);
+ void viewport_set_default_canvas_item_texture_repeat(RID p_viewport, RS::CanvasItemTextureRepeat p_repeat);
+
void handle_timestamp(String p_timestamp, uint64_t p_cpu_time, uint64_t p_gpu_time);
void set_default_clear_color(const Color &p_color);
diff --git a/servers/rendering/rendering_server_wrap_mt.h b/servers/rendering/rendering_server_wrap_mt.h
index c2337f8c9e..1836f99c99 100644
--- a/servers/rendering/rendering_server_wrap_mt.h
+++ b/servers/rendering/rendering_server_wrap_mt.h
@@ -432,6 +432,9 @@ public:
FUNC3(viewport_set_canvas_transform, RID, RID, const Transform2D &)
FUNC2(viewport_set_transparent_background, RID, bool)
+ FUNC2(viewport_set_default_canvas_item_texture_filter, RID, CanvasItemTextureFilter)
+ FUNC2(viewport_set_default_canvas_item_texture_repeat, RID, CanvasItemTextureRepeat)
+
FUNC2(viewport_set_global_canvas_transform, RID, const Transform2D &)
FUNC4(viewport_set_canvas_stacking, RID, RID, int, int)
FUNC2(viewport_set_shadow_atlas_size, RID, int)
@@ -583,9 +586,19 @@ public:
FUNC3(canvas_set_parent, RID, RID, float)
FUNC1(canvas_set_disable_scale, bool)
+ FUNCRID(canvas_texture)
+ FUNC3(canvas_texture_set_channel, RID, CanvasTextureChannel, RID)
+ FUNC3(canvas_texture_set_shading_parameters, RID, const Color &, float)
+
+ FUNC2(canvas_texture_set_texture_filter, RID, CanvasItemTextureFilter)
+ FUNC2(canvas_texture_set_texture_repeat, RID, CanvasItemTextureRepeat)
+
FUNCRID(canvas_item)
FUNC2(canvas_item_set_parent, RID, RID)
+ FUNC2(canvas_item_set_default_texture_filter, RID, CanvasItemTextureFilter)
+ FUNC2(canvas_item_set_default_texture_repeat, RID, CanvasItemTextureRepeat)
+
FUNC2(canvas_item_set_visible, RID, bool)
FUNC2(canvas_item_set_light_mask, RID, int)
@@ -600,23 +613,20 @@ public:
FUNC2(canvas_item_set_draw_behind_parent, RID, bool)
- FUNC2(canvas_item_set_default_texture_filter, RID, CanvasItemTextureFilter)
- FUNC2(canvas_item_set_default_texture_repeat, RID, CanvasItemTextureRepeat)
-
FUNC5(canvas_item_add_line, RID, const Point2 &, const Point2 &, const Color &, float)
FUNC4(canvas_item_add_polyline, RID, const Vector<Point2> &, const Vector<Color> &, float)
FUNC4(canvas_item_add_multiline, RID, const Vector<Point2> &, const Vector<Color> &, float)
FUNC3(canvas_item_add_rect, RID, const Rect2 &, const Color &)
FUNC4(canvas_item_add_circle, RID, const Point2 &, float, const Color &)
- FUNC11(canvas_item_add_texture_rect, RID, const Rect2 &, RID, bool, const Color &, bool, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- FUNC12(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, RID, RID, const Color &, bool, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- FUNC15(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- FUNC11(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- FUNC10(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- FUNC14(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, const Vector<int> &, const Vector<float> &, RID, int, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- FUNC10(canvas_item_add_mesh, RID, const RID &, const Transform2D &, const Color &, RID, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- FUNC8(canvas_item_add_multimesh, RID, RID, RID, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
- FUNC8(canvas_item_add_particles, RID, RID, RID, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
+ FUNC6(canvas_item_add_texture_rect, RID, const Rect2 &, RID, bool, const Color &, bool)
+ FUNC7(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, bool)
+ FUNC10(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &)
+ FUNC6(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float)
+ FUNC5(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID)
+ FUNC9(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, const Vector<int> &, const Vector<float> &, RID, int)
+ FUNC5(canvas_item_add_mesh, RID, const RID &, const Transform2D &, const Color &, RID)
+ FUNC3(canvas_item_add_multimesh, RID, RID, RID)
+ FUNC3(canvas_item_add_particles, RID, RID, RID)
FUNC2(canvas_item_add_set_transform, RID, const Transform2D &)
FUNC2(canvas_item_add_clip_ignore, RID, bool)
FUNC2(canvas_item_set_sort_children_by_y, RID, bool)
@@ -650,7 +660,6 @@ public:
FUNC2(canvas_light_set_mode, RID, CanvasLightMode)
FUNC2(canvas_light_set_shadow_enabled, RID, bool)
- FUNC2(canvas_light_set_shadow_buffer_size, RID, int)
FUNC2(canvas_light_set_shadow_filter, RID, CanvasLightShadowFilter)
FUNC2(canvas_light_set_shadow_color, RID, const Color &)
FUNC2(canvas_light_set_shadow_smooth, RID, float)
@@ -668,6 +677,8 @@ public:
FUNC2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode)
+ FUNC1(canvas_set_shadow_texture_size, int)
+
/* GLOBAL VARIABLES */
FUNC3(global_variable_add, const StringName &, GlobalVariableType, const Variant &)
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index e2f1ddb224..42a77101f7 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -1846,7 +1846,6 @@ void RenderingServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("canvas_light_set_item_shadow_cull_mask", "light", "mask"), &RenderingServer::canvas_light_set_item_shadow_cull_mask);
ClassDB::bind_method(D_METHOD("canvas_light_set_mode", "light", "mode"), &RenderingServer::canvas_light_set_mode);
ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_enabled", "light", "enabled"), &RenderingServer::canvas_light_set_shadow_enabled);
- ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_buffer_size", "light", "size"), &RenderingServer::canvas_light_set_shadow_buffer_size);
ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_filter", "light", "filter"), &RenderingServer::canvas_light_set_shadow_filter);
ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_color", "light", "color"), &RenderingServer::canvas_light_set_shadow_color);
ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_smooth", "light", "smooth"), &RenderingServer::canvas_light_set_shadow_smooth);
@@ -2335,6 +2334,8 @@ RenderingServer::RenderingServer() {
GLOBAL_DEF("rendering/quality/shadows/soft_shadow_quality.mobile", 0);
ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/shadows/soft_shadow_quality", PropertyInfo(Variant::INT, "rendering/quality/shadows/soft_shadow_quality", PROPERTY_HINT_ENUM, "Hard (Fastest),Soft Low (Fast),Soft Medium (Average),Soft High (Slow),Soft Ultra (Slowest)"));
+ GLOBAL_DEF("rendering/quality/2d_shadow_atlas/size", 2048);
+
GLOBAL_DEF("rendering/quality/shadow_atlas/size", 4096);
GLOBAL_DEF("rendering/quality/shadow_atlas/size.mobile", 2048);
ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/shadow_atlas/size", PropertyInfo(Variant::INT, "rendering/quality/shadow_atlas/size", PROPERTY_HINT_RANGE, "256,16384"));
diff --git a/servers/rendering_server.h b/servers/rendering_server.h
index e50170bdf7..61d0fed52f 100644
--- a/servers/rendering_server.h
+++ b/servers/rendering_server.h
@@ -661,6 +661,25 @@ public:
/* VIEWPORT TARGET API */
+ enum CanvasItemTextureFilter {
+ CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, //uses canvas item setting for draw command, uses global setting for canvas item
+ CANVAS_ITEM_TEXTURE_FILTER_NEAREST,
+ CANVAS_ITEM_TEXTURE_FILTER_LINEAR,
+ CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS,
+ CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS,
+ CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC,
+ CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC,
+ CANVAS_ITEM_TEXTURE_FILTER_MAX
+ };
+
+ enum CanvasItemTextureRepeat {
+ CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, //uses canvas item setting for draw command, uses global setting for canvas item
+ CANVAS_ITEM_TEXTURE_REPEAT_DISABLED,
+ CANVAS_ITEM_TEXTURE_REPEAT_ENABLED,
+ CANVAS_ITEM_TEXTURE_REPEAT_MIRROR,
+ CANVAS_ITEM_TEXTURE_REPEAT_MAX,
+ };
+
virtual RID viewport_create() = 0;
virtual void viewport_set_use_xr(RID p_viewport, bool p_use_xr) = 0;
@@ -702,6 +721,9 @@ public:
virtual void viewport_set_canvas_transform(RID p_viewport, RID p_canvas, const Transform2D &p_offset) = 0;
virtual void viewport_set_transparent_background(RID p_viewport, bool p_enabled) = 0;
+ virtual void viewport_set_default_canvas_item_texture_filter(RID p_viewport, CanvasItemTextureFilter p_filter) = 0;
+ virtual void viewport_set_default_canvas_item_texture_repeat(RID p_viewport, CanvasItemTextureRepeat p_repeat) = 0;
+
virtual void viewport_set_global_canvas_transform(RID p_viewport, const Transform2D &p_transform) = 0;
virtual void viewport_set_canvas_stacking(RID p_viewport, RID p_canvas, int p_layer, int p_sublayer) = 0;
@@ -1092,9 +1114,26 @@ public:
virtual void canvas_set_disable_scale(bool p_disable) = 0;
+ virtual RID canvas_texture_create() = 0;
+
+ enum CanvasTextureChannel {
+ CANVAS_TEXTURE_CHANNEL_DIFFUSE,
+ CANVAS_TEXTURE_CHANNEL_NORMAL,
+ CANVAS_TEXTURE_CHANNEL_SPECULAR,
+ };
+ virtual void canvas_texture_set_channel(RID p_canvas_texture, CanvasTextureChannel p_channel, RID p_texture) = 0;
+ virtual void canvas_texture_set_shading_parameters(RID p_canvas_texture, const Color &p_base_color, float p_shininess) = 0;
+
+ //takes effect only for new draw commands
+ virtual void canvas_texture_set_texture_filter(RID p_canvas_texture, CanvasItemTextureFilter p_filter) = 0;
+ virtual void canvas_texture_set_texture_repeat(RID p_canvas_texture, CanvasItemTextureRepeat p_repeat) = 0;
+
virtual RID canvas_item_create() = 0;
virtual void canvas_item_set_parent(RID p_item, RID p_parent) = 0;
+ virtual void canvas_item_set_default_texture_filter(RID p_item, CanvasItemTextureFilter p_filter) = 0;
+ virtual void canvas_item_set_default_texture_repeat(RID p_item, CanvasItemTextureRepeat p_repeat) = 0;
+
virtual void canvas_item_set_visible(RID p_item, bool p_visible) = 0;
virtual void canvas_item_set_light_mask(RID p_item, int p_mask) = 0;
@@ -1115,43 +1154,20 @@ public:
NINE_PATCH_TILE_FIT,
};
- enum CanvasItemTextureFilter {
- CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, //uses canvas item setting for draw command, uses global setting for canvas item
- CANVAS_ITEM_TEXTURE_FILTER_NEAREST,
- CANVAS_ITEM_TEXTURE_FILTER_LINEAR,
- CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS,
- CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS,
- CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC,
- CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC,
- CANVAS_ITEM_TEXTURE_FILTER_MAX
- };
-
- enum CanvasItemTextureRepeat {
- CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, //uses canvas item setting for draw command, uses global setting for canvas item
- CANVAS_ITEM_TEXTURE_REPEAT_DISABLED,
- CANVAS_ITEM_TEXTURE_REPEAT_ENABLED,
- CANVAS_ITEM_TEXTURE_REPEAT_MIRROR,
- CANVAS_ITEM_TEXTURE_REPEAT_MAX,
- };
-
- //takes effect only for new draw commands
- virtual void canvas_item_set_default_texture_filter(RID p_item, CanvasItemTextureFilter p_filter) = 0;
- virtual void canvas_item_set_default_texture_repeat(RID p_item, CanvasItemTextureRepeat p_repeat) = 0;
-
virtual void canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width = 1.0) = 0;
virtual void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0) = 0;
virtual void canvas_item_add_multiline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0) = 0;
virtual void canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color) = 0;
virtual void canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color) = 0;
- virtual void canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), CanvasItemTextureFilter p_texture_filter = CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, CanvasItemTextureRepeat = CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) = 0;
- virtual void canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), bool p_clip_uv = false, CanvasItemTextureFilter p_texture_filter = CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, CanvasItemTextureRepeat = CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) = 0;
- virtual void canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, NinePatchAxisMode p_x_axis_mode = NINE_PATCH_STRETCH, NinePatchAxisMode p_y_axis_mode = NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), CanvasItemTextureFilter p_texture_filter = CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, CanvasItemTextureRepeat = CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) = 0;
- virtual void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), CanvasItemTextureFilter p_texture_filter = CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, CanvasItemTextureRepeat = CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) = 0;
- virtual void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), CanvasItemTextureFilter p_texture_filter = CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, CanvasItemTextureRepeat = CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) = 0;
- virtual void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), CanvasItemTextureFilter p_texture_filter = CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, CanvasItemTextureRepeat = CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) = 0;
- virtual void canvas_item_add_mesh(RID p_item, const RID &p_mesh, const Transform2D &p_transform = Transform2D(), const Color &p_modulate = Color(1, 1, 1), RID p_texture = RID(), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), CanvasItemTextureFilter p_texture_filter = CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, CanvasItemTextureRepeat = CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) = 0;
- virtual void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture = RID(), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), CanvasItemTextureFilter p_texture_filter = CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, CanvasItemTextureRepeat = CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) = 0;
- virtual void canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal_map, RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), CanvasItemTextureFilter p_texture_filter = CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, CanvasItemTextureRepeat = CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) = 0;
+ virtual void canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) = 0;
+ virtual void canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, bool p_clip_uv = false) = 0;
+ virtual void canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, NinePatchAxisMode p_x_axis_mode = NINE_PATCH_STRETCH, NinePatchAxisMode p_y_axis_mode = NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1)) = 0;
+ virtual void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0) = 0;
+ virtual void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID()) = 0;
+ virtual void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>(), RID p_texture = RID(), int p_count = -1) = 0;
+ virtual void canvas_item_add_mesh(RID p_item, const RID &p_mesh, const Transform2D &p_transform = Transform2D(), const Color &p_modulate = Color(1, 1, 1), RID p_texture = RID()) = 0;
+ virtual void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture = RID()) = 0;
+ virtual void canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture) = 0;
virtual void canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform) = 0;
virtual void canvas_item_add_clip_ignore(RID p_item, bool p_ignore) = 0;
virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable) = 0;
@@ -1200,7 +1216,6 @@ public:
};
virtual void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled) = 0;
- virtual void canvas_light_set_shadow_buffer_size(RID p_light, int p_size) = 0;
virtual void canvas_light_set_shadow_filter(RID p_light, CanvasLightShadowFilter p_filter) = 0;
virtual void canvas_light_set_shadow_color(RID p_light, const Color &p_color) = 0;
virtual void canvas_light_set_shadow_smooth(RID p_light, float p_smooth) = 0;
@@ -1224,6 +1239,8 @@ public:
virtual void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon, CanvasOccluderPolygonCullMode p_mode) = 0;
+ virtual void canvas_set_shadow_texture_size(int p_size) = 0;
+
/* GLOBAL VARIABLES */
enum GlobalVariableType {
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 46a75d94b0..567f78f1b2 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -151,7 +151,7 @@ Use UI font variant if available, because it has tight vertical metrics and good
## freetype
- Upstream: https://www.freetype.org
-- Version: 2.10.2 (2020)
+- Version: 2.10.4 (2020)
- License: FreeType License (BSD-like)
Files extracted from upstream source:
diff --git a/thirdparty/freetype/include/freetype/config/ftconfig.h b/thirdparty/freetype/include/freetype/config/ftconfig.h
index 14eecefc2a..b464e0b789 100644
--- a/thirdparty/freetype/include/freetype/config/ftconfig.h
+++ b/thirdparty/freetype/include/freetype/config/ftconfig.h
@@ -41,533 +41,9 @@
#include FT_CONFIG_OPTIONS_H
#include FT_CONFIG_STANDARD_LIBRARY_H
-
-FT_BEGIN_HEADER
-
-
- /**************************************************************************
- *
- * PLATFORM-SPECIFIC CONFIGURATION MACROS
- *
- * These macros can be toggled to suit a specific system. The current ones
- * are defaults used to compile FreeType in an ANSI C environment (16bit
- * compilers are also supported). Copy this file to your own
- * `builds/<system>` directory, and edit it to port the engine.
- *
- */
-
-
- /* There are systems (like the Texas Instruments 'C54x) where a `char` */
- /* has 16~bits. ANSI~C says that `sizeof(char)` is always~1. Since an */
- /* `int` has 16~bits also for this system, `sizeof(int)` gives~1 which */
- /* is probably unexpected. */
- /* */
- /* `CHAR_BIT` (defined in `limits.h`) gives the number of bits in a */
- /* `char` type. */
-
-#ifndef FT_CHAR_BIT
-#define FT_CHAR_BIT CHAR_BIT
-#endif
-
-
- /* The size of an `int` type. */
-#if FT_UINT_MAX == 0xFFFFUL
-#define FT_SIZEOF_INT ( 16 / FT_CHAR_BIT )
-#elif FT_UINT_MAX == 0xFFFFFFFFUL
-#define FT_SIZEOF_INT ( 32 / FT_CHAR_BIT )
-#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
-#define FT_SIZEOF_INT ( 64 / FT_CHAR_BIT )
-#else
-#error "Unsupported size of `int' type!"
-#endif
-
- /* The size of a `long` type. A five-byte `long` (as used e.g. on the */
- /* DM642) is recognized but avoided. */
-#if FT_ULONG_MAX == 0xFFFFFFFFUL
-#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT )
-#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
-#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT )
-#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
-#define FT_SIZEOF_LONG ( 64 / FT_CHAR_BIT )
-#else
-#error "Unsupported size of `long' type!"
-#endif
-
-
- /* `FT_UNUSED` indicates that a given parameter is not used -- */
- /* this is only used to get rid of unpleasant compiler warnings. */
-#ifndef FT_UNUSED
-#define FT_UNUSED( arg ) ( (arg) = (arg) )
-#endif
-
-
- /**************************************************************************
- *
- * AUTOMATIC CONFIGURATION MACROS
- *
- * These macros are computed from the ones defined above. Don't touch
- * their definition, unless you know precisely what you are doing. No
- * porter should need to mess with them.
- *
- */
-
-
- /**************************************************************************
- *
- * Mac support
- *
- * This is the only necessary change, so it is defined here instead
- * providing a new configuration file.
- */
-#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
- /* No Carbon frameworks for 64bit 10.4.x. */
- /* `AvailabilityMacros.h` is available since Mac OS X 10.2, */
- /* so guess the system version by maximum errno before inclusion. */
-#include <errno.h>
-#ifdef ECANCELED /* defined since 10.2 */
-#include "AvailabilityMacros.h"
-#endif
-#if defined( __LP64__ ) && \
- ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
-#undef FT_MACINTOSH
-#endif
-
-#elif defined( __SC__ ) || defined( __MRC__ )
- /* Classic MacOS compilers */
-#include "ConditionalMacros.h"
-#if TARGET_OS_MAC
-#define FT_MACINTOSH 1
-#endif
-
-#endif
-
-
- /* Fix compiler warning with sgi compiler. */
-#if defined( __sgi ) && !defined( __GNUC__ )
-#if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
-#pragma set woff 3505
-#endif
-#endif
-
-
- /**************************************************************************
- *
- * @section:
- * basic_types
- *
- */
-
-
- /**************************************************************************
- *
- * @type:
- * FT_Int16
- *
- * @description:
- * A typedef for a 16bit signed integer type.
- */
- typedef signed short FT_Int16;
-
-
- /**************************************************************************
- *
- * @type:
- * FT_UInt16
- *
- * @description:
- * A typedef for a 16bit unsigned integer type.
- */
- typedef unsigned short FT_UInt16;
-
- /* */
-
-
- /* this #if 0 ... #endif clause is for documentation purposes */
-#if 0
-
- /**************************************************************************
- *
- * @type:
- * FT_Int32
- *
- * @description:
- * A typedef for a 32bit signed integer type. The size depends on the
- * configuration.
- */
- typedef signed XXX FT_Int32;
-
-
- /**************************************************************************
- *
- * @type:
- * FT_UInt32
- *
- * A typedef for a 32bit unsigned integer type. The size depends on the
- * configuration.
- */
- typedef unsigned XXX FT_UInt32;
-
-
- /**************************************************************************
- *
- * @type:
- * FT_Int64
- *
- * A typedef for a 64bit signed integer type. The size depends on the
- * configuration. Only defined if there is real 64bit support;
- * otherwise, it gets emulated with a structure (if necessary).
- */
- typedef signed XXX FT_Int64;
-
-
- /**************************************************************************
- *
- * @type:
- * FT_UInt64
- *
- * A typedef for a 64bit unsigned integer type. The size depends on the
- * configuration. Only defined if there is real 64bit support;
- * otherwise, it gets emulated with a structure (if necessary).
- */
- typedef unsigned XXX FT_UInt64;
-
- /* */
-
-#endif
-
-#if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT )
-
- typedef signed int FT_Int32;
- typedef unsigned int FT_UInt32;
-
-#elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT )
-
- typedef signed long FT_Int32;
- typedef unsigned long FT_UInt32;
-
-#else
-#error "no 32bit type found -- please check your configuration files"
-#endif
-
-
- /* look up an integer type that is at least 32~bits */
-#if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT )
-
- typedef int FT_Fast;
- typedef unsigned int FT_UFast;
-
-#elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT )
-
- typedef long FT_Fast;
- typedef unsigned long FT_UFast;
-
-#endif
-
-
- /* determine whether we have a 64-bit `int` type for platforms without */
- /* Autoconf */
-#if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT )
-
- /* `FT_LONG64` must be defined if a 64-bit type is available */
-#define FT_LONG64
-#define FT_INT64 long
-#define FT_UINT64 unsigned long
-
- /**************************************************************************
- *
- * A 64-bit data type may create compilation problems if you compile in
- * strict ANSI mode. To avoid them, we disable other 64-bit data types if
- * `__STDC__` is defined. You can however ignore this rule by defining the
- * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro.
- */
-#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
-
-#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
-
-#define FT_LONG64
-#define FT_INT64 long long int
-#define FT_UINT64 unsigned long long int
-
-#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
-
- /* this compiler provides the `__int64` type */
-#define FT_LONG64
-#define FT_INT64 __int64
-#define FT_UINT64 unsigned __int64
-
-#elif defined( __BORLANDC__ ) /* Borland C++ */
-
- /* XXXX: We should probably check the value of `__BORLANDC__` in order */
- /* to test the compiler version. */
-
- /* this compiler provides the `__int64` type */
-#define FT_LONG64
-#define FT_INT64 __int64
-#define FT_UINT64 unsigned __int64
-
-#elif defined( __WATCOMC__ ) /* Watcom C++ */
-
- /* Watcom doesn't provide 64-bit data types */
-
-#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
-
-#define FT_LONG64
-#define FT_INT64 long long int
-#define FT_UINT64 unsigned long long int
-
-#elif defined( __GNUC__ )
-
- /* GCC provides the `long long` type */
-#define FT_LONG64
-#define FT_INT64 long long int
-#define FT_UINT64 unsigned long long int
-
-#endif /* __STDC_VERSION__ >= 199901L */
-
-#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
-
-#ifdef FT_LONG64
- typedef FT_INT64 FT_Int64;
- typedef FT_UINT64 FT_UInt64;
-#endif
-
-
-#ifdef _WIN64
- /* only 64bit Windows uses the LLP64 data model, i.e., */
- /* 32bit integers, 64bit pointers */
-#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x)
-#else
-#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)
-#endif
-
-
- /**************************************************************************
- *
- * miscellaneous
- *
- */
-
-
-#define FT_BEGIN_STMNT do {
-#define FT_END_STMNT } while ( 0 )
-#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
-
-
- /* `typeof` condition taken from gnulib's `intprops.h` header file */
-#if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 ) || \
- ( defined( __IBMC__ ) && __IBMC__ >= 1210 && \
- defined( __IBM__TYPEOF__ ) ) || \
- ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) )
-#define FT_TYPEOF( type ) ( __typeof__ ( type ) )
-#else
-#define FT_TYPEOF( type ) /* empty */
-#endif
-
-
- /* Use `FT_LOCAL` and `FT_LOCAL_DEF` to declare and define, */
- /* respectively, a function that gets used only within the scope of a */
- /* module. Normally, both the header and source code files for such a */
- /* function are within a single module directory. */
- /* */
- /* Intra-module arrays should be tagged with `FT_LOCAL_ARRAY` and */
- /* `FT_LOCAL_ARRAY_DEF`. */
- /* */
-#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
-
-#define FT_LOCAL( x ) static x
-#define FT_LOCAL_DEF( x ) static x
-
-#else
-
-#ifdef __cplusplus
-#define FT_LOCAL( x ) extern "C" x
-#define FT_LOCAL_DEF( x ) extern "C" x
-#else
-#define FT_LOCAL( x ) extern x
-#define FT_LOCAL_DEF( x ) x
-#endif
-
-#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
-
-#define FT_LOCAL_ARRAY( x ) extern const x
-#define FT_LOCAL_ARRAY_DEF( x ) const x
-
-
- /* Use `FT_BASE` and `FT_BASE_DEF` to declare and define, respectively, */
- /* functions that are used in more than a single module. In the */
- /* current setup this implies that the declaration is in a header file */
- /* in the `include/freetype/internal` directory, and the function body */
- /* is in a file in `src/base`. */
- /* */
-#ifndef FT_BASE
-
-#ifdef __cplusplus
-#define FT_BASE( x ) extern "C" x
-#else
-#define FT_BASE( x ) extern x
-#endif
-
-#endif /* !FT_BASE */
-
-
-#ifndef FT_BASE_DEF
-
-#ifdef __cplusplus
-#define FT_BASE_DEF( x ) x
-#else
-#define FT_BASE_DEF( x ) x
-#endif
-
-#endif /* !FT_BASE_DEF */
-
-
- /* When compiling FreeType as a DLL or DSO with hidden visibility */
- /* some systems/compilers need a special attribute in front OR after */
- /* the return type of function declarations. */
- /* */
- /* Two macros are used within the FreeType source code to define */
- /* exported library functions: `FT_EXPORT` and `FT_EXPORT_DEF`. */
- /* */
- /* - `FT_EXPORT( return_type )` */
- /* */
- /* is used in a function declaration, as in */
- /* */
- /* ``` */
- /* FT_EXPORT( FT_Error ) */
- /* FT_Init_FreeType( FT_Library* alibrary ); */
- /* ``` */
- /* */
- /* - `FT_EXPORT_DEF( return_type )` */
- /* */
- /* is used in a function definition, as in */
- /* */
- /* ``` */
- /* FT_EXPORT_DEF( FT_Error ) */
- /* FT_Init_FreeType( FT_Library* alibrary ) */
- /* { */
- /* ... some code ... */
- /* return FT_Err_Ok; */
- /* } */
- /* ``` */
- /* */
- /* You can provide your own implementation of `FT_EXPORT` and */
- /* `FT_EXPORT_DEF` here if you want. */
- /* */
- /* To export a variable, use `FT_EXPORT_VAR`. */
- /* */
-#ifndef FT_EXPORT
-
-#ifdef FT2_BUILD_LIBRARY
-
-#if defined( _WIN32 ) && defined( DLL_EXPORT )
-#define FT_EXPORT( x ) __declspec( dllexport ) x
-#elif defined( __GNUC__ ) && __GNUC__ >= 4
-#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x
-#elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550
-#define FT_EXPORT( x ) __global x
-#elif defined( __cplusplus )
-#define FT_EXPORT( x ) extern "C" x
-#else
-#define FT_EXPORT( x ) extern x
-#endif
-
-#else
-
-#if defined( _WIN32 ) && defined( DLL_IMPORT )
-#define FT_EXPORT( x ) __declspec( dllimport ) x
-#elif defined( __cplusplus )
-#define FT_EXPORT( x ) extern "C" x
-#else
-#define FT_EXPORT( x ) extern x
-#endif
-
-#endif
-
-#endif /* !FT_EXPORT */
-
-
-#ifndef FT_EXPORT_DEF
-
-#ifdef __cplusplus
-#define FT_EXPORT_DEF( x ) extern "C" x
-#else
-#define FT_EXPORT_DEF( x ) extern x
-#endif
-
-#endif /* !FT_EXPORT_DEF */
-
-
-#ifndef FT_EXPORT_VAR
-
-#ifdef __cplusplus
-#define FT_EXPORT_VAR( x ) extern "C" x
-#else
-#define FT_EXPORT_VAR( x ) extern x
-#endif
-
-#endif /* !FT_EXPORT_VAR */
-
-
- /* The following macros are needed to compile the library with a */
- /* C++ compiler and with 16bit compilers. */
- /* */
-
- /* This is special. Within C++, you must specify `extern "C"` for */
- /* functions which are used via function pointers, and you also */
- /* must do that for structures which contain function pointers to */
- /* assure C linkage -- it's not possible to have (local) anonymous */
- /* functions which are accessed by (global) function pointers. */
- /* */
- /* */
- /* FT_CALLBACK_DEF is used to _define_ a callback function, */
- /* located in the same source code file as the structure that uses */
- /* it. */
- /* */
- /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */
- /* and define a callback function, respectively, in a similar way */
- /* as FT_BASE and FT_BASE_DEF work. */
- /* */
- /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
- /* contains pointers to callback functions. */
- /* */
- /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
- /* that contains pointers to callback functions. */
- /* */
- /* */
- /* Some 16bit compilers have to redefine these macros to insert */
- /* the infamous `_cdecl` or `__fastcall` declarations. */
- /* */
-#ifndef FT_CALLBACK_DEF
-#ifdef __cplusplus
-#define FT_CALLBACK_DEF( x ) extern "C" x
-#else
-#define FT_CALLBACK_DEF( x ) static x
-#endif
-#endif /* FT_CALLBACK_DEF */
-
-#ifndef FT_BASE_CALLBACK
-#ifdef __cplusplus
-#define FT_BASE_CALLBACK( x ) extern "C" x
-#define FT_BASE_CALLBACK_DEF( x ) extern "C" x
-#else
-#define FT_BASE_CALLBACK( x ) extern x
-#define FT_BASE_CALLBACK_DEF( x ) x
-#endif
-#endif /* FT_BASE_CALLBACK */
-
-#ifndef FT_CALLBACK_TABLE
-#ifdef __cplusplus
-#define FT_CALLBACK_TABLE extern "C"
-#define FT_CALLBACK_TABLE_DEF extern "C"
-#else
-#define FT_CALLBACK_TABLE extern
-#define FT_CALLBACK_TABLE_DEF /* nothing */
-#endif
-#endif /* FT_CALLBACK_TABLE */
-
-
-FT_END_HEADER
-
+#include <freetype/config/integer-types.h>
+#include <freetype/config/public-macros.h>
+#include <freetype/config/mac-support.h>
#endif /* FTCONFIG_H_ */
diff --git a/thirdparty/freetype/include/freetype/config/ftheader.h b/thirdparty/freetype/include/freetype/config/ftheader.h
index e91598e207..28b5cc60cf 100644
--- a/thirdparty/freetype/include/freetype/config/ftheader.h
+++ b/thirdparty/freetype/include/freetype/config/ftheader.h
@@ -30,10 +30,12 @@
/* encapsulated in an `extern "C" { .. }` block when included from a */
/* C++ compiler. */
/* */
-#ifdef __cplusplus
-#define FT_BEGIN_HEADER extern "C" {
-#else
-#define FT_BEGIN_HEADER /* nothing */
+#ifndef FT_BEGIN_HEADER
+# ifdef __cplusplus
+# define FT_BEGIN_HEADER extern "C" {
+# else
+# define FT_BEGIN_HEADER /* nothing */
+# endif
#endif
@@ -48,10 +50,12 @@
/* encapsulated in an `extern "C" { .. }` block when included from a */
/* C++ compiler. */
/* */
-#ifdef __cplusplus
-#define FT_END_HEADER }
-#else
-#define FT_END_HEADER /* nothing */
+#ifndef FT_END_HEADER
+# ifdef __cplusplus
+# define FT_END_HEADER }
+# else
+# define FT_END_HEADER /* nothing */
+# endif
#endif
@@ -73,9 +77,16 @@
* Macro definitions used to `#include` specific header files.
*
* @description:
- * The following macros are defined to the name of specific FreeType~2
- * header files. They can be used directly in `#include` statements as
- * in:
+ * In addition to the normal scheme of including header files like
+ *
+ * ```
+ * #include <freetype/freetype.h>
+ * #include <freetype/ftmm.h>
+ * #include <freetype/ftglyph.h>
+ * ```
+ *
+ * it is possible to used named macros instead. They can be used
+ * directly in `#include` statements as in
*
* ```
* #include FT_FREETYPE_H
@@ -83,13 +94,9 @@
* #include FT_GLYPH_H
* ```
*
- * There are several reasons why we are now using macros to name public
- * header files. The first one is that such macros are not limited to
- * the infamous 8.3~naming rule required by DOS (and
- * `FT_MULTIPLE_MASTERS_H` is a lot more meaningful than `ftmm.h`).
- *
- * The second reason is that it allows for more flexibility in the way
- * FreeType~2 is installed on a given system.
+ * These macros were introduced to overcome the infamous 8.3~naming rule
+ * required by DOS (and `FT_MULTIPLE_MASTERS_H` is a lot more meaningful
+ * than `ftmm.h`).
*
*/
@@ -797,16 +804,19 @@
#define FT_CACHE_INTERNAL_IMAGE_H FT_CACHE_H
#define FT_CACHE_INTERNAL_SBITS_H FT_CACHE_H
-
- /*
- * Include internal headers definitions from `<internal/...>` only when
- * building the library.
- */
+/* TODO(david): Move this section below to a different header */
#ifdef FT2_BUILD_LIBRARY
-#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
-#include FT_INTERNAL_INTERNAL_H
-#endif /* FT2_BUILD_LIBRARY */
+#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
+ /* We disable the warning `conditional expression is constant' here */
+ /* in order to compile cleanly with the maximum level of warnings. */
+ /* In particular, the warning complains about stuff like `while(0)' */
+ /* which is very useful in macro definitions. There is no benefit */
+ /* in having it enabled. */
+#pragma warning( disable : 4127 )
+
+#endif /* _MSC_VER */
+#endif /* FT2_BUILD_LIBRARY */
#endif /* FTHEADER_H_ */
diff --git a/thirdparty/freetype/include/freetype/config/ftmodule.h b/thirdparty/freetype/include/freetype/config/ftmodule.h
index 7c603e5327..b5c4b1ee58 100644
--- a/thirdparty/freetype/include/freetype/config/ftmodule.h
+++ b/thirdparty/freetype/include/freetype/config/ftmodule.h
@@ -25,8 +25,6 @@ FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
-FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
-FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
/* EOF */
diff --git a/thirdparty/freetype/include/freetype/config/ftoption.h b/thirdparty/freetype/include/freetype/config/ftoption.h
index 426806d2e4..097f19b8a5 100644
--- a/thirdparty/freetype/include/freetype/config/ftoption.h
+++ b/thirdparty/freetype/include/freetype/config/ftoption.h
@@ -42,7 +42,7 @@ FT_BEGIN_HEADER
* the name of a directory that is included _before_ the FreeType include
* path during compilation.
*
- * The default FreeType Makefiles and Jamfiles use the build directory
+ * The default FreeType Makefiles use the build directory
* `builds/<system>` by default, but you can easily change that for your
* own projects.
*
@@ -121,10 +121,8 @@ FT_BEGIN_HEADER
* mitigate color fringes inherent to this technology, you also need to
* explicitly set up LCD filtering.
*
- * Note that this feature is covered by several Microsoft patents and
- * should not be activated in any default build of the library. When this
- * macro is not defined, FreeType offers alternative LCD rendering
- * technology that produces excellent output without LCD filtering.
+ * When this macro is not defined, FreeType offers alternative LCD
+ * rendering technology that produces excellent output.
*/
/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
@@ -542,7 +540,7 @@ FT_BEGIN_HEADER
/**************************************************************************
*
- * Define `TT_CONFIG_OPTION_COLOR_LAYERS` if you want to support coloured
+ * Define `TT_CONFIG_OPTION_COLOR_LAYERS` if you want to support colored
* outlines (from the 'COLR'/'CPAL' tables) in all formats using the 'sfnt'
* module (namely TrueType~& OpenType).
*/
diff --git a/thirdparty/freetype/include/freetype/config/integer-types.h b/thirdparty/freetype/include/freetype/config/integer-types.h
new file mode 100644
index 0000000000..a0ca0c95e2
--- /dev/null
+++ b/thirdparty/freetype/include/freetype/config/integer-types.h
@@ -0,0 +1,245 @@
+/****************************************************************************
+ *
+ * config/integer-types.h
+ *
+ * FreeType integer types definitions.
+ *
+ * Copyright (C) 1996-2020 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
+#ifndef FREETYPE_CONFIG_INTEGER_TYPES_H_
+#define FREETYPE_CONFIG_INTEGER_TYPES_H_
+
+ /* There are systems (like the Texas Instruments 'C54x) where a `char` */
+ /* has 16~bits. ANSI~C says that `sizeof(char)` is always~1. Since an */
+ /* `int` has 16~bits also for this system, `sizeof(int)` gives~1 which */
+ /* is probably unexpected. */
+ /* */
+ /* `CHAR_BIT` (defined in `limits.h`) gives the number of bits in a */
+ /* `char` type. */
+
+#ifndef FT_CHAR_BIT
+#define FT_CHAR_BIT CHAR_BIT
+#endif
+
+#ifndef FT_SIZEOF_INT
+
+ /* The size of an `int` type. */
+#if FT_UINT_MAX == 0xFFFFUL
+#define FT_SIZEOF_INT ( 16 / FT_CHAR_BIT )
+#elif FT_UINT_MAX == 0xFFFFFFFFUL
+#define FT_SIZEOF_INT ( 32 / FT_CHAR_BIT )
+#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
+#define FT_SIZEOF_INT ( 64 / FT_CHAR_BIT )
+#else
+#error "Unsupported size of `int' type!"
+#endif
+
+#endif /* !defined(FT_SIZEOF_INT) */
+
+#ifndef FT_SIZEOF_LONG
+
+ /* The size of a `long` type. A five-byte `long` (as used e.g. on the */
+ /* DM642) is recognized but avoided. */
+#if FT_ULONG_MAX == 0xFFFFFFFFUL
+#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT )
+#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
+#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT )
+#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
+#define FT_SIZEOF_LONG ( 64 / FT_CHAR_BIT )
+#else
+#error "Unsupported size of `long' type!"
+#endif
+
+#endif /* !defined(FT_SIZEOF_LONG) */
+
+ /**************************************************************************
+ *
+ * @section:
+ * basic_types
+ *
+ */
+
+
+ /**************************************************************************
+ *
+ * @type:
+ * FT_Int16
+ *
+ * @description:
+ * A typedef for a 16bit signed integer type.
+ */
+ typedef signed short FT_Int16;
+
+
+ /**************************************************************************
+ *
+ * @type:
+ * FT_UInt16
+ *
+ * @description:
+ * A typedef for a 16bit unsigned integer type.
+ */
+ typedef unsigned short FT_UInt16;
+
+ /* */
+
+
+ /* this #if 0 ... #endif clause is for documentation purposes */
+#if 0
+
+ /**************************************************************************
+ *
+ * @type:
+ * FT_Int32
+ *
+ * @description:
+ * A typedef for a 32bit signed integer type. The size depends on the
+ * configuration.
+ */
+ typedef signed XXX FT_Int32;
+
+
+ /**************************************************************************
+ *
+ * @type:
+ * FT_UInt32
+ *
+ * A typedef for a 32bit unsigned integer type. The size depends on the
+ * configuration.
+ */
+ typedef unsigned XXX FT_UInt32;
+
+
+ /**************************************************************************
+ *
+ * @type:
+ * FT_Int64
+ *
+ * A typedef for a 64bit signed integer type. The size depends on the
+ * configuration. Only defined if there is real 64bit support;
+ * otherwise, it gets emulated with a structure (if necessary).
+ */
+ typedef signed XXX FT_Int64;
+
+
+ /**************************************************************************
+ *
+ * @type:
+ * FT_UInt64
+ *
+ * A typedef for a 64bit unsigned integer type. The size depends on the
+ * configuration. Only defined if there is real 64bit support;
+ * otherwise, it gets emulated with a structure (if necessary).
+ */
+ typedef unsigned XXX FT_UInt64;
+
+ /* */
+
+#endif
+
+#if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT )
+
+ typedef signed int FT_Int32;
+ typedef unsigned int FT_UInt32;
+
+#elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT )
+
+ typedef signed long FT_Int32;
+ typedef unsigned long FT_UInt32;
+
+#else
+#error "no 32bit type found -- please check your configuration files"
+#endif
+
+
+ /* look up an integer type that is at least 32~bits */
+#if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT )
+
+ typedef int FT_Fast;
+ typedef unsigned int FT_UFast;
+
+#elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT )
+
+ typedef long FT_Fast;
+ typedef unsigned long FT_UFast;
+
+#endif
+
+
+ /* determine whether we have a 64-bit `int` type for platforms without */
+ /* Autoconf */
+#if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT )
+
+ /* `FT_LONG64` must be defined if a 64-bit type is available */
+#define FT_LONG64
+#define FT_INT64 long
+#define FT_UINT64 unsigned long
+
+ /**************************************************************************
+ *
+ * A 64-bit data type may create compilation problems if you compile in
+ * strict ANSI mode. To avoid them, we disable other 64-bit data types if
+ * `__STDC__` is defined. You can however ignore this rule by defining the
+ * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro.
+ */
+#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
+
+#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
+
+#define FT_LONG64
+#define FT_INT64 long long int
+#define FT_UINT64 unsigned long long int
+
+#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
+
+ /* this compiler provides the `__int64` type */
+#define FT_LONG64
+#define FT_INT64 __int64
+#define FT_UINT64 unsigned __int64
+
+#elif defined( __BORLANDC__ ) /* Borland C++ */
+
+ /* XXXX: We should probably check the value of `__BORLANDC__` in order */
+ /* to test the compiler version. */
+
+ /* this compiler provides the `__int64` type */
+#define FT_LONG64
+#define FT_INT64 __int64
+#define FT_UINT64 unsigned __int64
+
+#elif defined( __WATCOMC__ ) /* Watcom C++ */
+
+ /* Watcom doesn't provide 64-bit data types */
+
+#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
+
+#define FT_LONG64
+#define FT_INT64 long long int
+#define FT_UINT64 unsigned long long int
+
+#elif defined( __GNUC__ )
+
+ /* GCC provides the `long long` type */
+#define FT_LONG64
+#define FT_INT64 long long int
+#define FT_UINT64 unsigned long long int
+
+#endif /* __STDC_VERSION__ >= 199901L */
+
+#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
+
+#ifdef FT_LONG64
+ typedef FT_INT64 FT_Int64;
+ typedef FT_UINT64 FT_UInt64;
+#endif
+
+
+#endif /* FREETYPE_CONFIG_INTEGER_TYPES_H_ */
diff --git a/thirdparty/freetype/include/freetype/config/mac-support.h b/thirdparty/freetype/include/freetype/config/mac-support.h
new file mode 100644
index 0000000000..94867088e9
--- /dev/null
+++ b/thirdparty/freetype/include/freetype/config/mac-support.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+ *
+ * config/mac-support.h
+ *
+ * Mac/OS X support configuration header.
+ *
+ * Copyright (C) 1996-2020 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
+#ifndef FREETYPE_CONFIG_MAC_SUPPORT_H_
+#define FREETYPE_CONFIG_MAC_SUPPORT_H_
+
+ /**************************************************************************
+ *
+ * Mac support
+ *
+ * This is the only necessary change, so it is defined here instead
+ * providing a new configuration file.
+ */
+#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
+ /* No Carbon frameworks for 64bit 10.4.x. */
+ /* `AvailabilityMacros.h` is available since Mac OS X 10.2, */
+ /* so guess the system version by maximum errno before inclusion. */
+#include <errno.h>
+#ifdef ECANCELED /* defined since 10.2 */
+#include "AvailabilityMacros.h"
+#endif
+#if defined( __LP64__ ) && \
+ ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
+#undef FT_MACINTOSH
+#endif
+
+#elif defined( __SC__ ) || defined( __MRC__ )
+ /* Classic MacOS compilers */
+#include "ConditionalMacros.h"
+#if TARGET_OS_MAC
+#define FT_MACINTOSH 1
+#endif
+
+#endif /* Mac support */
+
+#endif /* FREETYPE_CONFIG_MAC_SUPPORT_H_ */
diff --git a/thirdparty/freetype/include/freetype/config/public-macros.h b/thirdparty/freetype/include/freetype/config/public-macros.h
new file mode 100644
index 0000000000..6aa673e807
--- /dev/null
+++ b/thirdparty/freetype/include/freetype/config/public-macros.h
@@ -0,0 +1,120 @@
+/****************************************************************************
+ *
+ * config/public-macros.h
+ *
+ * Define a set of compiler macros used in public FreeType headers.
+ *
+ * Copyright (C) 2020 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
+
+ /*
+ * The definitions in this file are used by the public FreeType headers
+ * and thus should be considered part of the public API.
+ *
+ * Other compiler-specific macro definitions that are not exposed by the
+ * FreeType API should go into
+ * `include/freetype/internal/compiler-macros.h` instead.
+ */
+#ifndef FREETYPE_CONFIG_PUBLIC_MACROS_H_
+#define FREETYPE_CONFIG_PUBLIC_MACROS_H_
+
+ /*
+ * `FT_BEGIN_HEADER` and `FT_END_HEADER` might have already been defined
+ * by `freetype/config/ftheader.h`, but we don't want to include this
+ * header here, so redefine the macros here only when needed. Their
+ * definition is very stable, so keeping them in sync with the ones in the
+ * header should not be a maintenance issue.
+ */
+#ifndef FT_BEGIN_HEADER
+#ifdef __cplusplus
+#define FT_BEGIN_HEADER extern "C" {
+#else
+#define FT_BEGIN_HEADER /* empty */
+#endif
+#endif /* FT_BEGIN_HEADER */
+
+#ifndef FT_END_HEADER
+#ifdef __cplusplus
+#define FT_END_HEADER }
+#else
+#define FT_END_HEADER /* empty */
+#endif
+#endif /* FT_END_HEADER */
+
+
+FT_BEGIN_HEADER
+
+ /*
+ * Mark a function declaration as public. This ensures it will be
+ * properly exported to client code. Place this before a function
+ * declaration.
+ *
+ * NOTE: This macro should be considered an internal implementation
+ * detail, and not part of the FreeType API. It is only defined here
+ * because it is needed by `FT_EXPORT`.
+ */
+
+ /* Visual C, mingw */
+#if defined( _WIN32 )
+
+#if defined( FT2_BUILD_LIBRARY ) && defined( DLL_EXPORT )
+#define FT_PUBLIC_FUNCTION_ATTRIBUTE __declspec( dllexport )
+#elif defined( DLL_IMPORT )
+#define FT_PUBLIC_FUNCTION_ATTRIBUTE __declspec( dllimport )
+#endif
+
+ /* gcc, clang */
+#elif ( defined( __GNUC__ ) && __GNUC__ >= 4 ) || defined( __clang__ )
+#define FT_PUBLIC_FUNCTION_ATTRIBUTE \
+ __attribute__(( visibility( "default" ) ))
+
+ /* Sun */
+#elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550
+#define FT_PUBLIC_FUNCTION_ATTRIBUTE __global
+#endif
+
+
+#ifndef FT_PUBLIC_FUNCTION_ATTRIBUTE
+#define FT_PUBLIC_FUNCTION_ATTRIBUTE /* empty */
+#endif
+
+
+ /*
+ * Define a public FreeType API function. This ensures it is properly
+ * exported or imported at build time. The macro parameter is the
+ * function's return type as in:
+ *
+ * FT_EXPORT( FT_Bool )
+ * FT_Object_Method( FT_Object obj,
+ * ... );
+ *
+ * NOTE: This requires that all `FT_EXPORT` uses are inside
+ * `FT_BEGIN_HEADER ... FT_END_HEADER` blocks. This guarantees that the
+ * functions are exported with C linkage, even when the header is included
+ * by a C++ source file.
+ */
+#define FT_EXPORT( x ) FT_PUBLIC_FUNCTION_ATTRIBUTE extern x
+
+ /*
+ * `FT_UNUSED` indicates that a given parameter is not used -- this is
+ * only used to get rid of unpleasant compiler warnings.
+ *
+ * Technically, this was not meant to be part of the public API, but some
+ * third-party code depends on it.
+ */
+#ifndef FT_UNUSED
+#define FT_UNUSED( arg ) ( (arg) = (arg) )
+#endif
+
+
+FT_END_HEADER
+
+#endif /* FREETYPE_CONFIG_PUBLIC_MACROS_H_ */
diff --git a/thirdparty/freetype/include/freetype/freetype.h b/thirdparty/freetype/include/freetype/freetype.h
index 973264b125..be191f5aa0 100644
--- a/thirdparty/freetype/include/freetype/freetype.h
+++ b/thirdparty/freetype/include/freetype/freetype.h
@@ -20,19 +20,10 @@
#define FREETYPE_H_
-#ifndef FT_FREETYPE_H
-#error "`ft2build.h' hasn't been included yet!"
-#error "Please always use macros to include FreeType header files."
-#error "Example:"
-#error " #include <ft2build.h>"
-#error " #include FT_FREETYPE_H"
-#endif
-
-
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
-#include FT_TYPES_H
-#include FT_ERRORS_H
+#include <freetype/fttypes.h>
+#include <freetype/fterrors.h>
FT_BEGIN_HEADER
@@ -51,22 +42,15 @@ FT_BEGIN_HEADER
* How client applications should include FreeType header files.
*
* @description:
- * To be as flexible as possible (and for historical reasons), FreeType
- * uses a very special inclusion scheme to load header files, for example
+ * To be as flexible as possible (and for historical reasons), you must
+ * load file `ft2build.h` first before other header files, for example
*
* ```
* #include <ft2build.h>
*
- * #include FT_FREETYPE_H
- * #include FT_OUTLINE_H
+ * #include <freetype/freetype.h>
+ * #include <freetype/ftoutln.h>
* ```
- *
- * A compiler and its preprocessor only needs an include path to find the
- * file `ft2build.h`; the exact locations and names of the other FreeType
- * header files are hidden by @header_file_macros, loaded by
- * `ft2build.h`. The API documentation always gives the header macro
- * name needed for a particular function.
- *
*/
@@ -974,6 +958,9 @@ FT_BEGIN_HEADER
* Note that the bounding box might be off by (at least) one pixel for
* hinted fonts. See @FT_Size_Metrics for further discussion.
*
+ * Note that the bounding box does not vary in OpenType variable fonts
+ * and should only be used in relation to the default instance.
+ *
* units_per_EM ::
* The number of font units per EM square for this face. This is
* typically 2048 for TrueType fonts, and 1000 for Type~1 fonts. Only
@@ -3188,6 +3175,12 @@ FT_BEGIN_HEADER
* A pointer to the translation vector. Use `NULL` for the null vector.
*
* @note:
+ * This function is provided as a convenience, but keep in mind that
+ * @FT_Matrix coefficients are only 16.16 fixed point values, which can
+ * limit the accuracy of the results. Using floating-point computations
+ * to perform the transform directly in client code instead will always
+ * yield better numbers.
+ *
* The transformation is only applied to scalable image formats after the
* glyph has been loaded. It means that hinting is unaltered by the
* transformation and is performed on the character size given in the
@@ -3246,14 +3239,6 @@ FT_BEGIN_HEADER
* pixels and use the @FT_PIXEL_MODE_LCD_V mode.
*
* @note:
- * Should you define `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` in your
- * `ftoption.h`, which enables patented ClearType-style rendering, the
- * LCD-optimized glyph bitmaps should be filtered to reduce color fringes
- * inherent to this technology. You can either set up LCD filtering with
- * @FT_Library_SetLcdFilter or @FT_Face_Properties, or do the filtering
- * yourself. The default FreeType LCD rendering technology does not
- * require filtering.
- *
* The selected render mode only affects vector glyphs of a font.
* Embedded bitmaps often have a different pixel mode like
* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform them
@@ -4089,7 +4074,7 @@ FT_BEGIN_HEADER
* https://docs.microsoft.com/en-us/typography/opentype/spec/colr
*
* The glyph layer data for a given glyph index, if present, provides an
- * alternative, multi-colour glyph representation: Instead of rendering
+ * alternative, multi-color glyph representation: Instead of rendering
* the outline or bitmap with the given glyph index, glyphs with the
* indices and colors returned by this function are rendered layer by
* layer.
@@ -4782,7 +4767,7 @@ FT_BEGIN_HEADER
*/
#define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 10
-#define FREETYPE_PATCH 2
+#define FREETYPE_PATCH 4
/**************************************************************************
diff --git a/thirdparty/freetype/include/freetype/ftadvanc.h b/thirdparty/freetype/include/freetype/ftadvanc.h
index c30472bfdb..f166bc6f99 100644
--- a/thirdparty/freetype/include/freetype/ftadvanc.h
+++ b/thirdparty/freetype/include/freetype/ftadvanc.h
@@ -20,8 +20,7 @@
#define FTADVANC_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
@@ -96,6 +95,7 @@ FT_BEGIN_HEADER
* load_flags ::
* A set of bit flags similar to those used when calling
* @FT_Load_Glyph, used to determine what kind of advances you need.
+ *
* @output:
* padvance ::
* The advance value. If scaling is performed (based on the value of
diff --git a/thirdparty/freetype/include/freetype/ftbbox.h b/thirdparty/freetype/include/freetype/ftbbox.h
index 294f996976..fda1ad94a5 100644
--- a/thirdparty/freetype/include/freetype/ftbbox.h
+++ b/thirdparty/freetype/include/freetype/ftbbox.h
@@ -31,8 +31,7 @@
#define FTBBOX_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftbdf.h b/thirdparty/freetype/include/freetype/ftbdf.h
index 61db27c8f8..2e1daeeaaf 100644
--- a/thirdparty/freetype/include/freetype/ftbdf.h
+++ b/thirdparty/freetype/include/freetype/ftbdf.h
@@ -19,8 +19,7 @@
#ifndef FTBDF_H_
#define FTBDF_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftbitmap.h b/thirdparty/freetype/include/freetype/ftbitmap.h
index 6c55455767..282c22e1cf 100644
--- a/thirdparty/freetype/include/freetype/ftbitmap.h
+++ b/thirdparty/freetype/include/freetype/ftbitmap.h
@@ -20,9 +20,8 @@
#define FTBITMAP_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_COLOR_H
+#include <freetype/freetype.h>
+#include <freetype/ftcolor.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftbzip2.h b/thirdparty/freetype/include/freetype/ftbzip2.h
index cb8e8458ef..eb6a5a55d1 100644
--- a/thirdparty/freetype/include/freetype/ftbzip2.h
+++ b/thirdparty/freetype/include/freetype/ftbzip2.h
@@ -19,8 +19,7 @@
#ifndef FTBZIP2_H_
#define FTBZIP2_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
@@ -43,6 +42,16 @@ FT_BEGIN_HEADER
* Using bzip2-compressed font files.
*
* @description:
+ * In certain builds of the library, bzip2 compression recognition is
+ * automatically handled when calling @FT_New_Face or @FT_Open_Face.
+ * This means that if no font driver is capable of handling the raw
+ * compressed file, the library will try to open a bzip2 compressed
+ * stream from it and re-open the face with it.
+ *
+ * The stream implementation is very basic and resets the decompression
+ * process each time seeking backwards is needed within the stream,
+ * which significantly undermines the performance.
+ *
* This section contains the declaration of Bzip2-specific functions.
*
*/
@@ -75,15 +84,6 @@ FT_BEGIN_HEADER
* **not** call `FT_Stream_Close` on the source stream. None of the
* stream objects will be released to the heap.
*
- * The stream implementation is very basic and resets the decompression
- * process each time seeking backwards is needed within the stream.
- *
- * In certain builds of the library, bzip2 compression recognition is
- * automatically handled when calling @FT_New_Face or @FT_Open_Face.
- * This means that if no font driver is capable of handling the raw
- * compressed file, the library will try to open a bzip2 compressed
- * stream from it and re-open the face with it.
- *
* This function may return `FT_Err_Unimplemented_Feature` if your build
* of FreeType was not compiled with bzip2 support.
*/
diff --git a/thirdparty/freetype/include/freetype/ftcache.h b/thirdparty/freetype/include/freetype/ftcache.h
index d82c4815cf..6047275205 100644
--- a/thirdparty/freetype/include/freetype/ftcache.h
+++ b/thirdparty/freetype/include/freetype/ftcache.h
@@ -20,8 +20,7 @@
#define FTCACHE_H_
-#include <ft2build.h>
-#include FT_GLYPH_H
+#include <freetype/ftglyph.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/ftcid.h b/thirdparty/freetype/include/freetype/ftcid.h
index 85b74e0047..a29fb33306 100644
--- a/thirdparty/freetype/include/freetype/ftcid.h
+++ b/thirdparty/freetype/include/freetype/ftcid.h
@@ -19,8 +19,7 @@
#ifndef FTCID_H_
#define FTCID_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftcolor.h b/thirdparty/freetype/include/freetype/ftcolor.h
index b744939dd8..ecc6485e5a 100644
--- a/thirdparty/freetype/include/freetype/ftcolor.h
+++ b/thirdparty/freetype/include/freetype/ftcolor.h
@@ -19,8 +19,7 @@
#ifndef FTCOLOR_H_
#define FTCOLOR_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftdriver.h b/thirdparty/freetype/include/freetype/ftdriver.h
index 19b666ecb0..804ec34a39 100644
--- a/thirdparty/freetype/include/freetype/ftdriver.h
+++ b/thirdparty/freetype/include/freetype/ftdriver.h
@@ -19,9 +19,8 @@
#ifndef FTDRIVER_H_
#define FTDRIVER_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_PARAMETER_TAGS_H
+#include <freetype/freetype.h>
+#include <freetype/ftparams.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
@@ -427,10 +426,6 @@ FT_BEGIN_HEADER
* counteracts the 'thinning out' of glyphs, making text remain readable
* at smaller sizes.
*
- * By default, the Adobe engines for CFF, Type~1, and CID fonts darken
- * stems at smaller sizes, regardless of hinting, to enhance contrast.
- * Setting this property, stem darkening gets switched off.
- *
* For the auto-hinter, stem-darkening is experimental currently and thus
* switched off by default (this is, `no-stem-darkening` is set to TRUE
* by default). Total consistency with the CFF driver is not achieved
diff --git a/thirdparty/freetype/include/freetype/fterrors.h b/thirdparty/freetype/include/freetype/fterrors.h
index 771bc5db52..60a637c77c 100644
--- a/thirdparty/freetype/include/freetype/fterrors.h
+++ b/thirdparty/freetype/include/freetype/fterrors.h
@@ -89,7 +89,7 @@
* const char* err_msg;
* } ft_errors[] =
*
- * #include FT_ERRORS_H
+ * #include <freetype/fterrors.h>
* ```
*
* An alternative to using an array is a switch statement.
@@ -124,7 +124,7 @@
/* include module base error codes */
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
/*******************************************************************/
@@ -197,7 +197,7 @@
/* now include the error codes */
-#include FT_ERROR_DEFINITIONS_H
+#include <freetype/fterrdef.h>
#ifdef FT_ERROR_END_LIST
@@ -232,11 +232,16 @@
#undef FT_ERR_PREFIX
#endif
- /* FT_INCLUDE_ERR_PROTOS: Control if function prototypes should be */
- /* included with `#include FT_ERRORS_H'. This is */
- /* only true where `FT_ERRORDEF` is undefined. */
- /* FT_ERR_PROTOS_DEFINED: Actual multiple-inclusion protection of */
- /* `fterrors.h`. */
+ /* FT_INCLUDE_ERR_PROTOS: Control whether function prototypes should be */
+ /* included with */
+ /* */
+ /* #include <freetype/fterrors.h> */
+ /* */
+ /* This is only true where `FT_ERRORDEF` is */
+ /* undefined. */
+ /* */
+ /* FT_ERR_PROTOS_DEFINED: Actual multiple-inclusion protection of */
+ /* `fterrors.h`. */
#ifdef FT_INCLUDE_ERR_PROTOS
#undef FT_INCLUDE_ERR_PROTOS
diff --git a/thirdparty/freetype/include/freetype/ftfntfmt.h b/thirdparty/freetype/include/freetype/ftfntfmt.h
index ad5a1d4162..f803349cd7 100644
--- a/thirdparty/freetype/include/freetype/ftfntfmt.h
+++ b/thirdparty/freetype/include/freetype/ftfntfmt.h
@@ -19,8 +19,7 @@
#ifndef FTFNTFMT_H_
#define FTFNTFMT_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftgasp.h b/thirdparty/freetype/include/freetype/ftgasp.h
index aca1a1329d..6b76882c74 100644
--- a/thirdparty/freetype/include/freetype/ftgasp.h
+++ b/thirdparty/freetype/include/freetype/ftgasp.h
@@ -19,8 +19,7 @@
#ifndef FTGASP_H_
#define FTGASP_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftglyph.h b/thirdparty/freetype/include/freetype/ftglyph.h
index ec515a3694..704619e3d0 100644
--- a/thirdparty/freetype/include/freetype/ftglyph.h
+++ b/thirdparty/freetype/include/freetype/ftglyph.h
@@ -33,8 +33,7 @@
#define FTGLYPH_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftgxval.h b/thirdparty/freetype/include/freetype/ftgxval.h
index 691a73b94a..354460a9a7 100644
--- a/thirdparty/freetype/include/freetype/ftgxval.h
+++ b/thirdparty/freetype/include/freetype/ftgxval.h
@@ -28,8 +28,7 @@
#ifndef FTGXVAL_H_
#define FTGXVAL_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftgzip.h b/thirdparty/freetype/include/freetype/ftgzip.h
index f588c8503b..ec5939a191 100644
--- a/thirdparty/freetype/include/freetype/ftgzip.h
+++ b/thirdparty/freetype/include/freetype/ftgzip.h
@@ -19,8 +19,7 @@
#ifndef FTGZIP_H_
#define FTGZIP_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
@@ -43,6 +42,16 @@ FT_BEGIN_HEADER
* Using gzip-compressed font files.
*
* @description:
+ * In certain builds of the library, gzip compression recognition is
+ * automatically handled when calling @FT_New_Face or @FT_Open_Face.
+ * This means that if no font driver is capable of handling the raw
+ * compressed file, the library will try to open a gzipped stream from it
+ * and re-open the face with it.
+ *
+ * The stream implementation is very basic and resets the decompression
+ * process each time seeking backwards is needed within the stream,
+ * which significantly undermines the performance.
+ *
* This section contains the declaration of Gzip-specific functions.
*
*/
@@ -75,15 +84,6 @@ FT_BEGIN_HEADER
* **not** call `FT_Stream_Close` on the source stream. None of the
* stream objects will be released to the heap.
*
- * The stream implementation is very basic and resets the decompression
- * process each time seeking backwards is needed within the stream.
- *
- * In certain builds of the library, gzip compression recognition is
- * automatically handled when calling @FT_New_Face or @FT_Open_Face.
- * This means that if no font driver is capable of handling the raw
- * compressed file, the library will try to open a gzipped stream from it
- * and re-open the face with it.
- *
* This function may return `FT_Err_Unimplemented_Feature` if your build
* of FreeType was not compiled with zlib support.
*/
diff --git a/thirdparty/freetype/include/freetype/ftimage.h b/thirdparty/freetype/include/freetype/ftimage.h
index 185967c1b8..74911620d2 100644
--- a/thirdparty/freetype/include/freetype/ftimage.h
+++ b/thirdparty/freetype/include/freetype/ftimage.h
@@ -30,7 +30,6 @@
/* STANDALONE_ is from ftgrays.c */
#ifndef STANDALONE_
-#include <ft2build.h>
#endif
@@ -401,6 +400,13 @@ FT_BEGIN_HEADER
* if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for more
* information.
*
+ * FT_OUTLINE_OVERLAP ::
+ * This flag indicates that this outline contains overlapping contrours
+ * and the anti-aliased renderer should perform oversampling to
+ * mitigate possible artifacts. This flag should _not_ be set for
+ * well designed glyphs without overlaps because it quadruples the
+ * rendering time.
+ *
* FT_OUTLINE_HIGH_PRECISION ::
* This flag indicates that the scan-line converter should try to
* convert this outline to bitmaps with the highest possible quality.
@@ -432,6 +438,7 @@ FT_BEGIN_HEADER
#define FT_OUTLINE_IGNORE_DROPOUTS 0x8
#define FT_OUTLINE_SMART_DROPOUTS 0x10
#define FT_OUTLINE_INCLUDE_STUBS 0x20
+#define FT_OUTLINE_OVERLAP 0x40
#define FT_OUTLINE_HIGH_PRECISION 0x100
#define FT_OUTLINE_SINGLE_PASS 0x200
@@ -1004,20 +1011,26 @@ FT_BEGIN_HEADER
* User-supplied data that is passed to each drawing callback.
*
* clip_box ::
- * An optional clipping box. It is only used in direct rendering mode.
- * Note that coordinates here should be expressed in _integer_ pixels
- * (and not in 26.6 fixed-point units).
+ * An optional span clipping box expressed in _integer_ pixels
+ * (not in 26.6 fixed-point units).
*
* @note:
- * An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA bit
- * flag is set in the `flags` field, otherwise a monochrome bitmap is
- * generated.
- *
- * If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags`, the raster
- * will call the `gray_spans` callback to draw gray pixel spans. This
- * allows direct composition over a pre-existing bitmap through
- * user-provided callbacks to perform the span drawing and composition.
- * Not supported by the monochrome rasterizer.
+ * The @FT_RASTER_FLAG_AA bit flag must be set in the `flags` to
+ * generate an anti-aliased glyph bitmap, otherwise a monochrome bitmap
+ * is generated. The `target` should have appropriate pixel mode and its
+ * dimensions define the clipping region.
+ *
+ * If both @FT_RASTER_FLAG_AA and @FT_RASTER_FLAG_DIRECT bit flags
+ * are set in `flags`, the raster calls an @FT_SpanFunc callback
+ * `gray_spans` with `user` data as an argument ignoring `target`. This
+ * allows direct composition over a pre-existing user surface to perform
+ * the span drawing and composition. To optionally clip the spans, set
+ * the @FT_RASTER_FLAG_CLIP flag and `clip_box`. The monochrome raster
+ * does not support the direct mode.
+ *
+ * The gray-level rasterizer always uses 256 gray levels. If you want
+ * fewer gray levels, you have to use @FT_RASTER_FLAG_DIRECT and reduce
+ * the levels in the callback function.
*/
typedef struct FT_Raster_Params_
{
diff --git a/thirdparty/freetype/include/freetype/ftincrem.h b/thirdparty/freetype/include/freetype/ftincrem.h
index 8c00cfe41c..f67655eda0 100644
--- a/thirdparty/freetype/include/freetype/ftincrem.h
+++ b/thirdparty/freetype/include/freetype/ftincrem.h
@@ -19,9 +19,8 @@
#ifndef FTINCREM_H_
#define FTINCREM_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_PARAMETER_TAGS_H
+#include <freetype/freetype.h>
+#include <freetype/ftparams.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftlcdfil.h b/thirdparty/freetype/include/freetype/ftlcdfil.h
index c5516d0e0d..c6995f2ff7 100644
--- a/thirdparty/freetype/include/freetype/ftlcdfil.h
+++ b/thirdparty/freetype/include/freetype/ftlcdfil.h
@@ -20,9 +20,8 @@
#ifndef FTLCDFIL_H_
#define FTLCDFIL_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_PARAMETER_TAGS_H
+#include <freetype/freetype.h>
+#include <freetype/ftparams.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
@@ -47,7 +46,7 @@ FT_BEGIN_HEADER
* @description:
* FreeType provides two alternative subpixel rendering technologies.
* Should you define `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` in your
- * `ftoption.h` file, this enables patented ClearType-style rendering.
+ * `ftoption.h` file, this enables ClearType-style rendering.
* Otherwise, Harmony LCD rendering is enabled. These technologies are
* controlled differently and API described below, although always
* available, performs its function when appropriate method is enabled
@@ -177,7 +176,7 @@ FT_BEGIN_HEADER
* FT_Library_SetLcdFilter
*
* @description:
- * This function is used to apply color filtering to LCD decimated
+ * This function is used to change filter applied to LCD decimated
* bitmaps, like the ones used when calling @FT_Render_Glyph with
* @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.
*
@@ -196,15 +195,14 @@ FT_BEGIN_HEADER
* FreeType error code. 0~means success.
*
* @note:
- * This feature is always disabled by default. Clients must make an
- * explicit call to this function with a `filter` value other than
- * @FT_LCD_FILTER_NONE in order to enable it.
+ * Since 2.10.3 the LCD filtering is enabled with @FT_LCD_FILTER_DEFAULT.
+ * It is no longer necessary to call this function explicitly except
+ * to choose a different filter or disable filtering altogether with
+ * @FT_LCD_FILTER_NONE.
*
- * Due to **PATENTS** covering subpixel rendering, this function doesn't
- * do anything except returning `FT_Err_Unimplemented_Feature` if the
- * configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is not
- * defined in your build of the library, which should correspond to all
- * default builds of FreeType.
+ * This function does nothing but returns `FT_Err_Unimplemented_Feature`
+ * if the configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is
+ * not defined in your build of the library.
*
* @since:
* 2.3.0
@@ -235,11 +233,9 @@ FT_BEGIN_HEADER
* FreeType error code. 0~means success.
*
* @note:
- * Due to **PATENTS** covering subpixel rendering, this function doesn't
- * do anything except returning `FT_Err_Unimplemented_Feature` if the
- * configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is not
- * defined in your build of the library, which should correspond to all
- * default builds of FreeType.
+ * This function does nothing but returns `FT_Err_Unimplemented_Feature`
+ * if the configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is
+ * not defined in your build of the library.
*
* LCD filter weights can also be set per face using @FT_Face_Properties
* with @FT_PARAM_TAG_LCD_FILTER_WEIGHTS.
diff --git a/thirdparty/freetype/include/freetype/ftlist.h b/thirdparty/freetype/include/freetype/ftlist.h
index 3f6079f243..4588922706 100644
--- a/thirdparty/freetype/include/freetype/ftlist.h
+++ b/thirdparty/freetype/include/freetype/ftlist.h
@@ -28,8 +28,7 @@
#define FTLIST_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftlzw.h b/thirdparty/freetype/include/freetype/ftlzw.h
index 37a53c1b3e..ae46ad6021 100644
--- a/thirdparty/freetype/include/freetype/ftlzw.h
+++ b/thirdparty/freetype/include/freetype/ftlzw.h
@@ -19,8 +19,7 @@
#ifndef FTLZW_H_
#define FTLZW_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
@@ -43,6 +42,16 @@ FT_BEGIN_HEADER
* Using LZW-compressed font files.
*
* @description:
+ * In certain builds of the library, LZW compression recognition is
+ * automatically handled when calling @FT_New_Face or @FT_Open_Face.
+ * This means that if no font driver is capable of handling the raw
+ * compressed file, the library will try to open a LZW stream from it and
+ * re-open the face with it.
+ *
+ * The stream implementation is very basic and resets the decompression
+ * process each time seeking backwards is needed within the stream,
+ * which significantly undermines the performance.
+ *
* This section contains the declaration of LZW-specific functions.
*
*/
@@ -73,15 +82,6 @@ FT_BEGIN_HEADER
* **not** call `FT_Stream_Close` on the source stream. None of the
* stream objects will be released to the heap.
*
- * The stream implementation is very basic and resets the decompression
- * process each time seeking backwards is needed within the stream
- *
- * In certain builds of the library, LZW compression recognition is
- * automatically handled when calling @FT_New_Face or @FT_Open_Face.
- * This means that if no font driver is capable of handling the raw
- * compressed file, the library will try to open a LZW stream from it and
- * re-open the face with it.
- *
* This function may return `FT_Err_Unimplemented_Feature` if your build
* of FreeType was not compiled with LZW support.
*/
diff --git a/thirdparty/freetype/include/freetype/ftmac.h b/thirdparty/freetype/include/freetype/ftmac.h
index c1a0aa373e..c9de981845 100644
--- a/thirdparty/freetype/include/freetype/ftmac.h
+++ b/thirdparty/freetype/include/freetype/ftmac.h
@@ -29,7 +29,6 @@
#define FTMAC_H_
-#include <ft2build.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/ftmm.h b/thirdparty/freetype/include/freetype/ftmm.h
index 0d839942b9..d8781a8296 100644
--- a/thirdparty/freetype/include/freetype/ftmm.h
+++ b/thirdparty/freetype/include/freetype/ftmm.h
@@ -20,8 +20,7 @@
#define FTMM_H_
-#include <ft2build.h>
-#include FT_TYPE1_TABLES_H
+#include <freetype/t1tables.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/ftmodapi.h b/thirdparty/freetype/include/freetype/ftmodapi.h
index 01cb5fba88..3f7ae82bab 100644
--- a/thirdparty/freetype/include/freetype/ftmodapi.h
+++ b/thirdparty/freetype/include/freetype/ftmodapi.h
@@ -20,8 +20,7 @@
#define FTMODAPI_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
@@ -65,7 +64,7 @@ FT_BEGIN_HEADER
* psnames
* raster1
* sfnt
- * smooth, smooth-lcd, smooth-lcdv
+ * smooth
* truetype
* type1
* type42
@@ -486,7 +485,7 @@ FT_BEGIN_HEADER
*
* ```
* FREETYPE_PROPERTIES=truetype:interpreter-version=35 \
- * cff:no-stem-darkening=1 \
+ * cff:no-stem-darkening=0 \
* autofitter:warping=1
* ```
*
diff --git a/thirdparty/freetype/include/freetype/ftmoderr.h b/thirdparty/freetype/include/freetype/ftmoderr.h
index 5e6aeeb43e..f05fc53aa3 100644
--- a/thirdparty/freetype/include/freetype/ftmoderr.h
+++ b/thirdparty/freetype/include/freetype/ftmoderr.h
@@ -94,7 +94,7 @@
* const char* mod_err_msg
* } ft_mod_errors[] =
*
- * #include FT_MODULE_ERRORS_H
+ * #include <freetype/ftmoderr.h>
* ```
*
*/
diff --git a/thirdparty/freetype/include/freetype/ftotval.h b/thirdparty/freetype/include/freetype/ftotval.h
index 6f46c414bd..9c00ad30b9 100644
--- a/thirdparty/freetype/include/freetype/ftotval.h
+++ b/thirdparty/freetype/include/freetype/ftotval.h
@@ -30,8 +30,7 @@
#ifndef FTOTVAL_H_
#define FTOTVAL_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftoutln.h b/thirdparty/freetype/include/freetype/ftoutln.h
index fa295b0ab6..84e9b144c1 100644
--- a/thirdparty/freetype/include/freetype/ftoutln.h
+++ b/thirdparty/freetype/include/freetype/ftoutln.h
@@ -21,8 +21,7 @@
#define FTOUTLN_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
@@ -483,19 +482,13 @@ FT_BEGIN_HEADER
* FreeType error code. 0~means success.
*
* @note:
- * This advanced function uses @FT_Raster_Params as an argument,
- * allowing FreeType rasterizer to be used for direct composition,
- * translucency, etc. You should know how to set up @FT_Raster_Params
- * for this function to work.
- *
+ * This advanced function uses @FT_Raster_Params as an argument.
* The field `params.source` will be set to `outline` before the scan
* converter is called, which means that the value you give to it is
- * actually ignored.
- *
- * The gray-level rasterizer always uses 256 gray levels. If you want
- * less gray levels, you have to provide your own span callback. See the
- * @FT_RASTER_FLAG_DIRECT value of the `flags` field in the
- * @FT_Raster_Params structure for more details.
+ * actually ignored. Either `params.target` must point to preallocated
+ * bitmap, or @FT_RASTER_FLAG_DIRECT must be set in `params.flags`
+ * allowing FreeType rasterizer to be used for direct composition,
+ * translucency, etc. See @FT_Raster_Params for more details.
*/
FT_EXPORT( FT_Error )
FT_Outline_Render( FT_Library library,
diff --git a/thirdparty/freetype/include/freetype/ftparams.h b/thirdparty/freetype/include/freetype/ftparams.h
index 255c6bb160..55ea2a3870 100644
--- a/thirdparty/freetype/include/freetype/ftparams.h
+++ b/thirdparty/freetype/include/freetype/ftparams.h
@@ -19,8 +19,7 @@
#ifndef FTPARAMS_H_
#define FTPARAMS_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftpfr.h b/thirdparty/freetype/include/freetype/ftpfr.h
index 58fbbb78d3..9a5383f918 100644
--- a/thirdparty/freetype/include/freetype/ftpfr.h
+++ b/thirdparty/freetype/include/freetype/ftpfr.h
@@ -19,8 +19,7 @@
#ifndef FTPFR_H_
#define FTPFR_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftrender.h b/thirdparty/freetype/include/freetype/ftrender.h
index 6845111901..8007951b37 100644
--- a/thirdparty/freetype/include/freetype/ftrender.h
+++ b/thirdparty/freetype/include/freetype/ftrender.h
@@ -20,9 +20,8 @@
#define FTRENDER_H_
-#include <ft2build.h>
-#include FT_MODULE_H
-#include FT_GLYPH_H
+#include <freetype/ftmodapi.h>
+#include <freetype/ftglyph.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/ftsizes.h b/thirdparty/freetype/include/freetype/ftsizes.h
index 7dc9295211..a8682a30fb 100644
--- a/thirdparty/freetype/include/freetype/ftsizes.h
+++ b/thirdparty/freetype/include/freetype/ftsizes.h
@@ -29,8 +29,7 @@
#define FTSIZES_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftsnames.h b/thirdparty/freetype/include/freetype/ftsnames.h
index 2982760635..729e6ab069 100644
--- a/thirdparty/freetype/include/freetype/ftsnames.h
+++ b/thirdparty/freetype/include/freetype/ftsnames.h
@@ -23,9 +23,8 @@
#define FTSNAMES_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_PARAMETER_TAGS_H
+#include <freetype/freetype.h>
+#include <freetype/ftparams.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftstroke.h b/thirdparty/freetype/include/freetype/ftstroke.h
index 141af7d0ba..a759c94dde 100644
--- a/thirdparty/freetype/include/freetype/ftstroke.h
+++ b/thirdparty/freetype/include/freetype/ftstroke.h
@@ -19,9 +19,8 @@
#ifndef FTSTROKE_H_
#define FTSTROKE_H_
-#include <ft2build.h>
-#include FT_OUTLINE_H
-#include FT_GLYPH_H
+#include <freetype/ftoutln.h>
+#include <freetype/ftglyph.h>
FT_BEGIN_HEADER
@@ -44,7 +43,7 @@ FT_BEGIN_HEADER
* borders of the stroke.
*
* This can be useful to generate 'bordered' glyph, i.e., glyphs
- * displayed with a coloured (and anti-aliased) border around their
+ * displayed with a colored (and anti-aliased) border around their
* shape.
*
* @order:
diff --git a/thirdparty/freetype/include/freetype/ftsynth.h b/thirdparty/freetype/include/freetype/ftsynth.h
index 3882e69e61..bdb4c5753e 100644
--- a/thirdparty/freetype/include/freetype/ftsynth.h
+++ b/thirdparty/freetype/include/freetype/ftsynth.h
@@ -45,8 +45,7 @@
#define FTSYNTH_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ftsystem.h b/thirdparty/freetype/include/freetype/ftsystem.h
index f7fecb53f3..22aead7140 100644
--- a/thirdparty/freetype/include/freetype/ftsystem.h
+++ b/thirdparty/freetype/include/freetype/ftsystem.h
@@ -20,7 +20,6 @@
#define FTSYSTEM_H_
-#include <ft2build.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/fttrigon.h b/thirdparty/freetype/include/freetype/fttrigon.h
index 968df1fbfd..2ce6b324c9 100644
--- a/thirdparty/freetype/include/freetype/fttrigon.h
+++ b/thirdparty/freetype/include/freetype/fttrigon.h
@@ -19,7 +19,7 @@
#ifndef FTTRIGON_H_
#define FTTRIGON_H_
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/fttypes.h b/thirdparty/freetype/include/freetype/fttypes.h
index cb785d98b2..aaeb9e8785 100644
--- a/thirdparty/freetype/include/freetype/fttypes.h
+++ b/thirdparty/freetype/include/freetype/fttypes.h
@@ -22,8 +22,8 @@
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
-#include FT_SYSTEM_H
-#include FT_IMAGE_H
+#include <freetype/ftsystem.h>
+#include <freetype/ftimage.h>
#include <stddef.h>
diff --git a/thirdparty/freetype/include/freetype/ftwinfnt.h b/thirdparty/freetype/include/freetype/ftwinfnt.h
index bacb8aa373..786528c6ec 100644
--- a/thirdparty/freetype/include/freetype/ftwinfnt.h
+++ b/thirdparty/freetype/include/freetype/ftwinfnt.h
@@ -19,8 +19,7 @@
#ifndef FTWINFNT_H_
#define FTWINFNT_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/internal/autohint.h b/thirdparty/freetype/include/freetype/internal/autohint.h
index 438f9c175e..2a472e20b9 100644
--- a/thirdparty/freetype/include/freetype/internal/autohint.h
+++ b/thirdparty/freetype/include/freetype/internal/autohint.h
@@ -70,8 +70,7 @@
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
FT_BEGIN_HEADER
@@ -208,6 +207,9 @@ FT_BEGIN_HEADER
} FT_AutoHinter_InterfaceRec, *FT_AutoHinter_Interface;
+#define FT_DECLARE_AUTOHINTER_INTERFACE( class_ ) \
+ FT_CALLBACK_TABLE const FT_AutoHinter_InterfaceRec class_;
+
#define FT_DEFINE_AUTOHINTER_INTERFACE( \
class_, \
reset_face_, \
diff --git a/thirdparty/freetype/include/freetype/internal/cffotypes.h b/thirdparty/freetype/include/freetype/internal/cffotypes.h
index 207eeda5ff..a316fd1f30 100644
--- a/thirdparty/freetype/include/freetype/internal/cffotypes.h
+++ b/thirdparty/freetype/include/freetype/internal/cffotypes.h
@@ -19,12 +19,11 @@
#ifndef CFFOTYPES_H_
#define CFFOTYPES_H_
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_CFF_TYPES_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/cfftypes.h>
+#include <freetype/internal/tttypes.h>
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/pshints.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/cfftypes.h b/thirdparty/freetype/include/freetype/internal/cfftypes.h
index 40b0fc73c9..f21167b1e5 100644
--- a/thirdparty/freetype/include/freetype/internal/cfftypes.h
+++ b/thirdparty/freetype/include/freetype/internal/cfftypes.h
@@ -21,13 +21,12 @@
#define CFFTYPES_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/freetype.h>
+#include <freetype/t1tables.h>
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/pshints.h>
+#include <freetype/internal/t1types.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/compiler-macros.h b/thirdparty/freetype/include/freetype/internal/compiler-macros.h
new file mode 100644
index 0000000000..97c18d3a21
--- /dev/null
+++ b/thirdparty/freetype/include/freetype/internal/compiler-macros.h
@@ -0,0 +1,307 @@
+/****************************************************************************
+ *
+ * internal/compiler-macros.h
+ *
+ * Compiler-specific macro definitions used internally by FreeType.
+ *
+ * Copyright (C) 2020 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
+
+#ifndef INTERNAL_COMPILER_MACROS_H_
+#define INTERNAL_COMPILER_MACROS_H_
+
+#include <freetype/config/public-macros.h>
+
+FT_BEGIN_HEADER
+
+ /* Fix compiler warning with sgi compiler. */
+#if defined( __sgi ) && !defined( __GNUC__ )
+# if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
+# pragma set woff 3505
+# endif
+#endif
+
+ /* Fix compiler warning with sgi compiler. */
+#if defined( __sgi ) && !defined( __GNUC__ )
+# if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
+# pragma set woff 3505
+# endif
+#endif
+
+ /*
+ * When defining a macro that expands to a non-trivial C statement, use
+ * FT_BEGIN_STMNT and FT_END_STMNT to enclose the macro's body. This
+ * ensures there are no surprises when the macro is invoked in conditional
+ * branches.
+ *
+ * Example:
+ *
+ * #define LOG( ... ) \
+ * FT_BEGIN_STMNT \
+ * if ( logging_enabled ) \
+ * log( __VA_ARGS__ ); \
+ * FT_END_STMNT
+ */
+#define FT_BEGIN_STMNT do {
+#define FT_END_STMNT } while ( 0 )
+
+ /*
+ * FT_DUMMY_STMNT expands to an empty C statement. Useful for
+ * conditionally defined statement macros.
+ *
+ * Example:
+ *
+ * #ifdef BUILD_CONFIG_LOGGING
+ * #define LOG( ... ) \
+ * FT_BEGIN_STMNT \
+ * if ( logging_enabled ) \
+ * log( __VA_ARGS__ ); \
+ * FT_END_STMNT
+ * #else
+ * # define LOG( ... ) FT_DUMMY_STMNT
+ * #endif
+ */
+#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
+
+#ifdef _WIN64
+ /* only 64bit Windows uses the LLP64 data model, i.e., */
+ /* 32-bit integers, 64-bit pointers. */
+#define FT_UINT_TO_POINTER( x ) (void *)(unsigned __int64)(x)
+#else
+#define FT_UINT_TO_POINTER( x ) (void *)(unsigned long)(x)
+#endif
+
+ /*
+ * Use `FT_TYPEOF( type )` to cast a value to `type`. This is useful to
+ * suppress signedness compilation warnings in macros.
+ *
+ * Example:
+ *
+ * #define PAD_( x, n ) ( (x) & ~FT_TYPEOF( x )( (n) - 1 ) )
+ *
+ * (The `typeof` condition is taken from gnulib's `intprops.h` header
+ * file.)
+ */
+#if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 ) || \
+ ( defined( __IBMC__ ) && __IBMC__ >= 1210 && \
+ defined( __IBM__TYPEOF__ ) ) || \
+ ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) )
+#define FT_TYPEOF( type ) ( __typeof__ ( type ) )
+#else
+#define FT_TYPEOF( type ) /* empty */
+#endif
+
+ /*
+ * Mark a function declaration as internal to the library. This ensures
+ * that it will not be exposed by default to client code, and helps
+ * generate smaller and faster code on ELF-based platforms. Place this
+ * before a function declaration.
+ */
+
+ /* Visual C, mingw */
+#if defined( _WIN32 )
+#define FT_INTERNAL_FUNCTION_ATTRIBUTE /* empty */
+
+ /* gcc, clang */
+#elif ( defined( __GNUC__ ) && __GNUC__ >= 4 ) || defined( __clang__ )
+#define FT_INTERNAL_FUNCTION_ATTRIBUTE \
+ __attribute__(( visibility( "hidden" ) ))
+
+ /* Sun */
+#elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550
+#define FT_INTERNAL_FUNCTION_ATTRIBUTE __hidden
+
+#else
+#define FT_INTERNAL_FUNCTION_ATTRIBUTE /* empty */
+#endif
+
+ /*
+ * FreeType supports compilation of its C sources with a C++ compiler (in
+ * C++ mode); this introduces a number of subtle issues.
+ *
+ * The main one is that a C++ function declaration and its definition must
+ * have the same 'linkage'. Because all FreeType headers declare their
+ * functions with C linkage (i.e., within an `extern "C" { ... }` block
+ * due to the magic of FT_BEGIN_HEADER and FT_END_HEADER), their
+ * definition in FreeType sources should also be prefixed with `extern
+ * "C"` when compiled in C++ mode.
+ *
+ * The `FT_FUNCTION_DECLARATION` and `FT_FUNCTION_DEFINITION` macros are
+ * provided to deal with this case, as well as `FT_CALLBACK_DEF` and its
+ * siblings below.
+ */
+
+ /*
+ * `FT_FUNCTION_DECLARATION( type )` can be used to write a C function
+ * declaration to ensure it will have C linkage when the library is built
+ * with a C++ compiler. The parameter is the function's return type, so a
+ * declaration would look like
+ *
+ * FT_FUNCTION_DECLARATION( int )
+ * foo( int x );
+ *
+ * NOTE: This requires that all uses are inside of `FT_BEGIN_HEADER ...
+ * FT_END_HEADER` blocks, which guarantees that the declarations have C
+ * linkage when the headers are included by C++ sources.
+ *
+ * NOTE: Do not use directly. Use `FT_LOCAL`, `FT_BASE`, and `FT_EXPORT`
+ * instead.
+ */
+#define FT_FUNCTION_DECLARATION( x ) extern x
+
+ /*
+ * Same as `FT_FUNCTION_DECLARATION`, but for function definitions instead.
+ *
+ * NOTE: Do not use directly. Use `FT_LOCAL_DEF`, `FT_BASE_DEF`, and
+ * `FT_EXPORT_DEF` instead.
+ */
+#ifdef __cplusplus
+#define FT_FUNCTION_DEFINITION( x ) extern "C" x
+#else
+#define FT_FUNCTION_DEFINITION( x ) x
+#endif
+
+ /*
+ * Use `FT_LOCAL` and `FT_LOCAL_DEF` to declare and define, respectively,
+ * an internal FreeType function that is only used by the sources of a
+ * single `src/module/` directory. This ensures that the functions are
+ * turned into static ones at build time, resulting in smaller and faster
+ * code.
+ */
+#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
+
+#define FT_LOCAL( x ) static x
+#define FT_LOCAL_DEF( x ) static x
+
+#else
+
+#define FT_LOCAL( x ) FT_INTERNAL_FUNCTION_ATTRIBUTE \
+ FT_FUNCTION_DECLARATION( x )
+#define FT_LOCAL_DEF( x ) FT_FUNCTION_DEFINITION( x )
+
+#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
+
+ /*
+ * Use `FT_LOCAL_ARRAY` and `FT_LOCAL_ARRAY_DEF` to declare and define,
+ * respectively, a constant array that must be accessed from several
+ * sources in the same `src/module/` sub-directory, and which are internal
+ * to the library.
+ */
+#define FT_LOCAL_ARRAY( x ) FT_INTERNAL_FUNCTION_ATTRIBUTE \
+ extern const x
+#define FT_LOCAL_ARRAY_DEF( x ) FT_FUNCTION_DEFINITION( const x )
+
+ /*
+ * `Use FT_BASE` and `FT_BASE_DEF` to declare and define, respectively, an
+ * internal library function that is used by more than a single module.
+ */
+#define FT_BASE( x ) FT_INTERNAL_FUNCTION_ATTRIBUTE \
+ FT_FUNCTION_DECLARATION( x )
+#define FT_BASE_DEF( x ) FT_FUNCTION_DEFINITION( x )
+
+
+ /*
+ * NOTE: Conditionally define `FT_EXPORT_VAR` due to its definition in
+ * `src/smooth/ftgrays.h` to make the header more portable.
+ */
+#ifndef FT_EXPORT_VAR
+#define FT_EXPORT_VAR( x ) FT_FUNCTION_DECLARATION( x )
+#endif
+
+ /* When compiling FreeType as a DLL or DSO with hidden visibility, */
+ /* some systems/compilers need a special attribute in front OR after */
+ /* the return type of function declarations. */
+ /* */
+ /* Two macros are used within the FreeType source code to define */
+ /* exported library functions: `FT_EXPORT` and `FT_EXPORT_DEF`. */
+ /* */
+ /* - `FT_EXPORT( return_type )` */
+ /* */
+ /* is used in a function declaration, as in */
+ /* */
+ /* ``` */
+ /* FT_EXPORT( FT_Error ) */
+ /* FT_Init_FreeType( FT_Library* alibrary ); */
+ /* ``` */
+ /* */
+ /* - `FT_EXPORT_DEF( return_type )` */
+ /* */
+ /* is used in a function definition, as in */
+ /* */
+ /* ``` */
+ /* FT_EXPORT_DEF( FT_Error ) */
+ /* FT_Init_FreeType( FT_Library* alibrary ) */
+ /* { */
+ /* ... some code ... */
+ /* return FT_Err_Ok; */
+ /* } */
+ /* ``` */
+ /* */
+ /* You can provide your own implementation of `FT_EXPORT` and */
+ /* `FT_EXPORT_DEF` here if you want. */
+ /* */
+ /* To export a variable, use `FT_EXPORT_VAR`. */
+ /* */
+
+ /* See `freetype/config/compiler_macros.h` for the `FT_EXPORT` definition */
+#define FT_EXPORT_DEF( x ) FT_FUNCTION_DEFINITION( x )
+
+ /* The following macros are needed to compile the library with a */
+ /* C++ compiler and with 16bit compilers. */
+ /* */
+
+ /* This is special. Within C++, you must specify `extern "C"` for */
+ /* functions which are used via function pointers, and you also */
+ /* must do that for structures which contain function pointers to */
+ /* assure C linkage -- it's not possible to have (local) anonymous */
+ /* functions which are accessed by (global) function pointers. */
+ /* */
+ /* */
+ /* FT_CALLBACK_DEF is used to _define_ a callback function, */
+ /* located in the same source code file as the structure that uses */
+ /* it. */
+ /* */
+ /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */
+ /* and define a callback function, respectively, in a similar way */
+ /* as FT_BASE and FT_BASE_DEF work. */
+ /* */
+ /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
+ /* contains pointers to callback functions. */
+ /* */
+ /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
+ /* that contains pointers to callback functions. */
+ /* */
+ /* */
+ /* Some 16bit compilers have to redefine these macros to insert */
+ /* the infamous `_cdecl` or `__fastcall` declarations. */
+ /* */
+#ifdef __cplusplus
+#define FT_CALLBACK_DEF( x ) extern "C" x
+#else
+#define FT_CALLBACK_DEF( x ) static x
+#endif
+
+#define FT_BASE_CALLBACK( x ) FT_FUNCTION_DECLARATION( x )
+#define FT_BASE_CALLBACK_DEF( x ) FT_FUNCTION_DEFINITION( x )
+
+#ifndef FT_CALLBACK_TABLE
+#ifdef __cplusplus
+#define FT_CALLBACK_TABLE extern "C"
+#define FT_CALLBACK_TABLE_DEF extern "C"
+#else
+#define FT_CALLBACK_TABLE extern
+#define FT_CALLBACK_TABLE_DEF /* nothing */
+#endif
+#endif /* FT_CALLBACK_TABLE */
+
+FT_END_HEADER
+
+#endif /* INTERNAL_COMPILER_MACROS_H_ */
diff --git a/thirdparty/freetype/include/freetype/internal/ftcalc.h b/thirdparty/freetype/include/freetype/internal/ftcalc.h
index 3054a4c497..c65307472f 100644
--- a/thirdparty/freetype/include/freetype/internal/ftcalc.h
+++ b/thirdparty/freetype/include/freetype/internal/ftcalc.h
@@ -20,9 +20,9 @@
#define FTCALC_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
+#include "compiler-macros.h"
FT_BEGIN_HEADER
@@ -449,8 +449,7 @@ FT_BEGIN_HEADER
#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) * 4 ) /* << 2 */
#define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 )
-#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \
- : ( -( ( 32 - (x) ) & -64 ) ) )
+#define ROUND_F26DOT6( x ) ( ( (x) + 32 - ( x < 0 ) ) & -64 )
/*
* The following macros have two purposes.
diff --git a/thirdparty/freetype/include/freetype/internal/ftdebug.h b/thirdparty/freetype/include/freetype/internal/ftdebug.h
index 00d258e642..df5357ad55 100644
--- a/thirdparty/freetype/include/freetype/internal/ftdebug.h
+++ b/thirdparty/freetype/include/freetype/internal/ftdebug.h
@@ -27,7 +27,9 @@
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
+
+#include "compiler-macros.h"
FT_BEGIN_HEADER
@@ -56,7 +58,7 @@ FT_BEGIN_HEADER
/* defining the enumeration */
typedef enum FT_Trace_
{
-#include FT_INTERNAL_TRACE_H
+#include <freetype/internal/fttrace.h>
trace_count
} FT_Trace;
diff --git a/thirdparty/freetype/include/freetype/internal/ftdrv.h b/thirdparty/freetype/include/freetype/internal/ftdrv.h
index 1dd9206c87..7f22710eae 100644
--- a/thirdparty/freetype/include/freetype/internal/ftdrv.h
+++ b/thirdparty/freetype/include/freetype/internal/ftdrv.h
@@ -20,9 +20,9 @@
#define FTDRV_H_
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
+#include "compiler-macros.h"
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/ftgloadr.h b/thirdparty/freetype/include/freetype/internal/ftgloadr.h
index 6f3793b1c0..27b8659f7c 100644
--- a/thirdparty/freetype/include/freetype/internal/ftgloadr.h
+++ b/thirdparty/freetype/include/freetype/internal/ftgloadr.h
@@ -20,8 +20,7 @@
#define FTGLOADR_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
FT_BEGIN_HEADER
@@ -138,8 +137,6 @@ FT_BEGIN_HEADER
FT_BASE( void )
FT_GlyphLoader_Add( FT_GlyphLoader loader );
- /* */
-
FT_END_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/fthash.h b/thirdparty/freetype/include/freetype/internal/fthash.h
index 249188040b..622ec76bb9 100644
--- a/thirdparty/freetype/include/freetype/internal/fthash.h
+++ b/thirdparty/freetype/include/freetype/internal/fthash.h
@@ -43,8 +43,7 @@
#define FTHASH_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/ftmemory.h b/thirdparty/freetype/include/freetype/internal/ftmemory.h
index e0758c127a..ddb18b0512 100644
--- a/thirdparty/freetype/include/freetype/internal/ftmemory.h
+++ b/thirdparty/freetype/include/freetype/internal/ftmemory.h
@@ -22,8 +22,9 @@
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
-#include FT_TYPES_H
+#include <freetype/fttypes.h>
+#include "compiler-macros.h"
FT_BEGIN_HEADER
@@ -389,8 +390,6 @@ extern "C++"
#define FT_STRCPYN( dst, src, size ) \
ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) )
- /* */
-
FT_END_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/ftobjs.h b/thirdparty/freetype/include/freetype/internal/ftobjs.h
index 140eebc7c6..25db2c494f 100644
--- a/thirdparty/freetype/include/freetype/internal/ftobjs.h
+++ b/thirdparty/freetype/include/freetype/internal/ftobjs.h
@@ -26,21 +26,21 @@
#ifndef FTOBJS_H_
#define FTOBJS_H_
-#include <ft2build.h>
-#include FT_RENDER_H
-#include FT_SIZES_H
-#include FT_LCD_FILTER_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_GLYPH_LOADER_H
-#include FT_INTERNAL_DRIVER_H
-#include FT_INTERNAL_AUTOHINT_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_INTERNAL_CALC_H
+#include <freetype/ftrender.h>
+#include <freetype/ftsizes.h>
+#include <freetype/ftlcdfil.h>
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftgloadr.h>
+#include <freetype/internal/ftdrv.h>
+#include <freetype/internal/autohint.h>
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/ftcalc.h>
#ifdef FT_CONFIG_OPTION_INCREMENTAL
-#include FT_INCREMENTAL_H
+#include <freetype/ftincrem.h>
#endif
+#include "compiler-macros.h"
FT_BEGIN_HEADER
@@ -226,8 +226,8 @@ FT_BEGIN_HEADER
} FT_CMap_ClassRec;
-#define FT_DECLARE_CMAP_CLASS( class_ ) \
- FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
+#define FT_DECLARE_CMAP_CLASS( class_ ) \
+ FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
#define FT_DEFINE_CMAP_CLASS( \
class_, \
@@ -653,7 +653,7 @@ FT_BEGIN_HEADER
FT_BASE( void )
FT_Done_GlyphSlot( FT_GlyphSlot slot );
- /* */
+ /* */
#define FT_REQUEST_WIDTH( req ) \
( (req)->horiResolution \
@@ -1057,6 +1057,9 @@ FT_BEGIN_HEADER
* The struct will be allocated in the global scope (or the scope where
* the macro is used).
*/
+#define FT_DECLARE_GLYPH( class_ ) \
+ FT_CALLBACK_TABLE const FT_Glyph_Class class_;
+
#define FT_DEFINE_GLYPH( \
class_, \
size_, \
diff --git a/thirdparty/freetype/include/freetype/internal/ftpsprop.h b/thirdparty/freetype/include/freetype/internal/ftpsprop.h
index 72907c4c3a..81ec29151c 100644
--- a/thirdparty/freetype/include/freetype/internal/ftpsprop.h
+++ b/thirdparty/freetype/include/freetype/internal/ftpsprop.h
@@ -20,8 +20,7 @@
#define FTPSPROP_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/ftrfork.h b/thirdparty/freetype/include/freetype/internal/ftrfork.h
index 9a275a5155..1b7b25acbe 100644
--- a/thirdparty/freetype/include/freetype/internal/ftrfork.h
+++ b/thirdparty/freetype/include/freetype/internal/ftrfork.h
@@ -25,8 +25,7 @@
#define FTRFORK_H_
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/ftserv.h b/thirdparty/freetype/include/freetype/internal/ftserv.h
index bcaf4720d5..6e1a9472da 100644
--- a/thirdparty/freetype/include/freetype/internal/ftserv.h
+++ b/thirdparty/freetype/include/freetype/internal/ftserv.h
@@ -31,6 +31,7 @@
#ifndef FTSERV_H_
#define FTSERV_H_
+#include "compiler-macros.h"
FT_BEGIN_HEADER
@@ -486,33 +487,6 @@ FT_BEGIN_HEADER
/* */
- /*
- * The header files containing the services.
- */
-
-#define FT_SERVICE_BDF_H <freetype/internal/services/svbdf.h>
-#define FT_SERVICE_CFF_TABLE_LOAD_H <freetype/internal/services/svcfftl.h>
-#define FT_SERVICE_CID_H <freetype/internal/services/svcid.h>
-#define FT_SERVICE_FONT_FORMAT_H <freetype/internal/services/svfntfmt.h>
-#define FT_SERVICE_GLYPH_DICT_H <freetype/internal/services/svgldict.h>
-#define FT_SERVICE_GX_VALIDATE_H <freetype/internal/services/svgxval.h>
-#define FT_SERVICE_KERNING_H <freetype/internal/services/svkern.h>
-#define FT_SERVICE_METRICS_VARIATIONS_H <freetype/internal/services/svmetric.h>
-#define FT_SERVICE_MULTIPLE_MASTERS_H <freetype/internal/services/svmm.h>
-#define FT_SERVICE_OPENTYPE_VALIDATE_H <freetype/internal/services/svotval.h>
-#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h>
-#define FT_SERVICE_POSTSCRIPT_CMAPS_H <freetype/internal/services/svpscmap.h>
-#define FT_SERVICE_POSTSCRIPT_INFO_H <freetype/internal/services/svpsinfo.h>
-#define FT_SERVICE_POSTSCRIPT_NAME_H <freetype/internal/services/svpostnm.h>
-#define FT_SERVICE_PROPERTIES_H <freetype/internal/services/svprop.h>
-#define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h>
-#define FT_SERVICE_TRUETYPE_ENGINE_H <freetype/internal/services/svtteng.h>
-#define FT_SERVICE_TRUETYPE_GLYF_H <freetype/internal/services/svttglyf.h>
-#define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h>
-#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h>
-
- /* */
-
FT_END_HEADER
#endif /* FTSERV_H_ */
diff --git a/thirdparty/freetype/include/freetype/internal/ftstream.h b/thirdparty/freetype/include/freetype/internal/ftstream.h
index f3b3ef0d02..e7d922260f 100644
--- a/thirdparty/freetype/include/freetype/internal/ftstream.h
+++ b/thirdparty/freetype/include/freetype/internal/ftstream.h
@@ -21,8 +21,8 @@
#include <ft2build.h>
-#include FT_SYSTEM_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftsystem.h>
+#include <freetype/internal/ftobjs.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/ftvalid.h b/thirdparty/freetype/include/freetype/internal/ftvalid.h
index 62aea4dc68..a5bc6c9b52 100644
--- a/thirdparty/freetype/include/freetype/internal/ftvalid.h
+++ b/thirdparty/freetype/include/freetype/internal/ftvalid.h
@@ -20,8 +20,9 @@
#define FTVALID_H_
#include <ft2build.h>
-#include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_setjmp and ft_longjmp */
+#include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_jmpbuf */
+#include "compiler-macros.h"
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/psaux.h b/thirdparty/freetype/include/freetype/internal/psaux.h
index 8248a0ecdb..8e0a262fd5 100644
--- a/thirdparty/freetype/include/freetype/internal/psaux.h
+++ b/thirdparty/freetype/include/freetype/internal/psaux.h
@@ -21,14 +21,13 @@
#define PSAUX_H_
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_HASH_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_CFF_TYPES_H
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/t1types.h>
+#include <freetype/internal/fthash.h>
+#include <freetype/internal/tttypes.h>
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/cfftypes.h>
+#include <freetype/internal/cffotypes.h>
diff --git a/thirdparty/freetype/include/freetype/internal/pshints.h b/thirdparty/freetype/include/freetype/internal/pshints.h
index cf0c65298c..663e9d3488 100644
--- a/thirdparty/freetype/include/freetype/internal/pshints.h
+++ b/thirdparty/freetype/include/freetype/internal/pshints.h
@@ -22,9 +22,8 @@
#define PSHINTS_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TYPE1_TABLES_H
+#include <freetype/freetype.h>
+#include <freetype/t1tables.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svbdf.h b/thirdparty/freetype/include/freetype/internal/services/svbdf.h
index 0ec9c7ccb0..81f5a06b62 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svbdf.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svbdf.h
@@ -19,8 +19,8 @@
#ifndef SVBDF_H_
#define SVBDF_H_
-#include FT_BDF_H
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/ftbdf.h>
+#include <freetype/internal/ftserv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svcfftl.h b/thirdparty/freetype/include/freetype/internal/services/svcfftl.h
index c2f42c1d17..1d2dbb6a8e 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svcfftl.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svcfftl.h
@@ -19,8 +19,8 @@
#ifndef SVCFFTL_H_
#define SVCFFTL_H_
-#include FT_INTERNAL_SERVICE_H
-#include FT_INTERNAL_CFF_TYPES_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/cfftypes.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svcid.h b/thirdparty/freetype/include/freetype/internal/services/svcid.h
index b8efd8147b..bd49f3270a 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svcid.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svcid.h
@@ -19,7 +19,7 @@
#ifndef SVCID_H_
#define SVCID_H_
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/internal/ftserv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h b/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h
index 5ec84c933c..6114d638af 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h
@@ -19,7 +19,7 @@
#ifndef SVFNTFMT_H_
#define SVFNTFMT_H_
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/internal/ftserv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svgldict.h b/thirdparty/freetype/include/freetype/internal/services/svgldict.h
index 5a63883c90..f9443e40d6 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svgldict.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svgldict.h
@@ -19,7 +19,7 @@
#ifndef SVGLDICT_H_
#define SVGLDICT_H_
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/internal/ftserv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svgxval.h b/thirdparty/freetype/include/freetype/internal/services/svgxval.h
index d0cb10a423..83c2f26cee 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svgxval.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svgxval.h
@@ -28,8 +28,8 @@
#ifndef SVGXVAL_H_
#define SVGXVAL_H_
-#include FT_GX_VALIDATE_H
-#include FT_INTERNAL_VALIDATE_H
+#include <freetype/ftgxval.h>
+#include <freetype/internal/ftvalid.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svkern.h b/thirdparty/freetype/include/freetype/internal/services/svkern.h
index 891c61a755..13cfb32722 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svkern.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svkern.h
@@ -19,8 +19,8 @@
#ifndef SVKERN_H_
#define SVKERN_H_
-#include FT_INTERNAL_SERVICE_H
-#include FT_TRUETYPE_TABLES_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/tttables.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svmetric.h b/thirdparty/freetype/include/freetype/internal/services/svmetric.h
index 06faa4b4f8..2b30edaabe 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svmetric.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svmetric.h
@@ -19,7 +19,7 @@
#ifndef SVMETRIC_H_
#define SVMETRIC_H_
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/internal/ftserv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svmm.h b/thirdparty/freetype/include/freetype/internal/services/svmm.h
index fa044c92dd..5a807636a6 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svmm.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svmm.h
@@ -19,7 +19,7 @@
#ifndef SVMM_H_
#define SVMM_H_
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/internal/ftserv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svotval.h b/thirdparty/freetype/include/freetype/internal/services/svotval.h
index 34ad7ca9f1..763fb2efbe 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svotval.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svotval.h
@@ -19,8 +19,8 @@
#ifndef SVOTVAL_H_
#define SVOTVAL_H_
-#include FT_OPENTYPE_VALIDATE_H
-#include FT_INTERNAL_VALIDATE_H
+#include <freetype/ftotval.h>
+#include <freetype/internal/ftvalid.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svpfr.h b/thirdparty/freetype/include/freetype/internal/services/svpfr.h
index 2dd075c5da..bdeba0785c 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svpfr.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svpfr.h
@@ -19,8 +19,8 @@
#ifndef SVPFR_H_
#define SVPFR_H_
-#include FT_PFR_H
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/ftpfr.h>
+#include <freetype/internal/ftserv.h>
FT_BEGIN_HEADER
@@ -56,7 +56,6 @@ FT_BEGIN_HEADER
};
- /* */
FT_END_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svpostnm.h b/thirdparty/freetype/include/freetype/internal/services/svpostnm.h
index 86ab611382..8ef62c5f92 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svpostnm.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svpostnm.h
@@ -19,7 +19,7 @@
#ifndef SVPOSTNM_H_
#define SVPOSTNM_H_
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/internal/ftserv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svpscmap.h b/thirdparty/freetype/include/freetype/internal/services/svpscmap.h
index 6c2ffe2e2a..b4dcd80759 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svpscmap.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svpscmap.h
@@ -19,7 +19,7 @@
#ifndef SVPSCMAP_H_
#define SVPSCMAP_H_
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h b/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h
index ade24dc2ba..1e7276ff43 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h
@@ -19,8 +19,8 @@
#ifndef SVPSINFO_H_
#define SVPSINFO_H_
-#include FT_INTERNAL_SERVICE_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/t1types.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svsfnt.h b/thirdparty/freetype/include/freetype/internal/services/svsfnt.h
index f3e81ca84e..39c8b5e19d 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svsfnt.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svsfnt.h
@@ -19,8 +19,8 @@
#ifndef SVSFNT_H_
#define SVSFNT_H_
-#include FT_INTERNAL_SERVICE_H
-#include FT_TRUETYPE_TABLES_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/tttables.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svttcmap.h b/thirdparty/freetype/include/freetype/internal/services/svttcmap.h
index fbb3115ed4..c18bb2336f 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svttcmap.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svttcmap.h
@@ -22,8 +22,8 @@
#ifndef SVTTCMAP_H_
#define SVTTCMAP_H_
-#include FT_INTERNAL_SERVICE_H
-#include FT_TRUETYPE_TABLES_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/tttables.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svtteng.h b/thirdparty/freetype/include/freetype/internal/services/svtteng.h
index 6218d9efe0..7a17e4a755 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svtteng.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svtteng.h
@@ -19,8 +19,8 @@
#ifndef SVTTENG_H_
#define SVTTENG_H_
-#include FT_INTERNAL_SERVICE_H
-#include FT_MODULE_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/ftmodapi.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svttglyf.h b/thirdparty/freetype/include/freetype/internal/services/svttglyf.h
index d9894e362d..90a81dd40e 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svttglyf.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svttglyf.h
@@ -18,8 +18,8 @@
#ifndef SVTTGLYF_H_
#define SVTTGLYF_H_
-#include FT_INTERNAL_SERVICE_H
-#include FT_TRUETYPE_TABLES_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/tttables.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h b/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h
index 377f73d450..8c915f5257 100644
--- a/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h
+++ b/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h
@@ -19,8 +19,8 @@
#ifndef SVWINFNT_H_
#define SVWINFNT_H_
-#include FT_INTERNAL_SERVICE_H
-#include FT_WINFONTS_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/ftwinfnt.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/sfnt.h b/thirdparty/freetype/include/freetype/internal/sfnt.h
index b9c81a8f37..b4c12dbb26 100644
--- a/thirdparty/freetype/include/freetype/internal/sfnt.h
+++ b/thirdparty/freetype/include/freetype/internal/sfnt.h
@@ -20,10 +20,9 @@
#define SFNT_H_
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_INTERNAL_WOFF_TYPES_H
+#include <freetype/internal/ftdrv.h>
+#include <freetype/internal/tttypes.h>
+#include <freetype/internal/wofftypes.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/t1types.h b/thirdparty/freetype/include/freetype/internal/t1types.h
index 799c2939fa..6a0fe5e97d 100644
--- a/thirdparty/freetype/include/freetype/internal/t1types.h
+++ b/thirdparty/freetype/include/freetype/internal/t1types.h
@@ -21,12 +21,11 @@
#define T1TYPES_H_
-#include <ft2build.h>
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_INTERNAL_HASH_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include <freetype/t1tables.h>
+#include <freetype/internal/pshints.h>
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/fthash.h>
+#include <freetype/internal/services/svpscmap.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/internal/tttypes.h b/thirdparty/freetype/include/freetype/internal/tttypes.h
index 1bddf102be..c36342c93a 100644
--- a/thirdparty/freetype/include/freetype/internal/tttypes.h
+++ b/thirdparty/freetype/include/freetype/internal/tttypes.h
@@ -21,13 +21,12 @@
#define TTTYPES_H_
-#include <ft2build.h>
-#include FT_TRUETYPE_TABLES_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_COLOR_H
+#include <freetype/tttables.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftcolor.h>
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
+#include <freetype/ftmm.h>
#endif
diff --git a/thirdparty/freetype/include/freetype/internal/wofftypes.h b/thirdparty/freetype/include/freetype/internal/wofftypes.h
index 26159b9d3e..1874a138a0 100644
--- a/thirdparty/freetype/include/freetype/internal/wofftypes.h
+++ b/thirdparty/freetype/include/freetype/internal/wofftypes.h
@@ -21,9 +21,8 @@
#define WOFFTYPES_H_
-#include <ft2build.h>
-#include FT_TRUETYPE_TABLES_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/tttables.h>
+#include <freetype/internal/ftobjs.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/t1tables.h b/thirdparty/freetype/include/freetype/t1tables.h
index 522d6ae6aa..426e14024e 100644
--- a/thirdparty/freetype/include/freetype/t1tables.h
+++ b/thirdparty/freetype/include/freetype/t1tables.h
@@ -21,8 +21,7 @@
#define T1TABLES_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/ttnameid.h b/thirdparty/freetype/include/freetype/ttnameid.h
index 9a00913ee7..2b2ed4c613 100644
--- a/thirdparty/freetype/include/freetype/ttnameid.h
+++ b/thirdparty/freetype/include/freetype/ttnameid.h
@@ -20,7 +20,6 @@
#define TTNAMEID_H_
-#include <ft2build.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/include/freetype/tttables.h b/thirdparty/freetype/include/freetype/tttables.h
index 8108db7173..c8fa35ef8e 100644
--- a/thirdparty/freetype/include/freetype/tttables.h
+++ b/thirdparty/freetype/include/freetype/tttables.h
@@ -21,8 +21,7 @@
#define TTTABLES_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/freetype/tttags.h b/thirdparty/freetype/include/freetype/tttags.h
index f2b2a45266..3c9fbd59d7 100644
--- a/thirdparty/freetype/include/freetype/tttags.h
+++ b/thirdparty/freetype/include/freetype/tttags.h
@@ -20,8 +20,7 @@
#define TTAGS_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/include/ft2build.h b/thirdparty/freetype/include/ft2build.h
index 195e918335..b4fd1f8c3e 100644
--- a/thirdparty/freetype/include/ft2build.h
+++ b/thirdparty/freetype/include/ft2build.h
@@ -18,16 +18,14 @@
/**************************************************************************
*
- * This is the 'entry point' for FreeType header file inclusions. It is
- * the only header file which should be included directly; all other
- * FreeType header files should be accessed with macro names (after
- * including `ft2build.h`).
+ * This is the 'entry point' for FreeType header file inclusions, to be
+ * loaded before all other header files.
*
* A typical example is
*
* ```
* #include <ft2build.h>
- * #include FT_FREETYPE_H
+ * #include <freetype/freetype.h>
* ```
*
*/
diff --git a/thirdparty/freetype/src/autofit/afblue.c b/thirdparty/freetype/src/autofit/afblue.c
index 63f9ed4589..9ebffdd099 100644
--- a/thirdparty/freetype/src/autofit/afblue.c
+++ b/thirdparty/freetype/src/autofit/afblue.c
@@ -134,7 +134,7 @@
'\0',
'\xF0', '\x90', '\x90', '\xA8', ' ', '\xF0', '\x90', '\x90', '\xAA', ' ', '\xF0', '\x90', '\x90', '\xAC', ' ', '\xF0', '\x90', '\x90', '\xBF', ' ', '\xF0', '\x90', '\x91', '\x83', /* 𐐨 𐐪 𐐬 𐐿 𐑃 */
'\0',
- '\xE0', '\xA4', '\x95', ' ', '\xE0', '\xA4', '\xAE', ' ', '\xE0', '\xA4', '\x85', ' ', '\xE0', '\xA4', '\x86', ' ', '\xE0', '\xA4', '\xA5', ' ', '\xE0', '\xA4', '\xA7', ' ', '\xE0', '\xA4', '\xAD', ' ', '\xE0', '\xA4', '\xB6', /* क म अ आ थ ध भ श */
+ '\xE0', '\xA4', '\x95', ' ', '\xE0', '\xA4', '\xA8', ' ', '\xE0', '\xA4', '\xAE', ' ', '\xE0', '\xA4', '\x89', ' ', '\xE0', '\xA4', '\x9B', ' ', '\xE0', '\xA4', '\x9F', ' ', '\xE0', '\xA4', '\xA0', ' ', '\xE0', '\xA4', '\xA1', /* क न म उ छ ट ठ ड */
'\0',
'\xE0', '\xA4', '\x88', ' ', '\xE0', '\xA4', '\x90', ' ', '\xE0', '\xA4', '\x93', ' ', '\xE0', '\xA4', '\x94', ' ', '\xE0', '\xA4', '\xBF', ' ', '\xE0', '\xA5', '\x80', ' ', '\xE0', '\xA5', '\x8B', ' ', '\xE0', '\xA5', '\x8C', /* ई ऐ ओ औ ि ी ो ौ */
'\0',
@@ -296,6 +296,20 @@
'\0',
'\xE0', '\xB4', '\x9F', ' ', '\xE0', '\xB4', '\xA0', ' ', '\xE0', '\xB4', '\xA7', ' ', '\xE0', '\xB4', '\xB6', ' ', '\xE0', '\xB4', '\x98', ' ', '\xE0', '\xB4', '\x9A', ' ', '\xE0', '\xB4', '\xA5', ' ', '\xE0', '\xB4', '\xB2', /* ട ഠ ധ ശ ഘ ച ഥ ല */
'\0',
+ '\xF0', '\x96', '\xB9', '\x80', ' ', '\xF0', '\x96', '\xB9', '\x81', ' ', '\xF0', '\x96', '\xB9', '\x82', ' ', '\xF0', '\x96', '\xB9', '\x83', ' ', '\xF0', '\x96', '\xB9', '\x8F', ' ', '\xF0', '\x96', '\xB9', '\x9A', ' ', '\xF0', '\x96', '\xB9', '\x9F', /* 𖹀 𖹁 𖹂 𖹃 𖹏 𖹚 𖹟 */
+ '\0',
+ '\xF0', '\x96', '\xB9', '\x80', ' ', '\xF0', '\x96', '\xB9', '\x81', ' ', '\xF0', '\x96', '\xB9', '\x82', ' ', '\xF0', '\x96', '\xB9', '\x83', ' ', '\xF0', '\x96', '\xB9', '\x8F', ' ', '\xF0', '\x96', '\xB9', '\x9A', ' ', '\xF0', '\x96', '\xB9', '\x92', ' ', '\xF0', '\x96', '\xB9', '\x93', /* 𖹀 𖹁 𖹂 𖹃 𖹏 𖹚 𖹒 𖹓 */
+ '\0',
+ '\xF0', '\x96', '\xB9', '\xA4', ' ', '\xF0', '\x96', '\xB9', '\xAC', ' ', '\xF0', '\x96', '\xB9', '\xA7', ' ', '\xF0', '\x96', '\xB9', '\xB4', ' ', '\xF0', '\x96', '\xB9', '\xB6', ' ', '\xF0', '\x96', '\xB9', '\xBE', /* 𖹤 𖹬 𖹧 𖹴 𖹶 𖹾 */
+ '\0',
+ '\xF0', '\x96', '\xB9', '\xA0', ' ', '\xF0', '\x96', '\xB9', '\xA1', ' ', '\xF0', '\x96', '\xB9', '\xA2', ' ', '\xF0', '\x96', '\xB9', '\xB9', ' ', '\xF0', '\x96', '\xB9', '\xB3', ' ', '\xF0', '\x96', '\xB9', '\xAE', /* 𖹠 𖹡 𖹢 𖹹 𖹳 𖹮 */
+ '\0',
+ '\xF0', '\x96', '\xB9', '\xA0', ' ', '\xF0', '\x96', '\xB9', '\xA1', ' ', '\xF0', '\x96', '\xB9', '\xA2', ' ', '\xF0', '\x96', '\xB9', '\xB3', ' ', '\xF0', '\x96', '\xB9', '\xAD', ' ', '\xF0', '\x96', '\xB9', '\xBD', /* 𖹠 𖹡 𖹢 𖹳 𖹭 𖹽 */
+ '\0',
+ '\xF0', '\x96', '\xB9', '\xA5', ' ', '\xF0', '\x96', '\xB9', '\xA8', ' ', '\xF0', '\x96', '\xB9', '\xA9', /* 𖹥 𖹨 𖹩 */
+ '\0',
+ '\xF0', '\x96', '\xBA', '\x80', ' ', '\xF0', '\x96', '\xBA', '\x85', ' ', '\xF0', '\x96', '\xBA', '\x88', ' ', '\xF0', '\x96', '\xBA', '\x84', ' ', '\xF0', '\x96', '\xBA', '\x8D', /* 𖺀 𖺅 𖺈 𖺄 𖺍 */
+ '\0',
'\xE1', '\xA0', '\xB3', ' ', '\xE1', '\xA0', '\xB4', ' ', '\xE1', '\xA0', '\xB6', ' ', '\xE1', '\xA0', '\xBD', ' ', '\xE1', '\xA1', '\x82', ' ', '\xE1', '\xA1', '\x8A', ' ', '\xE2', '\x80', '\x8D', '\xE1', '\xA1', '\xA1', '\xE2', '\x80', '\x8D', ' ', '\xE2', '\x80', '\x8D', '\xE1', '\xA1', '\xB3', '\xE2', '\x80', '\x8D', /* ᠳ ᠴ ᠶ ᠽ ᡂ ᡊ ‍ᡡ‍ ‍ᡳ‍ */
'\0',
'\xE1', '\xA1', '\x83', /* ᡃ */
@@ -494,14 +508,14 @@
{ AF_BLUE_STRING_CHAKMA_BOTTOM, 0 },
{ AF_BLUE_STRING_CHAKMA_DESCENDER, 0 },
{ AF_BLUE_STRING_MAX, 0 },
- { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
- { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 },
- { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
- AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
- { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 },
- { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
- { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 },
- { AF_BLUE_STRING_MAX, 0 },
+ { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 },
+ { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
+ { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 },
+ { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 },
+ { AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_CARIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
{ AF_BLUE_STRING_CARIAN_BOTTOM, 0 },
{ AF_BLUE_STRING_MAX, 0 },
@@ -601,6 +615,9 @@
{ AF_BLUE_STRING_HEBREW_BOTTOM, 0 },
{ AF_BLUE_STRING_HEBREW_DESCENDER, 0 },
{ AF_BLUE_STRING_MAX, 0 },
+ { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_KANNADA_BOTTOM, 0 },
+ { AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_KAYAH_LI_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
{ AF_BLUE_STRING_KAYAH_LI_BOTTOM, 0 },
@@ -619,9 +636,6 @@
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
{ AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 },
{ AF_BLUE_STRING_MAX, 0 },
- { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
- { AF_BLUE_STRING_KANNADA_BOTTOM, 0 },
- { AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
{ AF_BLUE_STRING_LAO_BOTTOM, 0 },
@@ -659,6 +673,15 @@
{ AF_BLUE_STRING_MALAYALAM_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
{ AF_BLUE_STRING_MALAYALAM_BOTTOM, 0 },
{ AF_BLUE_STRING_MAX, 0 },
+ { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM, 0 },
+ { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
+ { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM, 0 },
+ { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER, 0 },
+ { AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_MONGOLIAN_TOP_BASE, AF_BLUE_PROPERTY_LATIN_TOP },
{ AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE, 0 },
{ AF_BLUE_STRING_MAX, 0 },
@@ -724,9 +747,6 @@
{ AF_BLUE_STRING_TELUGU_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
{ AF_BLUE_STRING_TELUGU_BOTTOM, 0 },
{ AF_BLUE_STRING_MAX, 0 },
- { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP },
- { AF_BLUE_STRING_TIFINAGH, 0 },
- { AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_THAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
AF_BLUE_PROPERTY_LATIN_X_HEIGHT },
{ AF_BLUE_STRING_THAI_BOTTOM, 0 },
@@ -736,6 +756,9 @@
{ AF_BLUE_STRING_THAI_LARGE_DESCENDER, 0 },
{ AF_BLUE_STRING_THAI_DIGIT_TOP, 0 },
{ AF_BLUE_STRING_MAX, 0 },
+ { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP },
+ { AF_BLUE_STRING_TIFINAGH, 0 },
+ { AF_BLUE_STRING_MAX, 0 },
{ AF_BLUE_STRING_VAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP },
{ AF_BLUE_STRING_VAI_BOTTOM, 0 },
{ AF_BLUE_STRING_MAX, 0 },
diff --git a/thirdparty/freetype/src/autofit/afblue.dat b/thirdparty/freetype/src/autofit/afblue.dat
index f8356ba3a1..b19b8df0f4 100644
--- a/thirdparty/freetype/src/autofit/afblue.dat
+++ b/thirdparty/freetype/src/autofit/afblue.dat
@@ -203,7 +203,7 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN:
"𐐨 𐐪 𐐬 𐐿 𐑃"
AF_BLUE_STRING_DEVANAGARI_BASE
- "क म अ आ थ ध भ श"
+ "क न म उ छ ट ठ ड"
AF_BLUE_STRING_DEVANAGARI_TOP
"ई ऐ ओ औ ि ी ो ौ"
// note that some fonts have extreme variation in the height of the
@@ -392,6 +392,21 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN:
AF_BLUE_STRING_MALAYALAM_BOTTOM
"ട ഠ ധ ശ ഘ ച ഥ ല"
+ AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP
+ "𖹀 𖹁 𖹂 𖹃 𖹏 𖹚 𖹟"
+ AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM
+ "𖹀 𖹁 𖹂 𖹃 𖹏 𖹚 𖹒 𖹓"
+ AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP
+ "𖹤 𖹬 𖹧 𖹴 𖹶 𖹾"
+ AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP
+ "𖹠 𖹡 𖹢 𖹹 𖹳 𖹮"
+ AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM
+ "𖹠 𖹡 𖹢 𖹳 𖹭 𖹽"
+ AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER
+ "𖹥 𖹨 𖹩"
+ AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP
+ "𖺀 𖺅 𖺈 𖺄 𖺍"
+
AF_BLUE_STRING_MONGOLIAN_TOP_BASE
"ᠳ ᠴ ᠶ ᠽ ᡂ ᡊ ‍ᡡ‍ ‍ᡳ‍"
AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE
@@ -741,14 +756,14 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
{ AF_BLUE_STRING_MAX, 0 }
AF_BLUE_STRINGSET_CANS
- { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
- { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 }
- { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
- AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
- { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 }
- { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
- { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 }
- { AF_BLUE_STRING_MAX, 0 }
+ { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM, 0 }
+ { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
+ { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0 }
+ { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM, 0 }
+ { AF_BLUE_STRING_MAX, 0 }
AF_BLUE_STRINGSET_CARI
{ AF_BLUE_STRING_CARIAN_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
@@ -881,6 +896,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
{ AF_BLUE_STRING_HEBREW_DESCENDER, 0 }
{ AF_BLUE_STRING_MAX, 0 }
+ AF_BLUE_STRINGSET_KNDA
+ { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_KANNADA_BOTTOM, 0 }
+ { AF_BLUE_STRING_MAX, 0 }
+
AF_BLUE_STRINGSET_KALI
{ AF_BLUE_STRING_KAYAH_LI_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
@@ -905,11 +925,6 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
{ AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0 }
{ AF_BLUE_STRING_MAX, 0 }
- AF_BLUE_STRINGSET_KNDA
- { AF_BLUE_STRING_KANNADA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
- { AF_BLUE_STRING_KANNADA_BOTTOM, 0 }
- { AF_BLUE_STRING_MAX, 0 }
-
AF_BLUE_STRINGSET_LAO
{ AF_BLUE_STRING_LAO_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
@@ -959,6 +974,17 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
{ AF_BLUE_STRING_MALAYALAM_BOTTOM, 0 }
{ AF_BLUE_STRING_MAX, 0 }
+ AF_BLUE_STRINGSET_MEDF
+ { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM, 0 }
+ { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
+ AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
+ { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM, 0 }
+ { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER, 0 }
+ { AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_MAX, 0 }
+
AF_BLUE_STRINGSET_MONG
{ AF_BLUE_STRING_MONGOLIAN_TOP_BASE, AF_BLUE_PROPERTY_LATIN_TOP }
{ AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE, 0 }
@@ -1056,11 +1082,6 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
{ AF_BLUE_STRING_TELUGU_BOTTOM, 0 }
{ AF_BLUE_STRING_MAX, 0 }
- AF_BLUE_STRINGSET_TFNG
- { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP }
- { AF_BLUE_STRING_TIFINAGH, 0 }
- { AF_BLUE_STRING_MAX, 0 }
-
AF_BLUE_STRINGSET_THAI
{ AF_BLUE_STRING_THAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP |
AF_BLUE_PROPERTY_LATIN_X_HEIGHT }
@@ -1072,6 +1093,11 @@ AF_BLUE_STRINGSET_ENUM AF_BLUE_STRINGSETS_ARRAY AF_BLUE_STRINGSET_MAX_LEN:
{ AF_BLUE_STRING_THAI_DIGIT_TOP, 0 }
{ AF_BLUE_STRING_MAX, 0 }
+ AF_BLUE_STRINGSET_TFNG
+ { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP }
+ { AF_BLUE_STRING_TIFINAGH, 0 }
+ { AF_BLUE_STRING_MAX, 0 }
+
AF_BLUE_STRINGSET_VAII
{ AF_BLUE_STRING_VAI_TOP, AF_BLUE_PROPERTY_LATIN_TOP }
{ AF_BLUE_STRING_VAI_BOTTOM, 0 }
diff --git a/thirdparty/freetype/src/autofit/afblue.h b/thirdparty/freetype/src/autofit/afblue.h
index 2b6a5cdda4..486d663b6c 100644
--- a/thirdparty/freetype/src/autofit/afblue.h
+++ b/thirdparty/freetype/src/autofit/afblue.h
@@ -212,61 +212,68 @@ FT_BEGIN_HEADER
AF_BLUE_STRING_LISU_BOTTOM = 3506,
AF_BLUE_STRING_MALAYALAM_TOP = 3538,
AF_BLUE_STRING_MALAYALAM_BOTTOM = 3582,
- AF_BLUE_STRING_MONGOLIAN_TOP_BASE = 3614,
- AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE = 3658,
- AF_BLUE_STRING_MYANMAR_TOP = 3662,
- AF_BLUE_STRING_MYANMAR_BOTTOM = 3694,
- AF_BLUE_STRING_MYANMAR_ASCENDER = 3726,
- AF_BLUE_STRING_MYANMAR_DESCENDER = 3754,
- AF_BLUE_STRING_NKO_TOP = 3786,
- AF_BLUE_STRING_NKO_BOTTOM = 3810,
- AF_BLUE_STRING_NKO_SMALL_TOP = 3825,
- AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3834,
- AF_BLUE_STRING_OL_CHIKI = 3846,
- AF_BLUE_STRING_OLD_TURKIC_TOP = 3870,
- AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3885,
- AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3905,
- AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3945,
- AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3975,
- AF_BLUE_STRING_OSAGE_SMALL_TOP = 3990,
- AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 4030,
- AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 4070,
- AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4095,
- AF_BLUE_STRING_OSMANYA_TOP = 4110,
- AF_BLUE_STRING_OSMANYA_BOTTOM = 4150,
- AF_BLUE_STRING_ROHINGYA_TOP = 4190,
- AF_BLUE_STRING_ROHINGYA_BOTTOM = 4215,
- AF_BLUE_STRING_ROHINGYA_JOIN = 4240,
- AF_BLUE_STRING_SAURASHTRA_TOP = 4243,
- AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4275,
- AF_BLUE_STRING_SHAVIAN_TOP = 4295,
- AF_BLUE_STRING_SHAVIAN_BOTTOM = 4305,
- AF_BLUE_STRING_SHAVIAN_DESCENDER = 4330,
- AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4340,
- AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4375,
- AF_BLUE_STRING_SINHALA_TOP = 4390,
- AF_BLUE_STRING_SINHALA_BOTTOM = 4422,
- AF_BLUE_STRING_SINHALA_DESCENDER = 4454,
- AF_BLUE_STRING_SUNDANESE_TOP = 4498,
- AF_BLUE_STRING_SUNDANESE_BOTTOM = 4522,
- AF_BLUE_STRING_SUNDANESE_DESCENDER = 4554,
- AF_BLUE_STRING_TAI_VIET_TOP = 4562,
- AF_BLUE_STRING_TAI_VIET_BOTTOM = 4582,
- AF_BLUE_STRING_TAMIL_TOP = 4594,
- AF_BLUE_STRING_TAMIL_BOTTOM = 4626,
- AF_BLUE_STRING_TELUGU_TOP = 4658,
- AF_BLUE_STRING_TELUGU_BOTTOM = 4686,
- AF_BLUE_STRING_THAI_TOP = 4714,
- AF_BLUE_STRING_THAI_BOTTOM = 4738,
- AF_BLUE_STRING_THAI_ASCENDER = 4766,
- AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4778,
- AF_BLUE_STRING_THAI_DESCENDER = 4790,
- AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4806,
- AF_BLUE_STRING_THAI_DIGIT_TOP = 4814,
- AF_BLUE_STRING_TIFINAGH = 4826,
- AF_BLUE_STRING_VAI_TOP = 4858,
- AF_BLUE_STRING_VAI_BOTTOM = 4890,
- af_blue_1_1 = 4921,
+ AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP = 3614,
+ AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM = 3649,
+ AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP = 3689,
+ AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP = 3719,
+ AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM = 3749,
+ AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER = 3779,
+ AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP = 3794,
+ AF_BLUE_STRING_MONGOLIAN_TOP_BASE = 3819,
+ AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE = 3863,
+ AF_BLUE_STRING_MYANMAR_TOP = 3867,
+ AF_BLUE_STRING_MYANMAR_BOTTOM = 3899,
+ AF_BLUE_STRING_MYANMAR_ASCENDER = 3931,
+ AF_BLUE_STRING_MYANMAR_DESCENDER = 3959,
+ AF_BLUE_STRING_NKO_TOP = 3991,
+ AF_BLUE_STRING_NKO_BOTTOM = 4015,
+ AF_BLUE_STRING_NKO_SMALL_TOP = 4030,
+ AF_BLUE_STRING_NKO_SMALL_BOTTOM = 4039,
+ AF_BLUE_STRING_OL_CHIKI = 4051,
+ AF_BLUE_STRING_OLD_TURKIC_TOP = 4075,
+ AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 4090,
+ AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 4110,
+ AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 4150,
+ AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 4180,
+ AF_BLUE_STRING_OSAGE_SMALL_TOP = 4195,
+ AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 4235,
+ AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 4275,
+ AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4300,
+ AF_BLUE_STRING_OSMANYA_TOP = 4315,
+ AF_BLUE_STRING_OSMANYA_BOTTOM = 4355,
+ AF_BLUE_STRING_ROHINGYA_TOP = 4395,
+ AF_BLUE_STRING_ROHINGYA_BOTTOM = 4420,
+ AF_BLUE_STRING_ROHINGYA_JOIN = 4445,
+ AF_BLUE_STRING_SAURASHTRA_TOP = 4448,
+ AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4480,
+ AF_BLUE_STRING_SHAVIAN_TOP = 4500,
+ AF_BLUE_STRING_SHAVIAN_BOTTOM = 4510,
+ AF_BLUE_STRING_SHAVIAN_DESCENDER = 4535,
+ AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4545,
+ AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4580,
+ AF_BLUE_STRING_SINHALA_TOP = 4595,
+ AF_BLUE_STRING_SINHALA_BOTTOM = 4627,
+ AF_BLUE_STRING_SINHALA_DESCENDER = 4659,
+ AF_BLUE_STRING_SUNDANESE_TOP = 4703,
+ AF_BLUE_STRING_SUNDANESE_BOTTOM = 4727,
+ AF_BLUE_STRING_SUNDANESE_DESCENDER = 4759,
+ AF_BLUE_STRING_TAI_VIET_TOP = 4767,
+ AF_BLUE_STRING_TAI_VIET_BOTTOM = 4787,
+ AF_BLUE_STRING_TAMIL_TOP = 4799,
+ AF_BLUE_STRING_TAMIL_BOTTOM = 4831,
+ AF_BLUE_STRING_TELUGU_TOP = 4863,
+ AF_BLUE_STRING_TELUGU_BOTTOM = 4891,
+ AF_BLUE_STRING_THAI_TOP = 4919,
+ AF_BLUE_STRING_THAI_BOTTOM = 4943,
+ AF_BLUE_STRING_THAI_ASCENDER = 4971,
+ AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4983,
+ AF_BLUE_STRING_THAI_DESCENDER = 4995,
+ AF_BLUE_STRING_THAI_LARGE_DESCENDER = 5011,
+ AF_BLUE_STRING_THAI_DIGIT_TOP = 5019,
+ AF_BLUE_STRING_TIFINAGH = 5031,
+ AF_BLUE_STRING_VAI_TOP = 5063,
+ AF_BLUE_STRING_VAI_BOTTOM = 5095,
+ af_blue_1_1 = 5126,
#ifdef AF_CONFIG_OPTION_CJK
AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1,
AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203,
@@ -350,36 +357,37 @@ FT_BEGIN_HEADER
AF_BLUE_STRINGSET_GUJR = 112,
AF_BLUE_STRINGSET_GURU = 118,
AF_BLUE_STRINGSET_HEBR = 124,
- AF_BLUE_STRINGSET_KALI = 128,
- AF_BLUE_STRINGSET_KHMR = 134,
- AF_BLUE_STRINGSET_KHMS = 140,
- AF_BLUE_STRINGSET_KNDA = 143,
+ AF_BLUE_STRINGSET_KNDA = 128,
+ AF_BLUE_STRINGSET_KALI = 131,
+ AF_BLUE_STRINGSET_KHMR = 137,
+ AF_BLUE_STRINGSET_KHMS = 143,
AF_BLUE_STRINGSET_LAO = 146,
AF_BLUE_STRINGSET_LATN = 152,
AF_BLUE_STRINGSET_LATB = 159,
AF_BLUE_STRINGSET_LATP = 166,
AF_BLUE_STRINGSET_LISU = 173,
AF_BLUE_STRINGSET_MLYM = 176,
- AF_BLUE_STRINGSET_MONG = 179,
- AF_BLUE_STRINGSET_MYMR = 182,
- AF_BLUE_STRINGSET_NKOO = 187,
- AF_BLUE_STRINGSET_NONE = 192,
- AF_BLUE_STRINGSET_OLCK = 193,
- AF_BLUE_STRINGSET_ORKH = 196,
- AF_BLUE_STRINGSET_OSGE = 199,
- AF_BLUE_STRINGSET_OSMA = 207,
- AF_BLUE_STRINGSET_ROHG = 210,
- AF_BLUE_STRINGSET_SAUR = 214,
- AF_BLUE_STRINGSET_SHAW = 217,
- AF_BLUE_STRINGSET_SINH = 223,
- AF_BLUE_STRINGSET_SUND = 227,
- AF_BLUE_STRINGSET_TAML = 231,
- AF_BLUE_STRINGSET_TAVT = 234,
- AF_BLUE_STRINGSET_TELU = 237,
- AF_BLUE_STRINGSET_TFNG = 240,
- AF_BLUE_STRINGSET_THAI = 243,
- AF_BLUE_STRINGSET_VAII = 251,
- af_blue_2_1 = 254,
+ AF_BLUE_STRINGSET_MEDF = 179,
+ AF_BLUE_STRINGSET_MONG = 187,
+ AF_BLUE_STRINGSET_MYMR = 190,
+ AF_BLUE_STRINGSET_NKOO = 195,
+ AF_BLUE_STRINGSET_NONE = 200,
+ AF_BLUE_STRINGSET_OLCK = 201,
+ AF_BLUE_STRINGSET_ORKH = 204,
+ AF_BLUE_STRINGSET_OSGE = 207,
+ AF_BLUE_STRINGSET_OSMA = 215,
+ AF_BLUE_STRINGSET_ROHG = 218,
+ AF_BLUE_STRINGSET_SAUR = 222,
+ AF_BLUE_STRINGSET_SHAW = 225,
+ AF_BLUE_STRINGSET_SINH = 231,
+ AF_BLUE_STRINGSET_SUND = 235,
+ AF_BLUE_STRINGSET_TAML = 239,
+ AF_BLUE_STRINGSET_TAVT = 242,
+ AF_BLUE_STRINGSET_TELU = 245,
+ AF_BLUE_STRINGSET_THAI = 248,
+ AF_BLUE_STRINGSET_TFNG = 256,
+ AF_BLUE_STRINGSET_VAII = 259,
+ af_blue_2_1 = 262,
#ifdef AF_CONFIG_OPTION_CJK
AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0,
af_blue_2_1_1 = af_blue_2_1 + 2,
diff --git a/thirdparty/freetype/src/autofit/afcjk.c b/thirdparty/freetype/src/autofit/afcjk.c
index ca6ce0c60c..3b340cd5ed 100644
--- a/thirdparty/freetype/src/autofit/afcjk.c
+++ b/thirdparty/freetype/src/autofit/afcjk.c
@@ -22,9 +22,8 @@
*
*/
-#include <ft2build.h>
-#include FT_ADVANCES_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/ftadvanc.h>
+#include <freetype/internal/ftdebug.h>
#include "afglobal.h"
#include "aflatin.h"
@@ -158,7 +157,7 @@
if ( !glyph_index )
goto Exit;
- FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n",
+ FT_TRACE5(( "standard character: U+%04lX (glyph index %ld)\n",
ch, glyph_index ));
error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
@@ -261,9 +260,9 @@
dim == AF_DIMENSION_VERT ? "horizontal"
: "vertical" ));
- FT_TRACE5(( " %d (standard)", axis->standard_width ));
+ FT_TRACE5(( " %ld (standard)", axis->standard_width ));
for ( i = 1; i < axis->width_count; i++ )
- FT_TRACE5(( " %d", axis->widths[i].org ));
+ FT_TRACE5(( " %ld", axis->widths[i].org ));
FT_TRACE5(( "\n" ));
}
@@ -728,7 +727,7 @@
delta2 = FT_MulFix( delta2, scale );
- FT_TRACE5(( "delta: %d", delta1 ));
+ FT_TRACE5(( "delta: %ld", delta1 ));
if ( delta2 < 32 )
delta2 = 0;
#if 0
@@ -737,7 +736,7 @@
#endif
else
delta2 = FT_PIX_ROUND( delta2 );
- FT_TRACE5(( "/%d\n", delta2 ));
+ FT_TRACE5(( "/%ld\n", delta2 ));
if ( delta1 < 0 )
delta2 = -delta2;
@@ -1644,7 +1643,7 @@
stem_edge->pos = base_edge->pos + fitted_width;
- FT_TRACE5(( " CJKLINK: edge %d @%d (opos=%.2f) linked to %.2f,"
+ FT_TRACE5(( " CJKLINK: edge %ld @%d (opos=%.2f) linked to %.2f,"
" dist was %.2f, now %.2f\n",
stem_edge - hints->axis[dim].edges, stem_edge->fpos,
stem_edge->opos / 64.0, stem_edge->pos / 64.0,
@@ -1866,7 +1865,7 @@
continue;
#ifdef FT_DEBUG_LEVEL_TRACE
- FT_TRACE5(( " CJKBLUE: edge %d @%d (opos=%.2f) snapped to %.2f,"
+ FT_TRACE5(( " CJKBLUE: edge %ld @%d (opos=%.2f) snapped to %.2f,"
" was %.2f\n",
edge1 - edges, edge1->fpos, edge1->opos / 64.0,
blue->fit / 64.0, edge1->pos / 64.0 ));
@@ -1930,7 +1929,7 @@
/* this should not happen, but it's better to be safe */
if ( edge2->blue_edge )
{
- FT_TRACE5(( "ASSERTION FAILED for edge %d\n", edge2-edges ));
+ FT_TRACE5(( "ASSERTION FAILED for edge %ld\n", edge2-edges ));
af_cjk_align_linked_edge( hints, dim, edge2, edge );
edge->flags |= AF_EDGE_DONE;
diff --git a/thirdparty/freetype/src/autofit/aferrors.h b/thirdparty/freetype/src/autofit/aferrors.h
index 6c7d0e1d70..f90899944b 100644
--- a/thirdparty/freetype/src/autofit/aferrors.h
+++ b/thirdparty/freetype/src/autofit/aferrors.h
@@ -26,7 +26,7 @@
#ifndef AFERRORS_H_
#define AFERRORS_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -34,7 +34,7 @@
#define FT_ERR_PREFIX AF_Err_
#define FT_ERR_BASE FT_Mod_Err_Autofit
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* AFERRORS_H_ */
diff --git a/thirdparty/freetype/src/autofit/afglobal.c b/thirdparty/freetype/src/autofit/afglobal.c
index 5ad4ea9211..d5129423d5 100644
--- a/thirdparty/freetype/src/autofit/afglobal.c
+++ b/thirdparty/freetype/src/autofit/afglobal.c
@@ -19,7 +19,7 @@
#include "afglobal.h"
#include "afranges.h"
#include "afshaper.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
/**************************************************************************
@@ -306,7 +306,7 @@
if ( !( count % 10 ) )
FT_TRACE4(( " " ));
- FT_TRACE4(( " %d", idx ));
+ FT_TRACE4(( " %ld", idx ));
count++;
if ( !( count % 10 ) )
diff --git a/thirdparty/freetype/src/autofit/afhints.c b/thirdparty/freetype/src/autofit/afhints.c
index 5a123b2ba3..a8e00890ef 100644
--- a/thirdparty/freetype/src/autofit/afhints.c
+++ b/thirdparty/freetype/src/autofit/afhints.c
@@ -18,8 +18,8 @@
#include "afhints.h"
#include "aferrors.h"
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftdebug.h>
/**************************************************************************
diff --git a/thirdparty/freetype/src/autofit/aflatin.c b/thirdparty/freetype/src/autofit/aflatin.c
index b453fcdf69..21ec02ebd2 100644
--- a/thirdparty/freetype/src/autofit/aflatin.c
+++ b/thirdparty/freetype/src/autofit/aflatin.c
@@ -16,9 +16,8 @@
*/
-#include <ft2build.h>
-#include FT_ADVANCES_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/ftadvanc.h>
+#include <freetype/internal/ftdebug.h>
#include "afglobal.h"
#include "aflatin.h"
@@ -155,7 +154,7 @@
goto Exit;
}
- FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n",
+ FT_TRACE5(( "standard character: U+%04lX (glyph index %ld)\n",
ch, glyph_index ));
error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
@@ -258,9 +257,9 @@
dim == AF_DIMENSION_VERT ? "horizontal"
: "vertical" ));
- FT_TRACE5(( " %d (standard)", axis->standard_width ));
+ FT_TRACE5(( " %ld (standard)", axis->standard_width ));
for ( i = 1; i < axis->width_count; i++ )
- FT_TRACE5(( " %d", axis->widths[i].org ));
+ FT_TRACE5(( " %ld", axis->widths[i].org ));
FT_TRACE5(( "\n" ));
}
@@ -1032,7 +1031,7 @@
{
*a = *b;
FT_TRACE5(( "blue zone overlap:"
- " adjusting %s %d to %ld\n",
+ " adjusting %s %ld to %ld\n",
a_is_top ? "overshoot" : "reference",
blue_sorted[i] - axis->blues,
*a ));
@@ -1280,7 +1279,7 @@
"af_latin_metrics_scale_dim:"
" x height alignment (style `%s'):\n"
" "
- " vertical scaling changed from %.5f to %.5f (by %d%%)\n"
+ " vertical scaling changed from %.5f to %.5f (by %ld%%)\n"
"\n",
af_style_names[metrics->root.style_class->style],
scale / 65536.0,
@@ -1333,7 +1332,7 @@
width->cur = FT_MulFix( width->org, scale );
width->fit = width->cur;
- FT_TRACE5(( " %d scaled to %.2f\n",
+ FT_TRACE5(( " %ld scaled to %.2f\n",
width->org,
width->cur / 64.0 ));
}
@@ -1474,8 +1473,8 @@
AF_LatinBlue blue = &axis->blues[nn];
- FT_TRACE5(( " reference %d: %d scaled to %.2f%s\n"
- " overshoot %d: %d scaled to %.2f%s\n",
+ FT_TRACE5(( " reference %d: %ld scaled to %.2f%s\n"
+ " overshoot %d: %ld scaled to %.2f%s\n",
nn,
blue->ref.org,
blue->ref.fit / 64.0,
@@ -2945,7 +2944,7 @@
stem_edge->pos = base_edge->pos + fitted_width;
- FT_TRACE5(( " LINK: edge %d (opos=%.2f) linked to %.2f,"
+ FT_TRACE5(( " LINK: edge %ld (opos=%.2f) linked to %.2f,"
" dist was %.2f, now %.2f\n",
stem_edge - hints->axis[dim].edges, stem_edge->opos / 64.0,
stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 ));
@@ -3069,12 +3068,12 @@
#ifdef FT_DEBUG_LEVEL_TRACE
if ( !anchor )
- FT_TRACE5(( " BLUE_ANCHOR: edge %d (opos=%.2f) snapped to %.2f,"
- " was %.2f (anchor=edge %d)\n",
+ FT_TRACE5(( " BLUE_ANCHOR: edge %ld (opos=%.2f) snapped to %.2f,"
+ " was %.2f (anchor=edge %ld)\n",
edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0,
edge1->pos / 64.0, edge - edges ));
else
- FT_TRACE5(( " BLUE: edge %d (opos=%.2f) snapped to %.2f,"
+ FT_TRACE5(( " BLUE: edge %ld (opos=%.2f) snapped to %.2f,"
" was %.2f\n",
edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0,
edge1->pos / 64.0 ));
@@ -3123,7 +3122,7 @@
/* this should not happen, but it's better to be safe */
if ( edge2->blue_edge )
{
- FT_TRACE5(( " ASSERTION FAILED for edge %d\n", edge2 - edges ));
+ FT_TRACE5(( " ASSERTION FAILED for edge %ld\n", edge2 - edges ));
af_latin_align_linked_edge( hints, dim, edge2, edge );
edge->flags |= AF_EDGE_DONE;
@@ -3191,7 +3190,7 @@
anchor = edge;
edge->flags |= AF_EDGE_DONE;
- FT_TRACE5(( " ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f)"
+ FT_TRACE5(( " ANCHOR: edge %ld (opos=%.2f) and %ld (opos=%.2f)"
" snapped to %.2f and %.2f\n",
edge - edges, edge->opos / 64.0,
edge2 - edges, edge2->opos / 64.0,
@@ -3220,7 +3219,7 @@
if ( edge2->flags & AF_EDGE_DONE )
{
- FT_TRACE5(( " ADJUST: edge %d (pos=%.2f) moved to %.2f\n",
+ FT_TRACE5(( " ADJUST: edge %ld (pos=%.2f) moved to %.2f\n",
edge - edges, edge->pos / 64.0,
( edge2->pos - cur_len ) / 64.0 ));
@@ -3261,7 +3260,7 @@
edge->pos = cur_pos1 - cur_len / 2;
edge2->pos = cur_pos1 + cur_len / 2;
- FT_TRACE5(( " STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)"
+ FT_TRACE5(( " STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
" snapped to %.2f and %.2f\n",
edge - edges, edge->opos / 64.0,
edge2 - edges, edge2->opos / 64.0,
@@ -3292,7 +3291,7 @@
edge->pos = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2;
edge2->pos = edge->pos + cur_len;
- FT_TRACE5(( " STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)"
+ FT_TRACE5(( " STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
" snapped to %.2f and %.2f\n",
edge - edges, edge->opos / 64.0,
edge2 - edges, edge2->opos / 64.0,
@@ -3315,7 +3314,7 @@
if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
{
#ifdef FT_DEBUG_LEVEL_TRACE
- FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n",
+ FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
edge - edges,
edge->pos / 64.0,
edge[-1].pos / 64.0 ));
@@ -3417,7 +3416,7 @@
if ( delta < 64 + 16 )
{
af_latin_align_serif_edge( hints, edge->serif, edge );
- FT_TRACE5(( " SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f)"
+ FT_TRACE5(( " SERIF: edge %ld (opos=%.2f) serif to %ld (opos=%.2f)"
" aligned to %.2f\n",
edge - edges, edge->opos / 64.0,
edge->serif - edges, edge->serif->opos / 64.0,
@@ -3427,7 +3426,7 @@
{
edge->pos = FT_PIX_ROUND( edge->opos );
anchor = edge;
- FT_TRACE5(( " SERIF_ANCHOR: edge %d (opos=%.2f)"
+ FT_TRACE5(( " SERIF_ANCHOR: edge %ld (opos=%.2f)"
" snapped to %.2f\n",
edge-edges, edge->opos / 64.0, edge->pos / 64.0 ));
}
@@ -3455,8 +3454,8 @@
after->pos - before->pos,
after->opos - before->opos );
- FT_TRACE5(( " SERIF_LINK1: edge %d (opos=%.2f) snapped to %.2f"
- " from %d (opos=%.2f)\n",
+ FT_TRACE5(( " SERIF_LINK1: edge %ld (opos=%.2f) snapped to %.2f"
+ " from %ld (opos=%.2f)\n",
edge - edges, edge->opos / 64.0,
edge->pos / 64.0,
before - edges, before->opos / 64.0 ));
@@ -3465,7 +3464,7 @@
{
edge->pos = anchor->pos +
( ( edge->opos - anchor->opos + 16 ) & ~31 );
- FT_TRACE5(( " SERIF_LINK2: edge %d (opos=%.2f)"
+ FT_TRACE5(( " SERIF_LINK2: edge %ld (opos=%.2f)"
" snapped to %.2f\n",
edge - edges, edge->opos / 64.0, edge->pos / 64.0 ));
}
@@ -3485,7 +3484,7 @@
if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
{
#ifdef FT_DEBUG_LEVEL_TRACE
- FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n",
+ FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
edge - edges,
edge->pos / 64.0,
edge[-1].pos / 64.0 ));
@@ -3506,7 +3505,7 @@
if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
{
#ifdef FT_DEBUG_LEVEL_TRACE
- FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n",
+ FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
edge - edges,
edge->pos / 64.0,
edge[1].pos / 64.0 ));
diff --git a/thirdparty/freetype/src/autofit/aflatin2.c b/thirdparty/freetype/src/autofit/aflatin2.c
index 7bd4156a0f..902f3982e0 100644
--- a/thirdparty/freetype/src/autofit/aflatin2.c
+++ b/thirdparty/freetype/src/autofit/aflatin2.c
@@ -21,8 +21,7 @@
*/
-#include <ft2build.h>
-#include FT_ADVANCES_H
+#include <freetype/ftadvanc.h>
#ifdef FT_OPTION_AUTOFIT2
diff --git a/thirdparty/freetype/src/autofit/afloader.c b/thirdparty/freetype/src/autofit/afloader.c
index a53fbf2d21..c35d85c4cf 100644
--- a/thirdparty/freetype/src/autofit/afloader.c
+++ b/thirdparty/freetype/src/autofit/afloader.c
@@ -22,7 +22,7 @@
#include "aferrors.h"
#include "afmodule.h"
-#include FT_INTERNAL_CALC_H
+#include <freetype/internal/ftcalc.h>
/* Initialize glyph loader. */
diff --git a/thirdparty/freetype/src/autofit/afmodule.c b/thirdparty/freetype/src/autofit/afmodule.c
index 0bcae4cc25..e16494460e 100644
--- a/thirdparty/freetype/src/autofit/afmodule.c
+++ b/thirdparty/freetype/src/autofit/afmodule.c
@@ -53,10 +53,10 @@
void* _af_debug_hints = _af_debug_hints_rec;
#endif
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_DRIVER_H
-#include FT_SERVICE_PROPERTIES_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftdriver.h>
+#include <freetype/internal/services/svprop.h>
/**************************************************************************
@@ -149,7 +149,7 @@
if ( !af_style_classes[ss] )
{
FT_TRACE0(( "af_property_set: Invalid value %d for property `%s'\n",
- fallback_script, property_name ));
+ *fallback_script, property_name ));
return FT_THROW( Invalid_Argument );
}
@@ -550,8 +550,8 @@
NULL, /* reset_face */
NULL, /* get_global_hints */
NULL, /* done_global_hints */
- (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph ) /* load_glyph */
-
+ (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph /* load_glyph */
+ )
FT_DEFINE_MODULE(
autofit_module_class,
diff --git a/thirdparty/freetype/src/autofit/afmodule.h b/thirdparty/freetype/src/autofit/afmodule.h
index efa0240b4b..e8fe4a93aa 100644
--- a/thirdparty/freetype/src/autofit/afmodule.h
+++ b/thirdparty/freetype/src/autofit/afmodule.h
@@ -19,9 +19,8 @@
#ifndef AFMODULE_H_
#define AFMODULE_H_
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_MODULE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftmodapi.h>
FT_BEGIN_HEADER
@@ -47,6 +46,7 @@ FT_BEGIN_HEADER
} AF_ModuleRec, *AF_Module;
+FT_DECLARE_AUTOHINTER_INTERFACE( af_autofitter_interface )
FT_DECLARE_MODULE( autofit_module_class )
diff --git a/thirdparty/freetype/src/autofit/afranges.c b/thirdparty/freetype/src/autofit/afranges.c
index d6ecf88910..c8ebf5e784 100644
--- a/thirdparty/freetype/src/autofit/afranges.c
+++ b/thirdparty/freetype/src/autofit/afranges.c
@@ -664,6 +664,18 @@
};
+ const AF_Script_UniRangeRec af_medf_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0x16E40, 0x16E9F ), /* Medefaidrin */
+ AF_UNIRANGE_REC( 0, 0 )
+ };
+
+ const AF_Script_UniRangeRec af_medf_nonbase_uniranges[] =
+ {
+ AF_UNIRANGE_REC( 0, 0 )
+ };
+
+
const AF_Script_UniRangeRec af_mong_uniranges[] =
{
AF_UNIRANGE_REC( 0x1800, 0x18AF ), /* Mongolian */
diff --git a/thirdparty/freetype/src/autofit/afscript.h b/thirdparty/freetype/src/autofit/afscript.h
index 36caaddc56..4cf9cc19f5 100644
--- a/thirdparty/freetype/src/autofit/afscript.h
+++ b/thirdparty/freetype/src/autofit/afscript.h
@@ -243,6 +243,12 @@
HINTING_BOTTOM_TO_TOP,
"\xE0\xB4\xA0 \xE0\xB4\xB1" ) /* ഠ റ */
+ SCRIPT( medf, MEDF,
+ "Medefaidrin",
+ HB_SCRIPT_MEDEFAIDRIN,
+ HINTING_BOTTOM_TO_TOP,
+ "\xF0\x96\xB9\xA1 \xF0\x96\xB9\x9B \xF0\x96\xB9\xAF" ) /* 𖹡 𖹛 𖹯 */
+
SCRIPT( mong, MONG,
"Mongolian",
HB_SCRIPT_MONGOLIAN,
diff --git a/thirdparty/freetype/src/autofit/afshaper.c b/thirdparty/freetype/src/autofit/afshaper.c
index d3902db2ed..bbf7b6b1f9 100644
--- a/thirdparty/freetype/src/autofit/afshaper.c
+++ b/thirdparty/freetype/src/autofit/afshaper.c
@@ -16,9 +16,8 @@
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_ADVANCES_H
+#include <freetype/freetype.h>
+#include <freetype/ftadvanc.h>
#include "afglobal.h"
#include "aftypes.h"
#include "afshaper.h"
diff --git a/thirdparty/freetype/src/autofit/afshaper.h b/thirdparty/freetype/src/autofit/afshaper.h
index a7dbf34f1a..138c27b32b 100644
--- a/thirdparty/freetype/src/autofit/afshaper.h
+++ b/thirdparty/freetype/src/autofit/afshaper.h
@@ -20,8 +20,7 @@
#define AFSHAPER_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
diff --git a/thirdparty/freetype/src/autofit/afstyles.h b/thirdparty/freetype/src/autofit/afstyles.h
index 8d411ab0d7..9113ec451e 100644
--- a/thirdparty/freetype/src/autofit/afstyles.h
+++ b/thirdparty/freetype/src/autofit/afstyles.h
@@ -322,6 +322,13 @@
AF_BLUE_STRINGSET_MLYM,
AF_COVERAGE_DEFAULT )
+ STYLE( medf_dflt, MEDF_DFLT,
+ "Medefaidrin default style",
+ AF_WRITING_SYSTEM_LATIN,
+ AF_SCRIPT_MEDF,
+ AF_BLUE_STRINGSET_MEDF,
+ AF_COVERAGE_DEFAULT )
+
STYLE( mong_dflt, MONG_DFLT,
"Mongolian default style",
AF_WRITING_SYSTEM_LATIN,
diff --git a/thirdparty/freetype/src/autofit/aftypes.h b/thirdparty/freetype/src/autofit/aftypes.h
index 7ca0b59e32..5f040c6b4b 100644
--- a/thirdparty/freetype/src/autofit/aftypes.h
+++ b/thirdparty/freetype/src/autofit/aftypes.h
@@ -32,12 +32,11 @@
#ifndef AFTYPES_H_
#define AFTYPES_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/freetype.h>
+#include <freetype/ftoutln.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
#include "afblue.h"
diff --git a/thirdparty/freetype/src/autofit/autofit.c b/thirdparty/freetype/src/autofit/autofit.c
index 88be8bf2bc..ef5e7f1452 100644
--- a/thirdparty/freetype/src/autofit/autofit.c
+++ b/thirdparty/freetype/src/autofit/autofit.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "afangles.c"
#include "afblue.c"
diff --git a/thirdparty/freetype/src/base/ftadvanc.c b/thirdparty/freetype/src/base/ftadvanc.c
index 310bbba41e..c689e6a15b 100644
--- a/thirdparty/freetype/src/base/ftadvanc.c
+++ b/thirdparty/freetype/src/base/ftadvanc.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
-#include FT_ADVANCES_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftadvanc.h>
+#include <freetype/internal/ftobjs.h>
static FT_Error
diff --git a/thirdparty/freetype/src/base/ftbase.c b/thirdparty/freetype/src/base/ftbase.c
index b8242bb960..bfbaffd64e 100644
--- a/thirdparty/freetype/src/base/ftbase.c
+++ b/thirdparty/freetype/src/base/ftbase.c
@@ -16,7 +16,6 @@
*/
-#include <ft2build.h>
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include "ftadvanc.c"
diff --git a/thirdparty/freetype/src/base/ftbase.h b/thirdparty/freetype/src/base/ftbase.h
index 472713addf..25afa9bc31 100644
--- a/thirdparty/freetype/src/base/ftbase.h
+++ b/thirdparty/freetype/src/base/ftbase.h
@@ -20,13 +20,16 @@
#define FTBASE_H_
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
FT_BEGIN_HEADER
+ FT_DECLARE_GLYPH( ft_bitmap_glyph_class )
+ FT_DECLARE_GLYPH( ft_outline_glyph_class )
+
+
#ifdef FT_CONFIG_OPTION_MAC_FONTS
/* MacOS resource fork cannot exceed 16MB at least for Carbon code; */
diff --git a/thirdparty/freetype/src/base/ftbbox.c b/thirdparty/freetype/src/base/ftbbox.c
index 9d9f9c4015..30a4eba0b3 100644
--- a/thirdparty/freetype/src/base/ftbbox.c
+++ b/thirdparty/freetype/src/base/ftbbox.c
@@ -24,14 +24,13 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-
-#include FT_BBOX_H
-#include FT_IMAGE_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftdebug.h>
+
+#include <freetype/ftbbox.h>
+#include <freetype/ftimage.h>
+#include <freetype/ftoutln.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftobjs.h>
typedef struct TBBox_Rec_
diff --git a/thirdparty/freetype/src/base/ftbdf.c b/thirdparty/freetype/src/base/ftbdf.c
index a239e5f873..fc374c6675 100644
--- a/thirdparty/freetype/src/base/ftbdf.c
+++ b/thirdparty/freetype/src/base/ftbdf.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_BDF_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svbdf.h>
/* documentation is in ftbdf.h */
diff --git a/thirdparty/freetype/src/base/ftbitmap.c b/thirdparty/freetype/src/base/ftbitmap.c
index 18ac4c5f34..584213ddcf 100644
--- a/thirdparty/freetype/src/base/ftbitmap.c
+++ b/thirdparty/freetype/src/base/ftbitmap.c
@@ -16,12 +16,11 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
-#include FT_BITMAP_H
-#include FT_IMAGE_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftbitmap.h>
+#include <freetype/ftimage.h>
+#include <freetype/internal/ftobjs.h>
/**************************************************************************
@@ -909,13 +908,13 @@
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE5(( "FT_Bitmap_Blend:\n"
- " source bitmap: (%d, %d) -- (%d, %d); %d x %d\n",
+ " source bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
source_llx / 64, source_lly / 64,
source_urx / 64, source_ury / 64,
source_->width, source_->rows ));
if ( target->width && target->rows )
- FT_TRACE5(( " target bitmap: (%d, %d) -- (%d, %d); %d x %d\n",
+ FT_TRACE5(( " target bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
target_llx / 64, target_lly / 64,
target_urx / 64, target_ury / 64,
target->width, target->rows ));
@@ -923,7 +922,7 @@
FT_TRACE5(( " target bitmap: empty\n" ));
if ( final_width && final_rows )
- FT_TRACE5(( " final bitmap: (%d, %d) -- (%d, %d); %d x %d\n",
+ FT_TRACE5(( " final bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
final_llx / 64, final_lly / 64,
final_urx / 64, final_ury / 64,
final_width, final_rows ));
diff --git a/thirdparty/freetype/src/base/ftcalc.c b/thirdparty/freetype/src/base/ftcalc.c
index 53550057b1..b5258c85a1 100644
--- a/thirdparty/freetype/src/base/ftcalc.c
+++ b/thirdparty/freetype/src/base/ftcalc.c
@@ -32,12 +32,11 @@
*/
-#include <ft2build.h>
-#include FT_GLYPH_H
-#include FT_TRIGONOMETRY_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftglyph.h>
+#include <freetype/fttrigon.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
#ifdef FT_MULFIX_ASSEMBLER
diff --git a/thirdparty/freetype/src/base/ftcid.c b/thirdparty/freetype/src/base/ftcid.c
index 17c25730e7..ce8a876adc 100644
--- a/thirdparty/freetype/src/base/ftcid.c
+++ b/thirdparty/freetype/src/base/ftcid.c
@@ -16,10 +16,9 @@
*/
-#include <ft2build.h>
-#include FT_CID_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_CID_H
+#include <freetype/ftcid.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svcid.h>
/* documentation is in ftcid.h */
diff --git a/thirdparty/freetype/src/base/ftcolor.c b/thirdparty/freetype/src/base/ftcolor.c
index 986e9924a6..a50d680096 100644
--- a/thirdparty/freetype/src/base/ftcolor.c
+++ b/thirdparty/freetype/src/base/ftcolor.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_COLOR_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/tttypes.h>
+#include <freetype/ftcolor.h>
#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
diff --git a/thirdparty/freetype/src/base/ftdbgmem.c b/thirdparty/freetype/src/base/ftdbgmem.c
index 7f06c86006..eb0d651607 100644
--- a/thirdparty/freetype/src/base/ftdbgmem.c
+++ b/thirdparty/freetype/src/base/ftdbgmem.c
@@ -18,11 +18,11 @@
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_SYSTEM_H
-#include FT_ERRORS_H
-#include FT_TYPES_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftmemory.h>
+#include <freetype/ftsystem.h>
+#include <freetype/fterrors.h>
+#include <freetype/fttypes.h>
#ifdef FT_DEBUG_MEMORY
diff --git a/thirdparty/freetype/src/base/ftdebug.c b/thirdparty/freetype/src/base/ftdebug.c
index da1c1265e3..62cf680b01 100644
--- a/thirdparty/freetype/src/base/ftdebug.c
+++ b/thirdparty/freetype/src/base/ftdebug.c
@@ -41,9 +41,8 @@
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
#ifdef FT_DEBUG_LEVEL_ERROR
@@ -126,7 +125,7 @@
static const char* ft_trace_toggles[trace_count + 1] =
{
-#include FT_INTERNAL_TRACE_H
+#include <freetype/internal/fttrace.h>
NULL
};
diff --git a/thirdparty/freetype/src/base/fterrors.c b/thirdparty/freetype/src/base/fterrors.c
index 8aa688fbe2..eba9e76563 100644
--- a/thirdparty/freetype/src/base/fterrors.c
+++ b/thirdparty/freetype/src/base/fterrors.c
@@ -16,9 +16,8 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_ERRORS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/fterrors.h>
/* documentation is in fterrors.h */
@@ -38,7 +37,7 @@
#define FT_ERRORDEF( e, v, s ) case v: return s;
#define FT_ERROR_END_LIST }
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* defined( FT_CONFIG_OPTION_ERROR_STRINGS ) || ... */
diff --git a/thirdparty/freetype/src/base/ftfntfmt.c b/thirdparty/freetype/src/base/ftfntfmt.c
index 95e9b6e4c1..a45317e797 100644
--- a/thirdparty/freetype/src/base/ftfntfmt.c
+++ b/thirdparty/freetype/src/base/ftfntfmt.c
@@ -16,10 +16,9 @@
*/
-#include <ft2build.h>
-#include FT_FONT_FORMATS_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_FONT_FORMAT_H
+#include <freetype/ftfntfmt.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svfntfmt.h>
/* documentation is in ftfntfmt.h */
diff --git a/thirdparty/freetype/src/base/ftfstype.c b/thirdparty/freetype/src/base/ftfstype.c
index 461d857077..bca548fc56 100644
--- a/thirdparty/freetype/src/base/ftfstype.c
+++ b/thirdparty/freetype/src/base/ftfstype.c
@@ -15,11 +15,10 @@
*
*/
-#include <ft2build.h>
-#include FT_TYPE1_TABLES_H
-#include FT_TRUETYPE_TABLES_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
+#include <freetype/t1tables.h>
+#include <freetype/tttables.h>
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/services/svpsinfo.h>
/* documentation is in freetype.h */
diff --git a/thirdparty/freetype/src/base/ftgasp.c b/thirdparty/freetype/src/base/ftgasp.c
index 0fd80b9cd6..eed05a3265 100644
--- a/thirdparty/freetype/src/base/ftgasp.c
+++ b/thirdparty/freetype/src/base/ftgasp.c
@@ -16,9 +16,8 @@
*/
-#include <ft2build.h>
-#include FT_GASP_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/ftgasp.h>
+#include <freetype/internal/tttypes.h>
FT_EXPORT_DEF( FT_Int )
diff --git a/thirdparty/freetype/src/base/ftgloadr.c b/thirdparty/freetype/src/base/ftgloadr.c
index 6032885c6b..05fc7692bb 100644
--- a/thirdparty/freetype/src/base/ftgloadr.c
+++ b/thirdparty/freetype/src/base/ftgloadr.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_GLYPH_LOADER_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftgloadr.h>
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftobjs.h>
#undef FT_COMPONENT
#define FT_COMPONENT gloader
@@ -93,6 +92,7 @@
base->outline.n_points = 0;
base->outline.n_contours = 0;
+ base->outline.flags = 0;
base->num_subglyphs = 0;
*current = *base;
diff --git a/thirdparty/freetype/src/base/ftglyph.c b/thirdparty/freetype/src/base/ftglyph.c
index 44654be780..825eba2c4d 100644
--- a/thirdparty/freetype/src/base/ftglyph.c
+++ b/thirdparty/freetype/src/base/ftglyph.c
@@ -28,13 +28,14 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
-#include FT_GLYPH_H
-#include FT_OUTLINE_H
-#include FT_BITMAP_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftglyph.h>
+#include <freetype/ftoutln.h>
+#include <freetype/ftbitmap.h>
+#include <freetype/internal/ftobjs.h>
+
+#include "ftbase.h"
/**************************************************************************
diff --git a/thirdparty/freetype/src/base/ftgxval.c b/thirdparty/freetype/src/base/ftgxval.c
index fa32c5f6ca..f04df14526 100644
--- a/thirdparty/freetype/src/base/ftgxval.c
+++ b/thirdparty/freetype/src/base/ftgxval.c
@@ -25,11 +25,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_GX_VALIDATE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svgxval.h>
/* documentation is in ftgxval.h */
diff --git a/thirdparty/freetype/src/base/fthash.c b/thirdparty/freetype/src/base/fthash.c
index 387e6d26db..449b03a5c1 100644
--- a/thirdparty/freetype/src/base/fthash.c
+++ b/thirdparty/freetype/src/base/fthash.c
@@ -39,9 +39,8 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_HASH_H
-#include FT_INTERNAL_MEMORY_H
+#include <freetype/internal/fthash.h>
+#include <freetype/internal/ftmemory.h>
#define INITIAL_HT_SIZE 241
diff --git a/thirdparty/freetype/src/base/ftinit.c b/thirdparty/freetype/src/base/ftinit.c
index 1aab09a771..0acc75e460 100644
--- a/thirdparty/freetype/src/base/ftinit.c
+++ b/thirdparty/freetype/src/base/ftinit.c
@@ -39,9 +39,9 @@
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_MODULE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftmodapi.h>
/**************************************************************************
diff --git a/thirdparty/freetype/src/base/ftlcdfil.c b/thirdparty/freetype/src/base/ftlcdfil.c
index d4ef93a518..1e84dbc894 100644
--- a/thirdparty/freetype/src/base/ftlcdfil.c
+++ b/thirdparty/freetype/src/base/ftlcdfil.c
@@ -16,12 +16,11 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
-#include FT_LCD_FILTER_H
-#include FT_IMAGE_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftlcdfil.h>
+#include <freetype/ftimage.h>
+#include <freetype/internal/ftobjs.h>
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
diff --git a/thirdparty/freetype/src/base/ftmac.c b/thirdparty/freetype/src/base/ftmac.c
index 2de43a0146..55a631fd74 100644
--- a/thirdparty/freetype/src/base/ftmac.c
+++ b/thirdparty/freetype/src/base/ftmac.c
@@ -65,10 +65,9 @@
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/freetype.h>
+#include <freetype/tttags.h>
+#include <freetype/internal/ftstream.h>
#include "ftbase.h"
diff --git a/thirdparty/freetype/src/base/ftmm.c b/thirdparty/freetype/src/base/ftmm.c
index ef2e3d9588..9a702b9933 100644
--- a/thirdparty/freetype/src/base/ftmm.c
+++ b/thirdparty/freetype/src/base/ftmm.c
@@ -16,13 +16,12 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
-#include FT_MULTIPLE_MASTERS_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svmetric.h>
/**************************************************************************
diff --git a/thirdparty/freetype/src/base/ftobjs.c b/thirdparty/freetype/src/base/ftobjs.c
index 1b042614d2..c060bbbc87 100644
--- a/thirdparty/freetype/src/base/ftobjs.c
+++ b/thirdparty/freetype/src/base/ftobjs.c
@@ -16,32 +16,31 @@
*/
-#include <ft2build.h>
-#include FT_LIST_H
-#include FT_OUTLINE_H
-#include FT_FONT_FORMATS_H
-
-#include FT_INTERNAL_VALIDATE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_RFORK_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H /* for SFNT_Load_Table_Func */
-#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for PS_Driver */
-
-#include FT_TRUETYPE_TABLES_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_TRUETYPE_IDS_H
-
-#include FT_SERVICE_PROPERTIES_H
-#include FT_SERVICE_SFNT_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_TT_CMAP_H
-#include FT_SERVICE_KERNING_H
-#include FT_SERVICE_TRUETYPE_ENGINE_H
-
-#include FT_DRIVER_H
+#include <freetype/ftlist.h>
+#include <freetype/ftoutln.h>
+#include <freetype/ftfntfmt.h>
+
+#include <freetype/internal/ftvalid.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftrfork.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h> /* for SFNT_Load_Table_Func */
+#include <freetype/internal/psaux.h> /* for PS_Driver */
+
+#include <freetype/tttables.h>
+#include <freetype/tttags.h>
+#include <freetype/ttnameid.h>
+
+#include <freetype/internal/services/svprop.h>
+#include <freetype/internal/services/svsfnt.h>
+#include <freetype/internal/services/svpostnm.h>
+#include <freetype/internal/services/svgldict.h>
+#include <freetype/internal/services/svttcmap.h>
+#include <freetype/internal/services/svkern.h>
+#include <freetype/internal/services/svtteng.h>
+
+#include <freetype/ftdriver.h>
#ifdef FT_CONFIG_OPTION_MAC_FONTS
#include "ftbase.h"
@@ -50,7 +49,7 @@
#ifdef FT_DEBUG_LEVEL_TRACE
-#include FT_BITMAP_H
+#include <freetype/ftbitmap.h>
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
/* We disable the warning `conversion from XXX to YYY, */
@@ -1063,11 +1062,30 @@
slot->linearHoriAdvance / 65536.0 ));
FT_TRACE5(( " linear y advance: %f\n",
slot->linearVertAdvance / 65536.0 ));
+ FT_TRACE5(( "\n" ));
FT_TRACE5(( " bitmap %dx%d, %s (mode %d)\n",
slot->bitmap.width,
slot->bitmap.rows,
pixel_modes[slot->bitmap.pixel_mode],
slot->bitmap.pixel_mode ));
+ FT_TRACE5(( "\n" ));
+
+ {
+ FT_Glyph_Metrics* metrics = &slot->metrics;
+
+
+ FT_TRACE5(( " metrics:\n" ));
+ FT_TRACE5(( " width: %f\n", metrics->width / 64.0 ));
+ FT_TRACE5(( " height: %f\n", metrics->height / 64.0 ));
+ FT_TRACE5(( "\n" ));
+ FT_TRACE5(( " horiBearingX: %f\n", metrics->horiBearingX / 64.0 ));
+ FT_TRACE5(( " horiBearingY: %f\n", metrics->horiBearingY / 64.0 ));
+ FT_TRACE5(( " horiAdvance: %f\n", metrics->horiAdvance / 64.0 ));
+ FT_TRACE5(( "\n" ));
+ FT_TRACE5(( " vertBearingX: %f\n", metrics->vertBearingX / 64.0 ));
+ FT_TRACE5(( " vertBearingY: %f\n", metrics->vertBearingY / 64.0 ));
+ FT_TRACE5(( " vertAdvance: %f\n", metrics->vertAdvance / 64.0 ));
+ }
#endif
Exit:
@@ -1842,15 +1860,15 @@
/* FT2 allocator takes signed long buffer length,
* too large value causing overflow should be checked
*/
- FT_TRACE4(( " POST fragment #%d: length=0x%08x"
- " total pfb_len=0x%08x\n",
+ FT_TRACE4(( " POST fragment #%d: length=0x%08lx"
+ " total pfb_len=0x%08lx\n",
i, temp, pfb_len + temp + 6 ));
if ( FT_MAC_RFORK_MAX_LEN < temp ||
FT_MAC_RFORK_MAX_LEN - temp < pfb_len + 6 )
{
FT_TRACE2(( " MacOS resource length cannot exceed"
- " 0x%08x\n",
+ " 0x%08lx\n",
FT_MAC_RFORK_MAX_LEN ));
error = FT_THROW( Invalid_Offset );
@@ -1861,13 +1879,13 @@
}
FT_TRACE2(( " total buffer size to concatenate"
- " %d POST fragments: 0x%08x\n",
+ " %ld POST fragments: 0x%08lx\n",
resource_cnt, pfb_len + 2 ));
if ( pfb_len + 2 < 6 )
{
FT_TRACE2(( " too long fragment length makes"
- " pfb_len confused: pfb_len=0x%08x\n",
+ " pfb_len confused: pfb_len=0x%08lx\n",
pfb_len ));
error = FT_THROW( Array_Too_Large );
@@ -1910,7 +1928,7 @@
goto Exit2;
FT_TRACE3(( "POST fragment[%d]:"
- " offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n",
+ " offsets=0x%08lx, rlen=0x%08lx, flags=0x%04x\n",
i, offsets[i], rlen, flags ));
error = FT_ERR( Array_Too_Large );
@@ -1937,7 +1955,7 @@
else
{
FT_TRACE3(( " Write POST fragment #%d header (4-byte) to buffer"
- " %p + 0x%08x\n",
+ " %p + 0x%08lx\n",
i, pfb_data, pfb_lenpos ));
if ( pfb_lenpos + 3 > pfb_len + 2 )
@@ -1952,7 +1970,7 @@
break;
FT_TRACE3(( " Write POST fragment #%d header (6-byte) to buffer"
- " %p + 0x%08x\n",
+ " %p + 0x%08lx\n",
i, pfb_data, pfb_pos ));
if ( pfb_pos + 6 > pfb_len + 2 )
@@ -1974,8 +1992,8 @@
if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len )
goto Exit2;
- FT_TRACE3(( " Load POST fragment #%d (%d byte) to buffer"
- " %p + 0x%08x\n",
+ FT_TRACE3(( " Load POST fragment #%d (%ld byte) to buffer"
+ " %p + 0x%08lx\n",
i, rlen, pfb_data, pfb_pos ));
error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen );
@@ -2260,7 +2278,7 @@
args2.flags = FT_OPEN_PATHNAME;
args2.pathname = file_names[i] ? file_names[i] : args->pathname;
- FT_TRACE3(( "Try rule %d: %s (offset=%d) ...",
+ FT_TRACE3(( "Try rule %d: %s (offset=%ld) ...",
i, args2.pathname, offsets[i] ));
error = FT_Stream_New( library, &args2, &stream2 );
@@ -2858,6 +2876,8 @@
if ( error )
{
FT_FREE( node );
+ if ( size )
+ FT_FREE( size->internal );
FT_FREE( size );
}
@@ -3213,9 +3233,9 @@
FT_Size_Metrics* metrics = &face->size->metrics;
- FT_TRACE5(( " x scale: %d (%f)\n",
+ FT_TRACE5(( " x scale: %ld (%f)\n",
metrics->x_scale, metrics->x_scale / 65536.0 ));
- FT_TRACE5(( " y scale: %d (%f)\n",
+ FT_TRACE5(( " y scale: %ld (%f)\n",
metrics->y_scale, metrics->y_scale / 65536.0 ));
FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
@@ -3288,9 +3308,9 @@
FT_Size_Metrics* metrics = &face->size->metrics;
- FT_TRACE5(( " x scale: %d (%f)\n",
+ FT_TRACE5(( " x scale: %ld (%f)\n",
metrics->x_scale, metrics->x_scale / 65536.0 ));
- FT_TRACE5(( " y scale: %d (%f)\n",
+ FT_TRACE5(( " y scale: %ld (%f)\n",
metrics->y_scale, metrics->y_scale / 65536.0 ));
FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 ));
FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 ));
@@ -3450,7 +3470,7 @@
if ( akerning->x != orig_x_rounded ||
akerning->y != orig_y_rounded )
FT_TRACE5(( "FT_Get_Kerning: horizontal kerning"
- " (%d, %d) scaled down to (%d, %d) pixels\n",
+ " (%ld, %ld) scaled down to (%ld, %ld) pixels\n",
orig_x_rounded / 64, orig_y_rounded / 64,
akerning->x / 64, akerning->y / 64 ));
}
@@ -3722,7 +3742,7 @@
if ( charcode > 0xFFFFFFFFUL )
{
FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
- FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+ FT_TRACE1(( " 0x%lx is truncated\n", charcode ));
}
result = cmap->clazz->char_index( cmap, (FT_UInt32)charcode );
@@ -3898,13 +3918,13 @@
{
FT_TRACE1(( "FT_Face_GetCharVariantIndex:"
" too large charcode" ));
- FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+ FT_TRACE1(( " 0x%lx is truncated\n", charcode ));
}
if ( variantSelector > 0xFFFFFFFFUL )
{
FT_TRACE1(( "FT_Face_GetCharVariantIndex:"
" too large variantSelector" ));
- FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
+ FT_TRACE1(( " 0x%lx is truncated\n", variantSelector ));
}
result = vcmap->clazz->char_var_index( vcmap, ucmap,
@@ -3941,13 +3961,13 @@
{
FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:"
" too large charcode" ));
- FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+ FT_TRACE1(( " 0x%lx is truncated\n", charcode ));
}
if ( variantSelector > 0xFFFFFFFFUL )
{
FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:"
" too large variantSelector" ));
- FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
+ FT_TRACE1(( " 0x%lx is truncated\n", variantSelector ));
}
result = vcmap->clazz->char_var_default( vcmap,
@@ -4010,7 +4030,7 @@
if ( charcode > 0xFFFFFFFFUL )
{
FT_TRACE1(( "FT_Face_GetVariantsOfChar: too large charcode" ));
- FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+ FT_TRACE1(( " 0x%lx is truncated\n", charcode ));
}
result = vcmap->clazz->charvariant_list( vcmap, memory,
@@ -4044,7 +4064,7 @@
if ( variantSelector > 0xFFFFFFFFUL )
{
FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" ));
- FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
+ FT_TRACE1(( " 0x%lx is truncated\n", variantSelector ));
}
result = vcmap->clazz->variantchar_list( vcmap, memory,
diff --git a/thirdparty/freetype/src/base/ftotval.c b/thirdparty/freetype/src/base/ftotval.c
index 9f69e0c1fd..90a5dd617c 100644
--- a/thirdparty/freetype/src/base/ftotval.c
+++ b/thirdparty/freetype/src/base/ftotval.c
@@ -15,12 +15,11 @@
*
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_OPENTYPE_VALIDATE_H
-#include FT_OPENTYPE_VALIDATE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svotval.h>
+#include <freetype/ftotval.h>
/* documentation is in ftotval.h */
diff --git a/thirdparty/freetype/src/base/ftoutln.c b/thirdparty/freetype/src/base/ftoutln.c
index faaae83294..311f098e3a 100644
--- a/thirdparty/freetype/src/base/ftoutln.c
+++ b/thirdparty/freetype/src/base/ftoutln.c
@@ -16,12 +16,11 @@
*/
-#include <ft2build.h>
-#include FT_OUTLINE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_TRIGONOMETRY_H
+#include <freetype/ftoutln.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/fttrigon.h>
/**************************************************************************
@@ -275,7 +274,7 @@
first = (FT_UInt)last + 1;
}
- FT_TRACE5(( "FT_Outline_Decompose: Done\n", n ));
+ FT_TRACE5(( "FT_Outline_Decompose: Done\n" ));
return FT_Err_Ok;
Invalid_Outline:
@@ -1061,6 +1060,11 @@
if ( cbox.xMin == cbox.xMax || cbox.yMin == cbox.yMax )
return FT_ORIENTATION_NONE;
+ /* Reject values large outlines. */
+ if ( cbox.xMin < -0x1000000L || cbox.yMin < -0x1000000L ||
+ cbox.xMax > 0x1000000L || cbox.yMax > 0x1000000L )
+ return FT_ORIENTATION_NONE;
+
xshift = FT_MSB( (FT_UInt32)( FT_ABS( cbox.xMax ) |
FT_ABS( cbox.xMin ) ) ) - 14;
xshift = FT_MAX( xshift, 0 );
diff --git a/thirdparty/freetype/src/base/ftpatent.c b/thirdparty/freetype/src/base/ftpatent.c
index 077a9b03fa..a02c636a65 100644
--- a/thirdparty/freetype/src/base/ftpatent.c
+++ b/thirdparty/freetype/src/base/ftpatent.c
@@ -16,13 +16,12 @@
*
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-#include FT_SERVICE_SFNT_H
-#include FT_SERVICE_TRUETYPE_GLYF_H
+#include <freetype/freetype.h>
+#include <freetype/tttags.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/services/svsfnt.h>
+#include <freetype/internal/services/svttglyf.h>
/* documentation is in freetype.h */
diff --git a/thirdparty/freetype/src/base/ftpfr.c b/thirdparty/freetype/src/base/ftpfr.c
index 57e65665ff..c656fcd9b9 100644
--- a/thirdparty/freetype/src/base/ftpfr.c
+++ b/thirdparty/freetype/src/base/ftpfr.c
@@ -15,11 +15,10 @@
*
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_PFR_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svpfr.h>
/* check the format */
diff --git a/thirdparty/freetype/src/base/ftpsprop.c b/thirdparty/freetype/src/base/ftpsprop.c
index c63f864c1a..8c29f50f6b 100644
--- a/thirdparty/freetype/src/base/ftpsprop.c
+++ b/thirdparty/freetype/src/base/ftpsprop.c
@@ -17,12 +17,11 @@
*/
-#include <ft2build.h>
-#include FT_DRIVER_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_POSTSCRIPT_PROPS_H
+#include <freetype/ftdriver.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftpsprop.h>
/**************************************************************************
diff --git a/thirdparty/freetype/src/base/ftrfork.c b/thirdparty/freetype/src/base/ftrfork.c
index 1bf7800f17..f989be47f4 100644
--- a/thirdparty/freetype/src/base/ftrfork.c
+++ b/thirdparty/freetype/src/base/ftrfork.c
@@ -24,10 +24,9 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_RFORK_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftrfork.h>
#include "ftbase.h"
@@ -240,7 +239,7 @@
(char)( 0xFF & ( tag_internal >> 16 ) ),
(char)( 0xFF & ( tag_internal >> 8 ) ),
(char)( 0xFF & ( tag_internal >> 0 ) ) ));
- FT_TRACE3(( " : subcount=%d, suboffset=0x%04x\n",
+ FT_TRACE3(( " : subcount=%d, suboffset=0x%04lx\n",
subcnt, rpos ));
if ( tag_internal == tag )
@@ -286,7 +285,7 @@
ref[j].offset = temp & 0xFFFFFFL;
FT_TRACE3(( " [%d]:"
- " resource_id=0x%04x, offset=0x%08x\n",
+ " resource_id=0x%04x, offset=0x%08lx\n",
j, (FT_UShort)ref[j].res_id, ref[j].offset ));
}
@@ -302,7 +301,7 @@
for ( j = 0; j < *count; j++ )
FT_TRACE3(( " [%d]:"
- " resource_id=0x%04x, offset=0x%08x\n",
+ " resource_id=0x%04x, offset=0x%08lx\n",
j, ref[j].res_id, ref[j].offset ));
}
diff --git a/thirdparty/freetype/src/base/ftsnames.c b/thirdparty/freetype/src/base/ftsnames.c
index 25f5d45be5..8507f28d36 100644
--- a/thirdparty/freetype/src/base/ftsnames.c
+++ b/thirdparty/freetype/src/base/ftsnames.c
@@ -19,12 +19,11 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
-#include FT_SFNT_NAMES_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/ftsnames.h>
+#include <freetype/internal/tttypes.h>
+#include <freetype/internal/ftstream.h>
#ifdef TT_CONFIG_OPTION_SFNT_NAMES
diff --git a/thirdparty/freetype/src/base/ftstream.c b/thirdparty/freetype/src/base/ftstream.c
index 7dbf9b55fc..d940254d8b 100644
--- a/thirdparty/freetype/src/base/ftstream.c
+++ b/thirdparty/freetype/src/base/ftstream.c
@@ -16,9 +16,8 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftdebug.h>
/**************************************************************************
diff --git a/thirdparty/freetype/src/base/ftstroke.c b/thirdparty/freetype/src/base/ftstroke.c
index 3369dc24b1..56f98e1d92 100644
--- a/thirdparty/freetype/src/base/ftstroke.c
+++ b/thirdparty/freetype/src/base/ftstroke.c
@@ -16,13 +16,12 @@
*/
-#include <ft2build.h>
-#include FT_STROKER_H
-#include FT_TRIGONOMETRY_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftstroke.h>
+#include <freetype/fttrigon.h>
+#include <freetype/ftoutln.h>
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
/* declare an extern to access `ft_outline_glyph_class' globally */
diff --git a/thirdparty/freetype/src/base/ftsynth.c b/thirdparty/freetype/src/base/ftsynth.c
index eee6b952b4..a9119e2b24 100644
--- a/thirdparty/freetype/src/base/ftsynth.c
+++ b/thirdparty/freetype/src/base/ftsynth.c
@@ -16,12 +16,11 @@
*/
-#include <ft2build.h>
-#include FT_SYNTHESIS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_OUTLINE_H
-#include FT_BITMAP_H
+#include <freetype/ftsynth.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftoutln.h>
+#include <freetype/ftbitmap.h>
/**************************************************************************
@@ -130,7 +129,7 @@
if ( ( ystr >> 6 ) > FT_INT_MAX || ( ystr >> 6 ) < FT_INT_MIN )
{
FT_TRACE1(( "FT_GlyphSlot_Embolden:" ));
- FT_TRACE1(( "too strong emboldening parameter ystr=%d\n", ystr ));
+ FT_TRACE1(( "too strong emboldening parameter ystr=%ld\n", ystr ));
return;
}
error = FT_GlyphSlot_Own_Bitmap( slot );
diff --git a/thirdparty/freetype/src/base/ftsystem.c b/thirdparty/freetype/src/base/ftsystem.c
index 290100613f..3013cbda9d 100644
--- a/thirdparty/freetype/src/base/ftsystem.c
+++ b/thirdparty/freetype/src/base/ftsystem.c
@@ -27,11 +27,11 @@
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_SYSTEM_H
-#include FT_ERRORS_H
-#include FT_TYPES_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/ftsystem.h>
+#include <freetype/fterrors.h>
+#include <freetype/fttypes.h>
/**************************************************************************
diff --git a/thirdparty/freetype/src/base/fttrigon.c b/thirdparty/freetype/src/base/fttrigon.c
index dbe11107bd..c6f027cf61 100644
--- a/thirdparty/freetype/src/base/fttrigon.c
+++ b/thirdparty/freetype/src/base/fttrigon.c
@@ -29,10 +29,9 @@
*
*/
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_CALC_H
-#include FT_TRIGONOMETRY_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/fttrigon.h>
/* the Cordic shrink factor 0.858785336480436 * 2^32 */
diff --git a/thirdparty/freetype/src/base/fttype1.c b/thirdparty/freetype/src/base/fttype1.c
index 61778faa70..be60ed6ec5 100644
--- a/thirdparty/freetype/src/base/fttype1.c
+++ b/thirdparty/freetype/src/base/fttype1.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/services/svpsinfo.h>
/* documentation is in t1tables.h */
diff --git a/thirdparty/freetype/src/base/ftutil.c b/thirdparty/freetype/src/base/ftutil.c
index 629af174b1..d90cfbcd26 100644
--- a/thirdparty/freetype/src/base/ftutil.c
+++ b/thirdparty/freetype/src/base/ftutil.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_LIST_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftlist.h>
/**************************************************************************
diff --git a/thirdparty/freetype/src/base/ftver.rc b/thirdparty/freetype/src/base/ftver.rc
index fcbd9eff5f..0b92e9b899 100644
--- a/thirdparty/freetype/src/base/ftver.rc
+++ b/thirdparty/freetype/src/base/ftver.rc
@@ -18,8 +18,8 @@
#include<windows.h>
-#define FT_VERSION 2,10,2,0
-#define FT_VERSION_STR "2.10.2"
+#define FT_VERSION 2,10,4,0
+#define FT_VERSION_STR "2.10.4"
VS_VERSION_INFO VERSIONINFO
FILEVERSION FT_VERSION
diff --git a/thirdparty/freetype/src/base/ftwinfnt.c b/thirdparty/freetype/src/base/ftwinfnt.c
index 77527277c2..699dc3d700 100644
--- a/thirdparty/freetype/src/base/ftwinfnt.c
+++ b/thirdparty/freetype/src/base/ftwinfnt.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_WINFONTS_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_WINFNT_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftwinfnt.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svwinfnt.h>
/* documentation is in ftwinfnt.h */
diff --git a/thirdparty/freetype/src/bdf/bdf.c b/thirdparty/freetype/src/bdf/bdf.c
index e54df6649b..249012e590 100644
--- a/thirdparty/freetype/src/bdf/bdf.c
+++ b/thirdparty/freetype/src/bdf/bdf.c
@@ -26,7 +26,6 @@ THE SOFTWARE.
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "bdflib.c"
#include "bdfdrivr.c"
diff --git a/thirdparty/freetype/src/bdf/bdf.h b/thirdparty/freetype/src/bdf/bdf.h
index d9abd2378f..5acbd5f2f9 100644
--- a/thirdparty/freetype/src/bdf/bdf.h
+++ b/thirdparty/freetype/src/bdf/bdf.h
@@ -30,10 +30,9 @@
* Based on bdf.h,v 1.16 2000/03/16 20:08:51 mleisher
*/
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_HASH_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/fthash.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/bdf/bdfdrivr.c b/thirdparty/freetype/src/bdf/bdfdrivr.c
index 60eb93305e..d29188b97b 100644
--- a/thirdparty/freetype/src/bdf/bdfdrivr.c
+++ b/thirdparty/freetype/src/bdf/bdfdrivr.c
@@ -24,16 +24,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_BDF_H
-#include FT_TRUETYPE_IDS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftbdf.h>
+#include <freetype/ttnameid.h>
-#include FT_SERVICE_BDF_H
-#include FT_SERVICE_FONT_FORMAT_H
+#include <freetype/internal/services/svbdf.h>
+#include <freetype/internal/services/svfntfmt.h>
#include "bdf.h"
#include "bdfdrivr.h"
@@ -184,7 +183,8 @@ THE SOFTWARE.
Exit:
if ( charcode > 0xFFFFFFFFUL )
{
- FT_TRACE1(( "bdf_cmap_char_next: charcode 0x%x > 32bit API" ));
+ FT_TRACE1(( "bdf_cmap_char_next: charcode 0x%lx > 32bit API",
+ charcode ));
*acharcode = 0;
/* XXX: result should be changed to indicate an overflow error */
}
@@ -402,10 +402,10 @@ THE SOFTWARE.
bdf_property_t* prop = NULL;
- FT_TRACE4(( " number of glyphs: allocated %d (used %d)\n",
+ FT_TRACE4(( " number of glyphs: allocated %ld (used %ld)\n",
font->glyphs_size,
font->glyphs_used ));
- FT_TRACE4(( " number of unencoded glyphs: allocated %d (used %d)\n",
+ FT_TRACE4(( " number of unencoded glyphs: allocated %ld (used %ld)\n",
font->unencoded_size,
font->unencoded_used ));
@@ -457,13 +457,13 @@ THE SOFTWARE.
if ( font->font_ascent > 0x7FFF || font->font_ascent < -0x7FFF )
{
font->font_ascent = font->font_ascent < 0 ? -0x7FFF : 0x7FFF;
- FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %d\n",
+ FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %ld\n",
font->font_ascent ));
}
if ( font->font_descent > 0x7FFF || font->font_descent < -0x7FFF )
{
font->font_descent = font->font_descent < 0 ? -0x7FFF : 0x7FFF;
- FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %d\n",
+ FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %ld\n",
font->font_descent ));
}
@@ -504,7 +504,7 @@ THE SOFTWARE.
prop->value.l < -0x504C2L )
{
bsize->size = 0x7FFF;
- FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n",
+ FT_TRACE0(( "BDF_Face_Init: clamping point size to value %ld\n",
bsize->size ));
}
else
@@ -517,7 +517,7 @@ THE SOFTWARE.
if ( font->point_size > 0x7FFF )
{
bsize->size = 0x7FFF;
- FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n",
+ FT_TRACE0(( "BDF_Face_Init: clamping point size to value %ld\n",
bsize->size ));
}
else
@@ -539,7 +539,7 @@ THE SOFTWARE.
if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF )
{
bsize->y_ppem = 0x7FFF << 6;
- FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %d\n",
+ FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %ld\n",
bsize->y_ppem ));
}
else
@@ -615,7 +615,7 @@ THE SOFTWARE.
for ( n = 0; n < font->glyphs_size; n++ )
{
(face->en_table[n]).enc = cur[n].encoding;
- FT_TRACE4(( " idx %d, val 0x%lX\n", n, cur[n].encoding ));
+ FT_TRACE4(( " idx %ld, val 0x%lX\n", n, cur[n].encoding ));
(face->en_table[n]).glyph = (FT_UShort)n;
if ( cur[n].encoding == font->default_char )
@@ -624,7 +624,7 @@ THE SOFTWARE.
face->default_glyph = (FT_UInt)n;
else
FT_TRACE1(( "BDF_Face_Init:"
- " idx %d is too large for this system\n", n ));
+ " idx %ld is too large for this system\n", n ));
}
}
}
@@ -825,7 +825,7 @@ THE SOFTWARE.
bitmap->rows = glyph.bbx.height;
bitmap->width = glyph.bbx.width;
if ( glyph.bpr > FT_INT_MAX )
- FT_TRACE1(( "BDF_Glyph_Load: too large pitch %d is truncated\n",
+ FT_TRACE1(( "BDF_Glyph_Load: too large pitch %ld is truncated\n",
glyph.bpr ));
bitmap->pitch = (int)glyph.bpr; /* same as FT_Bitmap.pitch */
@@ -902,7 +902,8 @@ THE SOFTWARE.
if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) )
{
FT_TRACE1(( "bdf_get_bdf_property:"
- " too large integer 0x%x is truncated\n" ));
+ " too large integer 0x%lx is truncated\n",
+ prop->value.l ));
}
aproperty->type = BDF_PROPERTY_TYPE_INTEGER;
aproperty->u.integer = (FT_Int32)prop->value.l;
@@ -912,7 +913,8 @@ THE SOFTWARE.
if ( prop->value.ul > 0xFFFFFFFFUL )
{
FT_TRACE1(( "bdf_get_bdf_property:"
- " too large cardinal 0x%x is truncated\n" ));
+ " too large cardinal 0x%lx is truncated\n",
+ prop->value.ul ));
}
aproperty->type = BDF_PROPERTY_TYPE_CARDINAL;
aproperty->u.cardinal = (FT_UInt32)prop->value.ul;
diff --git a/thirdparty/freetype/src/bdf/bdfdrivr.h b/thirdparty/freetype/src/bdf/bdfdrivr.h
index b37b84ea31..54aaa3353c 100644
--- a/thirdparty/freetype/src/bdf/bdfdrivr.h
+++ b/thirdparty/freetype/src/bdf/bdfdrivr.h
@@ -28,8 +28,7 @@ THE SOFTWARE.
#ifndef BDFDRIVR_H_
#define BDFDRIVR_H_
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
#include "bdf.h"
diff --git a/thirdparty/freetype/src/bdf/bdferror.h b/thirdparty/freetype/src/bdf/bdferror.h
index dbe41c02ab..c1b5444871 100644
--- a/thirdparty/freetype/src/bdf/bdferror.h
+++ b/thirdparty/freetype/src/bdf/bdferror.h
@@ -29,7 +29,7 @@
#ifndef BDFERROR_H_
#define BDFERROR_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -37,7 +37,7 @@
#define FT_ERR_PREFIX BDF_Err_
#define FT_ERR_BASE FT_Mod_Err_BDF
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* BDFERROR_H_ */
diff --git a/thirdparty/freetype/src/bdf/bdflib.c b/thirdparty/freetype/src/bdf/bdflib.c
index 63813f7edc..a4ddb9a1d9 100644
--- a/thirdparty/freetype/src/bdf/bdflib.c
+++ b/thirdparty/freetype/src/bdf/bdflib.c
@@ -31,12 +31,11 @@
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftobjs.h>
#include "bdf.h"
#include "bdferror.h"
diff --git a/thirdparty/freetype/src/bzip2/ftbzip2.c b/thirdparty/freetype/src/bzip2/ftbzip2.c
index e4d7a4901a..411c5d263b 100644
--- a/thirdparty/freetype/src/bzip2/ftbzip2.c
+++ b/thirdparty/freetype/src/bzip2/ftbzip2.c
@@ -22,15 +22,14 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_BZIP2_H
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftbzip2.h>
#include FT_CONFIG_STANDARD_LIBRARY_H
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -38,7 +37,7 @@
#define FT_ERR_PREFIX Bzip2_Err_
#define FT_ERR_BASE FT_Mod_Err_Bzip2
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#ifdef FT_CONFIG_OPTION_USE_BZIP2
diff --git a/thirdparty/freetype/src/cache/ftcache.c b/thirdparty/freetype/src/cache/ftcache.c
index 4137f68690..e90f4639cb 100644
--- a/thirdparty/freetype/src/cache/ftcache.c
+++ b/thirdparty/freetype/src/cache/ftcache.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "ftcbasic.c"
#include "ftccache.c"
diff --git a/thirdparty/freetype/src/cache/ftcbasic.c b/thirdparty/freetype/src/cache/ftcbasic.c
index a65a90e867..43ea314d4a 100644
--- a/thirdparty/freetype/src/cache/ftcbasic.c
+++ b/thirdparty/freetype/src/cache/ftcbasic.c
@@ -16,10 +16,9 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_CACHE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftcache.h>
#include "ftcglyph.h"
#include "ftcimage.h"
#include "ftcsbits.h"
@@ -111,7 +110,9 @@
if ( (FT_ULong)face->num_glyphs > FT_UINT_MAX || 0 > face->num_glyphs )
FT_TRACE1(( "ftc_basic_family_get_count:"
- " too large number of glyphs in this face, truncated\n",
+ " the number of glyphs in this face is %ld,\n"
+ " "
+ " which is too much and thus truncated\n",
face->num_glyphs ));
if ( !error )
@@ -394,7 +395,7 @@
#if FT_ULONG_MAX > FT_UINT_MAX
if ( load_flags > FT_UINT_MAX )
FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
- " higher bits in load_flags 0x%x are dropped\n",
+ " higher bits in load_flags 0x%lx are dropped\n",
load_flags & ~((FT_ULong)FT_UINT_MAX) ));
#endif
@@ -594,7 +595,7 @@
#if FT_ULONG_MAX > FT_UINT_MAX
if ( load_flags > FT_UINT_MAX )
FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
- " higher bits in load_flags 0x%x are dropped\n",
+ " higher bits in load_flags 0x%lx are dropped\n",
load_flags & ~((FT_ULong)FT_UINT_MAX) ));
#endif
diff --git a/thirdparty/freetype/src/cache/ftccache.c b/thirdparty/freetype/src/cache/ftccache.c
index 1d406c4200..1c8e0f3221 100644
--- a/thirdparty/freetype/src/cache/ftccache.c
+++ b/thirdparty/freetype/src/cache/ftccache.c
@@ -16,10 +16,9 @@
*/
-#include <ft2build.h>
#include "ftcmanag.h"
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
#include "ftccback.h"
#include "ftcerror.h"
diff --git a/thirdparty/freetype/src/cache/ftccache.h b/thirdparty/freetype/src/cache/ftccache.h
index 2996ee8080..11698bb0e9 100644
--- a/thirdparty/freetype/src/cache/ftccache.h
+++ b/thirdparty/freetype/src/cache/ftccache.h
@@ -19,7 +19,7 @@
#ifndef FTCCACHE_H_
#define FTCCACHE_H_
-
+#include <freetype/internal/compiler-macros.h>
#include "ftcmru.h"
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/cache/ftccback.h b/thirdparty/freetype/src/cache/ftccback.h
index 252be7c2b5..542acb1565 100644
--- a/thirdparty/freetype/src/cache/ftccback.h
+++ b/thirdparty/freetype/src/cache/ftccback.h
@@ -18,14 +18,14 @@
#ifndef FTCCBACK_H_
#define FTCCBACK_H_
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
#include "ftcmru.h"
#include "ftcimage.h"
#include "ftcmanag.h"
#include "ftcglyph.h"
#include "ftcsbits.h"
+FT_BEGIN_HEADER
FT_LOCAL( void )
ftc_inode_free( FTC_Node inode,
@@ -85,6 +85,7 @@
ftc_node_destroy( FTC_Node node,
FTC_Manager manager );
+FT_END_HEADER
#endif /* FTCCBACK_H_ */
diff --git a/thirdparty/freetype/src/cache/ftccmap.c b/thirdparty/freetype/src/cache/ftccmap.c
index a5da694d56..468c008cf6 100644
--- a/thirdparty/freetype/src/cache/ftccmap.c
+++ b/thirdparty/freetype/src/cache/ftccmap.c
@@ -16,13 +16,12 @@
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_CACHE_H
+#include <freetype/freetype.h>
+#include <freetype/ftcache.h>
#include "ftcmanag.h"
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
#include "ftccback.h"
#include "ftcerror.h"
diff --git a/thirdparty/freetype/src/cache/ftcerror.h b/thirdparty/freetype/src/cache/ftcerror.h
index 15e416ed21..bedfd28371 100644
--- a/thirdparty/freetype/src/cache/ftcerror.h
+++ b/thirdparty/freetype/src/cache/ftcerror.h
@@ -26,7 +26,7 @@
#ifndef FTCERROR_H_
#define FTCERROR_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -34,7 +34,7 @@
#define FT_ERR_PREFIX FTC_Err_
#define FT_ERR_BASE FT_Mod_Err_Cache
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* FTCERROR_H_ */
diff --git a/thirdparty/freetype/src/cache/ftcglyph.c b/thirdparty/freetype/src/cache/ftcglyph.c
index 559a2fb4c8..7f5438aad5 100644
--- a/thirdparty/freetype/src/cache/ftcglyph.c
+++ b/thirdparty/freetype/src/cache/ftcglyph.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_CACHE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftcache.h>
#include "ftcglyph.h"
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#include "ftccback.h"
#include "ftcerror.h"
diff --git a/thirdparty/freetype/src/cache/ftcglyph.h b/thirdparty/freetype/src/cache/ftcglyph.h
index ef689f9947..5629545f3c 100644
--- a/thirdparty/freetype/src/cache/ftcglyph.h
+++ b/thirdparty/freetype/src/cache/ftcglyph.h
@@ -117,7 +117,6 @@
#define FTCGLYPH_H_
-#include <ft2build.h>
#include "ftcmanag.h"
diff --git a/thirdparty/freetype/src/cache/ftcimage.c b/thirdparty/freetype/src/cache/ftcimage.c
index 7696b2e52d..58ebad8c93 100644
--- a/thirdparty/freetype/src/cache/ftcimage.c
+++ b/thirdparty/freetype/src/cache/ftcimage.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
#include "ftcimage.h"
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftobjs.h>
#include "ftccback.h"
#include "ftcerror.h"
diff --git a/thirdparty/freetype/src/cache/ftcimage.h b/thirdparty/freetype/src/cache/ftcimage.h
index f99c5074cf..a400788b3c 100644
--- a/thirdparty/freetype/src/cache/ftcimage.h
+++ b/thirdparty/freetype/src/cache/ftcimage.h
@@ -36,8 +36,7 @@
#define FTCIMAGE_H_
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
#include "ftcglyph.h"
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/cache/ftcmanag.c b/thirdparty/freetype/src/cache/ftcmanag.c
index a6f1733f64..436d41f374 100644
--- a/thirdparty/freetype/src/cache/ftcmanag.c
+++ b/thirdparty/freetype/src/cache/ftcmanag.c
@@ -16,12 +16,11 @@
*/
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
#include "ftcmanag.h"
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_SIZES_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftsizes.h>
#include "ftccback.h"
#include "ftcerror.h"
diff --git a/thirdparty/freetype/src/cache/ftcmanag.h b/thirdparty/freetype/src/cache/ftcmanag.h
index 17ade7175f..6c6ec68545 100644
--- a/thirdparty/freetype/src/cache/ftcmanag.h
+++ b/thirdparty/freetype/src/cache/ftcmanag.h
@@ -63,8 +63,7 @@
#define FTCMANAG_H_
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
#include "ftcmru.h"
#include "ftccache.h"
diff --git a/thirdparty/freetype/src/cache/ftcmru.c b/thirdparty/freetype/src/cache/ftcmru.c
index 370ae3be04..8feed45f6b 100644
--- a/thirdparty/freetype/src/cache/ftcmru.c
+++ b/thirdparty/freetype/src/cache/ftcmru.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
#include "ftcmru.h"
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
#include "ftcerror.h"
diff --git a/thirdparty/freetype/src/cache/ftcmru.h b/thirdparty/freetype/src/cache/ftcmru.h
index 1591c20807..ac4f9b126d 100644
--- a/thirdparty/freetype/src/cache/ftcmru.h
+++ b/thirdparty/freetype/src/cache/ftcmru.h
@@ -44,8 +44,8 @@
#define FTCMRU_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
+#include <freetype/internal/compiler-macros.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
diff --git a/thirdparty/freetype/src/cache/ftcsbits.c b/thirdparty/freetype/src/cache/ftcsbits.c
index 24e4aa1316..e0db930af8 100644
--- a/thirdparty/freetype/src/cache/ftcsbits.c
+++ b/thirdparty/freetype/src/cache/ftcsbits.c
@@ -16,12 +16,11 @@
*/
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
#include "ftcsbits.h"
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_ERRORS_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/fterrors.h>
#include "ftccback.h"
#include "ftcerror.h"
diff --git a/thirdparty/freetype/src/cache/ftcsbits.h b/thirdparty/freetype/src/cache/ftcsbits.h
index 2517d15552..46f797e724 100644
--- a/thirdparty/freetype/src/cache/ftcsbits.h
+++ b/thirdparty/freetype/src/cache/ftcsbits.h
@@ -20,8 +20,7 @@
#define FTCSBITS_H_
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
#include "ftcglyph.h"
diff --git a/thirdparty/freetype/src/cff/cff.c b/thirdparty/freetype/src/cff/cff.c
index 755228bb6c..0fa6c87870 100644
--- a/thirdparty/freetype/src/cff/cff.c
+++ b/thirdparty/freetype/src/cff/cff.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "cffcmap.c"
#include "cffdrivr.c"
diff --git a/thirdparty/freetype/src/cff/cffcmap.c b/thirdparty/freetype/src/cff/cffcmap.c
index 1a045765de..6d16ed4226 100644
--- a/thirdparty/freetype/src/cff/cffcmap.c
+++ b/thirdparty/freetype/src/cff/cffcmap.c
@@ -16,8 +16,7 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include "cffcmap.h"
#include "cffload.h"
diff --git a/thirdparty/freetype/src/cff/cffcmap.h b/thirdparty/freetype/src/cff/cffcmap.h
index 319be88241..69fab8dc6c 100644
--- a/thirdparty/freetype/src/cff/cffcmap.h
+++ b/thirdparty/freetype/src/cff/cffcmap.h
@@ -19,7 +19,7 @@
#ifndef CFFCMAP_H_
#define CFFCMAP_H_
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+#include <freetype/internal/cffotypes.h>
FT_BEGIN_HEADER
@@ -43,7 +43,7 @@ FT_BEGIN_HEADER
} CFF_CMapStdRec;
- FT_DECLARE_CMAP_CLASS(cff_cmap_encoding_class_rec)
+ FT_DECLARE_CMAP_CLASS( cff_cmap_encoding_class_rec )
/*************************************************************************/
@@ -56,7 +56,7 @@ FT_BEGIN_HEADER
/* unicode (synthetic) cmaps */
- FT_DECLARE_CMAP_CLASS(cff_cmap_unicode_class_rec)
+ FT_DECLARE_CMAP_CLASS( cff_cmap_unicode_class_rec )
FT_END_HEADER
diff --git a/thirdparty/freetype/src/cff/cffdrivr.c b/thirdparty/freetype/src/cff/cffdrivr.c
index 6d0dcd09d2..486ab24235 100644
--- a/thirdparty/freetype/src/cff/cffdrivr.c
+++ b/thirdparty/freetype/src/cff/cffdrivr.c
@@ -16,18 +16,17 @@
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_POSTSCRIPT_PROPS_H
-#include FT_SERVICE_CID_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_TT_CMAP_H
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/ftpsprop.h>
+#include <freetype/internal/services/svcid.h>
+#include <freetype/internal/services/svpsinfo.h>
+#include <freetype/internal/services/svpostnm.h>
+#include <freetype/internal/services/svttcmap.h>
+#include <freetype/internal/services/svcfftl.h>
#include "cffdrivr.h"
#include "cffgload.h"
@@ -37,16 +36,16 @@
#include "cffobjs.h"
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svmetric.h>
#endif
#include "cfferrs.h"
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_DRIVER_H
+#include <freetype/internal/services/svfntfmt.h>
+#include <freetype/internal/services/svgldict.h>
+#include <freetype/internal/services/svprop.h>
+#include <freetype/ftdriver.h>
/**************************************************************************
@@ -738,7 +737,7 @@
{
if ( dict->cid_supplement < FT_INT_MIN ||
dict->cid_supplement > FT_INT_MAX )
- FT_TRACE1(( "cff_get_ros: too large supplement %d is truncated\n",
+ FT_TRACE1(( "cff_get_ros: too large supplement %ld is truncated\n",
dict->cid_supplement ));
*supplement = (FT_Int)dict->cid_supplement;
}
diff --git a/thirdparty/freetype/src/cff/cffdrivr.h b/thirdparty/freetype/src/cff/cffdrivr.h
index 25471d511b..d198dd35cb 100644
--- a/thirdparty/freetype/src/cff/cffdrivr.h
+++ b/thirdparty/freetype/src/cff/cffdrivr.h
@@ -20,8 +20,7 @@
#define CFFDRIVER_H_
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/cff/cfferrs.h b/thirdparty/freetype/src/cff/cfferrs.h
index 32be8a7637..5b00a3f0a2 100644
--- a/thirdparty/freetype/src/cff/cfferrs.h
+++ b/thirdparty/freetype/src/cff/cfferrs.h
@@ -25,7 +25,7 @@
#ifndef CFFERRS_H_
#define CFFERRS_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -34,7 +34,7 @@
#define FT_ERR_BASE FT_Mod_Err_CFF
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* CFFERRS_H_ */
diff --git a/thirdparty/freetype/src/cff/cffgload.c b/thirdparty/freetype/src/cff/cffgload.c
index 1c4e1979c4..feee38a413 100644
--- a/thirdparty/freetype/src/cff/cffgload.c
+++ b/thirdparty/freetype/src/cff/cffgload.c
@@ -16,14 +16,13 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_OUTLINE_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/ftoutln.h>
+#include <freetype/ftdriver.h>
#include "cffload.h"
#include "cffgload.h"
@@ -207,8 +206,8 @@
PSAux_Service psaux = (PSAux_Service)face->psaux;
const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs;
- FT_Matrix font_matrix;
- FT_Vector font_offset;
+ FT_Matrix font_matrix;
+ FT_Vector font_offset;
force_scaling = FALSE;
@@ -364,7 +363,6 @@
top_upm = (FT_Long)cff->top_font.font_dict.units_per_em;
sub_upm = (FT_Long)cff->subfonts[fd_index]->font_dict.units_per_em;
-
font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix;
font_offset = cff->subfonts[fd_index]->font_dict.font_offset;
@@ -399,7 +397,6 @@
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face );
#endif
-
FT_Byte* charstring;
FT_ULong charstring_len;
@@ -665,8 +662,12 @@
metrics->horiBearingY = cbox.yMax;
if ( has_vertical_info )
+ {
metrics->vertBearingX = metrics->horiBearingX -
metrics->horiAdvance / 2;
+ metrics->vertBearingY = FT_MulFix( metrics->vertBearingY,
+ glyph->y_scale );
+ }
else
{
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
diff --git a/thirdparty/freetype/src/cff/cffgload.h b/thirdparty/freetype/src/cff/cffgload.h
index b4ad61a564..3b312f452e 100644
--- a/thirdparty/freetype/src/cff/cffgload.h
+++ b/thirdparty/freetype/src/cff/cffgload.h
@@ -20,9 +20,8 @@
#define CFFGLOAD_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+#include <freetype/freetype.h>
+#include <freetype/internal/cffotypes.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/cff/cffload.c b/thirdparty/freetype/src/cff/cffload.c
index 9f1d0e2e64..73d3eecd31 100644
--- a/thirdparty/freetype/src/cff/cffload.c
+++ b/thirdparty/freetype/src/cff/cffload.c
@@ -16,17 +16,16 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
+#include <freetype/t1tables.h>
+#include <freetype/internal/psaux.h>
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/services/svmm.h>
#endif
#include "cffload.h"
@@ -411,7 +410,7 @@
FT_Error error = FT_Err_Ok;
FT_Memory memory = idx->stream->memory;
- FT_Byte** t = NULL;
+ FT_Byte** tbl = NULL;
FT_Byte* new_bytes = NULL;
FT_ULong new_size;
@@ -428,11 +427,11 @@
new_size = idx->data_size + idx->count;
if ( idx->count > 0 &&
- !FT_NEW_ARRAY( t, idx->count + 1 ) &&
+ !FT_NEW_ARRAY( tbl, idx->count + 1 ) &&
( !pool || !FT_ALLOC( new_bytes, new_size ) ) )
{
FT_ULong n, cur_offset;
- FT_ULong extra = 0;
+ FT_ULong extra = 0;
FT_Byte* org_bytes = idx->bytes;
@@ -443,15 +442,15 @@
if ( cur_offset != 0 )
{
FT_TRACE0(( "cff_index_get_pointers:"
- " invalid first offset value %d set to zero\n",
+ " invalid first offset value %ld set to zero\n",
cur_offset ));
cur_offset = 0;
}
if ( !pool )
- t[0] = org_bytes + cur_offset;
+ tbl[0] = org_bytes + cur_offset;
else
- t[0] = new_bytes + cur_offset;
+ tbl[0] = new_bytes + cur_offset;
for ( n = 1; n <= idx->count; n++ )
{
@@ -465,23 +464,25 @@
next_offset = idx->data_size;
if ( !pool )
- t[n] = org_bytes + next_offset;
+ tbl[n] = org_bytes + next_offset;
else
{
- t[n] = new_bytes + next_offset + extra;
+ tbl[n] = new_bytes + next_offset + extra;
if ( next_offset != cur_offset )
{
- FT_MEM_COPY( t[n - 1], org_bytes + cur_offset, t[n] - t[n - 1] );
- t[n][0] = '\0';
- t[n] += 1;
+ FT_MEM_COPY( tbl[n - 1],
+ org_bytes + cur_offset,
+ tbl[n] - tbl[n - 1] );
+ tbl[n][0] = '\0';
+ tbl[n] += 1;
extra++;
}
}
cur_offset = next_offset;
}
- *table = t;
+ *table = tbl;
if ( pool )
*pool = new_bytes;
@@ -490,6 +491,11 @@
}
Exit:
+ if ( error && new_bytes )
+ FT_FREE( new_bytes );
+ if ( error && tbl )
+ FT_FREE( tbl );
+
return error;
}
@@ -553,8 +559,8 @@
idx->data_offset > stream->size - off2 + 1 )
{
FT_ERROR(( "cff_index_access_element:"
- " offset to next entry (%d)"
- " exceeds the end of stream (%d)\n",
+ " offset to next entry (%ld)"
+ " exceeds the end of stream (%ld)\n",
off2, stream->size - idx->data_offset + 1 ));
off2 = stream->size - idx->data_offset + 1;
}
@@ -978,7 +984,7 @@
if ( glyph_sid > 0xFFFFL - nleft )
{
FT_ERROR(( "cff_charset_load: invalid SID range trimmed"
- " nleft=%d -> %d\n", nleft, 0xFFFFL - glyph_sid ));
+ " nleft=%d -> %ld\n", nleft, 0xFFFFL - glyph_sid ));
nleft = ( FT_UInt )( 0xFFFFL - glyph_sid );
}
@@ -1945,7 +1951,7 @@
if ( priv->blue_shift > 1000 || priv->blue_shift < 0 )
{
FT_TRACE2(( "cff_load_private_dict:"
- " setting unlikely BlueShift value %d to default (7)\n",
+ " setting unlikely BlueShift value %ld to default (7)\n",
priv->blue_shift ));
priv->blue_shift = 7;
}
@@ -1953,7 +1959,7 @@
if ( priv->blue_fuzz > 1000 || priv->blue_fuzz < 0 )
{
FT_TRACE2(( "cff_load_private_dict:"
- " setting unlikely BlueFuzz value %d to default (1)\n",
+ " setting unlikely BlueFuzz value %ld to default (1)\n",
priv->blue_fuzz ));
priv->blue_fuzz = 1;
}
diff --git a/thirdparty/freetype/src/cff/cffload.h b/thirdparty/freetype/src/cff/cffload.h
index 1b7971293b..fc998db2db 100644
--- a/thirdparty/freetype/src/cff/cffload.h
+++ b/thirdparty/freetype/src/cff/cffload.h
@@ -20,10 +20,9 @@
#define CFFLOAD_H_
-#include <ft2build.h>
-#include FT_INTERNAL_CFF_TYPES_H
+#include <freetype/internal/cfftypes.h>
#include "cffparse.h"
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H /* for CFF_Face */
+#include <freetype/internal/cffotypes.h> /* for CFF_Face */
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/cff/cffobjs.c b/thirdparty/freetype/src/cff/cffobjs.c
index 78c3cb3c2d..d555d52358 100644
--- a/thirdparty/freetype/src/cff/cffobjs.c
+++ b/thirdparty/freetype/src/cff/cffobjs.c
@@ -16,32 +16,31 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_STREAM_H
-#include FT_ERRORS_H
-#include FT_TRUETYPE_IDS_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_SFNT_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/fterrors.h>
+#include <freetype/ttnameid.h>
+#include <freetype/tttags.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/ftdriver.h>
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svmetric.h>
#endif
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+#include <freetype/internal/cffotypes.h>
#include "cffobjs.h"
#include "cffload.h"
#include "cffcmap.h"
#include "cfferrs.h"
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/services/svcfftl.h>
/**************************************************************************
@@ -167,46 +166,56 @@
FT_Error error = FT_Err_Ok;
PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size );
+ FT_Memory memory = cffsize->face->memory;
+ CFF_Internal internal = NULL;
+ CFF_Face face = (CFF_Face)cffsize->face;
+ CFF_Font font = (CFF_Font)face->extra.data;
- if ( funcs )
- {
- CFF_Face face = (CFF_Face)cffsize->face;
- CFF_Font font = (CFF_Font)face->extra.data;
- CFF_Internal internal = NULL;
+ PS_PrivateRec priv;
- PS_PrivateRec priv;
- FT_Memory memory = cffsize->face->memory;
+ FT_UInt i;
- FT_UInt i;
+ if ( !funcs )
+ goto Exit;
+
+ if ( FT_NEW( internal ) )
+ goto Exit;
+ cff_make_private_dict( &font->top_font, &priv );
+ error = funcs->create( cffsize->face->memory, &priv,
+ &internal->topfont );
+ if ( error )
+ goto Exit;
+
+ for ( i = font->num_subfonts; i > 0; i-- )
+ {
+ CFF_SubFont sub = font->subfonts[i - 1];
- if ( FT_NEW( internal ) )
- goto Exit;
- cff_make_private_dict( &font->top_font, &priv );
+ cff_make_private_dict( sub, &priv );
error = funcs->create( cffsize->face->memory, &priv,
- &internal->topfont );
+ &internal->subfonts[i - 1] );
if ( error )
goto Exit;
+ }
- for ( i = font->num_subfonts; i > 0; i-- )
- {
- CFF_SubFont sub = font->subfonts[i - 1];
+ cffsize->internal->module_data = internal;
+ size->strike_index = 0xFFFFFFFFUL;
- cff_make_private_dict( sub, &priv );
- error = funcs->create( cffsize->face->memory, &priv,
- &internal->subfonts[i - 1] );
- if ( error )
- goto Exit;
+ Exit:
+ if ( error )
+ {
+ if ( internal )
+ {
+ for ( i = font->num_subfonts; i > 0; i-- )
+ FT_FREE( internal->subfonts[i - 1] );
+ FT_FREE( internal->topfont );
}
- cffsize->internal->module_data = internal;
+ FT_FREE( internal );
}
- size->strike_index = 0xFFFFFFFFUL;
-
- Exit:
return error;
}
@@ -349,7 +358,8 @@
FT_LOCAL_DEF( void )
cff_slot_done( FT_GlyphSlot slot )
{
- slot->internal->glyph_hints = NULL;
+ if ( slot->internal )
+ slot->internal->glyph_hints = NULL;
}
@@ -940,7 +950,8 @@
style_name = cff_strcpy( memory, fullp );
/* remove the style part from the family name (if present) */
- remove_style( cffface->family_name, style_name );
+ if ( style_name )
+ remove_style( cffface->family_name, style_name );
}
break;
}
diff --git a/thirdparty/freetype/src/cff/cffobjs.h b/thirdparty/freetype/src/cff/cffobjs.h
index 6f12b95db6..845bd90941 100644
--- a/thirdparty/freetype/src/cff/cffobjs.h
+++ b/thirdparty/freetype/src/cff/cffobjs.h
@@ -20,7 +20,6 @@
#define CFFOBJS_H_
-#include <ft2build.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/cff/cffparse.c b/thirdparty/freetype/src/cff/cffparse.c
index 0d3bf34592..69bcd5d957 100644
--- a/thirdparty/freetype/src/cff/cffparse.c
+++ b/thirdparty/freetype/src/cff/cffparse.c
@@ -16,13 +16,12 @@
*/
-#include <ft2build.h>
#include "cffparse.h"
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_LIST_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/ftlist.h>
#include "cfferrs.h"
#include "cffload.h"
@@ -714,7 +713,7 @@
( max_scaling - min_scaling ) > 9 )
{
FT_TRACE1(( "cff_parse_font_matrix:"
- " strange scaling values (minimum %d, maximum %d),\n"
+ " strange scaling values (minimum %ld, maximum %ld),\n"
" "
" using default matrix\n", min_scaling, max_scaling ));
goto Unlikely;
@@ -811,7 +810,7 @@
bbox->yMax = FT_RoundFix( cff_parse_fixed( parser, data ) );
error = FT_Err_Ok;
- FT_TRACE4(( " [%d %d %d %d]\n",
+ FT_TRACE4(( " [%ld %ld %ld %ld]\n",
bbox->xMin / 65536,
bbox->yMin / 65536,
bbox->xMax / 65536,
@@ -934,11 +933,11 @@
FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" ));
dict->cid_supplement = cff_parse_num( parser, data );
if ( dict->cid_supplement < 0 )
- FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n",
+ FT_TRACE1(( "cff_parse_cid_ros: negative supplement %ld is found\n",
dict->cid_supplement ));
error = FT_Err_Ok;
- FT_TRACE4(( " %d %d %d\n",
+ FT_TRACE4(( " %d %d %ld\n",
dict->cid_registry,
dict->cid_ordering,
dict->cid_supplement ));
@@ -1264,11 +1263,11 @@
FT_Byte* charstring_base;
FT_ULong charstring_len;
- FT_Fixed* stack;
- FT_ListNode node;
- CFF_T2_String t2;
- size_t t2_size;
- FT_Byte* q;
+ FT_Fixed* stack;
+ FT_ListNode node;
+ CFF_T2_String t2;
+ FT_Fixed t2_size;
+ FT_Byte* q;
charstring_base = ++p;
diff --git a/thirdparty/freetype/src/cff/cffparse.h b/thirdparty/freetype/src/cff/cffparse.h
index 887110a748..6f3fbb37d6 100644
--- a/thirdparty/freetype/src/cff/cffparse.h
+++ b/thirdparty/freetype/src/cff/cffparse.h
@@ -20,9 +20,8 @@
#define CFFPARSE_H_
-#include <ft2build.h>
-#include FT_INTERNAL_CFF_TYPES_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/cfftypes.h>
+#include <freetype/internal/ftobjs.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/cid/ciderrs.h b/thirdparty/freetype/src/cid/ciderrs.h
index 52ab55d684..f698bb2293 100644
--- a/thirdparty/freetype/src/cid/ciderrs.h
+++ b/thirdparty/freetype/src/cid/ciderrs.h
@@ -25,7 +25,7 @@
#ifndef CIDERRS_H_
#define CIDERRS_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -33,7 +33,7 @@
#define FT_ERR_PREFIX CID_Err_
#define FT_ERR_BASE FT_Mod_Err_CID
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* CIDERRS_H_ */
diff --git a/thirdparty/freetype/src/cid/cidgload.c b/thirdparty/freetype/src/cid/cidgload.c
index daa0bddc2a..54aa62f810 100644
--- a/thirdparty/freetype/src/cid/cidgload.c
+++ b/thirdparty/freetype/src/cid/cidgload.c
@@ -16,17 +16,16 @@
*/
-#include <ft2build.h>
#include "cidload.h"
#include "cidgload.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_CALC_H
-
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_CFF_TYPES_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/ftoutln.h>
+#include <freetype/internal/ftcalc.h>
+
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/cfftypes.h>
+#include <freetype/ftdriver.h>
#include "ciderrs.h"
diff --git a/thirdparty/freetype/src/cid/cidgload.h b/thirdparty/freetype/src/cid/cidgload.h
index 251c93c9f2..da36e37e06 100644
--- a/thirdparty/freetype/src/cid/cidgload.h
+++ b/thirdparty/freetype/src/cid/cidgload.h
@@ -20,7 +20,6 @@
#define CIDGLOAD_H_
-#include <ft2build.h>
#include "cidobjs.h"
diff --git a/thirdparty/freetype/src/cid/cidload.c b/thirdparty/freetype/src/cid/cidload.c
index 4723966024..bb9136a3df 100644
--- a/thirdparty/freetype/src/cid/cidload.c
+++ b/thirdparty/freetype/src/cid/cidload.c
@@ -17,11 +17,11 @@
#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include FT_CONFIG_CONFIG_H
-#include FT_MULTIPLE_MASTERS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/t1types.h>
+#include <freetype/internal/psaux.h>
#include "cidload.h"
@@ -254,7 +254,7 @@
goto Exit;
}
- FT_TRACE4(( " %d\n", num_dicts ));
+ FT_TRACE4(( " %ld\n", num_dicts ));
/*
* A single entry in the FDArray must (at least) contain the following
@@ -275,7 +275,7 @@
if ( (FT_ULong)num_dicts > stream->size / 100 )
{
FT_TRACE0(( "parse_fd_array: adjusting FDArray size"
- " (from %d to %d)\n",
+ " (from %ld to %ld)\n",
num_dicts,
stream->size / 100 ));
num_dicts = (FT_Long)( stream->size / 100 );
@@ -329,7 +329,7 @@
dict->expansion_factor = cid_parser_to_fixed( parser, 0 );
dict->private_dict.expansion_factor = dict->expansion_factor;
- FT_TRACE4(( "%d\n", dict->expansion_factor ));
+ FT_TRACE4(( "%ld\n", dict->expansion_factor ));
}
return;
@@ -804,7 +804,7 @@
face->root.stream->size - parser->data_offset )
{
FT_TRACE0(( "cid_face_open: adjusting length of binary data\n"
- " (from %d to %d bytes)\n",
+ " (from %ld to %ld bytes)\n",
parser->binary_length,
face->root.stream->size - parser->data_offset ));
parser->binary_length = face->root.stream->size -
diff --git a/thirdparty/freetype/src/cid/cidload.h b/thirdparty/freetype/src/cid/cidload.h
index e639f6ffef..06fb9ef476 100644
--- a/thirdparty/freetype/src/cid/cidload.h
+++ b/thirdparty/freetype/src/cid/cidload.h
@@ -20,8 +20,7 @@
#define CIDLOAD_H_
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftstream.h>
#include "cidparse.h"
diff --git a/thirdparty/freetype/src/cid/cidobjs.c b/thirdparty/freetype/src/cid/cidobjs.c
index 34f72b588d..04b295eb8f 100644
--- a/thirdparty/freetype/src/cid/cidobjs.c
+++ b/thirdparty/freetype/src/cid/cidobjs.c
@@ -16,17 +16,16 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
#include "cidgload.h"
#include "cidload.h"
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-#include FT_DRIVER_H
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/pshints.h>
+#include <freetype/ftdriver.h>
#include "ciderrs.h"
@@ -50,7 +49,8 @@
FT_LOCAL_DEF( void )
cid_slot_done( FT_GlyphSlot slot )
{
- slot->internal->glyph_hints = NULL;
+ if ( slot->internal )
+ slot->internal->glyph_hints = NULL;
}
diff --git a/thirdparty/freetype/src/cid/cidobjs.h b/thirdparty/freetype/src/cid/cidobjs.h
index efe812fd11..6ae3061379 100644
--- a/thirdparty/freetype/src/cid/cidobjs.h
+++ b/thirdparty/freetype/src/cid/cidobjs.h
@@ -21,9 +21,9 @@
#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/internal/t1types.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/cid/cidparse.c b/thirdparty/freetype/src/cid/cidparse.c
index 94a36e22f5..1fc098b448 100644
--- a/thirdparty/freetype/src/cid/cidparse.c
+++ b/thirdparty/freetype/src/cid/cidparse.c
@@ -16,10 +16,9 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftstream.h>
#include "cidparse.h"
diff --git a/thirdparty/freetype/src/cid/cidparse.h b/thirdparty/freetype/src/cid/cidparse.h
index 6b2944ff57..0b49bebf48 100644
--- a/thirdparty/freetype/src/cid/cidparse.h
+++ b/thirdparty/freetype/src/cid/cidparse.h
@@ -20,10 +20,9 @@
#define CIDPARSE_H_
-#include <ft2build.h>
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/t1types.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/psaux.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/cid/cidriver.c b/thirdparty/freetype/src/cid/cidriver.c
index ad2f7b5cf5..d08cea1d7e 100644
--- a/thirdparty/freetype/src/cid/cidriver.c
+++ b/thirdparty/freetype/src/cid/cidriver.c
@@ -16,22 +16,21 @@
*/
-#include <ft2build.h>
#include "cidriver.h"
#include "cidgload.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_POSTSCRIPT_PROPS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftpsprop.h>
#include "ciderrs.h"
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-#include FT_SERVICE_CID_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_DRIVER_H
+#include <freetype/internal/services/svpostnm.h>
+#include <freetype/internal/services/svfntfmt.h>
+#include <freetype/internal/services/svpsinfo.h>
+#include <freetype/internal/services/svcid.h>
+#include <freetype/internal/services/svprop.h>
+#include <freetype/ftdriver.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/psaux.h>
/**************************************************************************
diff --git a/thirdparty/freetype/src/cid/cidriver.h b/thirdparty/freetype/src/cid/cidriver.h
index 400c2ae295..0fc8ed37bf 100644
--- a/thirdparty/freetype/src/cid/cidriver.h
+++ b/thirdparty/freetype/src/cid/cidriver.h
@@ -20,8 +20,7 @@
#define CIDRIVER_H_
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/cid/type1cid.c b/thirdparty/freetype/src/cid/type1cid.c
index ba9141075f..082e8bfe5b 100644
--- a/thirdparty/freetype/src/cid/type1cid.c
+++ b/thirdparty/freetype/src/cid/type1cid.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "cidgload.c"
#include "cidload.c"
diff --git a/thirdparty/freetype/src/gxvalid/gxvalid.c b/thirdparty/freetype/src/gxvalid/gxvalid.c
index cb655aeb9d..683b8a6972 100644
--- a/thirdparty/freetype/src/gxvalid/gxvalid.c
+++ b/thirdparty/freetype/src/gxvalid/gxvalid.c
@@ -18,7 +18,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "gxvbsln.c"
#include "gxvcommn.c"
diff --git a/thirdparty/freetype/src/gxvalid/gxvalid.h b/thirdparty/freetype/src/gxvalid/gxvalid.h
index cdf1986324..ff2812da20 100644
--- a/thirdparty/freetype/src/gxvalid/gxvalid.h
+++ b/thirdparty/freetype/src/gxvalid/gxvalid.h
@@ -28,13 +28,12 @@
#ifndef GXVALID_H_
#define GXVALID_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
-#include "gxverror.h" /* must come before FT_INTERNAL_VALIDATE_H */
+#include "gxverror.h" /* must come before `ftvalid.h' */
-#include FT_INTERNAL_VALIDATE_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftvalid.h>
+#include <freetype/internal/ftstream.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/gxvalid/gxvcommn.h b/thirdparty/freetype/src/gxvalid/gxvcommn.h
index 2372fc86fa..59d149215c 100644
--- a/thirdparty/freetype/src/gxvalid/gxvcommn.h
+++ b/thirdparty/freetype/src/gxvalid/gxvcommn.h
@@ -43,10 +43,9 @@
#define GXVCOMMN_H_
-#include <ft2build.h>
#include "gxvalid.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_SFNT_NAMES_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftsnames.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/gxvalid/gxverror.h b/thirdparty/freetype/src/gxvalid/gxverror.h
index 475b9f7778..5d8f0b6806 100644
--- a/thirdparty/freetype/src/gxvalid/gxverror.h
+++ b/thirdparty/freetype/src/gxvalid/gxverror.h
@@ -35,7 +35,7 @@
#ifndef GXVERROR_H_
#define GXVERROR_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -43,7 +43,7 @@
#define FT_ERR_PREFIX GXV_Err_
#define FT_ERR_BASE FT_Mod_Err_GXvalid
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* GXVERROR_H_ */
diff --git a/thirdparty/freetype/src/gxvalid/gxvjust.c b/thirdparty/freetype/src/gxvalid/gxvjust.c
index d8875b4111..3c7f1f9534 100644
--- a/thirdparty/freetype/src/gxvalid/gxvjust.c
+++ b/thirdparty/freetype/src/gxvalid/gxvjust.c
@@ -28,7 +28,7 @@
#include "gxvalid.h"
#include "gxvcommn.h"
-#include FT_SFNT_NAMES_H
+#include <freetype/ftsnames.h>
/**************************************************************************
diff --git a/thirdparty/freetype/src/gxvalid/gxvkern.c b/thirdparty/freetype/src/gxvalid/gxvkern.c
index ab5643eb83..cc0b3dfcb4 100644
--- a/thirdparty/freetype/src/gxvalid/gxvkern.c
+++ b/thirdparty/freetype/src/gxvalid/gxvkern.c
@@ -28,8 +28,8 @@
#include "gxvalid.h"
#include "gxvcommn.h"
-#include FT_SFNT_NAMES_H
-#include FT_SERVICE_GX_VALIDATE_H
+#include <freetype/ftsnames.h>
+#include <freetype/internal/services/svgxval.h>
/**************************************************************************
diff --git a/thirdparty/freetype/src/gxvalid/gxvmod.c b/thirdparty/freetype/src/gxvalid/gxvmod.c
index 2b8f45d1c2..a467e87131 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmod.c
+++ b/thirdparty/freetype/src/gxvalid/gxvmod.c
@@ -25,12 +25,11 @@
*/
-#include <ft2build.h>
-#include FT_TRUETYPE_TABLES_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_GX_VALIDATE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_GX_VALIDATE_H
+#include <freetype/tttables.h>
+#include <freetype/tttags.h>
+#include <freetype/ftgxval.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svgxval.h>
#include "gxvmod.h"
#include "gxvalid.h"
diff --git a/thirdparty/freetype/src/gxvalid/gxvmod.h b/thirdparty/freetype/src/gxvalid/gxvmod.h
index bdf465f4f0..f2982c96c2 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmod.h
+++ b/thirdparty/freetype/src/gxvalid/gxvmod.h
@@ -29,8 +29,7 @@
#ifndef GXVMOD_H_
#define GXVMOD_H_
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/gxvalid/gxvmort.h b/thirdparty/freetype/src/gxvalid/gxvmort.h
index 35a18e76a6..7237c58254 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmort.h
+++ b/thirdparty/freetype/src/gxvalid/gxvmort.h
@@ -31,7 +31,10 @@
#include "gxvalid.h"
#include "gxvcommn.h"
-#include FT_SFNT_NAMES_H
+#include <freetype/ftsnames.h>
+
+
+FT_BEGIN_HEADER
typedef struct GXV_mort_featureRec_
@@ -88,6 +91,8 @@
GXV_Validator gxvalid );
+FT_END_HEADER
+
#endif /* GXVMORT_H_ */
diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx.h b/thirdparty/freetype/src/gxvalid/gxvmorx.h
index 99be181067..f747b1d636 100644
--- a/thirdparty/freetype/src/gxvalid/gxvmorx.h
+++ b/thirdparty/freetype/src/gxvalid/gxvmorx.h
@@ -33,7 +33,10 @@
#include "gxvcommn.h"
#include "gxvmort.h"
-#include FT_SFNT_NAMES_H
+#include <freetype/ftsnames.h>
+
+
+FT_BEGIN_HEADER
FT_LOCAL( void )
@@ -62,6 +65,8 @@
GXV_Validator gxvalid );
+FT_END_HEADER
+
#endif /* GXVMORX_H_ */
diff --git a/thirdparty/freetype/src/gzip/ftgzip.c b/thirdparty/freetype/src/gzip/ftgzip.c
index 6b1df3a4a7..de7d0fdd5b 100644
--- a/thirdparty/freetype/src/gzip/ftgzip.c
+++ b/thirdparty/freetype/src/gzip/ftgzip.c
@@ -20,15 +20,14 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_GZIP_H
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftgzip.h>
#include FT_CONFIG_STANDARD_LIBRARY_H
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -36,7 +35,7 @@
#define FT_ERR_PREFIX Gzip_Err_
#define FT_ERR_BASE FT_Mod_Err_Gzip
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#ifdef FT_CONFIG_OPTION_USE_ZLIB
diff --git a/thirdparty/freetype/src/lzw/ftlzw.c b/thirdparty/freetype/src/lzw/ftlzw.c
index 7d3f3e3f55..ddb81e6e97 100644
--- a/thirdparty/freetype/src/lzw/ftlzw.c
+++ b/thirdparty/freetype/src/lzw/ftlzw.c
@@ -21,15 +21,14 @@
*
*/
-#include <ft2build.h>
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_LZW_H
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftlzw.h>
#include FT_CONFIG_STANDARD_LIBRARY_H
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -37,7 +36,7 @@
#define FT_ERR_PREFIX LZW_Err_
#define FT_ERR_BASE FT_Mod_Err_LZW
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#ifdef FT_CONFIG_OPTION_USE_LZW
diff --git a/thirdparty/freetype/src/lzw/ftzopen.c b/thirdparty/freetype/src/lzw/ftzopen.c
index cdc7f4e683..884d2ec74e 100644
--- a/thirdparty/freetype/src/lzw/ftzopen.c
+++ b/thirdparty/freetype/src/lzw/ftzopen.c
@@ -20,9 +20,9 @@
*/
#include "ftzopen.h"
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftdebug.h>
static int
diff --git a/thirdparty/freetype/src/lzw/ftzopen.h b/thirdparty/freetype/src/lzw/ftzopen.h
index 2866529bd4..d8768f7b47 100644
--- a/thirdparty/freetype/src/lzw/ftzopen.h
+++ b/thirdparty/freetype/src/lzw/ftzopen.h
@@ -22,9 +22,9 @@
#ifndef FTZOPEN_H_
#define FTZOPEN_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
+FT_BEGIN_HEADER
/*
* This is a complete re-implementation of the LZW file reader,
@@ -166,6 +166,8 @@
/* */
+FT_END_HEADER
+
#endif /* FTZOPEN_H_ */
diff --git a/thirdparty/freetype/src/otvalid/otvalid.c b/thirdparty/freetype/src/otvalid/otvalid.c
index 487d336a3b..d640209f68 100644
--- a/thirdparty/freetype/src/otvalid/otvalid.c
+++ b/thirdparty/freetype/src/otvalid/otvalid.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "otvbase.c"
#include "otvcommn.c"
diff --git a/thirdparty/freetype/src/otvalid/otvalid.h b/thirdparty/freetype/src/otvalid/otvalid.h
index 3c70268964..8208ff0112 100644
--- a/thirdparty/freetype/src/otvalid/otvalid.h
+++ b/thirdparty/freetype/src/otvalid/otvalid.h
@@ -20,13 +20,12 @@
#define OTVALID_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
-#include "otverror.h" /* must come before FT_INTERNAL_VALIDATE_H */
+#include "otverror.h" /* must come before `ftvalid.h' */
-#include FT_INTERNAL_VALIDATE_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftvalid.h>
+#include <freetype/internal/ftstream.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/otvalid/otvcommn.h b/thirdparty/freetype/src/otvalid/otvcommn.h
index 1daf7dca79..f9926034a9 100644
--- a/thirdparty/freetype/src/otvalid/otvcommn.h
+++ b/thirdparty/freetype/src/otvalid/otvcommn.h
@@ -20,9 +20,8 @@
#define OTVCOMMN_H_
-#include <ft2build.h>
#include "otvalid.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/otvalid/otverror.h b/thirdparty/freetype/src/otvalid/otverror.h
index 49c34d6cd8..979e9cbd9c 100644
--- a/thirdparty/freetype/src/otvalid/otverror.h
+++ b/thirdparty/freetype/src/otvalid/otverror.h
@@ -26,7 +26,7 @@
#ifndef OTVERROR_H_
#define OTVERROR_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -34,7 +34,7 @@
#define FT_ERR_PREFIX OTV_Err_
#define FT_ERR_BASE FT_Mod_Err_OTvalid
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* OTVERROR_H_ */
diff --git a/thirdparty/freetype/src/otvalid/otvmod.c b/thirdparty/freetype/src/otvalid/otvmod.c
index 5f3e7e8d49..0188b27018 100644
--- a/thirdparty/freetype/src/otvalid/otvmod.c
+++ b/thirdparty/freetype/src/otvalid/otvmod.c
@@ -16,12 +16,11 @@
*/
-#include <ft2build.h>
-#include FT_TRUETYPE_TABLES_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_OPENTYPE_VALIDATE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_OPENTYPE_VALIDATE_H
+#include <freetype/tttables.h>
+#include <freetype/tttags.h>
+#include <freetype/ftotval.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svotval.h>
#include "otvmod.h"
#include "otvalid.h"
diff --git a/thirdparty/freetype/src/otvalid/otvmod.h b/thirdparty/freetype/src/otvalid/otvmod.h
index f172c2c8fa..efd6da035f 100644
--- a/thirdparty/freetype/src/otvalid/otvmod.h
+++ b/thirdparty/freetype/src/otvalid/otvmod.h
@@ -21,8 +21,7 @@
#define OTVMOD_H_
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/pcf/pcf.c b/thirdparty/freetype/src/pcf/pcf.c
index 8ffd6e280b..6b30fb249a 100644
--- a/thirdparty/freetype/src/pcf/pcf.c
+++ b/thirdparty/freetype/src/pcf/pcf.c
@@ -26,7 +26,6 @@ THE SOFTWARE.
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "pcfdrivr.c"
#include "pcfread.c"
diff --git a/thirdparty/freetype/src/pcf/pcf.h b/thirdparty/freetype/src/pcf/pcf.h
index 33be4bcd85..3134cc355b 100644
--- a/thirdparty/freetype/src/pcf/pcf.h
+++ b/thirdparty/freetype/src/pcf/pcf.h
@@ -29,9 +29,8 @@ THE SOFTWARE.
#define PCF_H_
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftdrv.h>
+#include <freetype/internal/ftstream.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/pcf/pcfdrivr.c b/thirdparty/freetype/src/pcf/pcfdrivr.c
index b39592c794..e9dd51752e 100644
--- a/thirdparty/freetype/src/pcf/pcfdrivr.c
+++ b/thirdparty/freetype/src/pcf/pcfdrivr.c
@@ -25,17 +25,16 @@ THE SOFTWARE.
*/
-#include <ft2build.h>
-
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_GZIP_H
-#include FT_LZW_H
-#include FT_BZIP2_H
-#include FT_ERRORS_H
-#include FT_BDF_H
-#include FT_TRUETYPE_IDS_H
+
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftgzip.h>
+#include <freetype/ftlzw.h>
+#include <freetype/ftbzip2.h>
+#include <freetype/fterrors.h>
+#include <freetype/ftbdf.h>
+#include <freetype/ttnameid.h>
#include "pcf.h"
#include "pcfdrivr.h"
@@ -47,10 +46,10 @@ THE SOFTWARE.
#undef FT_COMPONENT
#define FT_COMPONENT pcfread
-#include FT_SERVICE_BDF_H
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_DRIVER_H
+#include <freetype/internal/services/svbdf.h>
+#include <freetype/internal/services/svfntfmt.h>
+#include <freetype/internal/services/svprop.h>
+#include <freetype/ftdriver.h>
/**************************************************************************
@@ -137,7 +136,7 @@ THE SOFTWARE.
FT_UInt32 charcode = *acharcode;
FT_UShort charcodeRow;
FT_UShort charcodeCol;
- FT_Int result = 0;
+ FT_UInt result = 0;
while ( charcode < (FT_UInt32)( enc->lastRow * 256 + enc->lastCol ) )
@@ -607,8 +606,9 @@ THE SOFTWARE.
if ( prop->value.l > 0x7FFFFFFFL ||
prop->value.l < ( -1 - 0x7FFFFFFFL ) )
{
- FT_TRACE1(( "pcf_get_bdf_property:" ));
- FT_TRACE1(( " too large integer 0x%x is truncated\n" ));
+ FT_TRACE1(( "pcf_get_bdf_property:"
+ " too large integer 0x%lx is truncated\n",
+ prop->value.l ));
}
/*
diff --git a/thirdparty/freetype/src/pcf/pcfdrivr.h b/thirdparty/freetype/src/pcf/pcfdrivr.h
index 73db0823d2..d465393743 100644
--- a/thirdparty/freetype/src/pcf/pcfdrivr.h
+++ b/thirdparty/freetype/src/pcf/pcfdrivr.h
@@ -28,8 +28,7 @@ THE SOFTWARE.
#ifndef PCFDRIVR_H_
#define PCFDRIVR_H_
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/pcf/pcferror.h b/thirdparty/freetype/src/pcf/pcferror.h
index 2e69d1d219..8b9e9902a3 100644
--- a/thirdparty/freetype/src/pcf/pcferror.h
+++ b/thirdparty/freetype/src/pcf/pcferror.h
@@ -25,7 +25,7 @@
#ifndef PCFERROR_H_
#define PCFERROR_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -33,7 +33,7 @@
#define FT_ERR_PREFIX PCF_Err_
#define FT_ERR_BASE FT_Mod_Err_PCF
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* PCFERROR_H_ */
diff --git a/thirdparty/freetype/src/pcf/pcfread.c b/thirdparty/freetype/src/pcf/pcfread.c
index 2ffe22d71c..8817682cdf 100644
--- a/thirdparty/freetype/src/pcf/pcfread.c
+++ b/thirdparty/freetype/src/pcf/pcfread.c
@@ -25,11 +25,10 @@ THE SOFTWARE.
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftobjs.h>
#include "pcf.h"
#include "pcfread.h"
@@ -122,7 +121,7 @@ THE SOFTWARE.
toc->count > 9 )
{
FT_TRACE0(( "pcf_read_TOC: adjusting number of tables"
- " (from %d to %d)\n",
+ " (from %ld to %ld)\n",
toc->count,
FT_MIN( stream->size >> 4, 9 ) ));
toc->count = FT_MIN( stream->size >> 4, 9 );
@@ -242,7 +241,7 @@ THE SOFTWARE.
if ( tables[i].type == (FT_UInt)( 1 << j ) )
name = tableNames[j];
- FT_TRACE4(( " %d: type=%s, format=0x%X,"
+ FT_TRACE4(( " %d: type=%s, format=0x%lX,"
" size=%ld (0x%lX), offset=%ld (0x%lX)\n",
i, name,
tables[i].format,
@@ -661,7 +660,7 @@ THE SOFTWARE.
{
properties[i].value.l = props[i].value;
- FT_TRACE4(( " %d\n", properties[i].value.l ));
+ FT_TRACE4(( " %ld\n", properties[i].value.l ));
}
}
@@ -798,7 +797,7 @@ THE SOFTWARE.
metrics->descent = 0;
FT_TRACE0(( "pcf_get_metrics:"
- " invalid metrics for glyph %d\n", i ));
+ " invalid metrics for glyph %ld\n", i ));
}
}
@@ -918,11 +917,11 @@ THE SOFTWARE.
sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )];
- FT_TRACE4(( " %ld-bit padding implies a size of %lu\n",
+ FT_TRACE4(( " %d-bit padding implies a size of %lu\n",
8 << i, bitmapSizes[i] ));
}
- FT_TRACE4(( " %lu bitmaps, using %ld-bit padding\n",
+ FT_TRACE4(( " %lu bitmaps, using %d-bit padding\n",
nbitmaps,
8 << PCF_GLYPH_PAD_INDEX( format ) ));
FT_TRACE4(( " bitmap size: %lu\n", sizebitmaps ));
@@ -1252,13 +1251,13 @@ THE SOFTWARE.
if ( FT_ABS( accel->fontAscent ) > 0x7FFF )
{
accel->fontAscent = accel->fontAscent < 0 ? -0x7FFF : 0x7FFF;
- FT_TRACE0(( "pfc_get_accel: clamping font ascent to value %d\n",
+ FT_TRACE0(( "pfc_get_accel: clamping font ascent to value %ld\n",
accel->fontAscent ));
}
if ( FT_ABS( accel->fontDescent ) > 0x7FFF )
{
accel->fontDescent = accel->fontDescent < 0 ? -0x7FFF : 0x7FFF;
- FT_TRACE0(( "pfc_get_accel: clamping font descent to value %d\n",
+ FT_TRACE0(( "pfc_get_accel: clamping font descent to value %ld\n",
accel->fontDescent ));
}
@@ -1631,7 +1630,7 @@ THE SOFTWARE.
if ( FT_ABS( prop->value.l ) > 0x504C2L ) /* 0x7FFF * 72270/7200 */
{
bsize->size = 0x7FFF;
- FT_TRACE0(( "pcf_load_font: clamping point size to value %d\n",
+ FT_TRACE0(( "pcf_load_font: clamping point size to value %ld\n",
bsize->size ));
}
else
@@ -1650,7 +1649,7 @@ THE SOFTWARE.
if ( FT_ABS( prop->value.l ) > 0x7FFF )
{
bsize->y_ppem = 0x7FFF << 6;
- FT_TRACE0(( "pcf_load_font: clamping pixel size to value %d\n",
+ FT_TRACE0(( "pcf_load_font: clamping pixel size to value %ld\n",
bsize->y_ppem ));
}
else
diff --git a/thirdparty/freetype/src/pcf/pcfread.h b/thirdparty/freetype/src/pcf/pcfread.h
index bed30e5030..a54648fbf9 100644
--- a/thirdparty/freetype/src/pcf/pcfread.h
+++ b/thirdparty/freetype/src/pcf/pcfread.h
@@ -29,7 +29,6 @@ THE SOFTWARE.
#define PCFREAD_H_
-#include <ft2build.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/pcf/pcfutil.c b/thirdparty/freetype/src/pcf/pcfutil.c
index 045c42d60f..5d3c00791f 100644
--- a/thirdparty/freetype/src/pcf/pcfutil.c
+++ b/thirdparty/freetype/src/pcf/pcfutil.c
@@ -32,7 +32,6 @@ in this Software without prior written authorization from The Open Group.
/* Modified for use with FreeType */
-#include <ft2build.h>
#include "pcfutil.h"
diff --git a/thirdparty/freetype/src/pcf/pcfutil.h b/thirdparty/freetype/src/pcf/pcfutil.h
index be986e756b..a197c15595 100644
--- a/thirdparty/freetype/src/pcf/pcfutil.h
+++ b/thirdparty/freetype/src/pcf/pcfutil.h
@@ -31,7 +31,7 @@ THE SOFTWARE.
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
-
+#include <freetype/internal/compiler-macros.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/pfr/pfr.c b/thirdparty/freetype/src/pfr/pfr.c
index 5dea6fa34a..9264c77df2 100644
--- a/thirdparty/freetype/src/pfr/pfr.c
+++ b/thirdparty/freetype/src/pfr/pfr.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "pfrcmap.c"
#include "pfrdrivr.c"
diff --git a/thirdparty/freetype/src/pfr/pfrcmap.c b/thirdparty/freetype/src/pfr/pfrcmap.c
index 3f64ba8b04..ebc7b84393 100644
--- a/thirdparty/freetype/src/pfr/pfrcmap.c
+++ b/thirdparty/freetype/src/pfr/pfrcmap.c
@@ -16,8 +16,7 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include "pfrcmap.h"
#include "pfrobjs.h"
diff --git a/thirdparty/freetype/src/pfr/pfrcmap.h b/thirdparty/freetype/src/pfr/pfrcmap.h
index b90e8a101f..a6d920c30b 100644
--- a/thirdparty/freetype/src/pfr/pfrcmap.h
+++ b/thirdparty/freetype/src/pfr/pfrcmap.h
@@ -19,8 +19,7 @@
#ifndef PFRCMAP_H_
#define PFRCMAP_H_
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
#include "pfrtypes.h"
diff --git a/thirdparty/freetype/src/pfr/pfrdrivr.c b/thirdparty/freetype/src/pfr/pfrdrivr.c
index 2028c8e11b..b14320875a 100644
--- a/thirdparty/freetype/src/pfr/pfrdrivr.c
+++ b/thirdparty/freetype/src/pfr/pfrdrivr.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_SERVICE_PFR_H
-#include FT_SERVICE_FONT_FORMAT_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/services/svpfr.h>
+#include <freetype/internal/services/svfntfmt.h>
#include "pfrdrivr.h"
#include "pfrobjs.h"
diff --git a/thirdparty/freetype/src/pfr/pfrdrivr.h b/thirdparty/freetype/src/pfr/pfrdrivr.h
index 865ec8188a..7646b4d1bd 100644
--- a/thirdparty/freetype/src/pfr/pfrdrivr.h
+++ b/thirdparty/freetype/src/pfr/pfrdrivr.h
@@ -20,8 +20,7 @@
#define PFRDRIVR_H_
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/pfr/pfrerror.h b/thirdparty/freetype/src/pfr/pfrerror.h
index 2dbeedfe15..33460ef4fd 100644
--- a/thirdparty/freetype/src/pfr/pfrerror.h
+++ b/thirdparty/freetype/src/pfr/pfrerror.h
@@ -25,7 +25,7 @@
#ifndef PFRERROR_H_
#define PFRERROR_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -33,7 +33,7 @@
#define FT_ERR_PREFIX PFR_Err_
#define FT_ERR_BASE FT_Mod_Err_PFR
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* PFRERROR_H_ */
diff --git a/thirdparty/freetype/src/pfr/pfrgload.c b/thirdparty/freetype/src/pfr/pfrgload.c
index 7d57ae1530..aa640c3b07 100644
--- a/thirdparty/freetype/src/pfr/pfrgload.c
+++ b/thirdparty/freetype/src/pfr/pfrgload.c
@@ -19,7 +19,7 @@
#include "pfrgload.h"
#include "pfrsbit.h"
#include "pfrload.h" /* for macro definitions */
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include "pfrerror.h"
@@ -451,7 +451,7 @@
case 1: /* 16-bit absolute value */
PFR_CHECK( 2 );
cur->x = PFR_NEXT_SHORT( p );
- FT_TRACE7(( " x.%d", cur->x ));
+ FT_TRACE7(( " x.%ld", cur->x ));
break;
case 2: /* 8-bit delta */
@@ -481,7 +481,7 @@
case 1: /* 16-bit absolute value */
PFR_CHECK( 2 );
cur->y = PFR_NEXT_SHORT( p );
- FT_TRACE7(( " y.%d", cur->y ));
+ FT_TRACE7(( " y.%ld", cur->y ));
break;
case 2: /* 8-bit delta */
diff --git a/thirdparty/freetype/src/pfr/pfrload.c b/thirdparty/freetype/src/pfr/pfrload.c
index 6eeed28245..a2832e55c7 100644
--- a/thirdparty/freetype/src/pfr/pfrload.c
+++ b/thirdparty/freetype/src/pfr/pfrload.c
@@ -17,8 +17,8 @@
#include "pfrload.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
#include "pfrerror.h"
diff --git a/thirdparty/freetype/src/pfr/pfrload.h b/thirdparty/freetype/src/pfr/pfrload.h
index 7d113df270..7615b9ce14 100644
--- a/thirdparty/freetype/src/pfr/pfrload.h
+++ b/thirdparty/freetype/src/pfr/pfrload.h
@@ -20,7 +20,7 @@
#define PFRLOAD_H_
#include "pfrobjs.h"
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftstream.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/pfr/pfrobjs.c b/thirdparty/freetype/src/pfr/pfrobjs.c
index 9bc90a4b68..918e7fd496 100644
--- a/thirdparty/freetype/src/pfr/pfrobjs.c
+++ b/thirdparty/freetype/src/pfr/pfrobjs.c
@@ -21,10 +21,10 @@
#include "pfrgload.h"
#include "pfrcmap.h"
#include "pfrsbit.h"
-#include FT_OUTLINE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_TRUETYPE_IDS_H
+#include <freetype/ftoutln.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/ttnameid.h>
#include "pfrerror.h"
diff --git a/thirdparty/freetype/src/pfr/pfrsbit.c b/thirdparty/freetype/src/pfr/pfrsbit.c
index 00669e13ff..a6691e6d18 100644
--- a/thirdparty/freetype/src/pfr/pfrsbit.c
+++ b/thirdparty/freetype/src/pfr/pfrsbit.c
@@ -18,8 +18,8 @@
#include "pfrsbit.h"
#include "pfrload.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
#include "pfrerror.h"
@@ -745,7 +745,7 @@
ypos + (FT_Long)ysize < FT_INT_MIN )
{
FT_TRACE1(( "pfr_slot_load_bitmap:" ));
- FT_TRACE1(( "huge bitmap glyph %dx%d over FT_GlyphSlot\n",
+ FT_TRACE1(( "huge bitmap glyph %ldx%ld over FT_GlyphSlot\n",
xpos, ypos ));
error = FT_THROW( Invalid_Pixel_Size );
}
diff --git a/thirdparty/freetype/src/pfr/pfrtypes.h b/thirdparty/freetype/src/pfr/pfrtypes.h
index dfc47beff3..06fb82d51a 100644
--- a/thirdparty/freetype/src/pfr/pfrtypes.h
+++ b/thirdparty/freetype/src/pfr/pfrtypes.h
@@ -19,8 +19,7 @@
#ifndef PFRTYPES_H_
#define PFRTYPES_H_
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/psaux/afmparse.c b/thirdparty/freetype/src/psaux/afmparse.c
index b957158aec..2d6a0d9a12 100644
--- a/thirdparty/freetype/src/psaux/afmparse.c
+++ b/thirdparty/freetype/src/psaux/afmparse.c
@@ -15,10 +15,9 @@
*
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/psaux.h>
#ifndef T1_CONFIG_OPTION_NO_AFM
diff --git a/thirdparty/freetype/src/psaux/afmparse.h b/thirdparty/freetype/src/psaux/afmparse.h
index 50f4834b3f..16a3a3e902 100644
--- a/thirdparty/freetype/src/psaux/afmparse.h
+++ b/thirdparty/freetype/src/psaux/afmparse.h
@@ -20,8 +20,7 @@
#define AFMPARSE_H_
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/psaux.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/psaux/cffdecode.c b/thirdparty/freetype/src/psaux/cffdecode.c
index 172e3b23a3..3d2da1e03c 100644
--- a/thirdparty/freetype/src/psaux/cffdecode.c
+++ b/thirdparty/freetype/src/psaux/cffdecode.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/services/svcfftl.h>
#include "cffdecode.h"
#include "psobjs.h"
diff --git a/thirdparty/freetype/src/psaux/cffdecode.h b/thirdparty/freetype/src/psaux/cffdecode.h
index 5dc968b255..77a4962698 100644
--- a/thirdparty/freetype/src/psaux/cffdecode.h
+++ b/thirdparty/freetype/src/psaux/cffdecode.h
@@ -20,8 +20,7 @@
#define CFFDECODE_H_
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/psaux.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/psaux/psarrst.c b/thirdparty/freetype/src/psaux/psarrst.c
index 011803b416..8751d275fb 100644
--- a/thirdparty/freetype/src/psaux/psarrst.c
+++ b/thirdparty/freetype/src/psaux/psarrst.c
@@ -37,7 +37,7 @@
#include "psft.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include "psglue.h"
#include "psarrst.h"
diff --git a/thirdparty/freetype/src/psaux/psaux.c b/thirdparty/freetype/src/psaux/psaux.c
index 96d2484e9d..f4282222a6 100644
--- a/thirdparty/freetype/src/psaux/psaux.c
+++ b/thirdparty/freetype/src/psaux/psaux.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "afmparse.c"
#include "psauxmod.c"
diff --git a/thirdparty/freetype/src/psaux/psauxerr.h b/thirdparty/freetype/src/psaux/psauxerr.h
index df8b09ff78..8b9a958aec 100644
--- a/thirdparty/freetype/src/psaux/psauxerr.h
+++ b/thirdparty/freetype/src/psaux/psauxerr.h
@@ -26,7 +26,7 @@
#ifndef PSAUXERR_H_
#define PSAUXERR_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -34,7 +34,7 @@
#define FT_ERR_PREFIX PSaux_Err_
#define FT_ERR_BASE FT_Mod_Err_PSaux
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* PSAUXERR_H_ */
diff --git a/thirdparty/freetype/src/psaux/psauxmod.c b/thirdparty/freetype/src/psaux/psauxmod.c
index bb520792e0..e73ba22451 100644
--- a/thirdparty/freetype/src/psaux/psauxmod.c
+++ b/thirdparty/freetype/src/psaux/psauxmod.c
@@ -16,7 +16,6 @@
*/
-#include <ft2build.h>
#include "psauxmod.h"
#include "psobjs.h"
#include "t1decode.h"
@@ -171,9 +170,9 @@
};
- FT_CALLBACK_TABLE_DEF
- const FT_Module_Class psaux_module_class =
- {
+ FT_DEFINE_MODULE(
+ psaux_module_class,
+
0,
sizeof ( FT_ModuleRec ),
"psaux",
@@ -185,7 +184,7 @@
(FT_Module_Constructor)NULL, /* module_init */
(FT_Module_Destructor) NULL, /* module_done */
(FT_Module_Requester) NULL /* get_interface */
- };
+ )
/* END */
diff --git a/thirdparty/freetype/src/psaux/psauxmod.h b/thirdparty/freetype/src/psaux/psauxmod.h
index 6e2eb67042..a6bebe4b94 100644
--- a/thirdparty/freetype/src/psaux/psauxmod.h
+++ b/thirdparty/freetype/src/psaux/psauxmod.h
@@ -20,10 +20,9 @@
#define PSAUXMOD_H_
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/psaux.h>
FT_BEGIN_HEADER
@@ -35,10 +34,24 @@ FT_BEGIN_HEADER
FT_CALLBACK_TABLE
const PS_Builder_FuncsRec ps_builder_funcs;
+#ifndef T1_CONFIG_OPTION_NO_AFM
+ FT_CALLBACK_TABLE
+ const AFM_Parser_FuncsRec afm_parser_funcs;
+#endif
+
+ FT_CALLBACK_TABLE
+ const T1_CMap_ClassesRec t1_cmap_classes;
+
+ FT_CALLBACK_TABLE
+ const CFF_Decoder_FuncsRec cff_decoder_funcs;
+
FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class;
+ FT_DECLARE_MODULE( psaux_module_class )
+
+
FT_END_HEADER
#endif /* PSAUXMOD_H_ */
diff --git a/thirdparty/freetype/src/psaux/psblues.c b/thirdparty/freetype/src/psaux/psblues.c
index 89738ce474..3878e9bde0 100644
--- a/thirdparty/freetype/src/psaux/psblues.c
+++ b/thirdparty/freetype/src/psaux/psblues.c
@@ -37,7 +37,7 @@
#include "psft.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include "psblues.h"
#include "pshints.h"
diff --git a/thirdparty/freetype/src/psaux/psconv.c b/thirdparty/freetype/src/psaux/psconv.c
index c813a0596c..4cf5cd5d88 100644
--- a/thirdparty/freetype/src/psaux/psconv.c
+++ b/thirdparty/freetype/src/psaux/psconv.c
@@ -16,9 +16,8 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/ftdebug.h>
#include "psconv.h"
#include "psauxerr.h"
diff --git a/thirdparty/freetype/src/psaux/psconv.h b/thirdparty/freetype/src/psaux/psconv.h
index 2cd5c60e4b..833e827364 100644
--- a/thirdparty/freetype/src/psaux/psconv.h
+++ b/thirdparty/freetype/src/psaux/psconv.h
@@ -20,8 +20,7 @@
#define PSCONV_H_
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/psaux.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/psaux/pserror.h b/thirdparty/freetype/src/psaux/pserror.h
index b2156b3318..5738853fac 100644
--- a/thirdparty/freetype/src/psaux/pserror.h
+++ b/thirdparty/freetype/src/psaux/pserror.h
@@ -40,7 +40,7 @@
#define PSERROR_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -49,7 +49,8 @@
#define FT_ERR_BASE FT_Mod_Err_CF2
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
+#include <freetype/internal/compiler-macros.h>
#include "psft.h"
diff --git a/thirdparty/freetype/src/psaux/psfont.c b/thirdparty/freetype/src/psaux/psfont.c
index 00e4210819..0db1f0c5bc 100644
--- a/thirdparty/freetype/src/psaux/psfont.c
+++ b/thirdparty/freetype/src/psaux/psfont.c
@@ -36,8 +36,7 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_CALC_H
+#include <freetype/internal/ftcalc.h>
#include "psft.h"
diff --git a/thirdparty/freetype/src/psaux/psfont.h b/thirdparty/freetype/src/psaux/psfont.h
index 8fbacbb6e3..836fce4e4d 100644
--- a/thirdparty/freetype/src/psaux/psfont.h
+++ b/thirdparty/freetype/src/psaux/psfont.h
@@ -40,7 +40,7 @@
#define PSFONT_H_
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/internal/services/svcfftl.h>
#include "psft.h"
#include "psblues.h"
diff --git a/thirdparty/freetype/src/psaux/psft.c b/thirdparty/freetype/src/psaux/psft.c
index 50b40bf8fe..41c16542c1 100644
--- a/thirdparty/freetype/src/psaux/psft.c
+++ b/thirdparty/freetype/src/psaux/psft.c
@@ -37,7 +37,7 @@
#include "psft.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include "psfont.h"
#include "pserror.h"
@@ -45,11 +45,11 @@
#include "cffdecode.h"
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/services/svmm.h>
#endif
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/internal/services/svcfftl.h>
#define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */
diff --git a/thirdparty/freetype/src/psaux/psft.h b/thirdparty/freetype/src/psaux/psft.h
index 4c930f0d73..3da454e601 100644
--- a/thirdparty/freetype/src/psaux/psft.h
+++ b/thirdparty/freetype/src/psaux/psft.h
@@ -40,17 +40,17 @@
#define PSFT_H_
+#include <freetype/internal/compiler-macros.h>
#include "pstypes.h"
-
/* TODO: disable asserts for now */
#define CF2_NDEBUG
-#include FT_SYSTEM_H
+#include <freetype/ftsystem.h>
#include "psglue.h"
-#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for PS_Decoder */
+#include <freetype/internal/psaux.h> /* for PS_Decoder */
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/psaux/pshints.c b/thirdparty/freetype/src/psaux/pshints.c
index 1cbecd2b19..ce8cfca715 100644
--- a/thirdparty/freetype/src/psaux/pshints.c
+++ b/thirdparty/freetype/src/psaux/pshints.c
@@ -37,7 +37,7 @@
#include "psft.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include "psglue.h"
#include "psfont.h"
@@ -310,7 +310,7 @@
CF2_Hint hint = &hintmap->edge[i];
- FT_TRACE6(( " %3d %7.2f %7.2f %5d %s%s%s%s\n",
+ FT_TRACE6(( " %3ld %7.2f %7.2f %5d %s%s%s%s\n",
hint->index,
hint->csCoord / 65536.0,
hint->dsCoord / ( hint->scale * 1.0 ),
diff --git a/thirdparty/freetype/src/psaux/psintrp.c b/thirdparty/freetype/src/psaux/psintrp.c
index 0a84145535..519c694447 100644
--- a/thirdparty/freetype/src/psaux/psintrp.c
+++ b/thirdparty/freetype/src/psaux/psintrp.c
@@ -37,8 +37,8 @@
#include "psft.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/services/svcfftl.h>
#include "psglue.h"
#include "psfont.h"
diff --git a/thirdparty/freetype/src/psaux/psobjs.c b/thirdparty/freetype/src/psaux/psobjs.c
index b37a78832c..defc4d4fce 100644
--- a/thirdparty/freetype/src/psaux/psobjs.c
+++ b/thirdparty/freetype/src/psaux/psobjs.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_DRIVER_H
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/ftdriver.h>
#include "psobjs.h"
#include "psconv.h"
@@ -1233,7 +1232,7 @@
bbox->xMax = FT_RoundFix( temp[2] );
bbox->yMax = FT_RoundFix( temp[3] );
- FT_TRACE4(( " [%d %d %d %d]",
+ FT_TRACE4(( " [%ld %ld %ld %ld]",
bbox->xMin / 65536,
bbox->yMin / 65536,
bbox->xMax / 65536,
@@ -1287,7 +1286,7 @@
bbox->xMax = FT_RoundFix( temp[i + 2 * max_objects] );
bbox->yMax = FT_RoundFix( temp[i + 3 * max_objects] );
- FT_TRACE4(( " [%d %d %d %d]",
+ FT_TRACE4(( " [%ld %ld %ld %ld]",
bbox->xMin / 65536,
bbox->yMin / 65536,
bbox->xMax / 65536,
diff --git a/thirdparty/freetype/src/psaux/psobjs.h b/thirdparty/freetype/src/psaux/psobjs.h
index d37638d0ca..fdad672b6d 100644
--- a/thirdparty/freetype/src/psaux/psobjs.h
+++ b/thirdparty/freetype/src/psaux/psobjs.h
@@ -20,9 +20,8 @@
#define PSOBJS_H_
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/cffotypes.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/psaux/psread.c b/thirdparty/freetype/src/psaux/psread.c
index 86bfc03c6e..7f657f2cdc 100644
--- a/thirdparty/freetype/src/psaux/psread.c
+++ b/thirdparty/freetype/src/psaux/psread.c
@@ -37,7 +37,7 @@
#include "psft.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include "psglue.h"
diff --git a/thirdparty/freetype/src/psaux/psstack.c b/thirdparty/freetype/src/psaux/psstack.c
index 6659068001..7ae5256ef1 100644
--- a/thirdparty/freetype/src/psaux/psstack.c
+++ b/thirdparty/freetype/src/psaux/psstack.c
@@ -37,7 +37,7 @@
#include "psft.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include "psglue.h"
#include "psfont.h"
@@ -59,12 +59,12 @@
CF2_Stack stack = NULL;
- if ( !FT_NEW( stack ) )
- {
- /* initialize the structure; FT_NEW zeroes it */
- stack->memory = memory;
- stack->error = e;
- }
+ if ( FT_NEW( stack ) )
+ return NULL;
+
+ /* initialize the structure; FT_NEW zeroes it */
+ stack->memory = memory;
+ stack->error = e;
/* allocate the stack buffer */
if ( FT_NEW_ARRAY( stack->buffer, stackSize ) )
diff --git a/thirdparty/freetype/src/psaux/psstack.h b/thirdparty/freetype/src/psaux/psstack.h
index 18cd39bc6a..b9ef9edf1b 100644
--- a/thirdparty/freetype/src/psaux/psstack.h
+++ b/thirdparty/freetype/src/psaux/psstack.h
@@ -39,6 +39,7 @@
#ifndef PSSTACK_H_
#define PSSTACK_H_
+#include <freetype/internal/compiler-macros.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/psaux/pstypes.h b/thirdparty/freetype/src/psaux/pstypes.h
index 041287e8d5..435ef7e1fe 100644
--- a/thirdparty/freetype/src/psaux/pstypes.h
+++ b/thirdparty/freetype/src/psaux/pstypes.h
@@ -39,8 +39,7 @@
#ifndef PSTYPES_H_
#define PSTYPES_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/psaux/t1cmap.c b/thirdparty/freetype/src/psaux/t1cmap.c
index 451b276537..e21e93ca26 100644
--- a/thirdparty/freetype/src/psaux/t1cmap.c
+++ b/thirdparty/freetype/src/psaux/t1cmap.c
@@ -18,7 +18,7 @@
#include "t1cmap.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include "psauxerr.h"
diff --git a/thirdparty/freetype/src/psaux/t1cmap.h b/thirdparty/freetype/src/psaux/t1cmap.h
index 5411913831..031796510f 100644
--- a/thirdparty/freetype/src/psaux/t1cmap.h
+++ b/thirdparty/freetype/src/psaux/t1cmap.h
@@ -19,9 +19,8 @@
#ifndef T1CMAP_H_
#define T1CMAP_H_
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/t1types.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/psaux/t1decode.c b/thirdparty/freetype/src/psaux/t1decode.c
index fa1745d9e0..2ed27ca19e 100644
--- a/thirdparty/freetype/src/psaux/t1decode.c
+++ b/thirdparty/freetype/src/psaux/t1decode.c
@@ -16,12 +16,11 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-#include FT_INTERNAL_HASH_H
-#include FT_OUTLINE_H
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/pshints.h>
+#include <freetype/internal/fthash.h>
+#include <freetype/ftoutln.h>
#include "t1decode.h"
#include "psobjs.h"
@@ -1238,8 +1237,8 @@
FT_UNUSED( orig_y );
- /* the `metrics_only' indicates that we only want to compute */
- /* the glyph's metrics (lsb + advance width), not load the */
+ /* `metrics_only' indicates that we only want to compute the */
+ /* glyph's metrics (lsb + advance width) without loading the */
/* rest of it; so exit immediately */
if ( builder->metrics_only )
{
@@ -1273,8 +1272,8 @@
x = ADD_LONG( builder->pos_x, top[0] );
y = ADD_LONG( builder->pos_y, top[1] );
- /* the `metrics_only' indicates that we only want to compute */
- /* the glyph's metrics (lsb + advance width), not load the */
+ /* `metrics_only' indicates that we only want to compute the */
+ /* glyph's metrics (lsb + advance width) without loading the */
/* rest of it; so exit immediately */
if ( builder->metrics_only )
{
@@ -1728,7 +1727,7 @@
#ifdef FT_DEBUG_LEVEL_TRACE
if ( bol )
{
- FT_TRACE5(( " (%d)", decoder->top - decoder->stack ));
+ FT_TRACE5(( " (%ld)", decoder->top - decoder->stack ));
bol = FALSE;
}
#endif
@@ -1750,8 +1749,6 @@
case 7:
case 8:
case 9:
- case 10:
- case 11:
case 14:
case 15:
case 21:
@@ -1760,6 +1757,13 @@
case 31:
goto No_Width;
+ case 10:
+ op = op_callsubr;
+ break;
+ case 11:
+ op = op_return;
+ break;
+
case 13:
op = op_hsbw;
break;
@@ -1899,13 +1903,20 @@
#ifdef FT_DEBUG_LEVEL_TRACE
- if ( op != op_div )
+ switch ( op )
{
+ case op_callsubr:
+ case op_div:
+ case op_return:
+ break;
+
+ default:
if ( top - decoder->stack != num_args )
FT_TRACE0(( "t1_decoder_parse_metrics:"
" too much operands on the stack"
- " (seen %d, expected %d)\n",
+ " (seen %ld, expected %d)\n",
top - decoder->stack, num_args ));
+ break;
}
#endif /* FT_DEBUG_LEVEL_TRACE */
@@ -1926,8 +1937,8 @@
builder->advance.y = 0;
/* we only want to compute the glyph's metrics */
- /* (lsb + advance width), not load the rest of */
- /* it; so exit immediately */
+ /* (lsb + advance width) without loading the */
+ /* rest of it; so exit immediately */
FT_TRACE4(( "\n" ));
return FT_Err_Ok;
@@ -1945,8 +1956,8 @@
builder->advance.y = top[3];
/* we only want to compute the glyph's metrics */
- /* (lsb + advance width), not load the rest of */
- /* it; so exit immediately */
+ /* (lsb + advance width), without loading the */
+ /* rest of it; so exit immediately */
FT_TRACE4(( "\n" ));
return FT_Err_Ok;
@@ -1962,6 +1973,91 @@
large_int = FALSE;
break;
+ case op_callsubr:
+ {
+ FT_Int idx;
+
+
+ FT_TRACE4(( " callsubr" ));
+
+ idx = Fix2Int( top[0] );
+
+ if ( decoder->subrs_hash )
+ {
+ size_t* val = ft_hash_num_lookup( idx,
+ decoder->subrs_hash );
+
+
+ if ( val )
+ idx = *val;
+ else
+ idx = -1;
+ }
+
+ if ( idx < 0 || idx >= decoder->num_subrs )
+ {
+ FT_ERROR(( "t1_decoder_parse_metrics:"
+ " invalid subrs index\n" ));
+ goto Syntax_Error;
+ }
+
+ if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS )
+ {
+ FT_ERROR(( "t1_decoder_parse_metrics:"
+ " too many nested subrs\n" ));
+ goto Syntax_Error;
+ }
+
+ zone->cursor = ip; /* save current instruction pointer */
+
+ zone++;
+
+ /* The Type 1 driver stores subroutines without the seed bytes. */
+ /* The CID driver stores subroutines with seed bytes. This */
+ /* case is taken care of when decoder->subrs_len == 0. */
+ zone->base = decoder->subrs[idx];
+
+ if ( decoder->subrs_len )
+ zone->limit = zone->base + decoder->subrs_len[idx];
+ else
+ {
+ /* We are using subroutines from a CID font. We must adjust */
+ /* for the seed bytes. */
+ zone->base += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 );
+ zone->limit = decoder->subrs[idx + 1];
+ }
+
+ zone->cursor = zone->base;
+
+ if ( !zone->base )
+ {
+ FT_ERROR(( "t1_decoder_parse_metrics:"
+ " invoking empty subrs\n" ));
+ goto Syntax_Error;
+ }
+
+ decoder->zone = zone;
+ ip = zone->base;
+ limit = zone->limit;
+ break;
+ }
+
+ case op_return:
+ FT_TRACE4(( " return" ));
+
+ if ( zone <= decoder->zones )
+ {
+ FT_ERROR(( "t1_decoder_parse_metrics:"
+ " unexpected return\n" ));
+ goto Syntax_Error;
+ }
+
+ zone--;
+ ip = zone->cursor;
+ limit = zone->limit;
+ decoder->zone = zone;
+ break;
+
default:
FT_ERROR(( "t1_decoder_parse_metrics:"
" unhandled opcode %d\n", op ));
diff --git a/thirdparty/freetype/src/psaux/t1decode.h b/thirdparty/freetype/src/psaux/t1decode.h
index 231947e852..b793504ac6 100644
--- a/thirdparty/freetype/src/psaux/t1decode.h
+++ b/thirdparty/freetype/src/psaux/t1decode.h
@@ -20,9 +20,8 @@
#define T1DECODE_H_
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/t1types.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/pshinter/pshalgo.c b/thirdparty/freetype/src/pshinter/pshalgo.c
index 57dfa3da96..920b9a74b5 100644
--- a/thirdparty/freetype/src/pshinter/pshalgo.c
+++ b/thirdparty/freetype/src/pshinter/pshalgo.c
@@ -16,10 +16,9 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
#include "pshalgo.h"
#include "pshnterr.h"
diff --git a/thirdparty/freetype/src/pshinter/pshglob.c b/thirdparty/freetype/src/pshinter/pshglob.c
index d9f835f99e..cdc1c3af0e 100644
--- a/thirdparty/freetype/src/pshinter/pshglob.c
+++ b/thirdparty/freetype/src/pshinter/pshglob.c
@@ -17,10 +17,9 @@
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_CALC_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftcalc.h>
#include "pshglob.h"
#ifdef DEBUG_HINTER
diff --git a/thirdparty/freetype/src/pshinter/pshglob.h b/thirdparty/freetype/src/pshinter/pshglob.h
index cd2f3122f7..8181324e5e 100644
--- a/thirdparty/freetype/src/pshinter/pshglob.h
+++ b/thirdparty/freetype/src/pshinter/pshglob.h
@@ -20,8 +20,8 @@
#define PSHGLOB_H_
-#include FT_FREETYPE_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include <freetype/freetype.h>
+#include <freetype/internal/pshints.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/pshinter/pshinter.c b/thirdparty/freetype/src/pshinter/pshinter.c
index 6009db5187..3cca0ad7c2 100644
--- a/thirdparty/freetype/src/pshinter/pshinter.c
+++ b/thirdparty/freetype/src/pshinter/pshinter.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "pshalgo.c"
#include "pshglob.c"
diff --git a/thirdparty/freetype/src/pshinter/pshmod.c b/thirdparty/freetype/src/pshinter/pshmod.c
index 686859b3ed..e0abd386f9 100644
--- a/thirdparty/freetype/src/pshinter/pshmod.c
+++ b/thirdparty/freetype/src/pshinter/pshmod.c
@@ -16,10 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
#include "pshrec.h"
#include "pshalgo.h"
+#include "pshmod.h"
/* the Postscript Hinter module structure */
diff --git a/thirdparty/freetype/src/pshinter/pshmod.h b/thirdparty/freetype/src/pshinter/pshmod.h
index c44112e9d4..2a6eb1c469 100644
--- a/thirdparty/freetype/src/pshinter/pshmod.h
+++ b/thirdparty/freetype/src/pshinter/pshmod.h
@@ -20,8 +20,7 @@
#define PSHMOD_H_
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/pshinter/pshnterr.h b/thirdparty/freetype/src/pshinter/pshnterr.h
index c4e9f42d2c..d67955c410 100644
--- a/thirdparty/freetype/src/pshinter/pshnterr.h
+++ b/thirdparty/freetype/src/pshinter/pshnterr.h
@@ -25,7 +25,7 @@
#ifndef PSHNTERR_H_
#define PSHNTERR_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -33,7 +33,7 @@
#define FT_ERR_PREFIX PSH_Err_
#define FT_ERR_BASE FT_Mod_Err_PShinter
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* PSHNTERR_H_ */
diff --git a/thirdparty/freetype/src/pshinter/pshrec.c b/thirdparty/freetype/src/pshinter/pshrec.c
index a81c6f7123..bddccf2a6e 100644
--- a/thirdparty/freetype/src/pshinter/pshrec.c
+++ b/thirdparty/freetype/src/pshinter/pshrec.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
#include "pshrec.h"
#include "pshalgo.h"
@@ -875,7 +874,7 @@
if ( error )
{
FT_ERROR(( "ps_hints_stem: could not add stem"
- " (%d,%d) to hints table\n", stems[0], stems[1] ));
+ " (%ld,%ld) to hints table\n", stems[0], stems[1] ));
hints->error = error;
return;
diff --git a/thirdparty/freetype/src/pshinter/pshrec.h b/thirdparty/freetype/src/pshinter/pshrec.h
index a8bc5aeecb..b13c7be13c 100644
--- a/thirdparty/freetype/src/pshinter/pshrec.h
+++ b/thirdparty/freetype/src/pshinter/pshrec.h
@@ -32,8 +32,7 @@
#define PSHREC_H_
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include <freetype/internal/pshints.h>
#include "pshglob.h"
diff --git a/thirdparty/freetype/src/psnames/psmodule.c b/thirdparty/freetype/src/psnames/psmodule.c
index bb3ff07022..b38f9d3b1c 100644
--- a/thirdparty/freetype/src/psnames/psmodule.c
+++ b/thirdparty/freetype/src/psnames/psmodule.c
@@ -16,10 +16,9 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svpscmap.h>
#include "psmodule.h"
diff --git a/thirdparty/freetype/src/psnames/psmodule.h b/thirdparty/freetype/src/psnames/psmodule.h
index 955f699f3a..c85a9ecad7 100644
--- a/thirdparty/freetype/src/psnames/psmodule.h
+++ b/thirdparty/freetype/src/psnames/psmodule.h
@@ -20,8 +20,7 @@
#define PSMODULE_H_
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/psnames/psnamerr.h b/thirdparty/freetype/src/psnames/psnamerr.h
index fb9058e61a..154c701d04 100644
--- a/thirdparty/freetype/src/psnames/psnamerr.h
+++ b/thirdparty/freetype/src/psnames/psnamerr.h
@@ -26,7 +26,7 @@
#ifndef PSNAMERR_H_
#define PSNAMERR_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -34,7 +34,7 @@
#define FT_ERR_PREFIX PSnames_Err_
#define FT_ERR_BASE FT_Mod_Err_PSnames
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* PSNAMERR_H_ */
diff --git a/thirdparty/freetype/src/psnames/psnames.c b/thirdparty/freetype/src/psnames/psnames.c
index 5ac3897d25..cff36851ba 100644
--- a/thirdparty/freetype/src/psnames/psnames.c
+++ b/thirdparty/freetype/src/psnames/psnames.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "psmodule.c"
diff --git a/thirdparty/freetype/src/raster/ftraster.c b/thirdparty/freetype/src/raster/ftraster.c
index 35655a6346..9f0a7976fa 100644
--- a/thirdparty/freetype/src/raster/ftraster.c
+++ b/thirdparty/freetype/src/raster/ftraster.c
@@ -62,10 +62,9 @@
#else /* !STANDALONE_ */
-#include <ft2build.h>
#include "ftraster.h"
-#include FT_INTERNAL_CALC_H /* for FT_MulDiv and FT_MulDiv_No_Round */
-#include FT_OUTLINE_H /* for FT_Outline_Get_CBox */
+#include <freetype/internal/ftcalc.h> /* for FT_MulDiv and FT_MulDiv_No_Round */
+#include <freetype/ftoutln.h> /* for FT_Outline_Get_CBox */
#endif /* !STANDALONE_ */
@@ -226,8 +225,8 @@
#else /* !STANDALONE_ */
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H /* for FT_TRACE, FT_ERROR, and FT_THROW */
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h> /* for FT_TRACE, FT_ERROR, and FT_THROW */
#include "rasterrs.h"
@@ -460,6 +459,11 @@
#define IS_TOP_OVERSHOOT( x ) \
(Bool)( x - FLOOR( x ) >= ras.precision_half )
+ /* Smart dropout rounding to find which pixel is closer to span ends. */
+ /* To mimick Windows, symmetric cases break down indepenently of the */
+ /* precision. */
+#define SMART( p, q ) FLOOR( ( (p) + (q) + ras.precision * 63 / 64 ) >> 1 )
+
#if FT_RENDER_POOL_SIZE > 2048
#define FT_MAX_BLACK_POOL ( FT_RENDER_POOL_SIZE / sizeof ( Long ) )
#else
@@ -674,13 +678,13 @@
if ( overshoot )
ras.cProfile->flags |= Overshoot_Bottom;
- FT_TRACE6(( " new ascending profile = %p\n", ras.cProfile ));
+ FT_TRACE6(( " new ascending profile = %p\n", (void *)ras.cProfile ));
break;
case Descending_State:
if ( overshoot )
ras.cProfile->flags |= Overshoot_Top;
- FT_TRACE6(( " new descending profile = %p\n", ras.cProfile ));
+ FT_TRACE6(( " new descending profile = %p\n", (void *)ras.cProfile ));
break;
default:
@@ -737,7 +741,7 @@
FT_TRACE6(( " ending profile %p, start = %ld, height = %ld\n",
- ras.cProfile, ras.cProfile->start, h ));
+ (void *)ras.cProfile, ras.cProfile->start, h ));
ras.cProfile->height = h;
if ( overshoot )
@@ -2242,11 +2246,10 @@
/* in high-precision mode, we need 12 digits after the comma to */
/* represent multiples of 1/(1<<12) = 1/4096 */
- FT_TRACE7(( " y=%d x=[%.12f;%.12f], drop-out=%d",
+ FT_TRACE7(( " y=%d x=[% .12f;% .12f]",
y,
x1 / (double)ras.precision,
- x2 / (double)ras.precision,
- dropOutControl ));
+ x2 / (double)ras.precision ));
/* Drop-out control */
@@ -2274,7 +2277,7 @@
if ( e2 >= ras.bWidth )
e2 = ras.bWidth - 1;
- FT_TRACE7(( " -> x=[%d;%d]", e1, e2 ));
+ FT_TRACE7(( " -> x=[%ld;%ld]", e1, e2 ));
c1 = (Short)( e1 >> 3 );
c2 = (Short)( e2 >> 3 );
@@ -2316,7 +2319,7 @@
Short c1, f1;
- FT_TRACE7(( " y=%d x=[%.12f;%.12f]",
+ FT_TRACE7(( " y=%d x=[% .12f;% .12f]",
y,
x1 / (double)ras.precision,
x2 / (double)ras.precision ));
@@ -2353,8 +2356,6 @@
Int dropOutControl = left->flags & 7;
- FT_TRACE7(( ", drop-out=%d", dropOutControl ));
-
if ( e1 == e2 + ras.precision )
{
switch ( dropOutControl )
@@ -2364,7 +2365,7 @@
break;
case 4: /* smart drop-outs including stubs */
- pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
+ pxl = SMART( x1, x2 );
break;
case 1: /* simple drop-outs excluding stubs */
@@ -2413,7 +2414,7 @@
if ( dropOutControl == 1 )
pxl = e2;
else
- pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
+ pxl = SMART( x1, x2 );
break;
default: /* modes 2, 3, 6, 7 */
@@ -2448,7 +2449,7 @@
if ( e1 >= 0 && e1 < ras.bWidth )
{
- FT_TRACE7(( " -> x=%d (drop-out)", e1 ));
+ FT_TRACE7(( " -> x=%ld", e1 ));
c1 = (Short)( e1 >> 3 );
f1 = (Short)( e1 & 7 );
@@ -2457,7 +2458,7 @@
}
Exit:
- FT_TRACE7(( "\n" ));
+ FT_TRACE7(( " dropout=%d\n", left->flags & 7 ));
}
@@ -2495,44 +2496,68 @@
PProfile left,
PProfile right )
{
+ Long e1, e2;
+
FT_UNUSED( left );
FT_UNUSED( right );
- if ( x2 - x1 < ras.precision )
- {
- Long e1, e2;
+ FT_TRACE7(( " x=%d y=[% .12f;% .12f]",
+ y,
+ x1 / (double)ras.precision,
+ x2 / (double)ras.precision ));
+ /* We should not need this procedure but the vertical sweep */
+ /* mishandles horizontal lines through pixel centers. So we */
+ /* have to check perfectly aligned span edges here. */
+ /* */
+ /* XXX: Can we handle horizontal lines better and drop this? */
- FT_TRACE7(( " x=%d y=[%.12f;%.12f]",
- y,
- x1 / (double)ras.precision,
- x2 / (double)ras.precision ));
+ e1 = CEILING( x1 );
- e1 = CEILING( x1 );
- e2 = FLOOR ( x2 );
+ if ( x1 == e1 )
+ {
+ e1 = TRUNC( e1 );
- if ( e1 == e2 )
+ if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
{
- e1 = TRUNC( e1 );
-
- if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
- {
- Byte f1;
- PByte bits;
+ Byte f1;
+ PByte bits;
- FT_TRACE7(( " -> y=%d (drop-out)", e1 ));
+ bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
+ f1 = (Byte)( 0x80 >> ( y & 7 ) );
- bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
- f1 = (Byte)( 0x80 >> ( y & 7 ) );
+ FT_TRACE7(( bits[0] & f1 ? " redundant"
+ : " -> y=%ld edge", e1 ));
- bits[0] |= f1;
- }
+ bits[0] |= f1;
}
+ }
+
+ e2 = FLOOR ( x2 );
+
+ if ( x2 == e2 )
+ {
+ e2 = TRUNC( e2 );
+
+ if ( e2 >= 0 && (ULong)e2 < ras.target.rows )
+ {
+ Byte f1;
+ PByte bits;
+
- FT_TRACE7(( "\n" ));
+ bits = ras.bOrigin + ( y >> 3 ) - e2 * ras.target.pitch;
+ f1 = (Byte)( 0x80 >> ( y & 7 ) );
+
+ FT_TRACE7(( bits[0] & f1 ? " redundant"
+ : " -> y=%ld edge", e2 ));
+
+ bits[0] |= f1;
+ }
}
+
+ FT_TRACE7(( "\n" ));
}
@@ -2548,7 +2573,7 @@
Byte f1;
- FT_TRACE7(( " x=%d y=[%.12f;%.12f]",
+ FT_TRACE7(( " x=%d y=[% .12f;% .12f]",
y,
x1 / (double)ras.precision,
x2 / (double)ras.precision ));
@@ -2574,8 +2599,6 @@
Int dropOutControl = left->flags & 7;
- FT_TRACE7(( ", dropout=%d", dropOutControl ));
-
if ( e1 == e2 + ras.precision )
{
switch ( dropOutControl )
@@ -2585,7 +2608,7 @@
break;
case 4: /* smart drop-outs including stubs */
- pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
+ pxl = SMART( x1, x2 );
break;
case 1: /* simple drop-outs excluding stubs */
@@ -2609,7 +2632,7 @@
if ( dropOutControl == 1 )
pxl = e2;
else
- pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
+ pxl = SMART( x1, x2 );
break;
default: /* modes 2, 3, 6, 7 */
@@ -2645,7 +2668,7 @@
if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
{
- FT_TRACE7(( " -> y=%d (drop-out)", e1 ));
+ FT_TRACE7(( " -> y=%ld", e1 ));
bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
f1 = (Byte)( 0x80 >> ( y & 7 ) );
@@ -2654,7 +2677,7 @@
}
Exit:
- FT_TRACE7(( "\n" ));
+ FT_TRACE7(( " dropout=%d\n", left->flags & 7 ));
}
diff --git a/thirdparty/freetype/src/raster/ftraster.h b/thirdparty/freetype/src/raster/ftraster.h
index 833d30f234..1b2ee3c016 100644
--- a/thirdparty/freetype/src/raster/ftraster.h
+++ b/thirdparty/freetype/src/raster/ftraster.h
@@ -22,8 +22,9 @@
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
-#include FT_IMAGE_H
+#include <freetype/ftimage.h>
+#include <freetype/internal/compiler-macros.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/raster/ftrend1.c b/thirdparty/freetype/src/raster/ftrend1.c
index 944279a8d1..57fed9bc14 100644
--- a/thirdparty/freetype/src/raster/ftrend1.c
+++ b/thirdparty/freetype/src/raster/ftrend1.c
@@ -16,10 +16,9 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_OUTLINE_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftoutln.h>
#include "ftrend1.h"
#include "ftraster.h"
diff --git a/thirdparty/freetype/src/raster/ftrend1.h b/thirdparty/freetype/src/raster/ftrend1.h
index dc972b1bc2..3f6be53675 100644
--- a/thirdparty/freetype/src/raster/ftrend1.h
+++ b/thirdparty/freetype/src/raster/ftrend1.h
@@ -20,8 +20,7 @@
#define FTREND1_H_
-#include <ft2build.h>
-#include FT_RENDER_H
+#include <freetype/ftrender.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/raster/raster.c b/thirdparty/freetype/src/raster/raster.c
index 08431c8509..cd37943bf6 100644
--- a/thirdparty/freetype/src/raster/raster.c
+++ b/thirdparty/freetype/src/raster/raster.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "ftraster.c"
#include "ftrend1.c"
diff --git a/thirdparty/freetype/src/raster/rasterrs.h b/thirdparty/freetype/src/raster/rasterrs.h
index 379e1d3e89..a29651a6c5 100644
--- a/thirdparty/freetype/src/raster/rasterrs.h
+++ b/thirdparty/freetype/src/raster/rasterrs.h
@@ -26,7 +26,7 @@
#ifndef RASTERRS_H_
#define RASTERRS_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -34,7 +34,7 @@
#define FT_ERR_PREFIX Raster_Err_
#define FT_ERR_BASE FT_Mod_Err_Raster
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* RASTERRS_H_ */
diff --git a/thirdparty/freetype/src/sfnt/pngshim.c b/thirdparty/freetype/src/sfnt/pngshim.c
index 523b30a745..f55016122c 100644
--- a/thirdparty/freetype/src/sfnt/pngshim.c
+++ b/thirdparty/freetype/src/sfnt/pngshim.c
@@ -17,10 +17,9 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
#include FT_CONFIG_STANDARD_LIBRARY_H
@@ -61,7 +60,12 @@
/* predates clang; the `__BYTE_ORDER__' preprocessor symbol was */
/* introduced in gcc 4.6 and clang 3.2, respectively. */
/* `__builtin_shuffle' for gcc was introduced in gcc 4.7.0. */
-#if ( ( defined( __GNUC__ ) && \
+ /* */
+ /* Intel compilers do not currently support __builtin_shuffle; */
+
+ /* The Intel check must be first. */
+#if !defined( __INTEL_COMPILER ) && \
+ ( ( defined( __GNUC__ ) && \
( ( __GNUC__ >= 5 ) || \
( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 7 ) ) ) ) || \
( defined( __clang__ ) && \
@@ -328,6 +332,13 @@
if ( populate_map_and_metrics )
{
+ /* reject too large bitmaps similarly to the rasterizer */
+ if ( imgHeight > 0x7FFF || imgWidth > 0x7FFF )
+ {
+ error = FT_THROW( Array_Too_Large );
+ goto DestroyExit;
+ }
+
metrics->width = (FT_UShort)imgWidth;
metrics->height = (FT_UShort)imgHeight;
@@ -336,13 +347,6 @@
map->pixel_mode = FT_PIXEL_MODE_BGRA;
map->pitch = (int)( map->width * 4 );
map->num_grays = 256;
-
- /* reject too large bitmaps similarly to the rasterizer */
- if ( map->rows > 0x7FFF || map->width > 0x7FFF )
- {
- error = FT_THROW( Array_Too_Large );
- goto DestroyExit;
- }
}
/* convert palette/gray image to rgb */
diff --git a/thirdparty/freetype/src/sfnt/pngshim.h b/thirdparty/freetype/src/sfnt/pngshim.h
index d2c9e2b9b5..2d6e83d69b 100644
--- a/thirdparty/freetype/src/sfnt/pngshim.h
+++ b/thirdparty/freetype/src/sfnt/pngshim.h
@@ -21,7 +21,6 @@
#define PNGSHIM_H_
-#include <ft2build.h>
#include "ttload.h"
diff --git a/thirdparty/freetype/src/sfnt/sfdriver.c b/thirdparty/freetype/src/sfnt/sfdriver.c
index 6ca4f3c268..0460339a74 100644
--- a/thirdparty/freetype/src/sfnt/sfdriver.c
+++ b/thirdparty/freetype/src/sfnt/sfdriver.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_TRUETYPE_IDS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ttnameid.h>
#include "sfdriver.h"
#include "ttload.h"
@@ -43,21 +42,21 @@
#ifdef TT_CONFIG_OPTION_BDF
#include "ttbdf.h"
-#include FT_SERVICE_BDF_H
+#include <freetype/internal/services/svbdf.h>
#endif
#include "ttcmap.h"
#include "ttkern.h"
#include "ttmtx.h"
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_SFNT_H
-#include FT_SERVICE_TT_CMAP_H
+#include <freetype/internal/services/svgldict.h>
+#include <freetype/internal/services/svpostnm.h>
+#include <freetype/internal/services/svsfnt.h>
+#include <freetype/internal/services/svttcmap.h>
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/services/svmm.h>
#endif
@@ -195,7 +194,7 @@
else if ( (FT_ULong)face->num_glyphs < FT_UINT_MAX )
max_gid = (FT_UInt)face->num_glyphs;
else
- FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08x\n",
+ FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08lx\n",
FT_UINT_MAX, face->num_glyphs ));
for ( i = 0; i < max_gid; i++ )
diff --git a/thirdparty/freetype/src/sfnt/sfdriver.h b/thirdparty/freetype/src/sfnt/sfdriver.h
index d108ee2000..1ac2706325 100644
--- a/thirdparty/freetype/src/sfnt/sfdriver.h
+++ b/thirdparty/freetype/src/sfnt/sfdriver.h
@@ -20,8 +20,7 @@
#define SFDRIVER_H_
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/sfnt/sferrors.h b/thirdparty/freetype/src/sfnt/sferrors.h
index fbfca0e525..55c3e76b66 100644
--- a/thirdparty/freetype/src/sfnt/sferrors.h
+++ b/thirdparty/freetype/src/sfnt/sferrors.h
@@ -25,7 +25,7 @@
#ifndef SFERRORS_H_
#define SFERRORS_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -33,7 +33,7 @@
#define FT_ERR_PREFIX SFNT_Err_
#define FT_ERR_BASE FT_Mod_Err_SFNT
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* SFERRORS_H_ */
diff --git a/thirdparty/freetype/src/sfnt/sfnt.c b/thirdparty/freetype/src/sfnt/sfnt.c
index 9db7935ae4..471239ff0b 100644
--- a/thirdparty/freetype/src/sfnt/sfnt.c
+++ b/thirdparty/freetype/src/sfnt/sfnt.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "pngshim.c"
#include "sfdriver.c"
diff --git a/thirdparty/freetype/src/sfnt/sfobjs.c b/thirdparty/freetype/src/sfnt/sfobjs.c
index 2c66a9b648..39460be2e6 100644
--- a/thirdparty/freetype/src/sfnt/sfobjs.c
+++ b/thirdparty/freetype/src/sfnt/sfobjs.c
@@ -16,23 +16,22 @@
*/
-#include <ft2build.h>
#include "sfobjs.h"
#include "ttload.h"
#include "ttcmap.h"
#include "ttkern.h"
#include "sfwoff.h"
#include "sfwoff2.h"
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_TRUETYPE_IDS_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_SFNT_NAMES_H
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ttnameid.h>
+#include <freetype/tttags.h>
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/ftsnames.h>
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svmetric.h>
#endif
#include "sferrors.h"
@@ -547,8 +546,8 @@
/* Stream may have changed in sfnt_open_font. */
stream = face->root.stream;
- FT_TRACE2(( "sfnt_init_face: %08p (index %d)\n",
- face,
+ FT_TRACE2(( "sfnt_init_face: %p (index %d)\n",
+ (void *)face,
face_instance_index ));
face_index = FT_ABS( face_instance_index ) & 0xFFFF;
@@ -821,7 +820,7 @@
/* it doesn't contain outlines. */
/* */
- FT_TRACE2(( "sfnt_load_face: %08p\n\n", face ));
+ FT_TRACE2(( "sfnt_load_face: %p\n\n", (void *)face ));
/* do we have outlines in there? */
#ifdef FT_CONFIG_OPTION_INCREMENTAL
diff --git a/thirdparty/freetype/src/sfnt/sfobjs.h b/thirdparty/freetype/src/sfnt/sfobjs.h
index d8438a4834..e8e3042083 100644
--- a/thirdparty/freetype/src/sfnt/sfobjs.h
+++ b/thirdparty/freetype/src/sfnt/sfobjs.h
@@ -20,9 +20,8 @@
#define SFOBJS_H_
-#include <ft2build.h>
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/ftobjs.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/sfnt/sfwoff.c b/thirdparty/freetype/src/sfnt/sfwoff.c
index d1e330f675..f0a32e1e06 100644
--- a/thirdparty/freetype/src/sfnt/sfwoff.c
+++ b/thirdparty/freetype/src/sfnt/sfwoff.c
@@ -16,12 +16,11 @@
*/
-#include <ft2build.h>
#include "sfwoff.h"
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_GZIP_H
+#include <freetype/tttags.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/ftgzip.h>
/**************************************************************************
diff --git a/thirdparty/freetype/src/sfnt/sfwoff.h b/thirdparty/freetype/src/sfnt/sfwoff.h
index c1789d33d5..d177ab1160 100644
--- a/thirdparty/freetype/src/sfnt/sfwoff.h
+++ b/thirdparty/freetype/src/sfnt/sfwoff.h
@@ -20,9 +20,8 @@
#define SFWOFF_H_
-#include <ft2build.h>
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/ftobjs.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/sfnt/sfwoff2.c b/thirdparty/freetype/src/sfnt/sfwoff2.c
index 1b99e7d28c..5c8202f823 100644
--- a/thirdparty/freetype/src/sfnt/sfwoff2.c
+++ b/thirdparty/freetype/src/sfnt/sfwoff2.c
@@ -15,12 +15,11 @@
*
*/
-#include <ft2build.h>
#include "sfwoff2.h"
#include "woff2tags.h"
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/tttags.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
#ifdef FT_CONFIG_OPTION_USE_BROTLI
@@ -44,7 +43,8 @@
#define READ_BASE128( var ) FT_SET_ERROR( ReadBase128( stream, &var ) )
-#define ROUND4( var ) ( ( var + 3 ) & ~3 )
+ /* `var' should be FT_ULong */
+#define ROUND4( var ) ( ( var + 3 ) & ~3UL )
#define WRITE_USHORT( p, v ) \
do \
@@ -64,12 +64,12 @@
\
} while ( 0 )
-#define WRITE_SHORT( p, v ) \
- do \
- { \
- *(p)++ = ( (v) >> 8 ); \
- *(p)++ = ( (v) >> 0 ); \
- \
+#define WRITE_SHORT( p, v ) \
+ do \
+ { \
+ *(p)++ = (FT_Byte)( (v) >> 8 ); \
+ *(p)++ = (FT_Byte)( (v) >> 0 ); \
+ \
} while ( 0 )
#define WRITE_SFNT_BUF( buf, s ) \
@@ -125,10 +125,10 @@
Read255UShort( FT_Stream stream,
FT_UShort* value )
{
- static const FT_Int oneMoreByteCode1 = 255;
- static const FT_Int oneMoreByteCode2 = 254;
- static const FT_Int wordCode = 253;
- static const FT_Int lowestUCode = 253;
+ const FT_Byte oneMoreByteCode1 = 255;
+ const FT_Byte oneMoreByteCode2 = 254;
+ const FT_Byte wordCode = 253;
+ const FT_UShort lowestUCode = 253;
FT_Error error = FT_Err_Ok;
FT_Byte code;
@@ -281,12 +281,12 @@
/* Calculate table checksum of `buf'. */
- static FT_Long
+ static FT_ULong
compute_ULong_sum( FT_Byte* buf,
FT_ULong size )
{
FT_ULong checksum = 0;
- FT_ULong aligned_size = size & ~3;
+ FT_ULong aligned_size = size & ~3UL;
FT_ULong i;
FT_ULong v;
@@ -318,7 +318,9 @@
{
#ifdef FT_CONFIG_OPTION_USE_BROTLI
- FT_ULong uncompressed_size = dst_size;
+ /* this cast is only of importance on 32bit systems; */
+ /* we don't validate it */
+ FT_Offset uncompressed_size = (FT_Offset)dst_size;
BrotliDecoderResult result;
@@ -537,12 +539,12 @@
FT_ULong* glyph_size )
{
FT_UInt flag_offset = 10 + ( 2 * n_contours ) + 2 + instruction_len;
- FT_Int last_flag = -1;
- FT_Int repeat_count = 0;
- FT_Int last_x = 0;
- FT_Int last_y = 0;
- FT_UInt x_bytes = 0;
- FT_UInt y_bytes = 0;
+ FT_Byte last_flag = 0xFFU;
+ FT_Byte repeat_count = 0;
+ FT_Int last_x = 0;
+ FT_Int last_y = 0;
+ FT_UInt x_bytes = 0;
+ FT_UInt y_bytes = 0;
FT_UInt xy_bytes;
FT_UInt i;
FT_UInt x_offset;
@@ -554,9 +556,9 @@
{
const WOFF2_PointRec point = points[i];
- FT_Int flag = point.on_curve ? GLYF_ON_CURVE : 0;
- FT_Int dx = point.x - last_x;
- FT_Int dy = point.y - last_y;
+ FT_Byte flag = point.on_curve ? GLYF_ON_CURVE : 0;
+ FT_Int dx = point.x - last_x;
+ FT_Int dy = point.y - last_y;
if ( dx == 0 )
@@ -633,7 +635,7 @@
if ( dx == 0 )
;
else if ( dx > -256 && dx < 256 )
- dst[x_offset++] = FT_ABS( dx );
+ dst[x_offset++] = (FT_Byte)FT_ABS( dx );
else
{
pointer = dst + x_offset;
@@ -646,7 +648,7 @@
if ( dy == 0 )
;
else if ( dy > -256 && dy < 256 )
- dst[y_offset++] = FT_ABS( dy );
+ dst[y_offset++] = (FT_Byte)FT_ABS( dy );
else
{
pointer = dst + y_offset;
@@ -918,7 +920,7 @@
bbox_bitmap_offset = substreams[BBOX_STREAM].offset;
/* Size of bboxBitmap = 4 * floor((numGlyphs + 31) / 32) */
- bitmap_length = ( ( num_glyphs + 31 ) >> 5 ) << 2;
+ bitmap_length = ( ( num_glyphs + 31U ) >> 5 ) << 2;
substreams[BBOX_STREAM].offset += bitmap_length;
glyph_buf_size = WOFF2_DEFAULT_GLYPH_BUF;
@@ -1196,7 +1198,7 @@
/* Store x_mins, may be required to reconstruct `hmtx'. */
if ( n_contours > 0 )
- info->x_mins[i] = x_min;
+ info->x_mins[i] = (FT_Short)x_min;
}
info->glyf_table->dst_length = dest_offset - info->glyf_table->dst_offset;
@@ -1220,7 +1222,7 @@
FT_TRACE4(( " loca table info:\n" ));
FT_TRACE4(( " dst_offset = %lu\n", info->loca_table->dst_offset ));
FT_TRACE4(( " dst_length = %lu\n", info->loca_table->dst_length ));
- FT_TRACE4(( " checksum = %09x\n", *loca_checksum ));
+ FT_TRACE4(( " checksum = %09lx\n", *loca_checksum ));
/* Set pointer `sfnt_bytes' to its correct value. */
*sfnt_bytes = sfnt;
@@ -1287,6 +1289,12 @@
return FT_THROW( Invalid_Table );
}
+ if ( !info->loca_table )
+ {
+ FT_ERROR(( "`loca' table is missing.\n" ));
+ return FT_THROW( Invalid_Table );
+ }
+
/* Read `numGlyphs' field from `maxp' table. */
if ( FT_STREAM_SEEK( maxp_table->src_offset ) || FT_STREAM_SKIP( 8 ) )
return error;
@@ -1338,7 +1346,7 @@
if ( FT_STREAM_SEEK( glyf_offset ) || FT_STREAM_SKIP( 2 ) )
return error;
- if ( FT_READ_USHORT( info->x_mins[i] ) )
+ if ( FT_READ_SHORT( info->x_mins[i] ) )
return error;
}
@@ -1565,7 +1573,7 @@
WOFF2_TableRec table = *( indices[nn] );
- FT_TRACE3(( "Seeking to %d with table size %d.\n",
+ FT_TRACE3(( "Seeking to %ld with table size %ld.\n",
table.src_offset, table.src_length ));
FT_TRACE3(( "Table tag: %c%c%c%c.\n",
(FT_Char)( table.Tag >> 24 ),
@@ -1606,7 +1614,7 @@
checksum = compute_ULong_sum( transformed_buf + table.src_offset,
table.src_length );
- FT_TRACE4(( "Checksum = %09x.\n", checksum ));
+ FT_TRACE4(( "Checksum = %09lx.\n", checksum ));
if ( WRITE_SFNT_BUF( transformed_buf + table.src_offset,
table.src_length ) )
@@ -1631,7 +1639,7 @@
memory ) )
goto Fail;
- FT_TRACE4(( "Checksum = %09x.\n", checksum ));
+ FT_TRACE4(( "Checksum = %09lx.\n", checksum ));
}
else if ( table.Tag == TTAG_loca )
@@ -1707,7 +1715,7 @@
WRITE_ULONG( buf_cursor, font_checksum );
- FT_TRACE2(( "Final checksum = %09x.\n", font_checksum ));
+ FT_TRACE2(( "Final checksum = %09lx.\n", font_checksum ));
woff2->actual_sfnt_size = dest_offset;
@@ -1804,15 +1812,15 @@
if ( FT_STREAM_READ_FIELDS( woff2_header_fields, &woff2 ) )
return error;
- FT_TRACE4(( "signature -> 0x%X\n", woff2.signature ));
+ FT_TRACE4(( "signature -> 0x%lX\n", woff2.signature ));
FT_TRACE2(( "flavor -> 0x%08lx\n", woff2.flavor ));
FT_TRACE4(( "length -> %lu\n", woff2.length ));
FT_TRACE2(( "num_tables -> %hu\n", woff2.num_tables ));
FT_TRACE4(( "totalSfntSize -> %lu\n", woff2.totalSfntSize ));
- FT_TRACE4(( "metaOffset -> %hu\n", woff2.metaOffset ));
- FT_TRACE4(( "metaLength -> %hu\n", woff2.metaLength ));
- FT_TRACE4(( "privOffset -> %hu\n", woff2.privOffset ));
- FT_TRACE4(( "privLength -> %hu\n", woff2.privLength ));
+ FT_TRACE4(( "metaOffset -> %lu\n", woff2.metaOffset ));
+ FT_TRACE4(( "metaLength -> %lu\n", woff2.metaLength ));
+ FT_TRACE4(( "privOffset -> %lu\n", woff2.privOffset ));
+ FT_TRACE4(( "privLength -> %lu\n", woff2.privLength ));
/* Make sure we don't recurse back here. */
if ( woff2.flavor == TTAG_wOF2 )
@@ -1844,9 +1852,11 @@
FT_NEW_ARRAY( indices, woff2.num_tables ) )
goto Exit;
- FT_TRACE2(( "\n"
- " tag flags transform origLen transformLen\n"
- " --------------------------------------------------\n" ));
+ FT_TRACE2((
+ "\n"
+ " tag flags transform origLen transformLen offset\n"
+ " -----------------------------------------------------------\n" ));
+ /* " XXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX" */
for ( nn = 0; nn < woff2.num_tables; nn++ )
{
@@ -1916,7 +1926,7 @@
src_offset += table->TransformLength;
table->flags = flags;
- FT_TRACE2(( " %c%c%c%c %08d %08d %08ld %08ld\n",
+ FT_TRACE2(( " %c%c%c%c %08d %08d %08ld %08ld %08ld\n",
(FT_Char)( table->Tag >> 24 ),
(FT_Char)( table->Tag >> 16 ),
(FT_Char)( table->Tag >> 8 ),
@@ -1925,7 +1935,6 @@
( table->FlagByte >> 6 ) & 0x03,
table->dst_length,
table->TransformLength,
- table->src_length,
table->src_offset ));
indices[nn] = table;
@@ -1971,7 +1980,7 @@
goto Exit;
}
- FT_TRACE4(( "Number of fonts in TTC: %ld\n", woff2.num_fonts ));
+ FT_TRACE4(( "Number of fonts in TTC: %d\n", woff2.num_fonts ));
if ( FT_NEW_ARRAY( woff2.ttc_fonts, woff2.num_fonts ) )
goto Exit;
@@ -1989,7 +1998,7 @@
if ( FT_NEW_ARRAY( ttc_font->table_indices, ttc_font->num_tables ) )
goto Exit;
- FT_TRACE5(( "Number of tables in font %d: %ld\n",
+ FT_TRACE5(( "Number of tables in font %d: %d\n",
nn, ttc_font->num_tables ));
#ifdef FT_DEBUG_LEVEL_TRACE
diff --git a/thirdparty/freetype/src/sfnt/sfwoff2.h b/thirdparty/freetype/src/sfnt/sfwoff2.h
index 7ae6e2c06d..798f66bd0a 100644
--- a/thirdparty/freetype/src/sfnt/sfwoff2.h
+++ b/thirdparty/freetype/src/sfnt/sfwoff2.h
@@ -20,9 +20,8 @@
#define SFWOFF2_H_
-#include <ft2build.h>
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/ftobjs.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/sfnt/ttbdf.c b/thirdparty/freetype/src/sfnt/ttbdf.c
index bc35284cc8..a287d3afc4 100644
--- a/thirdparty/freetype/src/sfnt/ttbdf.c
+++ b/thirdparty/freetype/src/sfnt/ttbdf.c
@@ -16,10 +16,9 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
#include "ttbdf.h"
#include "sferrors.h"
diff --git a/thirdparty/freetype/src/sfnt/ttbdf.h b/thirdparty/freetype/src/sfnt/ttbdf.h
index c340f6631d..e60c01cb8b 100644
--- a/thirdparty/freetype/src/sfnt/ttbdf.h
+++ b/thirdparty/freetype/src/sfnt/ttbdf.h
@@ -20,9 +20,8 @@
#define TTBDF_H_
-#include <ft2build.h>
#include "ttload.h"
-#include FT_BDF_H
+#include <freetype/ftbdf.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/sfnt/ttcmap.c b/thirdparty/freetype/src/sfnt/ttcmap.c
index 2c34efb5ce..556a712199 100644
--- a/thirdparty/freetype/src/sfnt/ttcmap.c
+++ b/thirdparty/freetype/src/sfnt/ttcmap.c
@@ -16,14 +16,13 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
-#include "sferrors.h" /* must come before FT_INTERNAL_VALIDATE_H */
+#include "sferrors.h" /* must come before `ftvalid.h' */
-#include FT_INTERNAL_VALIDATE_H
-#include FT_INTERNAL_STREAM_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include <freetype/internal/ftvalid.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/services/svpscmap.h>
#include "ttload.h"
#include "ttcmap.h"
#include "ttpost.h"
@@ -3752,6 +3751,7 @@
static const TT_CMap_Class tt_cmap_classes[] =
{
+#undef TTCMAPCITEM
#define TTCMAPCITEM( a ) &a,
#include "ttcmapc.h"
NULL,
@@ -3788,8 +3788,9 @@
p += 2;
num_cmaps = TT_NEXT_USHORT( p );
- limit = table + face->cmap_size;
+ FT_TRACE4(( "tt_face_build_cmaps: %d cmaps\n", num_cmaps ));
+ limit = table + face->cmap_size;
for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- )
{
FT_CharMapRec charmap;
diff --git a/thirdparty/freetype/src/sfnt/ttcmap.h b/thirdparty/freetype/src/sfnt/ttcmap.h
index 4bf49e2d49..c7d7c21d2c 100644
--- a/thirdparty/freetype/src/sfnt/ttcmap.h
+++ b/thirdparty/freetype/src/sfnt/ttcmap.h
@@ -20,10 +20,9 @@
#define TTCMAP_H_
-#include <ft2build.h>
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_INTERNAL_VALIDATE_H
-#include FT_SERVICE_TT_CMAP_H
+#include <freetype/internal/tttypes.h>
+#include <freetype/internal/ftvalid.h>
+#include <freetype/internal/services/svttcmap.h>
FT_BEGIN_HEADER
@@ -91,6 +90,11 @@ FT_BEGIN_HEADER
};
+#undef TTCMAPCITEM
+#define TTCMAPCITEM( a ) FT_CALLBACK_TABLE const TT_CMap_ClassRec a;
+#include "ttcmapc.h"
+
+
typedef struct TT_ValidatorRec_
{
FT_ValidatorRec validator;
diff --git a/thirdparty/freetype/src/sfnt/ttcolr.c b/thirdparty/freetype/src/sfnt/ttcolr.c
index b37fa7b09a..9025e356ce 100644
--- a/thirdparty/freetype/src/sfnt/ttcolr.c
+++ b/thirdparty/freetype/src/sfnt/ttcolr.c
@@ -27,11 +27,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_COLOR_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
+#include <freetype/ftcolor.h>
#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
@@ -40,9 +39,9 @@
/* NOTE: These are the table sizes calculated through the specs. */
-#define BASE_GLYPH_SIZE 6
-#define LAYER_SIZE 4
-#define COLR_HEADER_SIZE 14
+#define BASE_GLYPH_SIZE 6U
+#define LAYER_SIZE 4U
+#define COLR_HEADER_SIZE 14U
typedef struct BaseGlyphRecord_
diff --git a/thirdparty/freetype/src/sfnt/ttcolr.h b/thirdparty/freetype/src/sfnt/ttcolr.h
index 8da6b3aa14..6412162669 100644
--- a/thirdparty/freetype/src/sfnt/ttcolr.h
+++ b/thirdparty/freetype/src/sfnt/ttcolr.h
@@ -22,7 +22,6 @@
#define __TTCOLR_H__
-#include <ft2build.h>
#include "ttload.h"
diff --git a/thirdparty/freetype/src/sfnt/ttcpal.c b/thirdparty/freetype/src/sfnt/ttcpal.c
index 165423e305..9c514bafe5 100644
--- a/thirdparty/freetype/src/sfnt/ttcpal.c
+++ b/thirdparty/freetype/src/sfnt/ttcpal.c
@@ -27,11 +27,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_COLOR_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
+#include <freetype/ftcolor.h>
#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
@@ -40,8 +39,8 @@
/* NOTE: These are the table sizes calculated through the specs. */
-#define CPAL_V0_HEADER_BASE_SIZE 12
-#define COLOR_SIZE 4
+#define CPAL_V0_HEADER_BASE_SIZE 12U
+#define COLOR_SIZE 4U
/* all data from `CPAL' not covered in FT_Palette_Data */
@@ -140,7 +139,7 @@
3U * 4 > table_size )
goto InvalidTable;
- p += face->palette_data.num_palettes * 2;
+ p += face->palette_data.num_palettes * 2U;
type_offset = FT_NEXT_ULONG( p );
label_offset = FT_NEXT_ULONG( p );
@@ -150,7 +149,7 @@
{
if ( type_offset >= table_size )
goto InvalidTable;
- if ( face->palette_data.num_palettes * 2 >
+ if ( face->palette_data.num_palettes * 2U >
table_size - type_offset )
goto InvalidTable;
@@ -171,7 +170,7 @@
{
if ( label_offset >= table_size )
goto InvalidTable;
- if ( face->palette_data.num_palettes * 2 >
+ if ( face->palette_data.num_palettes * 2U >
table_size - label_offset )
goto InvalidTable;
@@ -192,7 +191,7 @@
{
if ( entry_label_offset >= table_size )
goto InvalidTable;
- if ( face->palette_data.num_palette_entries * 2 >
+ if ( face->palette_data.num_palette_entries * 2U >
table_size - entry_label_offset )
goto InvalidTable;
diff --git a/thirdparty/freetype/src/sfnt/ttcpal.h b/thirdparty/freetype/src/sfnt/ttcpal.h
index f2e116ba2c..b544be696a 100644
--- a/thirdparty/freetype/src/sfnt/ttcpal.h
+++ b/thirdparty/freetype/src/sfnt/ttcpal.h
@@ -22,7 +22,6 @@
#define __TTCPAL_H__
-#include <ft2build.h>
#include "ttload.h"
diff --git a/thirdparty/freetype/src/sfnt/ttkern.c b/thirdparty/freetype/src/sfnt/ttkern.c
index 1d34acbd13..d4a70c7855 100644
--- a/thirdparty/freetype/src/sfnt/ttkern.c
+++ b/thirdparty/freetype/src/sfnt/ttkern.c
@@ -17,10 +17,9 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
#include "ttkern.h"
#include "sferrors.h"
diff --git a/thirdparty/freetype/src/sfnt/ttkern.h b/thirdparty/freetype/src/sfnt/ttkern.h
index 6560a283a6..f44b5bdeb0 100644
--- a/thirdparty/freetype/src/sfnt/ttkern.h
+++ b/thirdparty/freetype/src/sfnt/ttkern.h
@@ -21,9 +21,8 @@
#define TTKERN_H_
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/tttypes.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/sfnt/ttload.c b/thirdparty/freetype/src/sfnt/ttload.c
index d4e4ee4f10..4b46f41357 100644
--- a/thirdparty/freetype/src/sfnt/ttload.c
+++ b/thirdparty/freetype/src/sfnt/ttload.c
@@ -17,10 +17,9 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
#include "ttload.h"
#include "sferrors.h"
@@ -65,8 +64,8 @@
#endif
- FT_TRACE4(( "tt_face_lookup_table: %08p, `%c%c%c%c' -- ",
- face,
+ FT_TRACE4(( "tt_face_lookup_table: %p, `%c%c%c%c' -- ",
+ (void *)face,
(FT_Char)( tag >> 24 ),
(FT_Char)( tag >> 16 ),
(FT_Char)( tag >> 8 ),
@@ -363,7 +362,7 @@
};
- FT_TRACE2(( "tt_face_load_font_dir: %08p\n", face ));
+ FT_TRACE2(( "tt_face_load_font_dir: %p\n", (void *)face ));
/* read the offset table */
@@ -1315,7 +1314,7 @@
/* we don't load the glyph names, we do that in another */
/* module (ttpost). */
- FT_TRACE3(( "FormatType: 0x%x\n", post->FormatType ));
+ FT_TRACE3(( "FormatType: 0x%lx\n", post->FormatType ));
FT_TRACE3(( "isFixedPitch: %s\n", post->isFixedPitch
? " yes" : " no" ));
diff --git a/thirdparty/freetype/src/sfnt/ttload.h b/thirdparty/freetype/src/sfnt/ttload.h
index 49d40655f8..4e53d8b782 100644
--- a/thirdparty/freetype/src/sfnt/ttload.h
+++ b/thirdparty/freetype/src/sfnt/ttload.h
@@ -21,9 +21,8 @@
#define TTLOAD_H_
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/tttypes.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/sfnt/ttmtx.c b/thirdparty/freetype/src/sfnt/ttmtx.c
index e18ff877ef..021123336e 100644
--- a/thirdparty/freetype/src/sfnt/ttmtx.c
+++ b/thirdparty/freetype/src/sfnt/ttmtx.c
@@ -16,13 +16,12 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/internal/services/svmetric.h>
#endif
#include "ttmtx.h"
diff --git a/thirdparty/freetype/src/sfnt/ttmtx.h b/thirdparty/freetype/src/sfnt/ttmtx.h
index c98c79ec51..dba65ca9ba 100644
--- a/thirdparty/freetype/src/sfnt/ttmtx.h
+++ b/thirdparty/freetype/src/sfnt/ttmtx.h
@@ -20,9 +20,8 @@
#define TTMTX_H_
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/tttypes.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/sfnt/ttpost.c b/thirdparty/freetype/src/sfnt/ttpost.c
index f7be716219..e93a4bf1b1 100644
--- a/thirdparty/freetype/src/sfnt/ttpost.c
+++ b/thirdparty/freetype/src/sfnt/ttpost.c
@@ -25,10 +25,9 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
@@ -54,7 +53,7 @@
#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include <freetype/internal/services/svpscmap.h>
#define MAC_NAME( x ) (FT_String*)psnames->macintosh_name( (FT_UInt)(x) )
@@ -240,7 +239,7 @@
break;
else
{
- FT_TRACE6(( "load_format_20: %d byte left in post table\n",
+ FT_TRACE6(( "load_format_20: %ld byte left in post table\n",
post_limit - FT_STREAM_POS() ));
if ( FT_READ_BYTE( len ) )
diff --git a/thirdparty/freetype/src/sfnt/ttpost.h b/thirdparty/freetype/src/sfnt/ttpost.h
index 547f2ff843..94c7d16800 100644
--- a/thirdparty/freetype/src/sfnt/ttpost.h
+++ b/thirdparty/freetype/src/sfnt/ttpost.h
@@ -23,7 +23,7 @@
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/internal/tttypes.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/sfnt/ttsbit.c b/thirdparty/freetype/src/sfnt/ttsbit.c
index 3f8730f7fb..9dd4419710 100644
--- a/thirdparty/freetype/src/sfnt/ttsbit.c
+++ b/thirdparty/freetype/src/sfnt/ttsbit.c
@@ -19,11 +19,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_BITMAP_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
+#include <freetype/ftbitmap.h>
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
@@ -348,7 +347,7 @@
FT_TRACE2(( "tt_face_load_strike_metrics:"
" sanitizing invalid ascender and descender\n"
" "
- " values for strike %d (%dppem, %dppem)\n",
+ " values for strike %ld (%dppem, %dppem)\n",
strike_index,
metrics->x_ppem, metrics->y_ppem ));
diff --git a/thirdparty/freetype/src/sfnt/ttsbit.h b/thirdparty/freetype/src/sfnt/ttsbit.h
index dfeb886838..b867e43a61 100644
--- a/thirdparty/freetype/src/sfnt/ttsbit.h
+++ b/thirdparty/freetype/src/sfnt/ttsbit.h
@@ -20,7 +20,6 @@
#define TTSBIT_H_
-#include <ft2build.h>
#include "ttload.h"
diff --git a/thirdparty/freetype/src/sfnt/woff2tags.c b/thirdparty/freetype/src/sfnt/woff2tags.c
index 246f7fa062..fd9f2e6c5d 100644
--- a/thirdparty/freetype/src/sfnt/woff2tags.c
+++ b/thirdparty/freetype/src/sfnt/woff2tags.c
@@ -16,9 +16,8 @@
*/
-#include <ft2build.h>
-#include FT_TRUETYPE_TAGS_H
-
+#include <freetype/tttags.h>
+#include "woff2tags.h"
/*
* Return tag from index in the order given in WOFF2 specification.
diff --git a/thirdparty/freetype/src/sfnt/woff2tags.h b/thirdparty/freetype/src/sfnt/woff2tags.h
index 13d242e11d..c437c77aa1 100644
--- a/thirdparty/freetype/src/sfnt/woff2tags.h
+++ b/thirdparty/freetype/src/sfnt/woff2tags.h
@@ -4,7 +4,7 @@
*
* WOFFF2 Font table tags (specification).
*
- * Copyright (C) 1996-2020 by
+ * Copyright (C) 2019-2020 by
* Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,8 @@
#define WOFF2TAGS_H
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/compiler-macros.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/smooth/ftgrays.c b/thirdparty/freetype/src/smooth/ftgrays.c
index 93538331af..681900fd40 100644
--- a/thirdparty/freetype/src/smooth/ftgrays.c
+++ b/thirdparty/freetype/src/smooth/ftgrays.c
@@ -278,12 +278,11 @@ typedef ptrdiff_t FT_PtrDist;
#else /* !STANDALONE_ */
-#include <ft2build.h>
#include "ftgrays.h"
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_OUTLINE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/ftoutln.h>
#include "ftsmerrs.h"
@@ -1649,7 +1648,7 @@ typedef ptrdiff_t FT_PtrDist;
if ( !ras.invalid )
gray_record_cell( RAS_VAR );
- FT_TRACE7(( "band [%d..%d]: %d cell%s\n",
+ FT_TRACE7(( "band [%d..%d]: %ld cell%s\n",
ras.min_ey,
ras.max_ey,
ras.num_cells,
diff --git a/thirdparty/freetype/src/smooth/ftgrays.h b/thirdparty/freetype/src/smooth/ftgrays.h
index e10fd039ac..caba632833 100644
--- a/thirdparty/freetype/src/smooth/ftgrays.h
+++ b/thirdparty/freetype/src/smooth/ftgrays.h
@@ -28,7 +28,7 @@
#include "ftimage.h"
#else
#include <ft2build.h>
-#include FT_IMAGE_H
+#include <freetype/ftimage.h>
#endif
diff --git a/thirdparty/freetype/src/smooth/ftsmerrs.h b/thirdparty/freetype/src/smooth/ftsmerrs.h
index 3f8567b0fa..e93f3df9b3 100644
--- a/thirdparty/freetype/src/smooth/ftsmerrs.h
+++ b/thirdparty/freetype/src/smooth/ftsmerrs.h
@@ -26,7 +26,7 @@
#ifndef FTSMERRS_H_
#define FTSMERRS_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -34,7 +34,7 @@
#define FT_ERR_PREFIX Smooth_Err_
#define FT_ERR_BASE FT_Mod_Err_Smooth
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* FTSMERRS_H_ */
diff --git a/thirdparty/freetype/src/smooth/ftsmooth.c b/thirdparty/freetype/src/smooth/ftsmooth.c
index 072045cbc2..5d66bd6fc4 100644
--- a/thirdparty/freetype/src/smooth/ftsmooth.c
+++ b/thirdparty/freetype/src/smooth/ftsmooth.c
@@ -16,46 +16,15 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_OUTLINE_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftoutln.h>
#include "ftsmooth.h"
#include "ftgrays.h"
#include "ftsmerrs.h"
- /* initialize renderer -- init its raster */
- static FT_Error
- ft_smooth_init( FT_Renderer render )
- {
-
-#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-
- FT_Vector* sub = render->root.library->lcd_geometry;
-
-
- /* set up default subpixel geometry for striped RGB panels. */
- sub[0].x = -21;
- sub[0].y = 0;
- sub[1].x = 0;
- sub[1].y = 0;
- sub[2].x = 21;
- sub[2].y = 0;
-
-#elif 0 /* or else, once ClearType patents expire */
-
- FT_Library_SetLcdFilter( render->root.library, FT_LCD_FILTER_DEFAULT );
-
-#endif
-
- render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
-
- return 0;
- }
-
-
/* sets render-specific mode */
static FT_Error
ft_smooth_set_mode( FT_Renderer render,
@@ -107,14 +76,359 @@
FT_Outline_Get_CBox( &slot->outline, cbox );
}
+ typedef struct TOrigin_
+ {
+ unsigned char* origin; /* pixmap origin at the bottom-left */
+ int pitch; /* pitch to go down one row */
+
+ } TOrigin;
- /* convert a slot's glyph image into a bitmap */
+#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+
+ /* initialize renderer -- init its raster */
static FT_Error
- ft_smooth_render_generic( FT_Renderer render,
- FT_GlyphSlot slot,
- FT_Render_Mode mode,
- const FT_Vector* origin,
- FT_Render_Mode required_mode )
+ ft_smooth_init( FT_Renderer render )
+ {
+ FT_Vector* sub = render->root.library->lcd_geometry;
+
+
+ /* set up default subpixel geometry for striped RGB panels. */
+ sub[0].x = -21;
+ sub[0].y = 0;
+ sub[1].x = 0;
+ sub[1].y = 0;
+ sub[2].x = 21;
+ sub[2].y = 0;
+
+ render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
+
+ return 0;
+ }
+
+
+ /* This function writes every third byte in direct rendering mode */
+ static void
+ ft_smooth_lcd_spans( int y,
+ int count,
+ const FT_Span* spans,
+ TOrigin* target )
+ {
+ unsigned char* dst_line = target->origin - y * target->pitch;
+ unsigned char* dst;
+ unsigned short w;
+
+
+ for ( ; count--; spans++ )
+ for ( dst = dst_line + spans->x * 3, w = spans->len; w--; dst += 3 )
+ *dst = spans->coverage;
+ }
+
+
+ static FT_Error
+ ft_smooth_raster_lcd( FT_Renderer render,
+ FT_Outline* outline,
+ FT_Bitmap* bitmap )
+ {
+ FT_Error error = FT_Err_Ok;
+ FT_Vector* sub = render->root.library->lcd_geometry;
+ FT_Pos x, y;
+
+ FT_Raster_Params params;
+ TOrigin target;
+
+
+ /* Render 3 separate coverage bitmaps, shifting the outline. */
+ /* Set up direct rendering to record them on each third byte. */
+ params.source = outline;
+ params.flags = FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT;
+ params.gray_spans = (FT_SpanFunc)ft_smooth_lcd_spans;
+ params.user = &target;
+
+ params.clip_box.xMin = 0;
+ params.clip_box.yMin = 0;
+ params.clip_box.xMax = bitmap->width;
+ params.clip_box.yMax = bitmap->rows;
+
+ if ( bitmap->pitch < 0 )
+ target.origin = bitmap->buffer;
+ else
+ target.origin = bitmap->buffer
+ + ( bitmap->rows - 1 ) * (unsigned int)bitmap->pitch;
+
+ target.pitch = bitmap->pitch;
+
+ FT_Outline_Translate( outline,
+ -sub[0].x,
+ -sub[0].y );
+ error = render->raster_render( render->raster, &params );
+ x = sub[0].x;
+ y = sub[0].y;
+ if ( error )
+ goto Exit;
+
+ target.origin++;
+ FT_Outline_Translate( outline,
+ sub[0].x - sub[1].x,
+ sub[0].y - sub[1].y );
+ error = render->raster_render( render->raster, &params );
+ x = sub[1].x;
+ y = sub[1].y;
+ if ( error )
+ goto Exit;
+
+ target.origin++;
+ FT_Outline_Translate( outline,
+ sub[1].x - sub[2].x,
+ sub[1].y - sub[2].y );
+ error = render->raster_render( render->raster, &params );
+ x = sub[2].x;
+ y = sub[2].y;
+
+ Exit:
+ FT_Outline_Translate( outline, x, y );
+
+ return error;
+ }
+
+
+ static FT_Error
+ ft_smooth_raster_lcdv( FT_Renderer render,
+ FT_Outline* outline,
+ FT_Bitmap* bitmap )
+ {
+ FT_Error error = FT_Err_Ok;
+ int pitch = bitmap->pitch;
+ FT_Vector* sub = render->root.library->lcd_geometry;
+ FT_Pos x, y;
+
+ FT_Raster_Params params;
+
+
+ params.target = bitmap;
+ params.source = outline;
+ params.flags = FT_RASTER_FLAG_AA;
+
+ /* Render 3 separate coverage bitmaps, shifting the outline. */
+ /* Notice that the subpixel geometry vectors are rotated. */
+ /* Triple the pitch to render on each third row. */
+ bitmap->pitch *= 3;
+ bitmap->rows /= 3;
+
+ FT_Outline_Translate( outline,
+ -sub[0].y,
+ sub[0].x );
+ error = render->raster_render( render->raster, &params );
+ x = sub[0].y;
+ y = -sub[0].x;
+ if ( error )
+ goto Exit;
+
+ bitmap->buffer += pitch;
+ FT_Outline_Translate( outline,
+ sub[0].y - sub[1].y,
+ sub[1].x - sub[0].x );
+ error = render->raster_render( render->raster, &params );
+ x = sub[1].y;
+ y = -sub[1].x;
+ bitmap->buffer -= pitch;
+ if ( error )
+ goto Exit;
+
+ bitmap->buffer += 2 * pitch;
+ FT_Outline_Translate( outline,
+ sub[1].y - sub[2].y,
+ sub[2].x - sub[1].x );
+ error = render->raster_render( render->raster, &params );
+ x = sub[2].y;
+ y = -sub[2].x;
+ bitmap->buffer -= 2 * pitch;
+
+ Exit:
+ FT_Outline_Translate( outline, x, y );
+
+ bitmap->pitch /= 3;
+ bitmap->rows *= 3;
+
+ return error;
+ }
+
+#else /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+
+ /* initialize renderer -- init its raster */
+ static FT_Error
+ ft_smooth_init( FT_Renderer render )
+ {
+ /* set up default LCD filtering */
+ FT_Library_SetLcdFilter( render->root.library, FT_LCD_FILTER_DEFAULT );
+
+ render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
+
+ return 0;
+ }
+
+
+ static FT_Error
+ ft_smooth_raster_lcd( FT_Renderer render,
+ FT_Outline* outline,
+ FT_Bitmap* bitmap )
+ {
+ FT_Error error = FT_Err_Ok;
+ FT_Vector* points = outline->points;
+ FT_Vector* points_end = FT_OFFSET( points, outline->n_points );
+ FT_Vector* vec;
+
+ FT_Raster_Params params;
+
+
+ params.target = bitmap;
+ params.source = outline;
+ params.flags = FT_RASTER_FLAG_AA;
+
+ /* implode outline */
+ for ( vec = points; vec < points_end; vec++ )
+ vec->x *= 3;
+
+ /* render outline into the bitmap */
+ error = render->raster_render( render->raster, &params );
+
+ /* deflate outline */
+ for ( vec = points; vec < points_end; vec++ )
+ vec->x /= 3;
+
+ return error;
+ }
+
+
+ static FT_Error
+ ft_smooth_raster_lcdv( FT_Renderer render,
+ FT_Outline* outline,
+ FT_Bitmap* bitmap )
+ {
+ FT_Error error = FT_Err_Ok;
+ FT_Vector* points = outline->points;
+ FT_Vector* points_end = FT_OFFSET( points, outline->n_points );
+ FT_Vector* vec;
+
+ FT_Raster_Params params;
+
+
+ params.target = bitmap;
+ params.source = outline;
+ params.flags = FT_RASTER_FLAG_AA;
+
+ /* implode outline */
+ for ( vec = points; vec < points_end; vec++ )
+ vec->y *= 3;
+
+ /* render outline into the bitmap */
+ error = render->raster_render( render->raster, &params );
+
+ /* deflate outline */
+ for ( vec = points; vec < points_end; vec++ )
+ vec->y /= 3;
+
+ return error;
+ }
+
+#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+
+/* Oversampling scale to be used in rendering overlaps */
+#define SCALE ( 1 << 2 )
+
+ /* This function averages inflated spans in direct rendering mode */
+ static void
+ ft_smooth_overlap_spans( int y,
+ int count,
+ const FT_Span* spans,
+ TOrigin* target )
+ {
+ unsigned char* dst = target->origin - ( y / SCALE ) * target->pitch;
+ unsigned short x;
+ unsigned int cover, sum;
+
+
+ /* When accumulating the oversampled spans we need to assure that */
+ /* fully covered pixels are equal to 255 and do not overflow. */
+ /* It is important that the SCALE is a power of 2, each subpixel */
+ /* cover can also reach a power of 2 after rounding, and the total */
+ /* is clamped to 255 when it adds up to 256. */
+ for ( ; count--; spans++ )
+ {
+ cover = ( spans->coverage + SCALE * SCALE / 2 ) / ( SCALE * SCALE );
+ for ( x = 0; x < spans->len; x++ )
+ {
+ sum = dst[( spans->x + x ) / SCALE] + cover;
+ dst[( spans->x + x ) / SCALE] = (unsigned char)( sum - ( sum >> 8 ) );
+ }
+ }
+ }
+
+
+ static FT_Error
+ ft_smooth_raster_overlap( FT_Renderer render,
+ FT_Outline* outline,
+ FT_Bitmap* bitmap )
+ {
+ FT_Error error = FT_Err_Ok;
+ FT_Vector* points = outline->points;
+ FT_Vector* points_end = FT_OFFSET( points, outline->n_points );
+ FT_Vector* vec;
+
+ FT_Raster_Params params;
+ TOrigin target;
+
+
+ /* Reject outlines that are too wide for 16-bit FT_Span. */
+ /* Other limits are applied upstream with the same error code. */
+ if ( bitmap->width * SCALE > 0x7FFF )
+ return FT_THROW( Raster_Overflow );
+
+ /* Set up direct rendering to average oversampled spans. */
+ params.source = outline;
+ params.flags = FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT;
+ params.gray_spans = (FT_SpanFunc)ft_smooth_overlap_spans;
+ params.user = &target;
+
+ params.clip_box.xMin = 0;
+ params.clip_box.yMin = 0;
+ params.clip_box.xMax = bitmap->width * SCALE;
+ params.clip_box.yMax = bitmap->rows * SCALE;
+
+ if ( bitmap->pitch < 0 )
+ target.origin = bitmap->buffer;
+ else
+ target.origin = bitmap->buffer
+ + ( bitmap->rows - 1 ) * (unsigned int)bitmap->pitch;
+
+ target.pitch = bitmap->pitch;
+
+ /* inflate outline */
+ for ( vec = points; vec < points_end; vec++ )
+ {
+ vec->x *= SCALE;
+ vec->y *= SCALE;
+ }
+
+ /* render outline into the bitmap */
+ error = render->raster_render( render->raster, &params );
+
+ /* deflate outline */
+ for ( vec = points; vec < points_end; vec++ )
+ {
+ vec->x /= SCALE;
+ vec->y /= SCALE;
+ }
+
+ return error;
+ }
+
+#undef SCALE
+
+ static FT_Error
+ ft_smooth_render( FT_Renderer render,
+ FT_GlyphSlot slot,
+ FT_Render_Mode mode,
+ const FT_Vector* origin )
{
FT_Error error = FT_Err_Ok;
FT_Outline* outline = &slot->outline;
@@ -122,10 +436,6 @@
FT_Memory memory = render->root.memory;
FT_Pos x_shift = 0;
FT_Pos y_shift = 0;
- FT_Int hmul = ( mode == FT_RENDER_MODE_LCD );
- FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V );
-
- FT_Raster_Params params;
/* check glyph image format */
@@ -136,7 +446,10 @@
}
/* check mode */
- if ( mode != required_mode )
+ if ( mode != FT_RENDER_MODE_NORMAL &&
+ mode != FT_RENDER_MODE_LIGHT &&
+ mode != FT_RENDER_MODE_LCD &&
+ mode != FT_RENDER_MODE_LCD_V )
{
error = FT_THROW( Cannot_Render_Glyph );
goto Exit;
@@ -181,188 +494,57 @@
if ( x_shift || y_shift )
FT_Outline_Translate( outline, x_shift, y_shift );
- /* set up parameters */
- params.target = bitmap;
- params.source = outline;
- params.flags = FT_RASTER_FLAG_AA;
-
-#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-
- /* implode outline if needed */
+ if ( mode == FT_RENDER_MODE_NORMAL ||
+ mode == FT_RENDER_MODE_LIGHT )
{
- FT_Vector* points = outline->points;
- FT_Vector* points_end = FT_OFFSET( points, outline->n_points );
- FT_Vector* vec;
-
-
- if ( hmul )
- for ( vec = points; vec < points_end; vec++ )
- vec->x *= 3;
-
- if ( vmul )
- for ( vec = points; vec < points_end; vec++ )
- vec->y *= 3;
- }
-
- /* render outline into the bitmap */
- error = render->raster_render( render->raster, &params );
-
- /* deflate outline if needed */
- {
- FT_Vector* points = outline->points;
- FT_Vector* points_end = FT_OFFSET( points, outline->n_points );
- FT_Vector* vec;
+ if ( outline->flags & FT_OUTLINE_OVERLAP )
+ error = ft_smooth_raster_overlap( render, outline, bitmap );
+ else
+ {
+ FT_Raster_Params params;
- if ( hmul )
- for ( vec = points; vec < points_end; vec++ )
- vec->x /= 3;
+ params.target = bitmap;
+ params.source = outline;
+ params.flags = FT_RASTER_FLAG_AA;
- if ( vmul )
- for ( vec = points; vec < points_end; vec++ )
- vec->y /= 3;
+ error = render->raster_render( render->raster, &params );
+ }
}
-
- if ( error )
- goto Exit;
-
- /* finally apply filtering */
- if ( hmul || vmul )
+ else
{
- FT_Byte* lcd_weights;
- FT_Bitmap_LcdFilterFunc lcd_filter_func;
+ if ( mode == FT_RENDER_MODE_LCD )
+ error = ft_smooth_raster_lcd ( render, outline, bitmap );
+ else if ( mode == FT_RENDER_MODE_LCD_V )
+ error = ft_smooth_raster_lcdv( render, outline, bitmap );
+#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
- /* Per-face LCD filtering takes priority if set up. */
- if ( slot->face && slot->face->internal->lcd_filter_func )
+ /* finally apply filtering */
{
- lcd_weights = slot->face->internal->lcd_weights;
- lcd_filter_func = slot->face->internal->lcd_filter_func;
- }
- else
- {
- lcd_weights = slot->library->lcd_weights;
- lcd_filter_func = slot->library->lcd_filter_func;
- }
+ FT_Byte* lcd_weights;
+ FT_Bitmap_LcdFilterFunc lcd_filter_func;
- if ( lcd_filter_func )
- lcd_filter_func( bitmap, lcd_weights );
- }
-
-#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
- if ( hmul ) /* lcd */
- {
- FT_Byte* line;
- FT_Byte* temp = NULL;
- FT_UInt i, j;
-
- unsigned int height = bitmap->rows;
- unsigned int width = bitmap->width;
- int pitch = bitmap->pitch;
-
- FT_Vector* sub = slot->library->lcd_geometry;
-
-
- /* Render 3 separate monochrome bitmaps, shifting the outline. */
- width /= 3;
-
- FT_Outline_Translate( outline,
- -sub[0].x,
- -sub[0].y );
- error = render->raster_render( render->raster, &params );
- if ( error )
- goto Exit;
-
- bitmap->buffer += width;
- FT_Outline_Translate( outline,
- sub[0].x - sub[1].x,
- sub[0].y - sub[1].y );
- error = render->raster_render( render->raster, &params );
- bitmap->buffer -= width;
- if ( error )
- goto Exit;
-
- bitmap->buffer += 2 * width;
- FT_Outline_Translate( outline,
- sub[1].x - sub[2].x,
- sub[1].y - sub[2].y );
- error = render->raster_render( render->raster, &params );
- bitmap->buffer -= 2 * width;
- if ( error )
- goto Exit;
-
- x_shift -= sub[2].x;
- y_shift -= sub[2].y;
-
- /* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */
- /* XXX: It is more efficient to render every third byte above. */
-
- if ( FT_ALLOC( temp, (FT_ULong)pitch ) )
- goto Exit;
-
- for ( i = 0; i < height; i++ )
- {
- line = bitmap->buffer + i * (FT_ULong)pitch;
- for ( j = 0; j < width; j++ )
+ /* Per-face LCD filtering takes priority if set up. */
+ if ( slot->face && slot->face->internal->lcd_filter_func )
{
- temp[3 * j ] = line[j];
- temp[3 * j + 1] = line[j + width];
- temp[3 * j + 2] = line[j + width + width];
+ lcd_weights = slot->face->internal->lcd_weights;
+ lcd_filter_func = slot->face->internal->lcd_filter_func;
}
- FT_MEM_COPY( line, temp, pitch );
+ else
+ {
+ lcd_weights = slot->library->lcd_weights;
+ lcd_filter_func = slot->library->lcd_filter_func;
+ }
+
+ if ( lcd_filter_func )
+ lcd_filter_func( bitmap, lcd_weights );
}
- FT_FREE( temp );
- }
- else if ( vmul ) /* lcd_v */
- {
- int pitch = bitmap->pitch;
-
- FT_Vector* sub = slot->library->lcd_geometry;
-
-
- /* Render 3 separate monochrome bitmaps, shifting the outline. */
- /* Notice that the subpixel geometry vectors are rotated. */
- /* Triple the pitch to render on each third row. */
- bitmap->pitch *= 3;
- bitmap->rows /= 3;
-
- FT_Outline_Translate( outline,
- -sub[0].y,
- sub[0].x );
- error = render->raster_render( render->raster, &params );
- if ( error )
- goto Exit;
-
- bitmap->buffer += pitch;
- FT_Outline_Translate( outline,
- sub[0].y - sub[1].y,
- sub[1].x - sub[0].x );
- error = render->raster_render( render->raster, &params );
- bitmap->buffer -= pitch;
- if ( error )
- goto Exit;
-
- bitmap->buffer += 2 * pitch;
- FT_Outline_Translate( outline,
- sub[1].y - sub[2].y,
- sub[2].x - sub[1].x );
- error = render->raster_render( render->raster, &params );
- bitmap->buffer -= 2 * pitch;
- if ( error )
- goto Exit;
-
- x_shift -= sub[2].y;
- y_shift += sub[2].x;
-
- bitmap->pitch /= 3;
- bitmap->rows *= 3;
- }
- else /* grayscale */
- error = render->raster_render( render->raster, &params );
+#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+ }
Exit:
if ( !error )
@@ -383,45 +565,6 @@
}
- /* convert a slot's glyph image into a bitmap */
- static FT_Error
- ft_smooth_render( FT_Renderer render,
- FT_GlyphSlot slot,
- FT_Render_Mode mode,
- const FT_Vector* origin )
- {
- if ( mode == FT_RENDER_MODE_LIGHT )
- mode = FT_RENDER_MODE_NORMAL;
-
- return ft_smooth_render_generic( render, slot, mode, origin,
- FT_RENDER_MODE_NORMAL );
- }
-
-
- /* convert a slot's glyph image into a horizontal LCD bitmap */
- static FT_Error
- ft_smooth_render_lcd( FT_Renderer render,
- FT_GlyphSlot slot,
- FT_Render_Mode mode,
- const FT_Vector* origin )
- {
- return ft_smooth_render_generic( render, slot, mode, origin,
- FT_RENDER_MODE_LCD );
- }
-
-
- /* convert a slot's glyph image into a vertical LCD bitmap */
- static FT_Error
- ft_smooth_render_lcd_v( FT_Renderer render,
- FT_GlyphSlot slot,
- FT_Render_Mode mode,
- const FT_Vector* origin )
- {
- return ft_smooth_render_generic( render, slot, mode, origin,
- FT_RENDER_MODE_LCD_V );
- }
-
-
FT_DEFINE_RENDERER(
ft_smooth_renderer_class,
@@ -449,58 +592,4 @@
)
- FT_DEFINE_RENDERER(
- ft_smooth_lcd_renderer_class,
-
- FT_MODULE_RENDERER,
- sizeof ( FT_RendererRec ),
-
- "smooth-lcd",
- 0x10000L,
- 0x20000L,
-
- NULL, /* module specific interface */
-
- (FT_Module_Constructor)ft_smooth_init, /* module_init */
- (FT_Module_Destructor) NULL, /* module_done */
- (FT_Module_Requester) NULL, /* get_interface */
-
- FT_GLYPH_FORMAT_OUTLINE,
-
- (FT_Renderer_RenderFunc) ft_smooth_render_lcd, /* render_glyph */
- (FT_Renderer_TransformFunc)ft_smooth_transform, /* transform_glyph */
- (FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox, /* get_glyph_cbox */
- (FT_Renderer_SetModeFunc) ft_smooth_set_mode, /* set_mode */
-
- (FT_Raster_Funcs*)&ft_grays_raster /* raster_class */
- )
-
-
- FT_DEFINE_RENDERER(
- ft_smooth_lcdv_renderer_class,
-
- FT_MODULE_RENDERER,
- sizeof ( FT_RendererRec ),
-
- "smooth-lcdv",
- 0x10000L,
- 0x20000L,
-
- NULL, /* module specific interface */
-
- (FT_Module_Constructor)ft_smooth_init, /* module_init */
- (FT_Module_Destructor) NULL, /* module_done */
- (FT_Module_Requester) NULL, /* get_interface */
-
- FT_GLYPH_FORMAT_OUTLINE,
-
- (FT_Renderer_RenderFunc) ft_smooth_render_lcd_v, /* render_glyph */
- (FT_Renderer_TransformFunc)ft_smooth_transform, /* transform_glyph */
- (FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox, /* get_glyph_cbox */
- (FT_Renderer_SetModeFunc) ft_smooth_set_mode, /* set_mode */
-
- (FT_Raster_Funcs*)&ft_grays_raster /* raster_class */
- )
-
-
/* END */
diff --git a/thirdparty/freetype/src/smooth/ftsmooth.h b/thirdparty/freetype/src/smooth/ftsmooth.h
index ee5d2ff61d..22a88d54ec 100644
--- a/thirdparty/freetype/src/smooth/ftsmooth.h
+++ b/thirdparty/freetype/src/smooth/ftsmooth.h
@@ -20,8 +20,7 @@
#define FTSMOOTH_H_
-#include <ft2build.h>
-#include FT_RENDER_H
+#include <freetype/ftrender.h>
FT_BEGIN_HEADER
@@ -29,10 +28,6 @@ FT_BEGIN_HEADER
FT_DECLARE_RENDERER( ft_smooth_renderer_class )
- FT_DECLARE_RENDERER( ft_smooth_lcd_renderer_class )
-
- FT_DECLARE_RENDERER( ft_smooth_lcdv_renderer_class )
-
FT_END_HEADER
diff --git a/thirdparty/freetype/src/smooth/module.mk b/thirdparty/freetype/src/smooth/module.mk
index ad8b47dab6..9b1507f1e0 100644
--- a/thirdparty/freetype/src/smooth/module.mk
+++ b/thirdparty/freetype/src/smooth/module.mk
@@ -18,10 +18,6 @@ FTMODULE_H_COMMANDS += SMOOTH_RENDERER
define SMOOTH_RENDERER
$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_renderer_class $(CLOSE_DRIVER)
$(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer$(ECHO_DRIVER_DONE)
-$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcd_renderer_class $(CLOSE_DRIVER)
-$(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for LCDs$(ECHO_DRIVER_DONE)
-$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcdv_renderer_class $(CLOSE_DRIVER)
-$(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for vertical LCDs$(ECHO_DRIVER_DONE)
endef
# EOF
diff --git a/thirdparty/freetype/src/smooth/smooth.c b/thirdparty/freetype/src/smooth/smooth.c
index 6ad9424f01..04b531c087 100644
--- a/thirdparty/freetype/src/smooth/smooth.c
+++ b/thirdparty/freetype/src/smooth/smooth.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "ftgrays.c"
#include "ftsmooth.c"
diff --git a/thirdparty/freetype/src/truetype/truetype.c b/thirdparty/freetype/src/truetype/truetype.c
index 1f15b29bb2..41b6808a84 100644
--- a/thirdparty/freetype/src/truetype/truetype.c
+++ b/thirdparty/freetype/src/truetype/truetype.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "ttdriver.c" /* driver interface */
#include "ttgload.c" /* glyph loader */
diff --git a/thirdparty/freetype/src/truetype/ttdriver.c b/thirdparty/freetype/src/truetype/ttdriver.c
index 90fab46e28..bf830b1418 100644
--- a/thirdparty/freetype/src/truetype/ttdriver.c
+++ b/thirdparty/freetype/src/truetype/ttdriver.c
@@ -16,22 +16,21 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_SERVICE_FONT_FORMAT_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/services/svfntfmt.h>
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svmetric.h>
#endif
-#include FT_SERVICE_TRUETYPE_ENGINE_H
-#include FT_SERVICE_TRUETYPE_GLYF_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_DRIVER_H
+#include <freetype/internal/services/svtteng.h>
+#include <freetype/internal/services/svttglyf.h>
+#include <freetype/internal/services/svprop.h>
+#include <freetype/ftdriver.h>
#include "ttdriver.h"
#include "ttgload.h"
diff --git a/thirdparty/freetype/src/truetype/ttdriver.h b/thirdparty/freetype/src/truetype/ttdriver.h
index d1cfa47c8b..ee1438eb6e 100644
--- a/thirdparty/freetype/src/truetype/ttdriver.h
+++ b/thirdparty/freetype/src/truetype/ttdriver.h
@@ -20,8 +20,7 @@
#define TTDRIVER_H_
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/truetype/tterrors.h b/thirdparty/freetype/src/truetype/tterrors.h
index 71d66023cd..efeafd3a1b 100644
--- a/thirdparty/freetype/src/truetype/tterrors.h
+++ b/thirdparty/freetype/src/truetype/tterrors.h
@@ -26,7 +26,7 @@
#ifndef TTERRORS_H_
#define TTERRORS_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -34,7 +34,7 @@
#define FT_ERR_PREFIX TT_Err_
#define FT_ERR_BASE FT_Mod_Err_TrueType
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* TTERRORS_H_ */
diff --git a/thirdparty/freetype/src/truetype/ttgload.c b/thirdparty/freetype/src/truetype/ttgload.c
index 2a1742839a..1dd319dcbf 100644
--- a/thirdparty/freetype/src/truetype/ttgload.c
+++ b/thirdparty/freetype/src/truetype/ttgload.c
@@ -17,15 +17,15 @@
#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_OUTLINE_H
-#include FT_DRIVER_H
-#include FT_LIST_H
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/tttags.h>
+#include <freetype/ftoutln.h>
+#include <freetype/ftdriver.h>
+#include <freetype/ftlist.h>
#include "ttgload.h"
#include "ttpload.h"
@@ -60,7 +60,7 @@
#define SAME_X 0x10
#define Y_POSITIVE 0x20 /* two meanings depending on Y_SHORT_VECTOR */
#define SAME_Y 0x20
-#define OVERLAP_SIMPLE 0x40 /* we ignore this value */
+#define OVERLAP_SIMPLE 0x40 /* retained as FT_OUTLINE_OVERLAP */
/**************************************************************************
@@ -77,7 +77,7 @@
#define WE_HAVE_A_2X2 0x0080
#define WE_HAVE_INSTR 0x0100
#define USE_MY_METRICS 0x0200
-#define OVERLAP_COMPOUND 0x0400 /* we ignore this value */
+#define OVERLAP_COMPOUND 0x0400 /* retained as FT_OUTLINE_OVERLAP */
#define SCALED_COMPONENT_OFFSET 0x0800
#define UNSCALED_COMPONENT_OFFSET 0x1000
@@ -137,6 +137,11 @@
face->horizontal.Descender );
}
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( !face->vertical_info )
+ FT_TRACE5(( " [vertical metrics missing, computing values]\n" ));
+#endif
+
FT_TRACE5(( " advance height (font units): %d\n", *ah ));
FT_TRACE5(( " top side bearing (font units): %d\n", *tsb ));
}
@@ -333,9 +338,9 @@
loader->bbox.yMax = FT_NEXT_SHORT( p );
FT_TRACE5(( " # of contours: %d\n", loader->n_contours ));
- FT_TRACE5(( " xMin: %4d xMax: %4d\n", loader->bbox.xMin,
+ FT_TRACE5(( " xMin: %4ld xMax: %4ld\n", loader->bbox.xMin,
loader->bbox.xMax ));
- FT_TRACE5(( " yMin: %4d yMax: %4d\n", loader->bbox.yMin,
+ FT_TRACE5(( " yMin: %4ld yMax: %4ld\n", loader->bbox.yMin,
loader->bbox.yMax ));
loader->cursor = p;
@@ -489,6 +494,10 @@
}
}
+ /* retain the overlap flag */
+ if ( n_points && outline->tags[0] & OVERLAP_SIMPLE )
+ gloader->base.outline.flags |= FT_OUTLINE_OVERLAP;
+
/* reading the X coordinates */
vec = outline->points;
@@ -2183,6 +2192,11 @@
goto Exit;
}
}
+
+ /* retain the overlap flag */
+ if ( gloader->base.num_subglyphs &&
+ gloader->base.subglyphs[0].flags & OVERLAP_COMPOUND )
+ gloader->base.outline.flags |= FT_OUTLINE_OVERLAP;
}
/***********************************************************************/
@@ -2981,8 +2995,6 @@
error = compute_glyph_metrics( &loader, glyph_index );
}
- tt_loader_done( &loader );
-
/* Set the `high precision' bit flag. */
/* This is _critical_ to get correct output for monochrome */
/* TrueType glyphs at all sizes using the bytecode interpreter. */
@@ -2991,6 +3003,15 @@
size->metrics->y_ppem < 24 )
glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
+ FT_TRACE1(( " subglyphs = %u, contours = %hd, points = %hd,"
+ " flags = 0x%.3x\n",
+ loader.gloader->base.num_subglyphs,
+ glyph->outline.n_contours,
+ glyph->outline.n_points,
+ glyph->outline.flags ));
+
+ tt_loader_done( &loader );
+
Exit:
#ifdef FT_DEBUG_LEVEL_TRACE
if ( error )
diff --git a/thirdparty/freetype/src/truetype/ttgload.h b/thirdparty/freetype/src/truetype/ttgload.h
index 9a8c3e71dd..8f72cd558c 100644
--- a/thirdparty/freetype/src/truetype/ttgload.h
+++ b/thirdparty/freetype/src/truetype/ttgload.h
@@ -20,7 +20,6 @@
#define TTGLOAD_H_
-#include <ft2build.h>
#include "ttobjs.h"
#ifdef TT_USE_BYTECODE_INTERPRETER
diff --git a/thirdparty/freetype/src/truetype/ttgxvar.c b/thirdparty/freetype/src/truetype/ttgxvar.c
index 110f24a116..b462263de1 100644
--- a/thirdparty/freetype/src/truetype/ttgxvar.c
+++ b/thirdparty/freetype/src/truetype/ttgxvar.c
@@ -40,14 +40,14 @@
#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_TRUETYPE_IDS_H
-#include FT_MULTIPLE_MASTERS_H
-#include FT_LIST_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/tttags.h>
+#include <freetype/ttnameid.h>
+#include <freetype/ftmm.h>
+#include <freetype/ftlist.h>
#include "ttpload.h"
#include "ttgxvar.h"
@@ -1729,7 +1729,7 @@
if ( tuple_coords[i] == 0 )
{
- FT_TRACE6(( " tuple coordinate is zero, ignore\n", i ));
+ FT_TRACE6(( " tuple coordinate is zero, ignore\n" ));
continue;
}
diff --git a/thirdparty/freetype/src/truetype/ttgxvar.h b/thirdparty/freetype/src/truetype/ttgxvar.h
index 11664e997a..26e89bcf74 100644
--- a/thirdparty/freetype/src/truetype/ttgxvar.h
+++ b/thirdparty/freetype/src/truetype/ttgxvar.h
@@ -20,7 +20,6 @@
#define TTGXVAR_H_
-#include <ft2build.h>
#include "ttobjs.h"
diff --git a/thirdparty/freetype/src/truetype/ttinterp.c b/thirdparty/freetype/src/truetype/ttinterp.c
index 3215040970..0c3cb10ae8 100644
--- a/thirdparty/freetype/src/truetype/ttinterp.c
+++ b/thirdparty/freetype/src/truetype/ttinterp.c
@@ -20,13 +20,12 @@
/* issues; many thanks! */
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_TRIGONOMETRY_H
-#include FT_SYSTEM_H
-#include FT_DRIVER_H
-#include FT_MULTIPLE_MASTERS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/fttrigon.h>
+#include <freetype/ftsystem.h>
+#include <freetype/ftdriver.h>
+#include <freetype/ftmm.h>
#include "ttinterp.h"
#include "tterrors.h"
@@ -294,7 +293,7 @@
FT_Error error;
- FT_TRACE1(( "Init_Context: new object at 0x%08p\n", exec ));
+ FT_TRACE1(( "Init_Context: new object at %p\n", (void *)exec ));
exec->memory = memory;
exec->callSize = 32;
@@ -319,7 +318,7 @@
return FT_Err_Ok;
Fail_Memory:
- FT_ERROR(( "Init_Context: not enough memory for %p\n", exec ));
+ FT_ERROR(( "Init_Context: not enough memory for %p\n", (void *)exec ));
TT_Done_Context( exec );
return error;
@@ -1956,8 +1955,8 @@
* distance ::
* The distance (not) to round.
*
- * compensation ::
- * The engine compensation.
+ * color ::
+ * The engine compensation color.
*
* @Return:
* The compensated distance.
@@ -1965,12 +1964,11 @@
static FT_F26Dot6
Round_None( TT_ExecContext exc,
FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
+ FT_Int color )
{
+ FT_F26Dot6 compensation = exc->tt_metrics.compensations[color];
FT_F26Dot6 val;
- FT_UNUSED( exc );
-
if ( distance >= 0 )
{
@@ -2000,8 +1998,8 @@
* distance ::
* The distance to round.
*
- * compensation ::
- * The engine compensation.
+ * color ::
+ * The engine compensation color.
*
* @Return:
* Rounded distance.
@@ -2009,12 +2007,11 @@
static FT_F26Dot6
Round_To_Grid( TT_ExecContext exc,
FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
+ FT_Int color )
{
+ FT_F26Dot6 compensation = exc->tt_metrics.compensations[color];
FT_F26Dot6 val;
- FT_UNUSED( exc );
-
if ( distance >= 0 )
{
@@ -2046,8 +2043,8 @@
* distance ::
* The distance to round.
*
- * compensation ::
- * The engine compensation.
+ * color ::
+ * The engine compensation color.
*
* @Return:
* Rounded distance.
@@ -2055,12 +2052,11 @@
static FT_F26Dot6
Round_To_Half_Grid( TT_ExecContext exc,
FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
+ FT_Int color )
{
+ FT_F26Dot6 compensation = exc->tt_metrics.compensations[color];
FT_F26Dot6 val;
- FT_UNUSED( exc );
-
if ( distance >= 0 )
{
@@ -2094,8 +2090,8 @@
* distance ::
* The distance to round.
*
- * compensation ::
- * The engine compensation.
+ * color ::
+ * The engine compensation color.
*
* @Return:
* Rounded distance.
@@ -2103,12 +2099,11 @@
static FT_F26Dot6
Round_Down_To_Grid( TT_ExecContext exc,
FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
+ FT_Int color )
{
+ FT_F26Dot6 compensation = exc->tt_metrics.compensations[color];
FT_F26Dot6 val;
- FT_UNUSED( exc );
-
if ( distance >= 0 )
{
@@ -2139,8 +2134,8 @@
* distance ::
* The distance to round.
*
- * compensation ::
- * The engine compensation.
+ * color ::
+ * The engine compensation color.
*
* @Return:
* Rounded distance.
@@ -2148,12 +2143,11 @@
static FT_F26Dot6
Round_Up_To_Grid( TT_ExecContext exc,
FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
+ FT_Int color )
{
+ FT_F26Dot6 compensation = exc->tt_metrics.compensations[color];
FT_F26Dot6 val;
- FT_UNUSED( exc );
-
if ( distance >= 0 )
{
@@ -2185,8 +2179,8 @@
* distance ::
* The distance to round.
*
- * compensation ::
- * The engine compensation.
+ * color ::
+ * The engine compensation color.
*
* @Return:
* Rounded distance.
@@ -2194,12 +2188,11 @@
static FT_F26Dot6
Round_To_Double_Grid( TT_ExecContext exc,
FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
+ FT_Int color )
{
+ FT_F26Dot6 compensation = exc->tt_metrics.compensations[color];
FT_F26Dot6 val;
- FT_UNUSED( exc );
-
if ( distance >= 0 )
{
@@ -2231,8 +2224,8 @@
* distance ::
* The distance to round.
*
- * compensation ::
- * The engine compensation.
+ * color ::
+ * The engine compensation color.
*
* @Return:
* Rounded distance.
@@ -2246,8 +2239,9 @@
static FT_F26Dot6
Round_Super( TT_ExecContext exc,
FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
+ FT_Int color )
{
+ FT_F26Dot6 compensation = exc->tt_metrics.compensations[color];
FT_F26Dot6 val;
@@ -2286,8 +2280,8 @@
* distance ::
* The distance to round.
*
- * compensation ::
- * The engine compensation.
+ * color ::
+ * The engine compensation color.
*
* @Return:
* Rounded distance.
@@ -2299,8 +2293,9 @@
static FT_F26Dot6
Round_Super_45( TT_ExecContext exc,
FT_F26Dot6 distance,
- FT_F26Dot6 compensation )
+ FT_Int color )
{
+ FT_F26Dot6 compensation = exc->tt_metrics.compensations[color];
FT_F26Dot6 val;
@@ -2899,7 +2894,7 @@
Ins_ODD( TT_ExecContext exc,
FT_Long* args )
{
- args[0] = ( ( exc->func_round( exc, args[0], 0 ) & 127 ) == 64 );
+ args[0] = ( ( exc->func_round( exc, args[0], 3 ) & 127 ) == 64 );
}
@@ -2913,7 +2908,7 @@
Ins_EVEN( TT_ExecContext exc,
FT_Long* args )
{
- args[0] = ( ( exc->func_round( exc, args[0], 0 ) & 127 ) == 0 );
+ args[0] = ( ( exc->func_round( exc, args[0], 3 ) & 127 ) == 0 );
}
@@ -3243,10 +3238,7 @@
Ins_ROUND( TT_ExecContext exc,
FT_Long* args )
{
- args[0] = exc->func_round(
- exc,
- args[0],
- exc->tt_metrics.compensations[exc->opcode - 0x68] );
+ args[0] = exc->func_round( exc, args[0], exc->opcode & 3 );
}
@@ -3260,10 +3252,7 @@
Ins_NROUND( TT_ExecContext exc,
FT_Long* args )
{
- args[0] = Round_None(
- exc,
- args[0],
- exc->tt_metrics.compensations[exc->opcode - 0x6C] );
+ args[0] = Round_None( exc, args[0], exc->opcode & 3 );
}
@@ -5733,9 +5722,6 @@
{
FT_F26Dot6 dx, dy;
FT_UShort point;
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
- FT_Int B1, B2;
-#endif
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
FT_Bool in_twilight = FT_BOOL( exc->GS.gep0 == 0 ||
exc->GS.gep1 == 0 ||
@@ -5770,8 +5756,12 @@
}
else
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
- if ( SUBPIXEL_HINTING_INFINALITY )
+ if ( SUBPIXEL_HINTING_INFINALITY &&
+ exc->ignore_x_mode )
{
+ FT_Int B1, B2;
+
+
/* If not using ignore_x_mode rendering, allow ZP2 move. */
/* If inline deltas aren't allowed, skip ZP2 move. */
/* If using ignore_x_mode rendering, allow ZP2 point move if: */
@@ -5780,72 +5770,57 @@
/* - the glyph is specifically set to allow SHPIX moves */
/* - the move is on a previously Y-touched point */
- if ( exc->ignore_x_mode )
+ /* save point for later comparison */
+ B1 = exc->zp2.cur[point].y;
+
+ if ( exc->face->sph_compatibility_mode )
{
- /* save point for later comparison */
+ if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
+ dy = FT_PIX_ROUND( B1 + dy ) - B1;
+
+ /* skip post-iup deltas */
+ if ( exc->iup_called &&
+ ( ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_1 ) ||
+ ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ) )
+ goto Skip;
+
+ if ( !( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) &&
+ ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) ||
+ ( exc->zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y ) ||
+ ( exc->sph_tweak_flags & SPH_TWEAK_DO_SHPIX ) ) )
+ Move_Zp2_Point( exc, point, 0, dy, TRUE );
+
+ /* save new point */
if ( exc->GS.freeVector.y != 0 )
- B1 = exc->zp2.cur[point].y;
- else
- B1 = exc->zp2.cur[point].x;
-
- if ( !exc->face->sph_compatibility_mode &&
- exc->GS.freeVector.y != 0 )
{
- Move_Zp2_Point( exc, point, dx, dy, TRUE );
+ B2 = exc->zp2.cur[point].y;
- /* save new point */
- if ( exc->GS.freeVector.y != 0 )
- {
- B2 = exc->zp2.cur[point].y;
-
- /* reverse any disallowed moves */
- if ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
- ( B1 & 63 ) != 0 &&
- ( B2 & 63 ) != 0 &&
- B1 != B2 )
- Move_Zp2_Point( exc,
- point,
- NEG_LONG( dx ),
- NEG_LONG( dy ),
- TRUE );
- }
+ /* reverse any disallowed moves */
+ if ( ( B1 & 63 ) == 0 &&
+ ( B2 & 63 ) != 0 &&
+ B1 != B2 )
+ Move_Zp2_Point( exc, point, 0, NEG_LONG( dy ), TRUE );
}
- else if ( exc->face->sph_compatibility_mode )
- {
- if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
- {
- dx = FT_PIX_ROUND( B1 + dx ) - B1;
- dy = FT_PIX_ROUND( B1 + dy ) - B1;
- }
-
- /* skip post-iup deltas */
- if ( exc->iup_called &&
- ( ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_1 ) ||
- ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ) )
- goto Skip;
-
- if ( !( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) &&
- ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) ||
- ( exc->zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y ) ||
- ( exc->sph_tweak_flags & SPH_TWEAK_DO_SHPIX ) ) )
- Move_Zp2_Point( exc, point, 0, dy, TRUE );
-
- /* save new point */
- if ( exc->GS.freeVector.y != 0 )
- {
- B2 = exc->zp2.cur[point].y;
+ }
+ else if ( exc->GS.freeVector.y != 0 )
+ {
+ Move_Zp2_Point( exc, point, dx, dy, TRUE );
- /* reverse any disallowed moves */
- if ( ( B1 & 63 ) == 0 &&
- ( B2 & 63 ) != 0 &&
- B1 != B2 )
- Move_Zp2_Point( exc, point, 0, NEG_LONG( dy ), TRUE );
- }
- }
- else if ( exc->sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL )
- Move_Zp2_Point( exc, point, dx, dy, TRUE );
+ /* save new point */
+ B2 = exc->zp2.cur[point].y;
+
+ /* reverse any disallowed moves */
+ if ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
+ ( B1 & 63 ) != 0 &&
+ ( B2 & 63 ) != 0 &&
+ B1 != B2 )
+ Move_Zp2_Point( exc,
+ point,
+ NEG_LONG( dx ),
+ NEG_LONG( dy ),
+ TRUE );
}
- else
+ else if ( exc->sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL )
Move_Zp2_Point( exc, point, dx, dy, TRUE );
}
else
@@ -5893,22 +5868,8 @@
{
FT_UShort point = 0;
FT_F26Dot6 distance;
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
- FT_F26Dot6 control_value_cutin = 0;
- FT_F26Dot6 delta;
- if ( SUBPIXEL_HINTING_INFINALITY )
- {
- control_value_cutin = exc->GS.control_value_cutin;
-
- if ( exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 &&
- !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
- control_value_cutin = 0;
- }
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
-
point = (FT_UShort)args[0];
if ( BOUNDS( point, exc->zp1.n_points ) ||
@@ -5931,16 +5892,25 @@
distance = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 );
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
- delta = SUB_LONG( distance, args[1] );
- if ( delta < 0 )
- delta = NEG_LONG( delta );
-
/* subpixel hinting - make MSIRP respect CVT cut-in; */
- if ( SUBPIXEL_HINTING_INFINALITY &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 &&
- delta >= control_value_cutin )
- distance = args[1];
+ if ( SUBPIXEL_HINTING_INFINALITY &&
+ exc->ignore_x_mode &&
+ exc->GS.freeVector.x != 0 )
+ {
+ FT_F26Dot6 control_value_cutin = exc->GS.control_value_cutin;
+ FT_F26Dot6 delta;
+
+
+ if ( !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
+ control_value_cutin = 0;
+
+ delta = SUB_LONG( distance, args[1] );
+ if ( delta < 0 )
+ delta = NEG_LONG( delta );
+
+ if ( delta >= control_value_cutin )
+ distance = args[1];
+ }
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
exc->func_move( exc,
@@ -5987,18 +5957,10 @@
if ( SUBPIXEL_HINTING_INFINALITY &&
exc->ignore_x_mode &&
exc->GS.freeVector.x != 0 )
- distance = SUB_LONG(
- Round_None( exc,
- cur_dist,
- exc->tt_metrics.compensations[0] ),
- cur_dist );
+ distance = SUB_LONG( Round_None( exc, cur_dist, 3 ), cur_dist );
else
#endif
- distance = SUB_LONG(
- exc->func_round( exc,
- cur_dist,
- exc->tt_metrics.compensations[0] ),
- cur_dist );
+ distance = SUB_LONG( exc->func_round( exc, cur_dist, 3 ), cur_dist );
}
else
distance = 0;
@@ -6024,21 +5986,10 @@
FT_UShort point;
FT_F26Dot6 distance;
FT_F26Dot6 org_dist;
- FT_F26Dot6 control_value_cutin;
-
- control_value_cutin = exc->GS.control_value_cutin;
- cvtEntry = (FT_ULong)args[1];
- point = (FT_UShort)args[0];
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
- if ( SUBPIXEL_HINTING_INFINALITY &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 &&
- exc->GS.freeVector.y == 0 &&
- !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
- control_value_cutin = 0;
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
+ cvtEntry = (FT_ULong)args[1];
+ point = (FT_UShort)args[0];
if ( BOUNDS( point, exc->zp0.n_points ) ||
BOUNDSL( cvtEntry, exc->cvtSize ) )
@@ -6082,7 +6033,7 @@
exc->zp0.org[point].x = TT_MulFix14( distance,
exc->GS.freeVector.x );
exc->zp0.org[point].y = TT_MulFix14( distance,
- exc->GS.freeVector.y ),
+ exc->GS.freeVector.y );
exc->zp0.cur[point] = exc->zp0.org[point];
}
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
@@ -6098,9 +6049,19 @@
if ( ( exc->opcode & 1 ) != 0 ) /* rounding and control cut-in flag */
{
+ FT_F26Dot6 control_value_cutin = exc->GS.control_value_cutin;
FT_F26Dot6 delta;
+#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
+ if ( SUBPIXEL_HINTING_INFINALITY &&
+ exc->ignore_x_mode &&
+ exc->GS.freeVector.x != 0 &&
+ exc->GS.freeVector.y == 0 &&
+ !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
+ control_value_cutin = 0;
+#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
+
delta = SUB_LONG( distance, org_dist );
if ( delta < 0 )
delta = NEG_LONG( delta );
@@ -6112,14 +6073,10 @@
if ( SUBPIXEL_HINTING_INFINALITY &&
exc->ignore_x_mode &&
exc->GS.freeVector.x != 0 )
- distance = Round_None( exc,
- distance,
- exc->tt_metrics.compensations[0] );
+ distance = Round_None( exc, distance, 3 );
else
#endif
- distance = exc->func_round( exc,
- distance,
- exc->tt_metrics.compensations[0] );
+ distance = exc->func_round( exc, distance, 3 );
}
exc->func_move( exc, &exc->zp0, point, SUB_LONG( distance, org_dist ) );
@@ -6141,18 +6098,8 @@
FT_Long* args )
{
FT_UShort point = 0;
- FT_F26Dot6 org_dist, distance, minimum_distance;
-
+ FT_F26Dot6 org_dist, distance;
- minimum_distance = exc->GS.minimum_distance;
-
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
- if ( SUBPIXEL_HINTING_INFINALITY &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 &&
- !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
- minimum_distance = 0;
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
point = (FT_UShort)args[0];
@@ -6226,27 +6173,29 @@
if ( SUBPIXEL_HINTING_INFINALITY &&
exc->ignore_x_mode &&
exc->GS.freeVector.x != 0 )
- distance = Round_None(
- exc,
- org_dist,
- exc->tt_metrics.compensations[exc->opcode & 3] );
+ distance = Round_None( exc, org_dist, exc->opcode & 3 );
else
#endif
- distance = exc->func_round(
- exc,
- org_dist,
- exc->tt_metrics.compensations[exc->opcode & 3] );
+ distance = exc->func_round( exc, org_dist, exc->opcode & 3 );
}
else
- distance = Round_None(
- exc,
- org_dist,
- exc->tt_metrics.compensations[exc->opcode & 3] );
+ distance = Round_None( exc, org_dist, exc->opcode & 3 );
/* minimum distance flag */
if ( ( exc->opcode & 8 ) != 0 )
{
+ FT_F26Dot6 minimum_distance = exc->GS.minimum_distance;
+
+
+#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
+ if ( SUBPIXEL_HINTING_INFINALITY &&
+ exc->ignore_x_mode &&
+ exc->GS.freeVector.x != 0 &&
+ !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
+ minimum_distance = 0;
+#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
+
if ( org_dist >= 0 )
{
if ( distance < minimum_distance )
@@ -6290,30 +6239,13 @@
FT_F26Dot6 cvt_dist,
distance,
cur_dist,
- org_dist,
- control_value_cutin,
- minimum_distance;
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
- FT_Int B1 = 0; /* pacify compiler */
- FT_Int B2 = 0;
- FT_Bool reverse_move = FALSE;
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
+ org_dist;
FT_F26Dot6 delta;
- minimum_distance = exc->GS.minimum_distance;
- control_value_cutin = exc->GS.control_value_cutin;
- point = (FT_UShort)args[0];
- cvtEntry = (FT_ULong)( ADD_LONG( args[1], 1 ) );
-
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
- if ( SUBPIXEL_HINTING_INFINALITY &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.x != 0 &&
- !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
- control_value_cutin = minimum_distance = 0;
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
+ point = (FT_UShort)args[0];
+ cvtEntry = (FT_ULong)( ADD_LONG( args[1], 1 ) );
/* XXX: UNDOCUMENTED! cvt[-1] = 0 always */
@@ -6371,19 +6303,6 @@
cvt_dist = NEG_LONG( cvt_dist );
}
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
- if ( SUBPIXEL_HINTING_INFINALITY &&
- exc->ignore_x_mode &&
- exc->GS.freeVector.y != 0 &&
- ( exc->sph_tweak_flags & SPH_TWEAK_TIMES_NEW_ROMAN_HACK ) )
- {
- if ( cur_dist < -64 )
- cvt_dist -= 16;
- else if ( cur_dist > 64 && cur_dist < 84 )
- cvt_dist += 32;
- }
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
-
/* control value cut-in and round */
if ( ( exc->opcode & 4 ) != 0 )
@@ -6393,6 +6312,9 @@
if ( exc->GS.gep0 == exc->GS.gep1 )
{
+ FT_F26Dot6 control_value_cutin = exc->GS.control_value_cutin;
+
+
/* XXX: According to Greg Hitchcock, the following wording is */
/* the right one: */
/* */
@@ -6413,10 +6335,7 @@
cvt_dist = org_dist;
}
- distance = exc->func_round(
- exc,
- cvt_dist,
- exc->tt_metrics.compensations[exc->opcode & 3] );
+ distance = exc->func_round( exc, cvt_dist, exc->opcode & 3 );
}
else
{
@@ -6427,6 +6346,22 @@
exc->ignore_x_mode &&
exc->GS.gep0 == exc->GS.gep1 )
{
+ FT_F26Dot6 control_value_cutin = exc->GS.control_value_cutin;
+
+
+ if ( exc->GS.freeVector.x != 0 &&
+ !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
+ control_value_cutin = 0;
+
+ if ( exc->GS.freeVector.y != 0 &&
+ ( exc->sph_tweak_flags & SPH_TWEAK_TIMES_NEW_ROMAN_HACK ) )
+ {
+ if ( cur_dist < -64 )
+ cvt_dist -= 16;
+ else if ( cur_dist > 64 && cur_dist < 84 )
+ cvt_dist += 32;
+ }
+
delta = SUB_LONG( cvt_dist, org_dist );
if ( delta < 0 )
delta = NEG_LONG( delta );
@@ -6436,16 +6371,24 @@
}
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
- distance = Round_None(
- exc,
- cvt_dist,
- exc->tt_metrics.compensations[exc->opcode & 3] );
+ distance = Round_None( exc, cvt_dist, exc->opcode & 3 );
}
/* minimum distance test */
if ( ( exc->opcode & 8 ) != 0 )
{
+ FT_F26Dot6 minimum_distance = exc->GS.minimum_distance;
+
+
+#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
+ if ( SUBPIXEL_HINTING_INFINALITY &&
+ exc->ignore_x_mode &&
+ exc->GS.freeVector.x != 0 &&
+ !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
+ minimum_distance = 0;
+#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
+
if ( org_dist >= 0 )
{
if ( distance < minimum_distance )
@@ -6459,60 +6402,51 @@
}
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
- if ( SUBPIXEL_HINTING_INFINALITY )
+ if ( SUBPIXEL_HINTING_INFINALITY &&
+ exc->ignore_x_mode &&
+ exc->GS.freeVector.y != 0 )
{
+ FT_Int B1, B2;
+
+
B1 = exc->zp1.cur[point].y;
/* Round moves if necessary */
- if ( exc->ignore_x_mode &&
- exc->GS.freeVector.y != 0 &&
- ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) )
+ if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
distance = FT_PIX_ROUND( B1 + distance - cur_dist ) - B1 + cur_dist;
- if ( exc->ignore_x_mode &&
- exc->GS.freeVector.y != 0 &&
- ( exc->opcode & 16 ) == 0 &&
+ if ( ( exc->opcode & 16 ) == 0 &&
( exc->opcode & 8 ) == 0 &&
( exc->sph_tweak_flags & SPH_TWEAK_COURIER_NEW_2_HACK ) )
distance += 64;
- }
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
- exc->func_move( exc,
- &exc->zp1,
- point,
- SUB_LONG( distance, cur_dist ) );
+ exc->func_move( exc,
+ &exc->zp1,
+ point,
+ SUB_LONG( distance, cur_dist ) );
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
- if ( SUBPIXEL_HINTING_INFINALITY )
- {
B2 = exc->zp1.cur[point].y;
/* Reverse move if necessary */
- if ( exc->ignore_x_mode )
- {
- if ( exc->face->sph_compatibility_mode &&
- exc->GS.freeVector.y != 0 &&
+ if ( ( exc->face->sph_compatibility_mode &&
( B1 & 63 ) == 0 &&
- ( B2 & 63 ) != 0 )
- reverse_move = TRUE;
-
- if ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
- exc->GS.freeVector.y != 0 &&
- ( B2 & 63 ) != 0 &&
- ( B1 & 63 ) != 0 )
- reverse_move = TRUE;
- }
-
- if ( reverse_move )
+ ( B2 & 63 ) != 0 ) ||
+ ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
+ ( B1 & 63 ) != 0 &&
+ ( B2 & 63 ) != 0 ) )
exc->func_move( exc,
&exc->zp1,
point,
SUB_LONG( cur_dist, distance ) );
}
-
+ else
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
+ exc->func_move( exc,
+ &exc->zp1,
+ point,
+ SUB_LONG( distance, cur_dist ) );
+
Fail:
exc->GS.rp1 = exc->GS.rp0;
@@ -7185,10 +7119,9 @@
FT_UShort A;
FT_ULong C, P;
FT_Long B;
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
- FT_UShort B1, B2;
+#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( SUBPIXEL_HINTING_INFINALITY &&
exc->ignore_x_mode &&
exc->iup_called &&
@@ -7269,6 +7202,9 @@
/* rules, always skipping deltas in subpixel direction. */
else if ( exc->ignore_x_mode && exc->GS.freeVector.y != 0 )
{
+ FT_UShort B1, B2;
+
+
/* save the y value of the point now; compare after move */
B1 = (FT_UShort)exc->zp0.cur[A].y;
@@ -7846,7 +7782,7 @@
num_twilight_points = 0xFFFFU;
FT_TRACE5(( "TT_RunIns: Resetting number of twilight points\n"
- " from %d to the more reasonable value %d\n",
+ " from %d to the more reasonable value %ld\n",
exc->twilight.n_points,
num_twilight_points ));
exc->twilight.n_points = (FT_UShort)num_twilight_points;
@@ -7881,11 +7817,11 @@
exc->loopcall_counter_max = 100 * (FT_ULong)exc->face->root.num_glyphs;
FT_TRACE5(( "TT_RunIns: Limiting total number of loops in LOOPCALL"
- " to %d\n", exc->loopcall_counter_max ));
+ " to %ld\n", exc->loopcall_counter_max ));
exc->neg_jump_counter_max = exc->loopcall_counter_max;
FT_TRACE5(( "TT_RunIns: Limiting total number of backward jumps"
- " to %d\n", exc->neg_jump_counter_max ));
+ " to %ld\n", exc->neg_jump_counter_max ));
/* set PPEM and CVT functions */
exc->tt_metrics.ratio = 0;
@@ -7922,14 +7858,14 @@
/* if tracing level is 7, show current code position */
/* and the first few stack elements also */
FT_TRACE6(( " " ));
- FT_TRACE7(( "%06d ", exc->IP ));
+ FT_TRACE7(( "%06ld ", exc->IP ));
FT_TRACE6(( "%s", opcode_name[exc->opcode] + 2 ));
FT_TRACE7(( "%*s", *opcode_name[exc->opcode] == 'A'
? 2
: 12 - ( *opcode_name[exc->opcode] - '0' ),
"#" ));
for ( n = 1; n <= cnt; n++ )
- FT_TRACE7(( " %d", exc->stack[exc->top - n] ));
+ FT_TRACE7(( " %ld", exc->stack[exc->top - n] ));
FT_TRACE6(( "\n" ));
}
#endif /* FT_DEBUG_LEVEL_TRACE */
@@ -8647,7 +8583,7 @@
} while ( !exc->instruction_trap );
LNo_Error_:
- FT_TRACE4(( " %d instruction%s executed\n",
+ FT_TRACE4(( " %ld instruction%s executed\n",
ins_counter,
ins_counter == 1 ? "" : "s" ));
return FT_Err_Ok;
diff --git a/thirdparty/freetype/src/truetype/ttinterp.h b/thirdparty/freetype/src/truetype/ttinterp.h
index 07e4ad6891..6a83705a6c 100644
--- a/thirdparty/freetype/src/truetype/ttinterp.h
+++ b/thirdparty/freetype/src/truetype/ttinterp.h
@@ -19,7 +19,6 @@
#ifndef TTINTERP_H_
#define TTINTERP_H_
-#include <ft2build.h>
#include "ttobjs.h"
@@ -52,7 +51,7 @@ FT_BEGIN_HEADER
typedef FT_F26Dot6
(*TT_Round_Func)( TT_ExecContext exc,
FT_F26Dot6 distance,
- FT_F26Dot6 compensation );
+ FT_Int color );
/* Point displacement along the freedom vector routine */
typedef void
diff --git a/thirdparty/freetype/src/truetype/ttobjs.c b/thirdparty/freetype/src/truetype/ttobjs.c
index 730a5b8cdf..06d4569559 100644
--- a/thirdparty/freetype/src/truetype/ttobjs.c
+++ b/thirdparty/freetype/src/truetype/ttobjs.c
@@ -16,12 +16,11 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_SFNT_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/ftdriver.h>
#include "ttgload.h"
#include "ttpload.h"
@@ -1116,10 +1115,10 @@
/* The Apple specification says that the compensation for */
/* `gray' is always zero. FreeType doesn't do any */
/* compensation at all. */
- tt_metrics->compensations[0] = 0; /* gray */
- tt_metrics->compensations[1] = 0; /* black */
- tt_metrics->compensations[2] = 0; /* white */
- tt_metrics->compensations[3] = 0; /* the same as gray */
+ tt_metrics->compensations[0] = 0; /* gray */
+ tt_metrics->compensations[1] = 0; /* black */
+ tt_metrics->compensations[2] = 0; /* white */
+ tt_metrics->compensations[3] = 0; /* zero */
}
/* allocate function defs, instruction defs, cvt, and storage area */
diff --git a/thirdparty/freetype/src/truetype/ttobjs.h b/thirdparty/freetype/src/truetype/ttobjs.h
index 7c3fc7ef8a..d986deabc4 100644
--- a/thirdparty/freetype/src/truetype/ttobjs.h
+++ b/thirdparty/freetype/src/truetype/ttobjs.h
@@ -20,9 +20,8 @@
#define TTOBJS_H_
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/tttypes.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/truetype/ttpload.c b/thirdparty/freetype/src/truetype/ttpload.c
index d35393a8b0..b1255b88cd 100644
--- a/thirdparty/freetype/src/truetype/ttpload.c
+++ b/thirdparty/freetype/src/truetype/ttpload.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
#include "ttpload.h"
@@ -124,7 +123,7 @@
if ( face->num_locations != (FT_ULong)face->root.num_glyphs + 1 )
{
- FT_TRACE2(( "glyph count mismatch! loca: %d, maxp: %d\n",
+ FT_TRACE2(( "glyph count mismatch! loca: %ld, maxp: %ld\n",
face->num_locations - 1, face->root.num_glyphs ));
/* we only handle the case where `maxp' gives a larger value */
@@ -165,7 +164,7 @@
face->num_locations = (FT_ULong)face->root.num_glyphs + 1;
table_len = new_loca_len;
- FT_TRACE2(( "adjusting num_locations to %d\n",
+ FT_TRACE2(( "adjusting num_locations to %ld\n",
face->num_locations ));
}
else
@@ -173,7 +172,7 @@
face->root.num_glyphs = face->num_locations
? (FT_Long)face->num_locations - 1 : 0;
- FT_TRACE2(( "adjusting num_glyphs to %d\n",
+ FT_TRACE2(( "adjusting num_glyphs to %ld\n",
face->root.num_glyphs ));
}
}
@@ -238,7 +237,7 @@
if ( pos1 > face->glyf_len )
{
FT_TRACE1(( "tt_face_get_location:"
- " too large offset (0x%08lx) found for glyph index %ld,\n"
+ " too large offset (0x%08lx) found for glyph index %d,\n"
" "
" exceeding the end of `glyf' table (0x%08lx)\n",
pos1, gindex, face->glyf_len ));
@@ -252,7 +251,7 @@
if ( gindex == face->num_locations - 2 )
{
FT_TRACE1(( "tt_face_get_location:"
- " too large size (%ld bytes) found for glyph index %ld,\n"
+ " too large size (%ld bytes) found for glyph index %d,\n"
" "
" truncating at the end of `glyf' table to %ld bytes\n",
pos2 - pos1, gindex, face->glyf_len - pos1 ));
@@ -261,7 +260,7 @@
else
{
FT_TRACE1(( "tt_face_get_location:"
- " too large offset (0x%08lx) found for glyph index %ld,\n"
+ " too large offset (0x%08lx) found for glyph index %d,\n"
" "
" exceeding the end of `glyf' table (0x%08lx)\n",
pos2, gindex + 1, face->glyf_len ));
@@ -429,7 +428,7 @@
if ( FT_FRAME_EXTRACT( table_len, face->font_program ) )
goto Exit;
- FT_TRACE2(( "loaded, %12d bytes\n", face->font_program_size ));
+ FT_TRACE2(( "loaded, %12ld bytes\n", face->font_program_size ));
}
Exit:
@@ -492,7 +491,7 @@
if ( FT_FRAME_EXTRACT( table_len, face->cvt_program ) )
goto Exit;
- FT_TRACE2(( "loaded, %12d bytes\n", face->cvt_program_size ));
+ FT_TRACE2(( "loaded, %12ld bytes\n", face->cvt_program_size ));
}
Exit:
diff --git a/thirdparty/freetype/src/truetype/ttpload.h b/thirdparty/freetype/src/truetype/ttpload.h
index 3bbd4add19..bb669e0278 100644
--- a/thirdparty/freetype/src/truetype/ttpload.h
+++ b/thirdparty/freetype/src/truetype/ttpload.h
@@ -20,8 +20,7 @@
#define TTPLOAD_H_
-#include <ft2build.h>
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/internal/tttypes.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/truetype/ttsubpix.c b/thirdparty/freetype/src/truetype/ttsubpix.c
index 8289818863..56667deaf7 100644
--- a/thirdparty/freetype/src/truetype/ttsubpix.c
+++ b/thirdparty/freetype/src/truetype/ttsubpix.c
@@ -15,14 +15,13 @@
*
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_OUTLINE_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/tttags.h>
+#include <freetype/ftoutln.h>
+#include <freetype/ftdriver.h>
#include "ttsubpix.h"
diff --git a/thirdparty/freetype/src/truetype/ttsubpix.h b/thirdparty/freetype/src/truetype/ttsubpix.h
index 23adf7e8d8..229a6cf055 100644
--- a/thirdparty/freetype/src/truetype/ttsubpix.h
+++ b/thirdparty/freetype/src/truetype/ttsubpix.h
@@ -19,7 +19,6 @@
#ifndef TTSUBPIX_H_
#define TTSUBPIX_H_
-#include <ft2build.h>
#include "ttobjs.h"
#include "ttinterp.h"
diff --git a/thirdparty/freetype/src/type1/t1afm.c b/thirdparty/freetype/src/type1/t1afm.c
index 0866e7bf97..b9cd66b045 100644
--- a/thirdparty/freetype/src/type1/t1afm.c
+++ b/thirdparty/freetype/src/type1/t1afm.c
@@ -16,11 +16,10 @@
*/
-#include <ft2build.h>
#include "t1afm.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/psaux.h>
#include "t1errors.h"
diff --git a/thirdparty/freetype/src/type1/t1afm.h b/thirdparty/freetype/src/type1/t1afm.h
index 40ce8f9754..edf919c791 100644
--- a/thirdparty/freetype/src/type1/t1afm.h
+++ b/thirdparty/freetype/src/type1/t1afm.h
@@ -19,9 +19,8 @@
#ifndef T1AFM_H_
#define T1AFM_H_
-#include <ft2build.h>
#include "t1objs.h"
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/internal/t1types.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/type1/t1driver.c b/thirdparty/freetype/src/type1/t1driver.c
index 75a5698e8d..b786a87817 100644
--- a/thirdparty/freetype/src/type1/t1driver.c
+++ b/thirdparty/freetype/src/type1/t1driver.c
@@ -16,7 +16,6 @@
*/
-#include <ft2build.h>
#include "t1driver.h"
#include "t1gload.h"
#include "t1load.h"
@@ -27,20 +26,20 @@
#include "t1afm.h"
#endif
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_HASH_H
-#include FT_INTERNAL_POSTSCRIPT_PROPS_H
-#include FT_DRIVER_H
-
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_SERVICE_KERNING_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/fthash.h>
+#include <freetype/internal/ftpsprop.h>
+#include <freetype/ftdriver.h>
+
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svgldict.h>
+#include <freetype/internal/services/svfntfmt.h>
+#include <freetype/internal/services/svpostnm.h>
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/services/svpsinfo.h>
+#include <freetype/internal/services/svprop.h>
+#include <freetype/internal/services/svkern.h>
/**************************************************************************
diff --git a/thirdparty/freetype/src/type1/t1driver.h b/thirdparty/freetype/src/type1/t1driver.h
index 84b3e041c4..e7eae0b88c 100644
--- a/thirdparty/freetype/src/type1/t1driver.h
+++ b/thirdparty/freetype/src/type1/t1driver.h
@@ -20,8 +20,7 @@
#define T1DRIVER_H_
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/type1/t1errors.h b/thirdparty/freetype/src/type1/t1errors.h
index 1b119b843a..ad03a3d32a 100644
--- a/thirdparty/freetype/src/type1/t1errors.h
+++ b/thirdparty/freetype/src/type1/t1errors.h
@@ -25,7 +25,7 @@
#ifndef T1ERRORS_H_
#define T1ERRORS_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -33,7 +33,7 @@
#define FT_ERR_PREFIX T1_Err_
#define FT_ERR_BASE FT_Mod_Err_Type1
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* T1ERRORS_H_ */
diff --git a/thirdparty/freetype/src/type1/t1gload.c b/thirdparty/freetype/src/type1/t1gload.c
index fcaf66c401..d16b81f246 100644
--- a/thirdparty/freetype/src/type1/t1gload.c
+++ b/thirdparty/freetype/src/type1/t1gload.c
@@ -16,15 +16,14 @@
*/
-#include <ft2build.h>
#include "t1gload.h"
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_CFF_TYPES_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/ftoutln.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/cfftypes.h>
+#include <freetype/ftdriver.h>
#include "t1errors.h"
@@ -334,7 +333,7 @@
else
advances[nn] = 0;
- FT_TRACE5(( " idx %d: advance width %d font unit%s\n",
+ FT_TRACE5(( " idx %d: advance width %ld font unit%s\n",
first + nn,
advances[nn],
advances[nn] == 1 ? "" : "s" ));
diff --git a/thirdparty/freetype/src/type1/t1gload.h b/thirdparty/freetype/src/type1/t1gload.h
index 59fae82b6d..9947507c84 100644
--- a/thirdparty/freetype/src/type1/t1gload.h
+++ b/thirdparty/freetype/src/type1/t1gload.h
@@ -20,7 +20,6 @@
#define T1GLOAD_H_
-#include <ft2build.h>
#include "t1objs.h"
diff --git a/thirdparty/freetype/src/type1/t1load.c b/thirdparty/freetype/src/type1/t1load.c
index d0ea36badb..84986007b0 100644
--- a/thirdparty/freetype/src/type1/t1load.c
+++ b/thirdparty/freetype/src/type1/t1load.c
@@ -61,12 +61,12 @@
#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include FT_CONFIG_CONFIG_H
-#include FT_MULTIPLE_MASTERS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_HASH_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/t1types.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/fthash.h>
#include "t1load.h"
#include "t1errors.h"
@@ -1063,7 +1063,7 @@
map->design_points[p] = T1_ToInt( parser );
map->blend_points [p] = T1_ToFixed( parser, 0 );
- FT_TRACE4(( " [%d %f]",
+ FT_TRACE4(( " [%ld %f]",
map->design_points[p],
(double)map->blend_points[p] / 65536 ));
}
@@ -1755,7 +1755,7 @@
*/
FT_TRACE0(( "parse_subrs: adjusting number of subroutines"
- " (from %d to %d)\n",
+ " (from %d to %ld)\n",
num_subrs,
( parser->root.limit - parser->root.cursor ) >> 3 ));
num_subrs = ( parser->root.limit - parser->root.cursor ) >> 3;
@@ -1926,7 +1926,7 @@
if ( num_glyphs > ( limit - cur ) >> 3 )
{
FT_TRACE0(( "parse_charstrings: adjusting number of glyphs"
- " (from %d to %d)\n",
+ " (from %d to %ld)\n",
num_glyphs, ( limit - cur ) >> 3 ));
num_glyphs = ( limit - cur ) >> 3;
}
diff --git a/thirdparty/freetype/src/type1/t1load.h b/thirdparty/freetype/src/type1/t1load.h
index 9cac0f6fb6..4396415c20 100644
--- a/thirdparty/freetype/src/type1/t1load.h
+++ b/thirdparty/freetype/src/type1/t1load.h
@@ -20,10 +20,9 @@
#define T1LOAD_H_
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_MULTIPLE_MASTERS_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/ftmm.h>
#include "t1parse.h"
diff --git a/thirdparty/freetype/src/type1/t1objs.c b/thirdparty/freetype/src/type1/t1objs.c
index 80ee0e265e..3b918b7338 100644
--- a/thirdparty/freetype/src/type1/t1objs.c
+++ b/thirdparty/freetype/src/type1/t1objs.c
@@ -16,12 +16,11 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_IDS_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/ttnameid.h>
+#include <freetype/ftdriver.h>
#include "t1gload.h"
#include "t1load.h"
@@ -32,8 +31,8 @@
#include "t1afm.h"
#endif
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/psaux.h>
/**************************************************************************
@@ -347,8 +346,8 @@
if ( error )
goto Exit;
- FT_TRACE2(( "T1_Face_Init: %08p (index %d)\n",
- face,
+ FT_TRACE2(( "T1_Face_Init: %p (index %d)\n",
+ (void *)face,
face_index ));
/* if we just wanted to check the format, leave successfully now */
diff --git a/thirdparty/freetype/src/type1/t1objs.h b/thirdparty/freetype/src/type1/t1objs.h
index 6bc902cc89..536be8ba1e 100644
--- a/thirdparty/freetype/src/type1/t1objs.h
+++ b/thirdparty/freetype/src/type1/t1objs.h
@@ -21,9 +21,9 @@
#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/internal/t1types.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/type1/t1parse.c b/thirdparty/freetype/src/type1/t1parse.c
index ec30355bf8..74cf38bde7 100644
--- a/thirdparty/freetype/src/type1/t1parse.c
+++ b/thirdparty/freetype/src/type1/t1parse.c
@@ -33,10 +33,9 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/psaux.h>
#include "t1parse.h"
diff --git a/thirdparty/freetype/src/type1/t1parse.h b/thirdparty/freetype/src/type1/t1parse.h
index edf79b0a8b..1ea0110b50 100644
--- a/thirdparty/freetype/src/type1/t1parse.h
+++ b/thirdparty/freetype/src/type1/t1parse.h
@@ -20,9 +20,8 @@
#define T1PARSE_H_
-#include <ft2build.h>
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/t1types.h>
+#include <freetype/internal/ftstream.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/type1/type1.c b/thirdparty/freetype/src/type1/type1.c
index 95dbaeb501..cadee78994 100644
--- a/thirdparty/freetype/src/type1/type1.c
+++ b/thirdparty/freetype/src/type1/type1.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "t1afm.c"
#include "t1driver.c"
diff --git a/thirdparty/freetype/src/type42/t42drivr.c b/thirdparty/freetype/src/type42/t42drivr.c
index 4b2cab3474..90898b4329 100644
--- a/thirdparty/freetype/src/type42/t42drivr.c
+++ b/thirdparty/freetype/src/type42/t42drivr.c
@@ -39,12 +39,12 @@
#include "t42drivr.h"
#include "t42objs.h"
#include "t42error.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
+#include <freetype/internal/services/svfntfmt.h>
+#include <freetype/internal/services/svgldict.h>
+#include <freetype/internal/services/svpostnm.h>
+#include <freetype/internal/services/svpsinfo.h>
#undef FT_COMPONENT
#define FT_COMPONENT t42
diff --git a/thirdparty/freetype/src/type42/t42drivr.h b/thirdparty/freetype/src/type42/t42drivr.h
index 7e7ec70f9d..8bf2afc755 100644
--- a/thirdparty/freetype/src/type42/t42drivr.h
+++ b/thirdparty/freetype/src/type42/t42drivr.h
@@ -20,8 +20,7 @@
#define T42DRIVR_H_
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/type42/t42error.h b/thirdparty/freetype/src/type42/t42error.h
index 6d3617e927..e48132ec09 100644
--- a/thirdparty/freetype/src/type42/t42error.h
+++ b/thirdparty/freetype/src/type42/t42error.h
@@ -25,7 +25,7 @@
#ifndef T42ERROR_H_
#define T42ERROR_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -33,7 +33,7 @@
#define FT_ERR_PREFIX T42_Err_
#define FT_ERR_BASE FT_Mod_Err_Type42
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* T42ERROR_H_ */
diff --git a/thirdparty/freetype/src/type42/t42objs.c b/thirdparty/freetype/src/type42/t42objs.c
index 8d1e63ffc7..6acfcdf401 100644
--- a/thirdparty/freetype/src/type42/t42objs.c
+++ b/thirdparty/freetype/src/type42/t42objs.c
@@ -19,9 +19,9 @@
#include "t42objs.h"
#include "t42parse.h"
#include "t42error.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_LIST_H
-#include FT_TRUETYPE_IDS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftlist.h>
+#include <freetype/ttnameid.h>
#undef FT_COMPONENT
diff --git a/thirdparty/freetype/src/type42/t42objs.h b/thirdparty/freetype/src/type42/t42objs.h
index ecb495e8f0..69f5cffd44 100644
--- a/thirdparty/freetype/src/type42/t42objs.h
+++ b/thirdparty/freetype/src/type42/t42objs.h
@@ -19,15 +19,14 @@
#ifndef T42OBJS_H_
#define T42OBJS_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/freetype.h>
+#include <freetype/t1tables.h>
+#include <freetype/internal/t1types.h>
#include "t42types.h"
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DRIVER_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdrv.h>
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/pshints.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/type42/t42parse.c b/thirdparty/freetype/src/type42/t42parse.c
index 7f26d04170..98507699fa 100644
--- a/thirdparty/freetype/src/type42/t42parse.c
+++ b/thirdparty/freetype/src/type42/t42parse.c
@@ -18,9 +18,9 @@
#include "t42parse.h"
#include "t42error.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/psaux.h>
/**************************************************************************
@@ -826,7 +826,7 @@
if ( loader->num_glyphs > ( limit - parser->root.cursor ) >> 2 )
{
FT_TRACE0(( "t42_parse_charstrings: adjusting number of glyphs"
- " (from %d to %d)\n",
+ " (from %d to %ld)\n",
loader->num_glyphs,
( limit - parser->root.cursor ) >> 2 ));
loader->num_glyphs = ( limit - parser->root.cursor ) >> 2;
diff --git a/thirdparty/freetype/src/type42/t42parse.h b/thirdparty/freetype/src/type42/t42parse.h
index de54a46cf1..2ccf052d78 100644
--- a/thirdparty/freetype/src/type42/t42parse.h
+++ b/thirdparty/freetype/src/type42/t42parse.h
@@ -21,7 +21,7 @@
#include "t42objs.h"
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/psaux.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/type42/t42types.h b/thirdparty/freetype/src/type42/t42types.h
index f66f09db87..ba0cc21429 100644
--- a/thirdparty/freetype/src/type42/t42types.h
+++ b/thirdparty/freetype/src/type42/t42types.h
@@ -20,11 +20,10 @@
#define T42TYPES_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include <freetype/freetype.h>
+#include <freetype/t1tables.h>
+#include <freetype/internal/t1types.h>
+#include <freetype/internal/pshints.h>
FT_BEGIN_HEADER
diff --git a/thirdparty/freetype/src/type42/type42.c b/thirdparty/freetype/src/type42/type42.c
index 4739b3c333..012559e2fd 100644
--- a/thirdparty/freetype/src/type42/type42.c
+++ b/thirdparty/freetype/src/type42/type42.c
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "t42drivr.c"
#include "t42objs.c"
diff --git a/thirdparty/freetype/src/winfonts/fnterrs.h b/thirdparty/freetype/src/winfonts/fnterrs.h
index f98e68435b..550de386fc 100644
--- a/thirdparty/freetype/src/winfonts/fnterrs.h
+++ b/thirdparty/freetype/src/winfonts/fnterrs.h
@@ -26,7 +26,7 @@
#ifndef FNTERRS_H_
#define FNTERRS_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -34,7 +34,7 @@
#define FT_ERR_PREFIX FNT_Err_
#define FT_ERR_BASE FT_Mod_Err_Winfonts
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* FNTERRS_H_ */
diff --git a/thirdparty/freetype/src/winfonts/winfnt.c b/thirdparty/freetype/src/winfonts/winfnt.c
index 9b466e8f28..e83312d166 100644
--- a/thirdparty/freetype/src/winfonts/winfnt.c
+++ b/thirdparty/freetype/src/winfonts/winfnt.c
@@ -18,17 +18,16 @@
*/
-#include <ft2build.h>
-#include FT_WINFONTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_TRUETYPE_IDS_H
+#include <freetype/ftwinfnt.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ttnameid.h>
#include "winfnt.h"
#include "fnterrs.h"
-#include FT_SERVICE_WINFNT_H
-#include FT_SERVICE_FONT_FORMAT_H
+#include <freetype/internal/services/svwinfnt.h>
+#include <freetype/internal/services/svfntfmt.h>
/**************************************************************************
*
diff --git a/thirdparty/freetype/src/winfonts/winfnt.h b/thirdparty/freetype/src/winfonts/winfnt.h
index 391f4448a7..3367c7715e 100644
--- a/thirdparty/freetype/src/winfonts/winfnt.h
+++ b/thirdparty/freetype/src/winfonts/winfnt.h
@@ -21,9 +21,8 @@
#define WINFNT_H_
-#include <ft2build.h>
-#include FT_WINFONTS_H
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/ftwinfnt.h>
+#include <freetype/internal/ftdrv.h>
FT_BEGIN_HEADER