Commit Graph

44 Commits

Author SHA1 Message Date
Greg Daniel
95581bbba1 Allow caps on hairlines for gpu dashed lines
Bug: skia:
Change-Id: Ie3b61e0a308f7cbec65166f2f2ac4fe3cc5d16d0
Reviewed-on: https://skia-review.googlesource.com/21364
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2017-06-30 15:21:10 +00:00
Greg Daniel
5fb30566b4 Fix gpu dashing for case when circle dashes are large enough to overlap
Bug: skia:
Change-Id: I7153b28103c5ca0947c37d57357b64bf2aa884e5
Reviewed-on: https://skia-review.googlesource.com/20979
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-06-29 16:56:49 +00:00
Cary Clark
2a475eae62 add drawString helper to canvas
Many tests and examples use drawText with
a guess of how long the text is in bytes,
or a call to strlen(). Add a helper to
SkCanvas to simplify these examples.

Add another helper for SkString.

R=reed@google.com

Change-Id: I0204a31e938f065606f08ee7cd9a6b36db791ee2
Reviewed-on: https://skia-review.googlesource.com/13642
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Cary Clark <caryclark@skia.org>
2017-04-28 20:41:04 +00:00
Mike Klein
33d2055e59 GM: some header cleanup
gm.h includes sk_tool_utils.h but does not use it.

The bulk of this CL makes each gm that uses sk_tool_utils include it.

sk_tool_utils.h also provided SkRandom and SkTDArray,
so a couple GMs add those headers too.

Change-Id: Ieb2a7c542f0ca89c3223f744fc11b0ff37af36c1
Reviewed-on: https://skia-review.googlesource.com/10014
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
2017-03-22 18:11:49 +00:00
mtklein
dbfd7ab108 Replace a lot of 'static const' with 'constexpr' or 'const'.
'static const' means, there must be at most one of these, and initialize it at
compile time if possible or runtime if necessary.  This leads to unexpected
code execution, and TSAN* will complain about races on the guard variables.

Generally 'constexpr' or 'const' are better choices.  Neither can cause races:
they're either intialized at compile time (constexpr) or intialized each time
independently (const).

This CL prefers constexpr where possible, and uses const where not.  It even
prefers constexpr over const where they don't make a difference... I want to have
lots of examples of constexpr for people to see and mimic.

The scoped-to-class static has nothing to do with any of this, and is not changed.

* Not yet on the bots, which use an older TSAN.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2300623005

Review-Url: https://codereview.chromium.org/2300623005
2016-09-01 11:24:54 -07:00
reed
6dc14aab5e adjust gm bounds for better content fit
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1876753003

TBR=djsollen

Review URL: https://codereview.chromium.org/1876753003
2016-04-11 07:46:38 -07:00
halcanary
9d524f22bf Style bikeshed - remove extraneous whitespace
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1842753002

Review URL: https://codereview.chromium.org/1842753002
2016-03-29 09:03:53 -07:00
reed
a439334b6e Reland of "switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.org/1813553005/ )"
This reverts commit f28ad89427.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1813123003

TBR=

Review URL: https://codereview.chromium.org/1813123003
2016-03-18 11:22:57 -07:00
reed
f28ad89427 Revert of switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.org/1813553005/ )
Reason for revert:
some build breaks, possibly related to paint having to know what a patheffect is

Original issue's description:
> switch patheffects over to sk_sp
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1813553005
>
> Committed: https://skia.googlesource.com/skia/+/9fbee18f691a0afed1e38a851048ce06063505ed

TBR=caryclark@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1817543002
2016-03-18 10:17:27 -07:00
reed
9fbee18f69 switch patheffects over to sk_sp
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1813553005

Review URL: https://codereview.chromium.org/1813553005
2016-03-18 10:00:32 -07:00
caryclark
eb75c7db3a allow one zero length dash
If the constructed stroke that represents a dash has a
single dash of length zero, and the end cap is square or
round, draw the cap.

The old code initialized the initial dash length to zero,
making it ambiguous whether the first length is zero or
not.

R=robertphillips@google.com
BUG=583299
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1805963002

Committed: https://skia.googlesource.com/skia/+/5e1a24808415df2748822e8082e21a361362cdfe

Review URL: https://codereview.chromium.org/1805963002
2016-03-18 06:04:26 -07:00
bungeman
6f0749cfc7 Revert of allow one zero length dash (patchset #8 id:140001 of https://codereview.chromium.org/1805963002/ )
Reason for revert:
Causes the dash bench to crash.

Example crash:
https://build.chromium.org/p/client.skia/builders/Perf-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release/builds/5581/steps/nanobench/logs/stdio

Original issue's description:
> allow one zero length dash
>
> If the constructed stroke that represents a dash has a
> single dash of length zero, and the end cap is square or
> round, draw the cap.
>
> The old code initialized the initial dash length to zero,
> making it ambiguous whether the first length is zero or
> not.
>
> R=robertphillips@google.com
> BUG=583299
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1805963002
>
> Committed: https://skia.googlesource.com/skia/+/5e1a24808415df2748822e8082e21a361362cdfe

TBR=robertphillips@google.com,reed@google.com,caryclark@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=583299

Review URL: https://codereview.chromium.org/1808303004
2016-03-18 05:10:23 -07:00
caryclark
5e1a248084 allow one zero length dash
If the constructed stroke that represents a dash has a
single dash of length zero, and the end cap is square or
round, draw the cap.

The old code initialized the initial dash length to zero,
making it ambiguous whether the first length is zero or
not.

R=robertphillips@google.com
BUG=583299
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1805963002

Review URL: https://codereview.chromium.org/1805963002
2016-03-18 04:44:23 -07:00
caryclark
1aaadbd2fe make sausages rounder and portable
TBR=bungeman@google.com
BUG=226341
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1808203003

Review URL: https://codereview.chromium.org/1808203003
2016-03-17 07:01:49 -07:00
caryclark
d7ea92f2ff pass cap to dash text
Pass the paint cap parameter through to text rendering so
that dashed text draws correctly.

R=bungeman@google.com
BUG=226341
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1776983002

Review URL: https://codereview.chromium.org/1776983002
2016-03-16 07:34:02 -07:00
caryclark
70e6d6074a add new tests
These tests are for upcoming changes to optimize
the path edge list.

TBR=reed@google.com
BUG=573166
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1651573002

Review URL: https://codereview.chromium.org/1651573002
2016-01-30 10:11:21 -08:00
caryclark
f97aa74fea fix large dashed paths
Paths with lots of points exceed the 32767 point index.
Make the index larger, add a test, and allow the
t value to use the extra bits.

R=reed@google.com,fmalita@chromium.org
BUG=skia:3501
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1534223002

Review URL: https://codereview.chromium.org/1534223002
2015-12-18 07:03:13 -08:00
egdaniel
c00389e45a Fix gpu dashing for case where all intervals are 0.
BUG=skia:4409

Review URL: https://codereview.chromium.org/1381803005
2015-10-05 08:11:49 -07:00
halcanary
385fe4d4b6 Style Change: SkNEW->new; SkDELETE->delete
DOCS_PREVIEW= https://skia.org/?cl=1316123003

Review URL: https://codereview.chromium.org/1316123003
2015-08-26 13:07:49 -07:00
mtklein
36352bf5e3 C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla}
NOPRESUBMIT=true

BUG=skia:
DOCS_PREVIEW= https://skia.org/?cl=1037793002

Review URL: https://codereview.chromium.org/1037793002
2015-03-25 18:17:32 -07:00
mtklein
1c4029296f remove unused GM flags
Depends on https://codereview.chromium.org/873753002/

Thumbs up to CLion for refactoring this for me.

BUG=skia:

Review URL: https://codereview.chromium.org/867963004
2015-01-23 11:07:08 -08:00
mtklein
cf5d9c993d Spin off GM::runAsBench() from flags.
This will let us kill flags.

BUG=skia:

Review URL: https://codereview.chromium.org/873753002
2015-01-23 10:31:45 -08:00
mtklein
72c9faab45 Fix up all the easy virtual ... SK_OVERRIDE cases.
This fixes every case where virtual and SK_OVERRIDE were on the same line,
which should be the bulk of cases.  We'll have to manually clean up the rest
over time unless I level up in regexes.

for f in (find . -type f); perl -p -i -e 's/virtual (.*)SK_OVERRIDE/\1SK_OVERRIDE/g' $f; end

BUG=skia:

Review URL: https://codereview.chromium.org/806653007
2015-01-09 10:06:40 -08:00
egdaniel
21402e3851 Bug fix for cull_line in SkDashPathEffect.
In cull_line we must also check if both points are the same. Otherwise we
fail the assert in the else "SkASSERT(dy && !dx)".

This is currently blocking the roll as it fails a webkit test.

BUG=skia:

Review URL: https://codereview.chromium.org/703783002
2014-11-05 05:02:27 -08:00
robertphillips
9f2251c73e Crop the fast path dashed lines to the cull rect
Without:

maxrss  loops   min     median  mean    max     stddev  samples         config  bench
  56M   1       13.3ms  13.6ms  13.6ms  14.2ms  2%      Ooooo.....      8888    GM_dashing5_bw
  56M   13      390us   417us   416us   459us   5%      ooooO..o.o      gpu     GM_dashing5_bw
  56M   1       13.4ms  13.9ms  14.1ms  15ms    3%      Oooo..ooOo      8888    GM_dashing5_aa
  56M   13      402us   421us   416us   425us   2%      Ooo.ooOOOO      gpu     GM_dashing5_aa

With:

  40M   1       1.53ms  1.54ms  1.54ms  1.55ms  0%      oo.O...o..      8888    GM_dashing5_bw
  40M   12      407us   412us   415us   445us   3%      ...Oo.....      gpu     GM_dashing5_bw
  40M   1       1.7ms   1.7ms   1.7ms   1.72ms  0%      o.O.......      8888    GM_dashing5_aa
  43M   13      405us   409us   409us   415us   1%      ooo.Ooo..o      gpu     GM_dashing5_aa

The GM images (including the new one) are the same with and without this CL.

BUG=428296

Review URL: https://codereview.chromium.org/699623003
2014-11-04 13:33:50 -08:00
egdaniel
e61c411c12 Use vertex attributes for dash effect in gpu
This will allow us to batch dashed lines together when drawing. Also, this removes the need for
a coord transform matrix in the shader, thus we save the cost of uploading a new matrix uniform
everytime we do a simple transform to the dashed line we are drawing.

BUG=skia:
R=bsalomon@google.com

Author: egdaniel@google.com

Review URL: https://codereview.chromium.org/326103002
2014-06-12 10:24:21 -07:00
tfarina
f539318f0d Cleanup: Get rid of make_isize() function from gm.h.
This helper function is not necessary.

The same thing can be achieved by using SkISize::Make() provided by
SkTSize API.

BUG=skia:2645
TEST=make dm && out/Debug/dm
R=robertphillips@google.com, reed@google.com

Author: tfarina@chromium.org

Review URL: https://codereview.chromium.org/326523002
2014-06-09 23:59:03 -07:00
commit-bot@chromium.org
71db88225d Real fix for Widnows build errors for GrDashingEffect
NOTREECHECKS=True
NOTRY=True
R=bsalomon@google.com
TBR=bsalomon@google.com
BUG=skia:

Author: egdaniel@google.com

Review URL: https://codereview.chromium.org/291903002

git-svn-id: http://skia.googlecode.com/svn/trunk@14777 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-05-19 14:59:04 +00:00
commit-bot@chromium.org
628ed0b220 Add Dashing gpu effect for simple dashed lines
BUG=skia:
R=bsalomon@google.com

Author: egdaniel@google.com

Review URL: https://codereview.chromium.org/274673004

git-svn-id: http://skia.googlecode.com/svn/trunk@14775 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-05-19 14:32:49 +00:00
commit-bot@chromium.org
a90c680386 Turn on quilt mode in DM.
- Rename TileGrid -> Quilt to avoid the name overload.
  - Tag all failing GMs with kSkipTiled_Flag.

You may be wondering, do any GMs pass?  Yes, some do!  And that trends towards all of them as we increase --quiltTile.

Two GMs only fail in --quilt mode in 565.  Otherwise all GMs which fail are skipped, and those which don't fail aren't. (The 8888 variants of those two GMs are skipped even though they pass.)

BUG=skia:2477
R=reed@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/256373002

git-svn-id: http://skia.googlecode.com/svn/trunk@14457 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-04-30 13:20:45 +00:00
commit-bot@chromium.org
35c03fbf10 Remove scaleToFit from DashPathEffect
BUG=skia:
R=reed@google.com, bsalomon@google.com, scroggo@google.com

Author: egdaniel@google.com

Review URL: https://codereview.chromium.org/216493005

git-svn-id: http://skia.googlecode.com/svn/trunk@13999 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-03-31 18:52:51 +00:00
commit-bot@chromium.org
0a2bf90dcc Factory methods for heap-allocated SkPathEffect and SkXfermode objects.
This is part of an effort to ensure that all SkPaint effects can only be
allocated on the heap.

This patch makes the constructors of SkPathEffect, SkXfermode and
their subclasses non-public and instead provides factory methods for
creating these objects on the heap. We temporarily keep the constructors
of the following classes public to not break Chrome/Blink:

SkXfermode
SkCornerPathEffect
SkDashPathEffect

BUG=skia:2187
R=scroggo@google.com, reed@google.com, mtklein@google.com, bungeman@google.com

Author: dominikg@chromium.org

Review URL: https://codereview.chromium.org/166583002

git-svn-id: http://skia.googlecode.com/svn/trunk@13519 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-02-20 20:40:19 +00:00
commit-bot@chromium.org
4b413c8bb1 remove SkFloatToScalar macro
BUG=
R=reed@google.com, djsollen@google.com

Author: caryclark@google.com

Review URL: https://codereview.chromium.org/85463005

git-svn-id: http://skia.googlecode.com/svn/trunk@12385 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-11-25 19:44:07 +00:00
robertphillips@google.com
b62ce70745 Fix minor memory leaks
https://codereview.chromium.org/12703044/



git-svn-id: http://skia.googlecode.com/svn/trunk@8419 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-03-27 21:31:21 +00:00
skia.committer@gmail.com
e16efc1882 Sanitizing source files in Skia_Periodic_House_Keeping
git-svn-id: http://skia.googlecode.com/svn/trunk@7406 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-01-26 07:06:02 +00:00
robertphillips@google.com
5c4d5582c9 dashing asPoints could draw excessively long first dash
https://codereview.appspot.com/7098054/

Will require rebaselining of dashing gm.



git-svn-id: http://skia.googlecode.com/svn/trunk@7177 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-01-15 12:53:31 +00:00
reed@google.com
140d7286c5 fix warnings
Review URL: https://codereview.appspot.com/7073044

git-svn-id: http://skia.googlecode.com/svn/trunk@7064 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-01-07 20:25:04 +00:00
skia.committer@gmail.com
73b140a9f6 Sanitizing source files in Skia_Periodic_House_Keeping
git-svn-id: http://skia.googlecode.com/svn/trunk@6669 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-05 02:01:21 +00:00
robertphillips@google.com
8c685c5d75 Expand dashing3 GM to include additional dashing cases
https://codereview.appspot.com/6870056/



git-svn-id: http://skia.googlecode.com/svn/trunk@6667 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-04 20:34:11 +00:00
robertphillips@google.com
629ab54066 Added dashing fast path
https://codereview.appspot.com/6844067/



git-svn-id: http://skia.googlecode.com/svn/trunk@6585 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-11-28 17:18:11 +00:00
rmistry@google.com
ae933ce0ea Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part III of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6475053

git-svn-id: http://skia.googlecode.com/svn/trunk@5264 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-23 18:19:56 +00:00
reed@google.com
de1837bb96 remove bogus nearlyzero checks
Review URL: https://codereview.appspot.com/6213060

git-svn-id: http://skia.googlecode.com/svn/trunk@4014 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-05-21 16:47:43 +00:00
reed@google.com
21384df037 add dashing2 gm to exercise dashing on curves and polygons
git-svn-id: http://skia.googlecode.com/svn/trunk@3997 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-05-18 17:59:08 +00:00
reed@google.com
35a81dfdb2 add gm for dashing variations
git-svn-id: http://skia.googlecode.com/svn/trunk@3842 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-05-04 21:49:27 +00:00