Commit Graph

20 Commits

Author SHA1 Message Date
John Stiles
7bf799956d Reland "Add format-specifier warnings to SkDebugf."
This is a reland of e58831cd95

Original change's description:
> Add format-specifier warnings to SkDebugf.
>
> This CL fixes up many existing format-specifier violations in Skia.
> Note that GCC has a warning for formatting nothing, so existing calls to
> `SkDebugf("")` have been removed, or replaced with `SkDebugf("%s", "")`.
> These were apparently meant to be used as a place to set a breakpoint.
>
> Some of our clients also use SkDebug with bad format specifiers, so this
> check is currently only enabled when SKIA_IMPLEMENTATION is true.
>
> Change-Id: I8177a1298a624c6936adc24e0d8f481362a356d0
> Bug: skia:12143
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420902
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: skia:12143
Change-Id: Id3c0c21436ebd13899908d5ed5d44c42a0e23921
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421918
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-06-25 17:57:43 +00:00
Tyler Denniston
283dba5785 Revert "Add format-specifier warnings to SkDebugf."
This reverts commit e58831cd95.

Reason for revert: looks like breaking a few build bots

Original change's description:
> Add format-specifier warnings to SkDebugf.
>
> This CL fixes up many existing format-specifier violations in Skia.
> Note that GCC has a warning for formatting nothing, so existing calls to
> `SkDebugf("")` have been removed, or replaced with `SkDebugf("%s", "")`.
> These were apparently meant to be used as a place to set a breakpoint.
>
> Some of our clients also use SkDebug with bad format specifiers, so this
> check is currently only enabled when SKIA_IMPLEMENTATION is true.
>
> Change-Id: I8177a1298a624c6936adc24e0d8f481362a356d0
> Bug: skia:12143
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420902
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: I07848c1bf8992925c9498e916744d0840355a077
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12143
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421917
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-06-25 13:33:10 +00:00
John Stiles
e58831cd95 Add format-specifier warnings to SkDebugf.
This CL fixes up many existing format-specifier violations in Skia.
Note that GCC has a warning for formatting nothing, so existing calls to
`SkDebugf("")` have been removed, or replaced with `SkDebugf("%s", "")`.
These were apparently meant to be used as a place to set a breakpoint.

Some of our clients also use SkDebug with bad format specifiers, so this
check is currently only enabled when SKIA_IMPLEMENTATION is true.

Change-Id: I8177a1298a624c6936adc24e0d8f481362a356d0
Bug: skia:12143
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420902
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-06-25 11:05:59 +00:00
Ben Wagner
f6cc85844f Reland "Fix sk_app macOS raster window build conditions."
The "raster" window on macOS and iOS is actually backed by GL. Fix the
build rules and code conditions to reflect this. This allows for some
sk_app applications to run on macOS and iOS with skia_use_gl=false.

> Revert:
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397737
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

> Land:
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397256
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Change-Id: Ia8a421f4818856dd90cb4847095eee0d1836d1e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398056
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-04-19 18:25:44 +00:00
Brian Osman
9d4741370c Revert "Fix sk_app macOS raster window build conditions."
This reverts commit 163ba10dde.

Reason for revert: Mac linker errors

Original change's description:
> Fix sk_app macOS raster window build conditions.
>
> The "raster" window on macOS is actually backed by GL. Fix the build
> rules and code conditions to reflect this. This allows for some sk_app
> applications to run on macOS with skia_use_gl=false.
>
> Change-Id: I5d7b37c4172079e163690faa4e55a622a6d4f844
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397256
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

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

Change-Id: Ie5fa24138e4387784c21559f28528a4c4d335626
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397737
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-17 17:41:27 +00:00
Ben Wagner
163ba10dde Fix sk_app macOS raster window build conditions.
The "raster" window on macOS is actually backed by GL. Fix the build
rules and code conditions to reflect this. This allows for some sk_app
applications to run on macOS with skia_use_gl=false.

Change-Id: I5d7b37c4172079e163690faa4e55a622a6d4f844
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397256
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-17 15:18:05 +00:00
Ben Wagner
3d9ab7e7ec Separate general defaults from Skia defaults
In the build there are some defaults which actually apply to every
use of a built-in target type, but there are some (particularaly
warnings) which apply only to targets controlled by Skia. Currently
these unwanted defaults are magically known to exist and removed
wherever they are not wanted. Instead, create 'skia_' prefixed target
templates and apply these defaults to those instead.

Change-Id: I3a2afb53c7205a2e2748d1cfad46319f2e93d3b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385516
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-03-22 15:30:56 +00:00
Ben Wagner
5d9c20ecc9 Make TextBlob 'Text' allocators public.
This will allow users to create PDFs with the actual text embedded. This
will allow for correct search and copy operations on the generated PDF.

Since these are now public, SkTextBlobBuilderPriv is no longer needed
and is removed. For consistency, the allocRunRSXform overload is renamed
to allocRunTextRSXform.

Change-Id: I44be82d9038a433e1221d5cbfd8ed113ecb6d4fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375017
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-02-24 18:48:44 +00:00
Ben Wagner
0baacb50bc Remove lang parameter from TextBlob alloc methods.
The 'lang' was never stored or used, so this makes no current practical
difference. The original intent was to be able to specify a language so
that it could be emitted as a 'Lang' override in the 'ActualText' when
generating a PDF. However, due to the way 'ActualText' is generally used
this would be impractical. If there is ever a desire to mark up sections
of the PDF with a specific language it would be better handled in a
different way.

Change-Id: Id63596190235fc45ce17249b9b578b6f9b838b2b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375060
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-02-24 17:08:04 +00:00
John Stiles
ec9b4aab87 Enable ClangTidy check readability-const-return-type.
https://clang.llvm.org/extra/clang-tidy/checks/readability-const-return-type.html

`const` on a non-pointer/reference return type typically doesn't add
value and can have negative side effects. (i.e., returning a
`const std::string` isn't meaningfully different from returning a
`std::string`, but can sometimes inhibit move-related optimizations.)

In Skia's case, the priv() functions are a notable exception where const
return types are intentional and valuable. These calls have been marked
with NOLINT to exclude them from the check.

This check does not affect pointer and reference returns, where
constness is important.

Change-Id: I86cab92332f164e5ab710b4127182eec99831d7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308564
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-07 17:42:38 +00:00
John Stiles
a6841be235 Enable ClangTidy check llvm-namespace-comment.
This fixes a large number of SkSL namespaces which were labeled as if
they were anonymous, and also a handful of other mislabeled namespaces.
Missing namespace-end comments have been added throughout.
A number of diffs are just indentation-related (adjusting 1- or 3-
space indents to 2-space).

Change-Id: I6c62052a0d3aea4ae12ca07e0c2a8587b2fce4ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308503
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-08-06 19:07:52 +00:00
Ben Wagner
5b8dd73546 Hide ICU C++ API from Skia users.
Parts of third_party need the C++ API so hide it from Skia users as
needed to prevent re-introduction.

This also avoids the ICU version renaming / name mangling when building
our own test version of ICU. This makes life in an editor and debugger
much easier.

Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292854
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Change-Id: Id636fbf9e750fe72a4ace8a59fb9acac839a07c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292967
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-05-29 21:43:19 +00:00
Ben Wagner
2837f24a16 Revert "Hide ICU C++ API from Skia users."
This reverts commit 5ef0d2f6c0.

Reason for revert: Sharing a build with flutter is crazy pants.

Original change's description:
> Hide ICU C++ API from Skia users.
> 
> Parts of third_party need the C++ API so hide it from Skia users as
> needed to prevent re-introduction.
> 
> This also avoids the ICU version renaming / name mangling when building
> our own test version of ICU. This makes life in an editor and debugger
> much easier.
> 
> Change-Id: I8fb1903e2b31e9dd04efa22173a03115d629c232
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292854
> Reviewed-by: Julia Lavrova <jlavrova@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

TBR=bungeman@google.com,reed@google.com,jlavrova@google.com

Change-Id: If238225b20a6b73064e3b16c5e0bdc89760e522d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292966
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-05-29 19:08:04 +00:00
Ben Wagner
5ef0d2f6c0 Hide ICU C++ API from Skia users.
Parts of third_party need the C++ API so hide it from Skia users as
needed to prevent re-introduction.

This also avoids the ICU version renaming / name mangling when building
our own test version of ICU. This makes life in an editor and debugger
much easier.

Change-Id: I8fb1903e2b31e9dd04efa22173a03115d629c232
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292854
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-05-29 18:04:46 +00:00
Mike Klein
dc976a96ea update skstd
- Lots of skstd::foo is now std::foo since C++14.
- Get rid of SK_WHEN(cond,T); std::enable_if_t<cond,T> is pithy enough.
- Move SkBitmaskEnum.h contents into sknonstd.

Change-Id: Ie5dc459405b1ff55e5b3ac57e70df7edd7cf38c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286315
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-30 15:05:43 +00:00
Mike Klein
a01c6b0b59 reformat GN files
Change-Id: I2d19c4f0ff1439dcd923a3064eb3ba78432a5113
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281043
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-04-01 23:23:03 +00:00
Brian Osman
788b91678f Remove SkTMin and SkTMax
Use std::min and std::max everywhere.

SkTPin still exists. We can't use std::clamp yet, and even when
we can, it has undefined behavior with NaN. SkTPin is written
to ensure that we return a value in the [lo, hi] range.

Change-Id: I506852a36e024ae405358d5078a872e2c77fa71e
Docs-Preview: https://skia.org/?cl=269357
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269357
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-07 18:40:09 +00:00
Hal Canary
b1f411ac05 tools/skui: put all enums in a common namespace
Change-Id: Icd331e8946d80652750b8b6ea0db65f5f676ac3e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238058
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-08-29 15:39:32 +00:00
Hal Canary
63b4d5880a SkPlainTextEditor/app: cycle typeface with ctrl-0
Change-Id: I0bcf38b0ec75a52df856948a85e5711a68e6585e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237430
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-08-28 15:55:36 +00:00
Hal Canary
a0b66fc79d SkPlainTextEditor: from experimental to modules
Change-Id: I8896283ee3a57af926a43f6647e27059d52dd7a8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237146
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-08-27 20:32:19 +00:00