Commit Graph

2188 Commits

Author SHA1 Message Date
Chris Bracken
72f403c343 Use Mac font manager for both iOS and macOS
If skia_use_fonthost_mac is set, use SkFontMgr_mac_ct_factory.cpp on
both macOS and iOS. Previously, this was only used on macOS, causing iOS
Flutter builds to default to SkFontMgr_empty_factory.cpp on that
platform.

Patch that introduced the Flutter iOS issue:
https://skia-review.googlesource.com/c/skia/+/295437

Change-Id: If2f1e7db47a55245de6c2658ad564e79134d3e7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297194
Commit-Queue: Chris Bracken <cbracken@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-06-17 21:50:10 +00:00
Florin Malita
4190f27b41 Fix SkParse::FindNamedColor OOB
Plus some minor cleanup and asserts.

Bug: oss-fuzz:23395

Change-Id: I667bee2d7f21864defe2fd97df9eb4e99d69d9ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296451
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-06-17 14:23:14 +00:00
John Stiles
2518f546e3 Enable implicit-fallthrough warnings on Clang.
Change-Id: I5c1e6d8fd52ecfe628a78569b4665a64e1499fa5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296938
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-17 13:02:13 +00:00
Chris Dalton
de980231f6 Add a test for wide butt caps
This tests the case where the stroke has butt caps and its width
significantly larger than the path itself. There seems to be some
uncertainty over what should actually be drawn in some of these cases,
as evidenced by the variable results from different path renderers
here.

Change-Id: I5b62ec446bfbba73d09ddb4eac710e338bedfc6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296114
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-06-16 23:00:33 +00:00
Herb Derby
a08bde606a GrTextContext::Options -> GrSDFTOptions
Rename GrTextContext::Options to GrSDFTOptions. Remove GrTextContext.

TBR=reed@google.com

Change-Id: Ic89966cfe630cc6ee757977a6d63ae1da9e39ef0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296176
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-15 17:14:04 +00:00
Greg Daniel
01f278c834 Better handle backendFormat to CompressionType.
We also fix getReadSwizzle with this change.

Change-Id: I1989d8347dc97d7a4c75aa9094a0146419c6d8fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295819
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-12 21:47:14 +00:00
Adlai Holler
1bdbe55135 Cache last-accessed entry in lastRenderTask table.
This table is really hot during drawing and we saw a regression when
it was introduced. This change provides wins locally but I don't have
the regressed hardware handy.

Additionally, we change from SkGoodHash to the MixCheap function used by
some other small tables in the library.

Bug: skia:10372
Change-Id: Ic2dfbf41649515245e82cbcc9765cb29270eb5cf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295878
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-12 16:11:19 +00:00
John Stiles
796e7022ee Reland "Fetch clang-format automatically when compiling .fp files."
This is a reland of a25422faa4

Original change's description:
> Fetch clang-format automatically when compiling .fp files.
>
> On a freshly fetched repo, setting `skia_compile_processors = true` will
> fail to compile because clang-format is missing from the bin directory.
> This CL automatically runs fetch-clang-format for you when clang-format
> is absent.
>
> Change-Id: Ieeb359176072e92ca235316c820310333732f608
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295780
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Change-Id: Ib397716771f742f192ebd6ed7ec0a9915b2400c5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295956
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-12 13:21:41 +00:00
Chris Dalton
f26e596822 Duplicate ccpr/GrCCStrokeGeometry to tessellate/GrStrokeGeometry
CCPR stroking is not enabled by default and will eventually be
removed. This CL is a step toward migrating it to an MSAA version.

Change-Id: I565bea1c91c51bcd1ea3766aee6e4702adf3b09e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295608
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-06-11 21:59:23 +00:00
Robert Phillips
de2bca28cb Add new GM to exercise Vulkan YCbCr images
This will also expose the Vulkan precompilation path to immutable samplers.

Change-Id: Ida31bd70455299fbcc8f4d728aa15179f7685311
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295799
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-06-11 20:58:16 +00:00
John Stiles
21bbfc6c2d Revert "Fetch clang-format automatically when compiling .fp files."
This reverts commit a25422faa4.

Reason for revert: breaks Windows build

Original change's description:
> Fetch clang-format automatically when compiling .fp files.
> 
> On a freshly fetched repo, setting `skia_compile_processors = true` will
> fail to compile because clang-format is missing from the bin directory.
> This CL automatically runs fetch-clang-format for you when clang-format
> is absent.
> 
> Change-Id: Ieeb359176072e92ca235316c820310333732f608
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295780
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

TBR=mtklein@google.com,johnstiles@google.com

Change-Id: If6412e74a16aa515c223d5d4f326780c8a69766f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295832
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-11 20:36:05 +00:00
Ben Wagner
ee2ffc3b43 Delete .a file before writing static library.
The ar utility only adds symbols. As a result removed symbols are
sometimes still present in later builds, leading to great confusion.
Delete the .a file before recreating it with ar.

This is similar to what Chromium currently does in gcc_toolchain.gni.
However, we cannot always just use 'rm' because of the build for Android
on Windows, so this introduces 'rm.py' which is just like 'cp.py' but
without the copy part.

Bug: skia:10363
Change-Id: Icc0c3d18dab1e48ccfec47386662c7b4d2dc8811
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295569
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-11 17:19:23 +00:00
John Stiles
a25422faa4 Fetch clang-format automatically when compiling .fp files.
On a freshly fetched repo, setting `skia_compile_processors = true` will
fail to compile because clang-format is missing from the bin directory.
This CL automatically runs fetch-clang-format for you when clang-format
is absent.

Change-Id: Ieeb359176072e92ca235316c820310333732f608
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295780
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-11 17:19:22 +00:00
Ben Wagner
75626e4b1a Regularize selection of fontmgr.
Change-Id: Id7c51504450c1c7c9421eba3838bd6bc3440ca4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295437
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-11 12:28:03 +00:00
Brian Osman
ff7bee9817 Remove SkReader32, and some API from SkWriter32
After removing all unused API from SkReader32, it only had a handful
of functions, and it was (rightly) only used by SkReadBuffer. Remove
the temptation to use it by just folding it into SkReadBuffer.

SkWriter32 had some unnecessary functions as well (only used in unit
tests), so those are gone. There is still a strange relationship:
SkWriteBuffer is just an interface - SkReadBuffer is actually the
complement of SkBinaryWriteBuffer/SkWriter32. Those two classes produce
data in the exact same format, but with slightly different interfaces.
(The choice about which one is used is mostly about high-level
serialization vs. low-level helpers).

Change-Id: I1e823755febecd2e053ea732b21295d8f4d9d832
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295557
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-06-10 16:45:56 +00:00
Ben Wagner
771d3a214e Revert "Delete .a file before writing static library."
This reverts commit 3b035e0417.

Reason for revert: Build-Win-Clang-arm64-Release-Android runs on
                   Windows and uses llvm-ar.

Original change's description:
> Delete .a file before writing static library.
> 
> The ar utility only adds symbols. As a result removed symbols are
> sometimes still present in later builds, leading to great confusion.
> Delete the .a file before recreating it with ar.
> 
> This is similar to what Chromium currently does in gcc_toolchain.gni.
> 
> Bug: skia:10363
> Change-Id: I133deb6da570ca38a539b4f0bb486b61d6a664bf
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295217
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

TBR=mtklein@google.com,bungeman@google.com

Change-Id: I02ba93ce26eedb2b2362e96d2ebfcacbfb8e0902
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10363
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295445
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-06-10 13:44:39 +00:00
Ben Wagner
3b035e0417 Delete .a file before writing static library.
The ar utility only adds symbols. As a result removed symbols are
sometimes still present in later builds, leading to great confusion.
Delete the .a file before recreating it with ar.

This is similar to what Chromium currently does in gcc_toolchain.gni.

Bug: skia:10363
Change-Id: I133deb6da570ca38a539b4f0bb486b61d6a664bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295217
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-10 13:25:05 +00:00
Jim Van Verth
f43da14878 Add D3D descriptor tables and bind to command list.
This CL adds a new descriptor heap manager that handles creation of
descriptor tables, or ranges of shader-visible descriptors. These
are used to set the descriptors that match the setup of the root
signature. Data from non-shader-visible descriptors are copied into
these tables, and then they are bound to the command list.

Change-Id: Ia9fc24cae602244525a196025c044df3c2435d9f
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294300
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-06-10 01:05:03 +00:00
Chris Dalton
392fa03a1b Add an interactive sample that fits cubics to circular arcs
Fits a cubic to an arc on the unit circle using the following
constraints:

  1) The endpoints and tangent directions at the endpoints must match
     the arc.
  2) The cubic must be symmetric (length(p1 - p0) == length(p3 - p2)).
  3) The height of the cubic must match the height of the arc.

Using the above constraints, we arrive at the following formula for the
control length (c) (i.e., lengths of (p1 - p0) and (p3 - p2)):

  d = x0*x1 + y0*y1
  c = (sqrt(1 + d) * kM + kA) * rsqrt(1 - d)

(Where x0,y0,x1,y1 are the endpoints, kM = -4/3, and kA = 4/3 * sqrt(2).)

The sample also comes with a root finder that finds the max error value
of the curve, which ends up serving as a semi-formal proof that:

  1) Max error always occurs at T=0.21132486540519, regardless of
     endpoints.
  2) Error is reduced by exactly 64x each time we halve the arc angle

Change-Id: I29ad60dda06743d79f71275c38ffdd97261159ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295303
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-06-09 23:04:03 +00:00
Mike Klein
45f36b5b55 ignore SK_DISABLE_READBUFFER
Its effect is small and we want to rely on SkReadBuffer being available.

Size changes:

    - canvaskit uncompressed: 6,864,481 --> 6,864,481  (  no change  )
    - canvaskit   compressed: 2,667,117 --> 2,667,117  (  no change  )
    -   pathkit uncompressed:   329,187 -->   330,679  (+ 1.5K, +0.5%)
    -   pathkit   compressed:   134,158 -->   134,672  (+ 0.5K, +0.4%)
    -   flutter             : 1,302,108 --> 1,322,568  (+20.0K, +1.6%)

The Flutter change is the biggest mystery, as bloaty only pegs
SkReadBuffer as 3.9K.  The rest must come from other files including
SkReadBuffer.h not being able to see and inline away SkReadBuffer
routines?  Feels like SK_DISABLE_EFFECT_DESERIALIZATION isn't trimming
enough?

PS 4-6 have an idea to push SK_DISABLE_EFFECT_DESERIALIZATION further.

Change-Id: Ifda3ccb82dd0636cfed6bb826fb185a7bca2cbe0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295061
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-06-09 16:16:57 +00:00
John Stiles
fe64410954 Remove PremulInput and GrPremulInputFragmentProcessor.fp from Skia.
This FP was unused and not referenced anywhere in the codebase.

Change-Id: I27f963d7c26382101b585f356a75d84cef5ab237
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295080
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-08 21:04:46 +00:00
Florin Malita
26ae40f668 Reland "[skrive] Initial parser plumbing"
This reverts commit e923ae1be4.


Original change's description:
> Revert "[skrive] Initial parser plumbing"
> 
> This reverts commit 00a96f2c99.
> 
> Reason for revert: breaking wuffs 
> 
> Original change's description:
> > [skrive] Initial parser plumbing
> > 
> > TBR=
> > Change-Id: If96d81840b5bb3bc8c6e26f8aacca4d9dd8896e3
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293677
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
> > Commit-Queue: Florin Malita <fmalita@chromium.org>
> 
> TBR=fmalita@chromium.org,reed@google.com
> 
> Change-Id: I63258d560cc8ee8d069e6417d987342a74a3f0c2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295001
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org,reed@google.com

# Not skipping CQ checks because this is a reland.

Change-Id: I0a671bb7476ee92c365fbea1f156c73c6954fe40
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295003
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-06-08 16:38:59 +00:00
Florin Malita
e923ae1be4 Revert "[skrive] Initial parser plumbing"
This reverts commit 00a96f2c99.

Reason for revert: breaking wuffs 

Original change's description:
> [skrive] Initial parser plumbing
> 
> TBR=
> Change-Id: If96d81840b5bb3bc8c6e26f8aacca4d9dd8896e3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293677
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: I63258d560cc8ee8d069e6417d987342a74a3f0c2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295001
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-06-08 15:22:15 +00:00
Florin Malita
00a96f2c99 [skrive] Initial parser plumbing
TBR=
Change-Id: If96d81840b5bb3bc8c6e26f8aacca4d9dd8896e3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293677
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-06-08 14:23:34 +00:00
Michael Ludwig
9cced93b7a Handle color and stencil clears in GrClearOp
With prior changes, it became "clear" that GrClearOp and
GrClearStencilClipOp behaved very similarly, except that the stencil
op did not have any onCombine logic.

This just combines them in to a single clear op that will call the
render pass's clear and stencil clear functions as needed. I also
implemented combine logic to apply color and stencil clears in a single
op if the scissor state was compatible (although there's no render pass
API to combine the two clears into a single GPU function).

Change-Id: I8aa749fe64cc487d187854fd0acf6b03b86f1356
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290822
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2020-06-08 14:05:16 +00:00
Ben Wagner
0ef90dd5e9 Split out coretext fontmgr factory.
There can be only one SkFontMgr::Factory, so each should go in its own
translation unit. In addition, the name SkFontHost_mac is now rather out
of date and should now be SkFontMgr_mac_ct. Since the additional burden
of additional build changes after the first is minimal, also split out
SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
which are replacing it. Once references to it are removed from all
builds it can be removed.

This is intended to be a reorganization without much code change. Most
changes are simple renaming of functions which are now shared between
translation units. However, there are a few behavior changes here.
  * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
  * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
  * SkFontMgr_New_CoreText takes a CTFontCollectionRef.

Change-Id: Iac548f9fd920c426ea5c6dcdefe8da0a9b89ec90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294704
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294714
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-06-06 04:06:32 +00:00
Mike Klein
bb5b2a17c2 Revert "Split out coretext fontmgr factory."
This reverts commit 2c628340f4.

Reason for revert: ios-simulator chrome bot:

FAILED: obj/skia/x64/skia_unittests 
TOOL_VERSION=1591394828 ../../build/toolchain/mac/linker_driver.py -Wcrl,strippath,/opt/s/w/ir/cache/xcode_ios_11e146.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip ../../third_party/llvm-build/Release+Asserts/bin/clang++ -B /opt/s/w/ir/cache/xcode_ios_11e146.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/  -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker obj/skia/skia_unittests.xcent -Wl,-fatal_warnings -arch x86_64 -Werror -nostdlib++ -isysroot sdk/xcode_links/iPhoneSimulator13.4.sdk -mios-simulator-version-min=12.0 -Wl,-ObjC -o "obj/skia/x64/skia_unittests" -Wl,-filelist,"obj/skia/x64/skia_unittests.rsp" -framework UIKit  -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework UIKit -framework Security
Undefined symbols for architecture x86_64:
  "SkCTFontGetSmoothBehavior()", referenced from:
      SkTypeface_Mac::onFilterRec(SkScalerContextRec*) const in libskia.a(SkFontHost_mac.o)
      SkScalerContext_Mac::generateImage(SkGlyph const&) in libskia.a(SkFontHost_mac.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Original change's description:
> Split out coretext fontmgr factory.
> 
> There can be only one SkFontMgr::Factory, so each should go in its own
> translation unit. In addition, the name SkFontHost_mac is now rather out
> of date and should now be SkFontMgr_mac_ct. Since the additional burden
> of additional build changes after the first is minimal, also split out
> SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
> SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
> which are replacing it. Once references to it are removed from all
> builds it can be removed.
> 
> This is intended to be a reorganization without much code change. Most
> changes are simple renaming of functions which are now shared between
> translation units. However, there are a few behavior changes here.
>   * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
>   * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
>   * SkFontMgr_New_CoreText takes a CTFontCollectionRef.
> 
> Change-Id: I897f69f2f5ea06819f5daa964c09cdd36490af85
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294704

TBR=mtklein@google.com,bungeman@google.com

Change-Id: I5abeb7598c7f533477b4a4af5b568f7cbe6e8644
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294734
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-05 23:16:49 +00:00
Ben Wagner
2c628340f4 Split out coretext fontmgr factory.
There can be only one SkFontMgr::Factory, so each should go in its own
translation unit. In addition, the name SkFontHost_mac is now rather out
of date and should now be SkFontMgr_mac_ct. Since the additional burden
of additional build changes after the first is minimal, also split out
SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
which are replacing it. Once references to it are removed from all
builds it can be removed.

This is intended to be a reorganization without much code change. Most
changes are simple renaming of functions which are now shared between
translation units. However, there are a few behavior changes here.
  * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
  * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
  * SkFontMgr_New_CoreText takes a CTFontCollectionRef.

Change-Id: I897f69f2f5ea06819f5daa964c09cdd36490af85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294704
2020-06-05 21:40:46 +00:00
Mike Klein
6f56f2ed3f port skx opts to old style
Change-Id: I364365455cc3580f38ddd189f00050ea9e2238a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294565
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-06-05 20:35:08 +00:00
Ben Wagner
aa10dfeec9 Revert "Split out coretext fontmgr factory."
This reverts commit 5c14d63297.

Reason for revert: chromium 'analyze' doesn't do a good job

Original change's description:
> Split out coretext fontmgr factory.
> 
> There can be only one SkFontMgr::Factory, so each should go in its own
> translation unit. In addition, the name SkFontHost_mac is now rather out
> of date and should now be SkFontMgr_mac_ct. Since the additional burden
> of additional build changes after the first is minimal, also split out
> SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
> SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
> which are replacing it. Once references to it are removed from all
> builds it can be removed.
> 
> This is intended to be a reorganization without much code change. Most
> changes are simple renaming of functions which are now shared between
> translation units. However, there are a few behavior changes here.
>   * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
>   * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
>   * SkFontMgr_New_CoreText takes a CTFontCollectionRef.
> 
> Change-Id: Iaf58a0371667f266ada20c918941fab6bc27d9df
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

TBR=mtklein@google.com,bungeman@google.com

Change-Id: I469084efbfc71bba60e5fbfb4eb7152d57324d0c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294703
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-06-05 20:32:52 +00:00
Ben Wagner
5c14d63297 Split out coretext fontmgr factory.
There can be only one SkFontMgr::Factory, so each should go in its own
translation unit. In addition, the name SkFontHost_mac is now rather out
of date and should now be SkFontMgr_mac_ct. Since the additional burden
of additional build changes after the first is minimal, also split out
SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
which are replacing it. Once references to it are removed from all
builds it can be removed.

This is intended to be a reorganization without much code change. Most
changes are simple renaming of functions which are now shared between
translation units. However, there are a few behavior changes here.
  * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
  * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
  * SkFontMgr_New_CoreText takes a CTFontCollectionRef.

Change-Id: Iaf58a0371667f266ada20c918941fab6bc27d9df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-05 19:22:38 +00:00
Mike Klein
ad56c4c143 add structure for normal SKX opts
My experience porting the old opts over to the current SKX opts setup
was so bad that I don't want to try any more, and think it's probably
safer to port the SKX code to the old setup.

Need to hook up dependents (Chromium and Google3 I think) before we can
move the actual SXK opts code over.

Change-Id: Ibb8bc4a083cb104cd39f27cbfbc16e9eedd9bd46
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294495
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-05 13:48:39 +00:00
John Stiles
eed56f0fe5 Update GrFragmentProcessor::SwizzleOutput to use a child FP.
We are updating FPs to receive their input via a child FP where
possible, instead of relying on the input color.

This CL also adds a GM test for SwizzleOutput, since this did not appear
to be covered by existing unit tests.

Change-Id: I3d8176395bb42eab7ff471c9137597402b5b3a69
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293884
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-06-04 17:31:46 +00:00
Ben Wagner
d13487e71b Regularize SkFontMgr for CoreText build.
Move SkFontHost_mac.cpp into an 'optional' like the other fontmgr build
rules. This allows building with other fontmgrs on Mac and makes the lib
dependencies explicit. In the future this helps with splitting the out
the default factory.

Change-Id: Iecef9e428acb69f89b54afa00b4e779f5858c61a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294076
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-04 16:45:09 +00:00
Mike Klein
1faaa97f80 Revert "apply SkOpts_skx approach to SkOpts_hsw"
This reverts commit 08a39c2b5f.

Reason for revert: Flutter roll?

Original change's description:
> apply SkOpts_skx approach to SkOpts_hsw
> 
> Very slightly different build flags, switching from -march=haswell to
> -mavx2 -mfma -mf16c, but there are no diffs.
> 
> Left some TODOs for the next ones, but _hsw being so common I figured
> I'd do this one stand alone and make sure it shakes down before doing
> the rest.
> 
> clang-cl (but not clang) barfs when we've got a lambda using an AVX
> intrinsic inside a templated static helper function. Luckily they're
> all non-type template parameters, so we can just pass them as normal
> arguments, and it'll optimize the same as the templated code anyway.
> 
> This was weird, but since we're covering almost all the SkFoo_opts.h
> headers with HSW here, I don't anticipate this being a problem in the
> future.  (And I'm sure I'll never look back on this statement as naive.)
> 
> Change-Id: I2f84db356cafa5e158bcc3724fb1c3f58aca7f1e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293599
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,herb@google.com,reed@google.com

Change-Id: If3a75158d6e017f180d9e38d9ba296a0d72e1384
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294281
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-04 14:20:36 +00:00
Mike Klein
7f5b734505 Revert "finish new-style opts"
This reverts commit 4272d071d9.

Reason for revert: Flutter roll?

Original change's description:
> finish new-style opts
> 
> Nothing super interesting.
> 
> SkOpts_crc32.cpp is worth looking at
> as the only non-x86 code.
> 
> I marked a few places I think we can
> trim to save code size as follow ups.
> 
> Change-Id: Ifdc8f4d1495ff56df5d2cdde39f7e9a6ac2b1277
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294019
> Auto-Submit: Mike Klein <mtklein@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Herb Derby <herb@google.com>

TBR=mtklein@google.com,herb@google.com

Change-Id: Idbb914788489bdc5941f7fed23bf26d35d90dca4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294280
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-04 14:20:17 +00:00
Herb Derby
64aa5138c7 Remove SkAtlasTextTarget
I can find no references to SkAtlasTextTarget in AOSP or in Chromium.
With google3 CL/314226466 there are no more uses in Google3.

Change-Id: I60b5f06fc17c0e4f8d008886c96645475e3d48e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293839
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-06-04 03:52:35 +00:00
Mike Klein
4272d071d9 finish new-style opts
Nothing super interesting.

SkOpts_crc32.cpp is worth looking at
as the only non-x86 code.

I marked a few places I think we can
trim to save code size as follow ups.

Change-Id: Ifdc8f4d1495ff56df5d2cdde39f7e9a6ac2b1277
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294019
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-06-04 03:51:45 +00:00
Mike Klein
08a39c2b5f apply SkOpts_skx approach to SkOpts_hsw
Very slightly different build flags, switching from -march=haswell to
-mavx2 -mfma -mf16c, but there are no diffs.

Left some TODOs for the next ones, but _hsw being so common I figured
I'd do this one stand alone and make sure it shakes down before doing
the rest.

clang-cl (but not clang) barfs when we've got a lambda using an AVX
intrinsic inside a templated static helper function. Luckily they're
all non-type template parameters, so we can just pass them as normal
arguments, and it'll optimize the same as the templated code anyway.

This was weird, but since we're covering almost all the SkFoo_opts.h
headers with HSW here, I don't anticipate this being a problem in the
future.  (And I'm sure I'll never look back on this statement as naive.)

Change-Id: I2f84db356cafa5e158bcc3724fb1c3f58aca7f1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293599
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-03 21:34:05 +00:00
Mike Reed
579c295b6b Android test to depend on icu and harfbuzz.
Enable shaper and paragraph tests to run on Android builds.

Change-Id: Ib1685653ac4432a04998aed56dc76b9020253e75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293244
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-06-02 21:26:25 +00:00
Mike Klein
77a233283c does -fms-compatibility-version=19 still matter?
Change-Id: Ifb47c6be05bffad4a42030f4375dcbe0fe313ae0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293656
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-02 18:41:44 +00:00
Mike Klein
fdd542f807 roll clang_win
I was hoping this might fix the issues I'm seeing in the dependent CL.
It doesn't, but it's probably worth rolling every few months anyway.

Change-Id: I6d748d9e1a5bf908df78e989a624f2dccb1bd189
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293604
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-02 17:41:34 +00:00
John Stiles
f10581872c Add headers to SkSL GN file.
This makes it easier to work with SkSL files when using an IDE.

Change-Id: I30665478a9cde63b4c9ba7e5a9948e9647f7ef81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293571
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-06-02 17:28:24 +00:00
Leon Scroggins III
1adcac52d6 Remove transform_scanline from SkWebpEncoder
Bug: skia:10178

These functions can be performed generically using SkRasterPipeline
or skcms. Further, the reason we used a function pointer anyway was
so that we could call the same function on each row separately. But
libwebp's API doesn't let us do a single row at a time anyway.
Simplify this method by using readPixels when necessary and
skipping conversion entirely when possible.

Add support for encoding from unpremul 4444. It is simpler to support
it, and it's not obvious why we didn't support it before.

Keep the behavior of not supporting A8, and apply the same to the
other alpha-only formats. Note that we could support encoding such an
image to alpha, r=0, g=0, b=0, but I'd rather leave adding that
feature to a separate change, which enables it for all encoders (and
accounts for the internal use of PNGs as a round-trip for
kAlpha_8_SkColorType).

Add GMs to test the newly supported SkColorTypes.

Change-Id: I4d86c5621792fb6dc3cb68b736a1eb35d577e3a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292962
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-02 15:37:29 +00:00
Mike Klein
89c909efee Wsign-conversion for public headers
This is an Android request for our public headers,
much like warning about unused parameters.  See bug.

In general I've made two kinds of source changes:

   1) more commonly, explicitly cast to the type which
      is being implicitly cast to at head;

   2) less commonly, flip signedness of a value we're
      storing to match how it's used more smoothly.

Much of this is self inflicted inconsistent use of size_t, unsigned,
int, int32_t, uint32_t, etc.  SkTArray is particularly tricky because
of its std::vector half-compatibility.  E.g. resize() takes size_t,
but operator[] takes int.    ¯\_(ツ)_/¯

Bug: skia:9847
Change-Id: I64626a529e1662b3d3020bc03d477fc641eda544
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293436
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-02 12:34:54 +00:00
Jim Van Verth
3eadce263c Create ring buffer for managing D3D uniforms.
* Adds a base class for the ring buffer (to be used by Metal as well),
  which tracks the current available space. APIs will need to
  implement creation of the buffer in the subclass.
* The API implementation will need to store SubmitData on command buffer
  submit, and then pass it to finishSubmit when the command buffer
  finishes.

Change-Id: I4cc5e4a72d259ee9d15dac0e964819d4562da3d7
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291936
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-06-01 20:38:40 +00:00
Brian Osman
273944ac7c Convert GrMatrixEffect to pure CPP/H
Prelude to adding situational optimizations

Change-Id: Ie7994a87380ba6135398c9a1d4b26cea6bf32fa8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292972
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-06-01 14:33:57 +00:00
Greg Daniel
6c6caf420a Add GrBackendMutableState object to handle shared texture state.
This is will be the main struct used to synchronize changes of certain
texture/image between clients and Skia. With this change we
implement support for the Vulkan shared state as POC.

Bug: skia:10254
Change-Id: I10543357635c347838b193874e4da4496a0dcf06
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292311
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-05-29 16:53:08 +00:00
Jim Van Verth
afd4113bc3 Change D3DAttachmentViewManager to handle all CPU descriptors
Change-Id: I6af3673a9dedf0a5acfbd588bfbbb447b5c68013
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292576
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-05-28 15:34:59 +00:00
Greg Daniel
55822f17bd Add submittedProc to GrFlushInfo.
Bug: skia:10118
Change-Id: Iad848310d0f2fb22f19e9890209548fda103bd27
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291078
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-05-27 12:48:43 +00:00