Commit Graph

7 Commits

Author SHA1 Message Date
Brian Salomon
9fa47cc1c6 Make class members that are static constexpr also be inline.
This is in prep for compiling with -std=c++14 and -Wno-c++17-extensions
when building with clang. Chrome has encountered problems with
third_party headers that are included both in Skia and other Chrome
sources that produce different code based on whether preprocessor macros
indicate a C++14 or C++17 compilation.

In C++17 they are already inline implicitly. When compiling with C++14
we can get linker errors unless they're explicitly inlined or defined
outside the class. With -Wno-c++17-extensions we can explicitly inline
them in the C++14 build because the warning that would be generated
about using a C++17 language extension is suppressed.

We cannot do this in public headers because we support compiling with
C++14 without suppressing the C++17 language extension warnings.

Bug: chromium:1257145
Change-Id: Iaf5f4c62a398f98dd4ca9b7dfb86f2d5cab21d66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457498
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-10-11 16:22:59 +00:00
John Stiles
7571f9e490 Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'.
Mechanically updated via Xcode "Replace Regular Expression":

  typedef (.*) INHERITED;
    -->
  using INHERITED = $1;

The ClangTidy approach generated an even larger CL which would have
required a significant amount of hand-tweaking to be usable.

Change-Id: I671dc9d9efdf6d60151325c8d4d13fad7e10a15b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314999
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-03 03:41:26 +00:00
Tyler Denniston
4ccdaf6f2d Show mirror drawn with SkStroke (toy stroker)
Improves the sample slide to draw the skeleton geometry, and a mirror
image of the current path with Skia's stroker, which makes it easier to
compare.

Change-Id: I804f4304aec6025112c8ccac3bb61139559022f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305184
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2020-07-22 18:49:20 +00:00
Tyler Denniston
baa2a7bdd2 Add path recorder class (toy stroker)
This will be used to add undo support (removing verbs and their points),
which SkPath and SkPathBuilder don't have right now.

Also did away with an unnecessary pointer indirection.

Change-Id: Iec42af8b7a69aabe1496266aaa70ddc7b4e907bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305181
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2020-07-22 18:15:40 +00:00
Tyler Denniston
e9ced4f3da Elide inner loop geometry sometimes (toy stroker)
Many times a pair of stroked line segments doesn't actually require the
inner "loop" geometry. I think I've classified where it's required into
two cases.

This CL checks for the two cases where it is necessary, and skips adding
the extra geometry if not necessary. Requires a few extra
multiplications.

Change-Id: I421e2365523c8f5b5c190b5493cbe0e0d3d3a6c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305017
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2020-07-22 14:02:28 +00:00
Tyler Denniston
f219aadebc Add inner loop geometry to miter join for toy stroker
Now the miter join matches SkStroke, adding the extra inner loop
geometry always. Next will be the harder part, which is figuring out how
to get rid of it!

Also fixed a CW/CCW rotation inconsistency to match SkStroke

Change-Id: Ie3d164053fd5683f3b678bb80f8421dc6dc48cd7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304809
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Auto-Submit: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2020-07-21 20:51:48 +00:00
Tyler Denniston
324578b553 Add toy stroker sample
I figure we can use this as an area for prototyping new/different
stroker ideas.

Currently the sample does line segments with butt caps. Miter joins
aren't correct, as it's not adding the inner loop geometry that
SkPathStroker does.  On the sample slide, any red pixels are ones that
Skia filled but the toy stroker didn't.

Change-Id: Iea5eb320d88dd1dc5c60fbb2a997f56eec4f4f1f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303588
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2020-07-21 20:04:58 +00:00