Skip to content

Commit

Permalink
Merge commit '6d51638657bdc907cc78458ad5164ed2da95b333' into merge-mono
Browse files Browse the repository at this point in the history
  • Loading branch information
Et7f3 committed May 3, 2020
2 parents c4cfe8c + 6d51638 commit 6d38975
Show file tree
Hide file tree
Showing 41 changed files with 566 additions and 354 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ gl-out
node_modules
tools/lottiecap/filmstrip.png

_esy
_esy
/_ReSharper.Caches
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ deps = {
"third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@b001528ffa00e7c15a5002124f707570e59a5697",
"third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@96443b262250c390b0caefbf3eed8463ba35ecae",
"third_party/externals/expat" : "https://android.googlesource.com/platform/external/[email protected]_r55",
"third_party/externals/freetype" : "https://skia.googlesource.com/third_party/freetype2.git@fa6da7bf6dcbcfa22d2464259ad1cccee3233189",
"third_party/externals/freetype" : "https://skia.googlesource.com/third_party/freetype2.git@VER-2-10-1",
"third_party/externals/googletest" : "https://android.googlesource.com/platform/external/googletest@dd43b9998e9a44a579a7aba6c1309407d1a5ed95",
"third_party/externals/harfbuzz" : "https://skia.googlesource.com/third_party/[email protected]",
"third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@ec9c1133693148470ffe2e5e53576998e3650c1d",
Expand Down
1 change: 1 addition & 0 deletions gm/cgm.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "sk_canvas.h"
#include "sk_data.h"
#include "sk_general.h"
#include "sk_image.h"
#include "sk_paint.h"
#include "sk_shader.h"
Expand Down
43 changes: 17 additions & 26 deletions gn/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ declare_args() {

malloc = ""

enable_bitcode = false
if (is_tvos || is_watchos) {
enable_bitcode = true
}
enable_bitcode =
(is_tvos || is_watchos) &&
(target_cpu == "arm" || target_cpu == "arm64")
}

if (is_ios) {
Expand Down Expand Up @@ -60,12 +59,8 @@ config("default") {
"NOMINMAX",
]

if (msvc == 2015) {
_include_dirs = [ "$win_vc/include" ]
} else { # 2017
_include_dirs = [ "$win_vc/Tools/MSVC/$win_toolchain_version/include" ]
}
_include_dirs += [
_include_dirs = [
"$win_vc/Tools/MSVC/$win_toolchain_version/include",
"$win_sdk/Include/$win_sdk_version/shared",
"$win_sdk/Include/$win_sdk_version/ucrt",
"$win_sdk/Include/$win_sdk_version/um",
Expand All @@ -83,24 +78,16 @@ config("default") {
include_dirs = _include_dirs
}

_is_store = ""
if (is_winrt) {
_is_store = "/store"
}

lib_dirs = [
"$win_sdk/Lib/$win_sdk_version/ucrt/$target_cpu",
"$win_sdk/Lib/$win_sdk_version/um/$target_cpu",
"$win_vc/Tools/MSVC/$win_toolchain_version/lib/$target_cpu$_is_store",
]
if (msvc == 2015) {
if (target_cpu == "x86") {
lib_dirs += [ "$win_vc/lib" ]
} else {
lib_dirs += [ "$win_vc/lib/amd64" ]
}
} else { # 2017
_is_store = ""
if (is_winrt) {
_is_store = "/store"
}
lib_dirs +=
[ "$win_vc/Tools/MSVC/$win_toolchain_version/lib/$target_cpu$_is_store" ]
}
} else {
cflags += [
"-fstrict-aliasing",
Expand Down Expand Up @@ -216,8 +203,12 @@ config("default") {
} else if (target_cpu == "x64") {
_target = "x86_64"
}
if (is_watchos && _target == "armv7") {
_target = "armv7k"
if (is_watchos) {
if (target_cpu == "arm") {
_target = "armv7k"
} else if (target_cpu == "arm64") {
_target = "arm64_32"
}
}
asmflags += [
"-isysroot",
Expand Down
52 changes: 5 additions & 47 deletions gn/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ declare_args() {
cxx = "c++"

win_sdk = "C:/Program Files (x86)/Windows Kits/10"
min_win_sdk_version = "10.0.10240.0"
win_sdk_version = ""

win_vc = ""
Expand Down Expand Up @@ -140,62 +141,18 @@ if (is_android) {
}
}

msvc = ""
if (is_win) {
# By default we look for 2017 (Pro & Community), then 2015. If MSVC is installed in a
# By default we look for 2017 (Enterprise, Pro, and Community), then 2015. If MSVC is installed in a
# non-default location, you can set win_vc to inform us where it is.
vc_2017_ent_default =
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC"
vc_2017_pro_default =
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC"
vc_2017_com_default =
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC"
vc_2017_bt_default =
"C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC"
vc_2015_default = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC"

if (win_vc == "") {
if ("True" == exec_script("//gn/checkdir.py",
[ "$vc_2017_ent_default" ],
"trim string")) {
win_vc = vc_2017_ent_default
msvc = 2017
} else if ("True" == exec_script("//gn/checkdir.py",
[ "$vc_2017_pro_default" ],
"trim string")) {
win_vc = vc_2017_pro_default
msvc = 2017
} else if ("True" == exec_script("//gn/checkdir.py",
[ "$vc_2017_com_default" ],
"trim string")) {
win_vc = vc_2017_com_default
msvc = 2017
} else if ("True" == exec_script("//gn/checkdir.py",
[ "$vc_2017_bt_default" ],
"trim string")) {
win_vc = vc_2017_bt_default
msvc = 2017
} else if ("True" == exec_script("//gn/checkdir.py",
[ "$vc_2015_default" ],
"trim string")) {
win_vc = vc_2015_default
msvc = 2015
}
win_vc = exec_script("//gn/find_msvc.py", [], "trim string")
}
assert(win_vc != "") # Could not find VC installation. Set win_vc to your VC directory.

if (msvc == "") {
if ("True" ==
exec_script("//gn/checkdir.py", [ "$win_vc/Tools" ], "trim string")) {
msvc = 2017
} else {
msvc = 2015
}
}
}

if (is_win) {
if (msvc == 2017 && win_toolchain_version == "") {
if (win_toolchain_version == "") {
win_toolchain_version = exec_script("//gn/highest_version_dir.py",
[
"$win_vc/Tools/MSVC",
Expand All @@ -208,6 +165,7 @@ if (is_win) {
[
"$win_sdk/Include",
"[0-9]{2}\.[0-9]\.[0-9]{5}\.[0-9]",
min_win_sdk_version
],
"trim string")
}
Expand Down
26 changes: 26 additions & 0 deletions gn/find_msvc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python
# Copyright 2019 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os
import sys

'''
Look for the first match in the format
C:\\Program Files (x86)\\Microsoft Visual Studio\\${RELEASE}\\${VERSION}\\VC
'''
def find_msvc():
if sys.platform.startswith('win'):
default_dir = r'C:\Program Files (x86)\Microsoft Visual Studio'
for release in ['2019', '2017']:
for version in ['Enterprise', 'Professional', 'Community', 'BuildTools']:
path = os.path.join(default_dir, release, version, 'VC')
if os.path.isdir(path):
return path
return None

if __name__ == '__main__':
result = find_msvc()
if result:
sys.stdout.write(result + '\n')
9 changes: 8 additions & 1 deletion gn/lowest_version_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,12 @@

dirpath = sys.argv[1]
regex = re.compile(sys.argv[2])
minimum = sys.argv[3]

print sorted(filter(regex.match, os.listdir(dirpath)))[0]
matches = sorted(filter(regex.match, os.listdir(dirpath)))
for match in matches:
if (match >= minimum):
path = os.path.join(dirpath, match)
if os.path.isdir(path):
print match
break
15 changes: 3 additions & 12 deletions gn/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,17 @@ if (host_os == "win") {
toolchain("msvc") {
lib_dir_switch = "/LIBPATH:"

if (msvc == 2015) {
if (target_cpu == "x86") {
bin = "$win_vc/bin"
} else {
bin = "$win_vc/bin/amd64"
}
} else {
bin = "$win_vc/Tools/MSVC/$win_toolchain_version/bin/HostX64/$target_cpu"
}
bin = "$win_vc/Tools/MSVC/$win_toolchain_version/bin/HostX64/$target_cpu"

if (target_cpu == "x64") {
_target = "amd64"
} else {
_target = "amd64_" + target_cpu
}
if (is_winrt) {
_target += " uwp 10.0.10240.0 -vcvars_ver=14.1"
} else {
_target += " 8.1 -vcvars_ver=14.1"
_target += " uwp"
}
_target += " " + win_sdk_version + " -vcvars_ver=14.2"

_vcvarsall = "$win_vc/Auxiliary/Build/vcvarsall.bat"
env_setup = "cmd /c set __VSCMD_ARG_NO_LOGO=1 && set VSCMD_START_DIR=%CD% && \"$_vcvarsall\" $_target && "
Expand Down
1 change: 0 additions & 1 deletion include/c/sk_bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ SK_C_API uint16_t sk_bitmap_get_addr_16(sk_bitmap_t* cbitmap, int x, int y);
SK_C_API uint32_t sk_bitmap_get_addr_32(sk_bitmap_t* cbitmap, int x, int y);
SK_C_API void* sk_bitmap_get_addr(sk_bitmap_t* cbitmap, int x, int y);
SK_C_API sk_color_t sk_bitmap_get_pixel_color(sk_bitmap_t* cbitmap, int x, int y);
SK_C_API sk_pmcolor_t sk_bitmap_get_index8_color(sk_bitmap_t* cbitmap, int x, int y);
SK_C_API void sk_bitmap_set_pixel_color(sk_bitmap_t* cbitmap, int x, int y, sk_color_t color);
SK_C_API bool sk_bitmap_ready_to_draw(sk_bitmap_t* cbitmap);
SK_C_API void sk_bitmap_get_pixel_colors(sk_bitmap_t* cbitmap, sk_color_t* colors);
Expand Down
8 changes: 7 additions & 1 deletion include/c/sk_canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ SK_C_API void sk_canvas_draw_bitmap_lattice(sk_canvas_t* t, const sk_bitmap_t* b
SK_C_API void sk_canvas_draw_image_lattice(sk_canvas_t* t, const sk_image_t* image, const sk_lattice_t* lattice, const sk_rect_t* dst, const sk_paint_t* paint);
SK_C_API void sk_canvas_draw_bitmap_nine(sk_canvas_t* t, const sk_bitmap_t* bitmap, const sk_irect_t* center, const sk_rect_t* dst, const sk_paint_t* paint);
SK_C_API void sk_canvas_draw_image_nine(sk_canvas_t* t, const sk_image_t* image, const sk_irect_t* center, const sk_rect_t* dst, const sk_paint_t* paint);
SK_C_API void sk_canvas_draw_vertices(sk_canvas_t* ccanvas, sk_vertices_t* vertices, sk_blendmode_t mode, const sk_paint_t* paint);
SK_C_API void sk_canvas_draw_vertices(sk_canvas_t* ccanvas, const sk_vertices_t* vertices, sk_blendmode_t mode, const sk_paint_t* paint);
SK_C_API void sk_canvas_draw_arc(sk_canvas_t* ccanvas, const sk_rect_t* oval, float startAngle, float sweepAngle, bool useCenter, const sk_paint_t* paint);
SK_C_API void sk_canvas_draw_drrect(sk_canvas_t* ccanvas, const sk_rrect_t* outer, const sk_rrect_t* inner, const sk_paint_t* paint);
SK_C_API void sk_canvas_draw_atlas(sk_canvas_t* ccanvas, const sk_image_t* atlas, const sk_rsxform_t* xform, const sk_rect_t* tex, const sk_color_t* colors, int count, sk_blendmode_t mode, const sk_rect_t* cullRect, const sk_paint_t* paint);
SK_C_API void sk_canvas_draw_patch(sk_canvas_t* ccanvas, const sk_point_t* cubics, const sk_color_t* colors, const sk_point_t* texCoords, sk_blendmode_t mode, const sk_paint_t* paint);
SK_C_API bool sk_canvas_is_clip_empty(sk_canvas_t* ccanvas);
SK_C_API bool sk_canvas_is_clip_rect(sk_canvas_t* ccanvas);

SK_C_API sk_nodraw_canvas_t* sk_nodraw_canvas_new(int width, int height);
SK_C_API void sk_nodraw_canvas_destroy(sk_nodraw_canvas_t*);
Expand Down
8 changes: 8 additions & 0 deletions include/c/sk_colorspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

SK_C_PLUS_PLUS_BEGIN_GUARD

// sk_colorspace_t

SK_C_API void sk_colorspace_unref(sk_colorspace_t* cColorSpace);
SK_C_API sk_colorspace_t* sk_colorspace_new_srgb(void);
SK_C_API sk_colorspace_t* sk_colorspace_new_srgb_linear(void);
Expand All @@ -38,6 +40,12 @@ SK_C_API bool sk_colorspaceprimaries_to_xyzd50(const sk_colorspaceprimaries_t* p
SK_C_API void sk_colorspace_transfer_fn_invert(const sk_colorspace_transfer_fn_t* transfer, sk_colorspace_transfer_fn_t* inverted);
SK_C_API float sk_colorspace_transfer_fn_transform(const sk_colorspace_transfer_fn_t* transfer, float x);

// sk_color4f_t

SK_C_API sk_color_t sk_color4f_to_color(const sk_color4f_t* color4f);
SK_C_API void sk_color4f_from_color(sk_color_t color, sk_color4f_t* color4f);
SK_C_API void sk_color4f_pin(const sk_color4f_t* color4f, sk_color4f_t* pinned);

SK_C_PLUS_PLUS_END_GUARD

#endif
3 changes: 3 additions & 0 deletions include/c/sk_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ SK_C_API sk_image_t* sk_image_new_from_adopted_texture(gr_context_t* context, co
SK_C_API sk_image_t* sk_image_new_from_picture(sk_picture_t* picture, const sk_isize_t* dimensions, const sk_matrix_t* matrix, const sk_paint_t* paint);

SK_C_API sk_image_t* sk_image_make_subset(const sk_image_t* cimage, const sk_irect_t* subset);
SK_C_API sk_image_t* sk_image_make_texture_image(const sk_image_t* cimage, gr_context_t* context, sk_colorspace_t* colorspace);
SK_C_API sk_image_t* sk_image_make_non_texture_image(const sk_image_t* cimage);
SK_C_API sk_image_t* sk_image_make_raster_image(const sk_image_t* cimage);
SK_C_API sk_image_t* sk_image_make_with_filter(const sk_image_t* cimage, const sk_imagefilter_t* filter, const sk_irect_t* subset, const sk_irect_t* clipBounds, sk_irect_t* outSubset, sk_ipoint_t* outOffset);

SK_C_API void sk_image_ref(const sk_image_t*);
Expand All @@ -41,6 +43,7 @@ SK_C_API sk_shader_t* sk_image_make_shader(const sk_image_t*, sk_shader_tilemode
SK_C_API bool sk_image_peek_pixels(const sk_image_t* image, sk_pixmap_t* pixmap);
SK_C_API bool sk_image_is_texture_backed(const sk_image_t* image);
SK_C_API bool sk_image_is_lazy_generated(const sk_image_t* image);
SK_C_API bool sk_image_is_valid(const sk_image_t* image, gr_context_t* context);
SK_C_API bool sk_image_read_pixels(const sk_image_t* image, const sk_imageinfo_t* dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY, sk_image_caching_hint_t cachingHint);
SK_C_API bool sk_image_read_pixels_into_pixmap(const sk_image_t* image, const sk_pixmap_t* dst, int srcX, int srcY, sk_image_caching_hint_t cachingHint);
SK_C_API bool sk_image_scale_pixels(const sk_image_t* image, const sk_pixmap_t* dst, sk_filter_quality_t quality, sk_image_caching_hint_t cachingHint);
Expand Down
1 change: 1 addition & 0 deletions include/c/sk_matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ SK_C_API void sk_matrix44_as_col_major (sk_matrix44_t* matrix, float* dst);
SK_C_API void sk_matrix44_as_row_major (sk_matrix44_t* matrix, float* dst);
SK_C_API void sk_matrix44_set_col_major (sk_matrix44_t* matrix, float* dst);
SK_C_API void sk_matrix44_set_row_major (sk_matrix44_t* matrix, float* dst);
SK_C_API void sk_matrix44_set_3x3_row_major (sk_matrix44_t* matrix, float* dst);
SK_C_API void sk_matrix44_set_translate (sk_matrix44_t* matrix, float dx, float dy, float dz);
SK_C_API void sk_matrix44_pre_translate (sk_matrix44_t* matrix, float dx, float dy, float dz);
SK_C_API void sk_matrix44_post_translate (sk_matrix44_t* matrix, float dx, float dy, float dz);
Expand Down
1 change: 1 addition & 0 deletions include/c/sk_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ SK_C_API void sk_path_add_arc(sk_path_t* cpath, const sk_rect_t* crect, float st
SK_C_API sk_path_filltype_t sk_path_get_filltype(sk_path_t*);
SK_C_API void sk_path_set_filltype(sk_path_t*, sk_path_filltype_t);
SK_C_API void sk_path_transform(sk_path_t* cpath, const sk_matrix_t* cmatrix);
SK_C_API void sk_path_transform_to_dest(sk_path_t* cpath, const sk_matrix_t* cmatrix, sk_path_t* destination);
SK_C_API sk_path_t* sk_path_clone(const sk_path_t* cpath);
SK_C_API void sk_path_add_path_offset (sk_path_t* cpath, sk_path_t* other, float dx, float dy, sk_path_add_mode_t add_mode);
SK_C_API void sk_path_add_path_matrix (sk_path_t* cpath, sk_path_t* other, sk_matrix_t *matrix, sk_path_add_mode_t add_mode);
Expand Down
7 changes: 4 additions & 3 deletions include/c/sk_pixmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ SK_C_API bool sk_pixmap_read_pixels(const sk_pixmap_t* cpixmap, const sk_imagein
SK_C_API bool sk_pixmap_scale_pixels(const sk_pixmap_t* cpixmap, const sk_pixmap_t* dst, sk_filter_quality_t quality);
SK_C_API bool sk_pixmap_extract_subset(const sk_pixmap_t* cpixmap, sk_pixmap_t* result, const sk_irect_t* subset);
SK_C_API bool sk_pixmap_erase_color(const sk_pixmap_t* cpixmap, sk_color_t color, const sk_irect_t* subset);
SK_C_API bool sk_pixmap_erase_color4f(const sk_pixmap_t* cpixmap, const sk_color4f_t* color, const sk_irect_t* subset);

SK_C_API sk_color_t sk_color_unpremultiply(const sk_pmcolor_t pmcolor);
SK_C_API sk_pmcolor_t sk_color_premultiply(const sk_color_t color);
Expand All @@ -38,9 +39,9 @@ SK_C_API void sk_color_get_bit_shift(int* a, int* r, int* g, int* b);

SK_C_API void sk_swizzle_swap_rb(uint32_t* dest, const uint32_t* src, int count);

SK_C_API bool sk_webpencoder_encode(sk_wstream_t* dst, const sk_pixmap_t* src, sk_webpencoder_options_t options);
SK_C_API bool sk_jpegencoder_encode(sk_wstream_t* dst, const sk_pixmap_t* src, sk_jpegencoder_options_t options);
SK_C_API bool sk_pngencoder_encode(sk_wstream_t* dst, const sk_pixmap_t* src, sk_pngencoder_options_t options);
SK_C_API bool sk_webpencoder_encode(sk_wstream_t* dst, const sk_pixmap_t* src, const sk_webpencoder_options_t* options);
SK_C_API bool sk_jpegencoder_encode(sk_wstream_t* dst, const sk_pixmap_t* src, const sk_jpegencoder_options_t* options);
SK_C_API bool sk_pngencoder_encode(sk_wstream_t* dst, const sk_pixmap_t* src, const sk_pngencoder_options_t* options);

SK_C_PLUS_PLUS_END_GUARD

Expand Down
Loading

0 comments on commit 6d38975

Please sign in to comment.