Commit Graph

6292 Commits

Author SHA1 Message Date
mtklein
c095df55e8 GN: guard tools (except fiddle) by skia_enable_tools.
Our tools use third-party libraries pretty freely, some of which may not
be available in other GN environments (e.g. Fuchsia).  Most can also not
function when Skia is built as a shared library.

fiddle stands alone as the exception to both those points: it depends on
only Skia, and works fine with both a shared or static library.

So guard everything but fiddle with this flag skia_enable_tools, disabled
when we're building for Fuchsia or when we're build a shared library.

This CL has a couple of little tweaks to Fiddle to keep it working:
  - divorce it from :tool_utils, instead just building SkForceLinking.cpp itself;
  - fix up a buggy rebase_path() that was accidentally working when we depended
    on :tool_utils;
  - drop test_only: it now only requires production-code dependencies.

The SkImageEncoder Create* methods need to be SK_API if we want SkForceLinking
to work across .so's.  Without this, SkForceLinking needs to be part of Skia; it
can't be part of the application using Skia.

The rest is mostly just a re-indent under if (skia_enable_tools),
courtesy of gn format.

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

No public API changes.
TBR=reed@google.com

Review-Url: https://codereview.chromium.org/2273823003
2016-08-24 12:23:52 -07:00
fmalita
bf783b335c Fix SkTLazy(const T*) initialization
Splitting the fix from https://codereview.chromium.org/2271743002/.

R=bungeman@google.com,mtklein@google.com
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2278633002

Review-Url: https://codereview.chromium.org/2278633002
2016-08-24 11:03:24 -07:00
ajuma
95243ebb68 Make GrTextureStripAtlas flush pending IO on newly acquired texture
GrTextureStripAtlas uses its own lock counts to protect against
overwriting its own earlier writes, but that doesn't protect against
IO that was pending when a texture was first acquired.

BUG=chromium:637678
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2262233002

Review-Url: https://codereview.chromium.org/2262233002
2016-08-24 08:19:03 -07:00
brianosman
8aeec39f1f New helper for creating a color space from another, with linear gamma
Going to need this in many places once we expliclty require F16 surfaces
to have linear gamma color spaces.

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

Review-Url: https://codereview.chromium.org/2270103002
2016-08-24 05:11:20 -07:00
bsalomon
19fe41e85e Remove SkPixelRef::getTexture()
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2264293003

Review-Url: https://codereview.chromium.org/2264293003
2016-08-23 14:02:54 -07:00
vjiaoblack
e1e5c74086 Moving SkBlurImageFilter into core
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255803003

Committed: https://skia.googlesource.com/skia/+/dd3259eb95c3b47e11eefa3b176365a112a32b48
Committed: https://skia.googlesource.com/skia/+/e426babe7552b1cb4e27cdf4e90826feabb9e3b0
Committed: https://skia.googlesource.com/skia/+/4d760175686df8f61a11b66946eb307d89dd2c75
Committed: https://skia.googlesource.com/skia/+/a97a1ab5719d5c355f7900b7f17dec1e467cf57e
Review-Url: https://codereview.chromium.org/2255803003
2016-08-23 11:13:14 -07:00
bungeman
2a57f2fb2f Revert of Moving SkBlurImageFilter into core (patchset #9 id:160001 of https://codereview.chromium.org/2255803003/ )
Reason for revert:
Breaking internal roll. Still needs 'Create'.

Original issue's description:
> Moving SkBlurImageFilter into core
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255803003
>
> Committed: https://skia.googlesource.com/skia/+/dd3259eb95c3b47e11eefa3b176365a112a32b48
> Committed: https://skia.googlesource.com/skia/+/e426babe7552b1cb4e27cdf4e90826feabb9e3b0
> Committed: https://skia.googlesource.com/skia/+/4d760175686df8f61a11b66946eb307d89dd2c75
> Committed: https://skia.googlesource.com/skia/+/a97a1ab5719d5c355f7900b7f17dec1e467cf57e

TBR=reed@google.com,fmalita@chromium.org,vjiaoblack@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/2274603003
2016-08-23 10:04:54 -07:00
vjiaoblack
a97a1ab571 Moving SkBlurImageFilter into core
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255803003

Committed: https://skia.googlesource.com/skia/+/dd3259eb95c3b47e11eefa3b176365a112a32b48
Committed: https://skia.googlesource.com/skia/+/e426babe7552b1cb4e27cdf4e90826feabb9e3b0
Committed: https://skia.googlesource.com/skia/+/4d760175686df8f61a11b66946eb307d89dd2c75
Review-Url: https://codereview.chromium.org/2255803003
2016-08-23 07:50:52 -07:00
bsalomon
4f3a0ca85d GPU implementation of drawArc.
This adds analytic shaders for filled arcs and butt-cap stroked arcs where the center point is not used.

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

Review-Url: https://codereview.chromium.org/2259323003
2016-08-22 13:14:26 -07:00
reed
4d2cce442d check for wide-open inside quickContains
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2263373002

Review-Url: https://codereview.chromium.org/2263373002
2016-08-22 13:03:47 -07:00
vjiaoblack
a90dcf791b Revert of Moving SkBlurImageFilter into core (patchset #8 id:140001 of https://codereview.chromium.org/2255803003/ )
Reason for revert:
Misnamed function.

Original issue's description:
> Moving SkBlurImageFilter into core
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255803003
>
> Committed: https://skia.googlesource.com/skia/+/dd3259eb95c3b47e11eefa3b176365a112a32b48
> Committed: https://skia.googlesource.com/skia/+/e426babe7552b1cb4e27cdf4e90826feabb9e3b0
> Committed: https://skia.googlesource.com/skia/+/4d760175686df8f61a11b66946eb307d89dd2c75

TBR=reed@google.com,fmalita@chromium.org
# 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/2265263002
2016-08-22 12:04:41 -07:00
vjiaoblack
4d76017568 Moving SkBlurImageFilter into core
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255803003

Committed: https://skia.googlesource.com/skia/+/dd3259eb95c3b47e11eefa3b176365a112a32b48
Committed: https://skia.googlesource.com/skia/+/e426babe7552b1cb4e27cdf4e90826feabb9e3b0
Review-Url: https://codereview.chromium.org/2255803003
2016-08-22 12:00:25 -07:00
vjiaoblack
7b145120f2 Revert of Moving SkBlurImageFilter into core (patchset #8 id:140001 of https://codereview.chromium.org/2255803003/ )
Reason for revert:
Fixed it wrong, needs to revert to re-discuss and re-land.

Original issue's description:
> Moving SkBlurImageFilter into core
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255803003
>
> Committed: https://skia.googlesource.com/skia/+/dd3259eb95c3b47e11eefa3b176365a112a32b48
> Committed: https://skia.googlesource.com/skia/+/e426babe7552b1cb4e27cdf4e90826feabb9e3b0

TBR=reed@google.com,fmalita@chromium.org
# 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/2266063002
2016-08-22 11:30:40 -07:00
vjiaoblack
e426babe75 Moving SkBlurImageFilter into core
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255803003

Committed: https://skia.googlesource.com/skia/+/dd3259eb95c3b47e11eefa3b176365a112a32b48
Review-Url: https://codereview.chromium.org/2255803003
2016-08-22 10:51:27 -07:00
mtklein
2ec417257b Revert of Moving SkBlurImageFilter into core (patchset #6 id:100001 of https://codereview.chromium.org/2255803003/ )
Reason for revert:
It looks like this breaks our roll into Google3:
https://test.corp.google.com/ui#id=OCL:130943857:BASE:130944046:1471881622765:61dbdd3

Original issue's description:
> Moving SkBlurImageFilter into core
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255803003
>
> Committed: https://skia.googlesource.com/skia/+/dd3259eb95c3b47e11eefa3b176365a112a32b48

TBR=reed@google.com,fmalita@chromium.org,vjiaoblack@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/2263283002
2016-08-22 09:25:59 -07:00
vjiaoblack
dd3259eb95 Moving SkBlurImageFilter into core
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255803003

Review-Url: https://codereview.chromium.org/2255803003
2016-08-22 08:50:20 -07:00
reed
a39667c848 add SkMatrixPriv for specialized helpers
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2268443002

Review-Url: https://codereview.chromium.org/2268443002
2016-08-22 06:39:49 -07:00
reed
589a39eb81 store info in basedevice, change getter to non-virtual const&
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2261003003

Review-Url: https://codereview.chromium.org/2261003003
2016-08-20 07:59:19 -07:00
csmartdalton
02fa32c6d1 Move GrFixedClip into src directory
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2254343003

Review-Url: https://codereview.chromium.org/2254343003
2016-08-19 13:29:27 -07:00
bsalomon
ac3aa245ac Plumb drawArc to SkDevice.
Plumbs the drawArc canvas method down to SkDevice without converting to a path. Plumbs through the various recording canvas classes.

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

Review-Url: https://codereview.chromium.org/2257023003
2016-08-19 11:25:20 -07:00
dvonbeck
af0f6efa35 Added SkColor4f::FromColor3f(SkColor3f, float a)
Planning to use this for the ColorDisplay widget in https://codereview.chromium.org/2259183003/

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

Review-Url: https://codereview.chromium.org/2264643002
2016-08-19 11:23:15 -07:00
mtklein
cbdf007bc2 Fast path translate() in SkCanvas and SkLiteDL.
This adds didTranslate() so that SkLiteDL (and other canvas recorders)
can record the translate rather than the full concat.

It also adds a case to SkMatrix::preTranslate() to fast path
translate x translate -> translate (i.e. +=).

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

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

Misc bots failing in pictureimagefilter replay modes.
https://luci-milo.appspot.com/swarming/task/30b8e53f3a1f4f10/steps/dm/0/stdout

Problem is FMA vs. not.

CQ_INCLUDE_TRYBOTS=master.client.skia:
Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Fast-Trybot

Review-Url: https://codereview.chromium.org/2255283002
2016-08-19 09:05:27 -07:00
mtklein
954df2fe9f Revert of Fast path translate() in SkCanvas and SkLiteDL. (patchset #5 id:80001 of https://codereview.chromium.org/2255283002/ )
Reason for revert:
speculative

Original issue's description:
> Fast path translate() in SkCanvas and SkLiteDL.
>
> This adds didTranslate() so that SkLiteDL (and other canvas recorders)
> can record the translate rather than the full concat.
>
> It also adds a case to SkMatrix::preTranslate() to fast path
> translate x translate -> translate (i.e. +=).
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255283002
>
> Committed: https://skia.googlesource.com/skia/+/5fa47f4fd13b3158de4599414c86d17649c2dd1c

TBR=herb@google.com,reed@google.com,mtklein@chromium.org
# 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/2264433002
2016-08-18 17:43:59 -07:00
msarett
10e3d9bf59 Batched implementation of drawLattice() for GPU
Bechmarks (Nexus 6P):

Src=100x100, Dst=250x250, NumRects=9
Android              77.7us
Skia (without patch) 57.2us
Skia (with patch)    30.9us

Src=100x100, Dst=500x500, NumRects=9
Android              77.0us
Skia (without patch) 56.9us
Skia (with patch)    31.8us

Src=100x100, Dst=1000x1000, NumRects=9
Android              180us
Skia (without patch) 96.8us
Skia (with patch)    70.5us

Src=100x100, Dst=250x250, NumRects=15
Android              208us
Skia (without patch) 155us
Skia (with patch)    38.2us

Src=100x100, Dst=500x500, NumRects=15
Android              207us
Skia (without patch) 152us
Skia (with patch)    38.4us

Src=100x100, Dst=1000x1000, NumRects=15
Android              233us
Skia (without patch) 156us
Skia (with patch)    99.9us

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

Committed: https://skia.googlesource.com/skia/+/93242c4ae50dfcc0d922cdb3ba80bbc7b4bbe93d
Review-Url: https://codereview.chromium.org/2255963002
2016-08-18 15:46:03 -07:00
mtklein
5fa47f4fd1 Fast path translate() in SkCanvas and SkLiteDL.
This adds didTranslate() so that SkLiteDL (and other canvas recorders)
can record the translate rather than the full concat.

It also adds a case to SkMatrix::preTranslate() to fast path
translate x translate -> translate (i.e. +=).

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

Review-Url: https://codereview.chromium.org/2255283002
2016-08-18 15:42:32 -07:00
msarett
7fc08585d0 Revert of Batched implementation of drawLattice() for GPU (patchset #7 id:180001 of https://codereview.chromium.org/2255963002/ )
Reason for revert:
Things drawing weird.

Original issue's description:
> Batched implementation of drawLattice() for GPU
>
> Bechmarks (Nexus 6P):
>
> Src=100x100, Dst=250x250, NumRects=9
> Android              77.7us
> Skia (without patch) 57.2us
> Skia (with patch)    34.7us
>
> Src=100x100, Dst=500x500, NumRects=9
> Android              77.0us
> Skia (without patch) 56.9us
> Skia (with patch)    44.5us
>
> Src=100x100, Dst=1000x1000, NumRects=9
> Android              180us
> Skia (without patch) 96.8us
> Skia (with patch)    70.5us
>
> Src=100x100, Dst=250x250, NumRects=15
> Android              208us
> Skia (without patch) 155us
> Skia (with patch)    55.9us
>
> Src=100x100, Dst=500x500, NumRects=15
> Android              207us
> Skia (without patch) 152us
> Skia (with patch)    63.0us
>
> Src=100x100, Dst=1000x1000, NumRects=15
> Android              233us
> Skia (without patch) 156us
> Skia (with patch)    99.9us
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255963002
>
> Committed: https://skia.googlesource.com/skia/+/93242c4ae50dfcc0d922cdb3ba80bbc7b4bbe93d

TBR=bsalomon@google.com,reed@google.com,djsollen@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/2255683004
2016-08-18 14:29:22 -07:00
msarett
9637ea91b8 Fix initialization bug for fConservativeIsScaleTranslate
Also don't mark it as conservative, we expect it to be correct all
the time.

TBR=reed@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2261573002

Review-Url: https://codereview.chromium.org/2261573002
2016-08-18 14:03:30 -07:00
msarett
93242c4ae5 Batched implementation of drawLattice() for GPU
Bechmarks (Nexus 6P):

Src=100x100, Dst=250x250, NumRects=9
Android              77.7us
Skia (without patch) 57.2us
Skia (with patch)    34.7us

Src=100x100, Dst=500x500, NumRects=9
Android              77.0us
Skia (without patch) 56.9us
Skia (with patch)    44.5us

Src=100x100, Dst=1000x1000, NumRects=9
Android              180us
Skia (without patch) 96.8us
Skia (with patch)    70.5us

Src=100x100, Dst=250x250, NumRects=15
Android              208us
Skia (without patch) 155us
Skia (with patch)    55.9us

Src=100x100, Dst=500x500, NumRects=15
Android              207us
Skia (without patch) 152us
Skia (with patch)    63.0us

Src=100x100, Dst=1000x1000, NumRects=15
Android              233us
Skia (without patch) 156us
Skia (with patch)    99.9us

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

Review-Url: https://codereview.chromium.org/2255963002
2016-08-18 13:11:48 -07:00
reed
3aafe111b6 make LayerIter private, and remove skipClip option
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2257203002

Review-Url: https://codereview.chromium.org/2257203002
2016-08-18 12:45:34 -07:00
reed
7c1235457f remove disable aa/dither flags from Props -- never used
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2257643003

TBR=bsalomon

Review-Url: https://codereview.chromium.org/2257643003
2016-08-18 09:30:44 -07:00
robertphillips
f1c6cd7603 Rename WorseCaseSize to WorstCasSize
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2259863002

Review-Url: https://codereview.chromium.org/2259863002
2016-08-18 07:11:13 -07:00
brianosman
69c166d2ce Add alphaType() to SkImage
Keep isOpaque as a convenience method -- many places really only need to
know that for optimization purposes (SrcOver -> Src, etc...).

In all the places where we pull data back out or convert to another
object and need to supply an SkImageInfo, we can avoid losing information
about premulness.

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

Review-Url: https://codereview.chromium.org/2250663002
2016-08-17 14:01:05 -07:00
csmartdalton
28341fad84 Implement difference clip rects with window rectangles
Plumbs the pipeline for window rectangles and uses them for a very
basic implementation of difference clip rects. This puts a common
Blink pattern on fast path, but we will still eventually need to make
more comprehensive use of window rectangles during clipping.

GTX 960 perf result:
                              gpu                     glinst4                 glinst16
desk_jsfiddlebigcar.skp       0.254 -> 0.177 [70%]    0.279 -> 0.197 [71%]    0.577 -> 0.196 [34%]
keymobi_sfgate_com_.skp       0.697 -> 0.513 [74%]    0.766 -> 0.451 [59%]    0.769 -> 0.597 [78%]
keymobi_blogger.skp           0.406 -> 0.314 [77%]    0.436 -> 0.292 [67%]    0.696 -> 0.319 [46%]
desk_pokemonwiki.skp          0.121 -> 0.098 [81%]     0.13 -> 0.105 [81%]    0.216 -> 0.097 [45%]
desk_wikipedia.skp            0.121 -> 0.098 [81%]     0.13 -> 0.104 [80%]    0.199 -> 0.104 [52%]
keymobi_androidpolice_co...   0.443 -> 0.382 [86%]    0.447 -> 0.398 [89%]    0.444 -> 0.396 [89%]
keymobi_booking_com_sear...   1 .15 ->  1.03 [90%]     1.17 ->  1.06 [91%]     1.17 ->  1.05 [90%]
keymobi_theverge_com.skp      0.417 -> 0.396 [95%]    0.426 -> 0.405 [95%]    0.429 ->   0.4 [93%]

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

Review-Url: https://codereview.chromium.org/2251573002
2016-08-17 10:00:22 -07:00
msarett
549ca329cf Modify SkPngCodec to recognize 565 images from the sBIT chunk
Conveniently, SkPngImageEncoder already writes the sBIT chunk
appropriately.

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

Review-Url: https://codereview.chromium.org/2212563003
2016-08-17 08:54:08 -07:00
jvanverth
6c177a1a49 Add alternative ambient shadow method to Android shadow sample
TBR=bsalomon@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2249973003

Review-Url: https://codereview.chromium.org/2249973003
2016-08-17 07:59:41 -07:00
msarett
36931c2b47 Add test for platform encoders, turn off platform encoders by default
Clients that like WIC and CG can still use them.  And we can be
confident about that, since we now test WIC and CG.

Let Skia always use our own encoders by default, so we can do cool,
custom things on all platforms.

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

Review-Url: https://codereview.chromium.org/2250683003
2016-08-16 15:11:24 -07:00
halcanary
3287588a46 SkPDF: SkPDFFont class changes
SkPDFFont:
  * inline some one-line methdods.
      - SkPDFFont::typeface()
      - SkPDFFont::fontInfo()
      - SkPDFFont::firstGlyphID()
      - SkPDFFont::lastGlyphID()
      - SkPDFFont::getFontDescriptor()
  * de-virtualize some methods:
      - SkPDFFont::getType()
      - SkPDFFont::multiByteGlyphs()
  * Constructor takes more arguments:
    fontType, multiByteGlyphs
  * re-order fields (pointers before shorts)
  * use sk_sp<T> more, T* less

SkAdvancedTypefaceMetrics:
  * SkAdvancedTypefaceMetrics::fFont now a uint8_t
  * other enumes are sized.
  * SkAdvancedTypefaceMetrics::fStyle now big enough.
  * remove use of SkTBitOr, replaced with fancy templates

No public API changes.
TBR=reed@google.com

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

Review-Url: https://codereview.chromium.org/2246903002
2016-08-16 09:36:23 -07:00
mtklein
883c8efae7 SkLiteDL: remove freelisting, add reset() and SKLITEDL_PAGE knob.
We think Android can cache these better than a global freelist allows.
This removes the freelisting but adds reset() to allow reuse.

I took the opportunity to abstract 4096 as a define SKLITEDL_PAGE.

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

Review-Url: https://codereview.chromium.org/2248693004
2016-08-16 09:36:18 -07:00
msarett
168820625c Add onDrawBitmapLattice(), avoid unnecessary bitmap->image copy
out/Release/nanobench --match Lattice --config gpu --ms 3000
3.42ms -> 17.2us

For reference, a loop over drawBitmapRects (which is what
Android currently does) is about 13us.

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

Review-Url: https://codereview.chromium.org/2205273003
2016-08-16 09:31:08 -07:00
robertphillips
c4d2f90731 Update ComputeBlurredRRectParams to compute all the parameters needed for occluded blurred rrect ninepatch draws
This is split out of: https://codereview.chromium.org/2245653002/ (Start using vertex attributes for nine-patch blurred rrect draws)

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

Review-Url: https://codereview.chromium.org/2248533002
2016-08-16 09:30:03 -07:00
hstern
e6f8ff0013 Defined SkDEBUGFAILF on Release builds
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2244253003

Review-Url: https://codereview.chromium.org/2244253003
2016-08-15 15:26:31 -07:00
bsalomon
7f0d9f3920 Attempt to throw away rrect clips of rrects.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2241273003

Review-Url: https://codereview.chromium.org/2241273003
2016-08-15 14:49:10 -07:00
mtklein
8bbbb696cd Revert of add parallel public API for recording SkLiteDL. (patchset #1 id:1 of https://codereview.chromium.org/2246893002/ )
Reason for revert:
looking like we won't need this

Original issue's description:
> add parallel public API for recording SkLiteDL.
>
> The API is restricted to pretty much just what Derek calls,
> but it's enough that we can switch testing over to use it.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2246893002
>
> Committed: https://skia.googlesource.com/skia/+/ced26a3d6b77d3a6744a8ccb8eff23eda45fc867

TBR=djsollen@google.com,reed@google.com,mtklein@chromium.org
# 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/2243393002
2016-08-15 12:56:00 -07:00
dvonbeck
6ad75d10eb LightingFP now supports multiple directional lights
BUG=skia:5518
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2239933004

Review-Url: https://codereview.chromium.org/2239933004
2016-08-15 11:35:55 -07:00
csmartdalton
d211e7875d Convert GrAppliedClip interface to builder style
GrAppliedClip was about at its limit for how many "make" functions it
could have. Window rectangles would push it over the edge. This change
makes it so GrDrawTarget supplies the original draw bounds to the
constructor, and then GrClip adds the various required clipping
techniques.

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

Review-Url: https://codereview.chromium.org/2246113002
2016-08-15 11:17:19 -07:00
mtklein
ced26a3d6b add parallel public API for recording SkLiteDL.
The API is restricted to pretty much just what Derek calls,
but it's enough that we can switch testing over to use it.

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

Review-Url: https://codereview.chromium.org/2246893002
2016-08-15 08:05:39 -07:00
vjiaoblack
772b5ee446 Added PointLights to SkLights::Light
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2237493002

Review-Url: https://codereview.chromium.org/2237493002
2016-08-12 11:38:47 -07:00
msarett
fbfa258027 Optimized implementation of quickReject()
Impl Overview
(1) Keep the device clip bounds up to date.  This
    requires minimal additional work in a few places
    throughout canvas.
(2) Keep track of if the ctm isScaleTranslate.  Yes,
    there's a function that does this, but it's slow
    to call.
(3) Perform the src->device transform in quick reject,
    then check intersection/nan.

Other Notes:
(1) NaN and intersection checks are performed
    simultaneously.
(2) We no longer quick reject infinity.
(3) Affine and perspective are both handled in the slow
    case.
(4) SkRasterClip::isEmpty() is handled by the intersection
    check.

Performance on Nexus 6P:
93.2ms -> 59.8ms

Overall Android Jank Tests Performance Impact:
Should gain us a ms or two on some tests.

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

Committed: https://skia.googlesource.com/skia/+/d22a817ff57986407facd16af36320fc86ce02da
Review-Url: https://codereview.chromium.org/2225393002
2016-08-12 08:29:08 -07:00
mtklein
5aeb2fa253 Revert of Optimized implementation of quickReject() (patchset #12 id:260001 of https://codereview.chromium.org/2225393002/ )
Reason for revert:
New assert triggering in the Chrome roll,
https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/208750/steps/webkit_unit_tests%20%28with%20patch%29%20on%20Ubuntu-12.04/logs/FrameThrottlingTest.SynchronousLayoutInAnimationFrameCallback

and breaks the SKNX_NO_SIMD bot,
https://codereview.chromium.org/2236363004

Original issue's description:
> Optimized implementation of quickReject()
>
> Impl Overview
> (1) Keep the device clip bounds up to date.  This
>     requires minimal additional work in a few places
>     throughout canvas.
> (2) Keep track of if the ctm isScaleTranslate.  Yes,
>     there's a function that does this, but it's slow
>     to call.
> (3) Perform the src->device transform in quick reject,
>     then check intersection/nan.
>
> Other Notes:
> (1) NaN and intersection checks are performed
>     simultaneously.
> (2) We no longer quick reject infinity.
> (3) Affine and perspective are both handled in the slow
>     case.
> (4) SkRasterClip::isEmpty() is handled by the intersection
>     check.
>
> Performance on Nexus 6P:
> 93.2ms -> 59.8ms
>
> Overall Android Jank Tests Performance Impact:
> Should gain us a ms or two on some tests.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2225393002
>
> Committed: https://skia.googlesource.com/skia/+/d22a817ff57986407facd16af36320fc86ce02da

TBR=reed@google.com,herb@google.com,msarett@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/2231393003
2016-08-12 02:22:33 -07:00
msarett
d22a817ff5 Optimized implementation of quickReject()
Impl Overview
(1) Keep the device clip bounds up to date.  This
    requires minimal additional work in a few places
    throughout canvas.
(2) Keep track of if the ctm isScaleTranslate.  Yes,
    there's a function that does this, but it's slow
    to call.
(3) Perform the src->device transform in quick reject,
    then check intersection/nan.

Other Notes:
(1) NaN and intersection checks are performed
    simultaneously.
(2) We no longer quick reject infinity.
(3) Affine and perspective are both handled in the slow
    case.
(4) SkRasterClip::isEmpty() is handled by the intersection
    check.

Performance on Nexus 6P:
93.2ms -> 59.8ms

Overall Android Jank Tests Performance Impact:
Should gain us a ms or two on some tests.

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

Review-Url: https://codereview.chromium.org/2225393002
2016-08-11 14:40:04 -07:00
brianosman
86e7626f08 Move GrAtlasTextContext to GrDrawingManager, so we only have one.
Ultimately, avoids wasteful redundant computation and storage of distance
field fake-gamma tables.

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

Review-Url: https://codereview.chromium.org/2240623002
2016-08-11 12:17:32 -07:00
msarett
6372e65909 Delete quickRejectY()
This is the first step in a refactor of quickReject().

TBR=reed@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2241473002

Review-Url: https://codereview.chromium.org/2241473002
2016-08-11 10:31:49 -07:00
bsalomon
198ca42c67 Inline fast path for GrPaint::isConstantBlendedColor when no color FPs and src-over blend.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2236423002

Review-Url: https://codereview.chromium.org/2236423002
2016-08-11 07:39:33 -07:00
reed
a9ca05ca5e Deserialize pictures with custom image-deserializer
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2187613002

Review-Url: https://codereview.chromium.org/2187613002
2016-08-11 03:55:15 -07:00
hstern
7cffe9733b Add constructor to DashInfo to enable initializer lists
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2230143003

Review-Url: https://codereview.chromium.org/2230143003
2016-08-10 16:36:11 -07:00
fmalita
0cbe77c383 Add a SkTLazy copy assignment operator
Also scrub for NULL, etc.

R=mtklein@google.com,reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2232913003

Review-Url: https://codereview.chromium.org/2232913003
2016-08-10 16:30:37 -07:00
robertphillips
27cdd94790 Implement GPU occluded blur mask filter
Spawned off: https://codereview.chromium.org/2214163003/ (Minor clean up related to blur mask filters)

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

Review-Url: https://codereview.chromium.org/2201133002
2016-08-10 16:25:25 -07:00
reed
2ab9057b31 update textblob api to use sk_sp
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2236013002

NOTREECHECKS=True

Review-Url: https://codereview.chromium.org/2236013002
2016-08-10 14:16:41 -07:00
robertphillips
f5a83e8184 Create blurred RRect mask on GPU (rather than uploading it)
This CL doesn't try to resolve any of the larger issues. It just moves the computation of the blurred RRect to the gpu and sets up to start using vertex attributes for a nine patch draw (i.e., returning the texture coordinates)

All blurred rrects using the "analytic" path will change slightly with this CL.

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

Committed: https://skia.googlesource.com/skia/+/75ccdc77a70ec2083141bf9ba98eb2f01ece2479
Committed: https://skia.googlesource.com/skia/+/94b5c5a41160e0f55e267fc3d830df65736fac50
Review-Url: https://codereview.chromium.org/2222083004
2016-08-10 12:00:09 -07:00
csmartdalton
f9635999a4 Add flag for window rectangles to GrRenderTarget
Adds a flag to GrRenderTarget that indicates whether it can be used
with window rectangles. Also attempts to clean up some of the mixed
samples API.

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

Review-Url: https://codereview.chromium.org/2225303002
2016-08-10 11:09:07 -07:00
csmartdalton
ceeaa78713 Fix SkDEBUGCODE to accept commas
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2231663002

Review-Url: https://codereview.chromium.org/2231663002
2016-08-10 10:07:58 -07:00
bungeman
ce81ed58e2 Remove no longer existing friend.
sk_fontmgr_create_default used to exist before SkFontMgr::RefDefault
could do the job better. There are no actual implementations for this
function, so SkFontMgr should no longer be friends with it.

TBR=reed
Removes a deceased friend.

Review-Url: https://codereview.chromium.org/2232963002
2016-08-10 09:23:43 -07:00
robertphillips
3f0e6945f8 Revert of Create blurred RRect mask on GPU (rather than uploading it) (patchset #5 id:80001 of https://codereview.chromium.org/2222083004/ )
Reason for revert:
No NoGPU bot on commit queue ?

Original issue's description:
> Create blurred RRect mask on GPU (rather than uploading it)
>
> This CL doesn't try to resolve any of the larger issues. It just moves the computation of the blurred RRect to the gpu and sets up to start using vertex attributes for a nine patch draw (i.e., returning the texture coordinates)
>
> All blurred rrects using the "analytic" path will change slightly with this CL.
>
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2222083004
>
> Committed: https://skia.googlesource.com/skia/+/75ccdc77a70ec2083141bf9ba98eb2f01ece2479
> Committed: https://skia.googlesource.com/skia/+/94b5c5a41160e0f55e267fc3d830df65736fac50

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

Review-Url: https://codereview.chromium.org/2232953002
2016-08-10 08:40:35 -07:00
mtklein
3ff2cc81a5 constexpr NaN,+Inf,-Inf
Reading extern values meant these couldn't be compile-time constants.

math.h has INFINITY, which is macro that is supposed to expand to float +inf.
On MSVC it seems it's natively a double, so we cast just to make sure.

There's nan(const char*) in math.h for NaN too, but I don't trust that
to be compile-time evaluated.  So instead, we keep reinterpreting a bit pattern.

I did try to write

    static constexpr float float_nan() { ... }

and completely failed.  constexpr seems a bit too restrictive in C++11 to make
it work, but Clang kept telling me, you'll be able to do this with C++14.

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

Review-Url: https://codereview.chromium.org/2233853002
2016-08-10 08:31:42 -07:00
mtklein
3d96cb8db7 Default GR_GL_FUNCTION_TYPE to __stdcall on Windows.
Why is this configurable if we can't work without it?

Just to confirm, this is a Windows constraint, not an MSVC constraint, right?
Clang on Windows also needs __stdcall?

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

Review-Url: https://codereview.chromium.org/2233883002
2016-08-10 07:30:21 -07:00
robertphillips
94b5c5a411 Create blurred RRect mask on GPU (rather than uploading it)
This CL doesn't try to resolve any of the larger issues. It just moves the computation of the blurred RRect to the gpu and sets up to start using vertex attributes for a nine patch draw (i.e., returning the texture coordinates)

All blurred rrects using the "analytic" path will change slightly with this CL.

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

Committed: https://skia.googlesource.com/skia/+/75ccdc77a70ec2083141bf9ba98eb2f01ece2479
Review-Url: https://codereview.chromium.org/2222083004
2016-08-10 07:14:55 -07:00
halcanary
c5769b2e49 Revert of Change mapRectScaleTranslate to pass args/ret by value (patchset #2 id:20001 of https://codereview.chromium.org/2138943002/ )
Reason for revert:
Build-Ubuntu-GCC-Arm7-Release-Android fails.

Original issue's description:
> Change mapRectScaleTranslate to pass args/ret by value
>
> This reverts commit 6092b6e0e5.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2138943002
>
> Committed: https://skia.googlesource.com/skia/+/1bd13ca922d6448d595064faee486eaf3fa56e56

TBR=mtklein@google.com,msarett@google.com,reed@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/2234843002
2016-08-10 07:13:21 -07:00
reed
1bd13ca922 Change mapRectScaleTranslate to pass args/ret by value
This reverts commit 6092b6e0e5.

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

Review-Url: https://codereview.chromium.org/2138943002
2016-08-10 06:17:54 -07:00
robertphillips
69cfa9c28d Revert of Create blurred RRect mask on GPU (rather than uploading it) (patchset #4 id:60001 of https://codereview.chromium.org/2222083004/ )
Reason for revert:
Erg - dumb bug

Original issue's description:
> Create blurred RRect mask on GPU (rather than uploading it)
>
> This CL doesn't try to resolve any of the larger issues. It just moves the computation of the blurred RRect to the gpu and sets up to start using vertex attributes for a nine patch draw (i.e., returning the texture coordinates)
>
> All blurred rrects using the "analytic" path will change slightly with this CL.
>
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2222083004
>
> Committed: https://skia.googlesource.com/skia/+/75ccdc77a70ec2083141bf9ba98eb2f01ece2479

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

Review-Url: https://codereview.chromium.org/2236493002
2016-08-10 06:15:33 -07:00
robertphillips
75ccdc77a7 Create blurred RRect mask on GPU (rather than uploading it)
This CL doesn't try to resolve any of the larger issues. It just moves the computation of the blurred RRect to the gpu and sets up to start using vertex attributes for a nine patch draw (i.e., returning the texture coordinates)

All blurred rrects using the "analytic" path will change slightly with this CL.

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

Review-Url: https://codereview.chromium.org/2222083004
2016-08-10 05:33:12 -07:00
halcanary
e9d55c57a6 Revert of Store mipmap levels in deferred texture image (patchset #11 id:200001 of https://codereview.chromium.org/2115023002/ )
Reason for revert:
speculative revert: android dm crashes

Original issue's description:
> Store mipmap levels in deferred texture image
>
> This is a follow-up to https://codereview.chromium.org/2034933003/ which
> was reverted due to a memory leak.
>
> When creating the deferred texture image, detect if using medium / high
> quality. If so, generate and store mipmaps in the deferred texture
> image.
>
> When creating a texture from that be sure to read it back out.
>
> BUG=578304
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2115023002
>
> Committed: https://skia.googlesource.com/skia/+/d6113140f7ae8996f679ac6698a60fb8c1386da3

TBR=brianosman@google.com,bsalomon@google.com,ericrk@chromium.org,cblume@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=578304

Review-Url: https://codereview.chromium.org/2227323002
2016-08-09 17:46:25 -07:00
cblume
d6113140f7 Store mipmap levels in deferred texture image
This is a follow-up to https://codereview.chromium.org/2034933003/ which
was reverted due to a memory leak.

When creating the deferred texture image, detect if using medium / high
quality. If so, generate and store mipmaps in the deferred texture
image.

When creating a texture from that be sure to read it back out.

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

Review-Url: https://codereview.chromium.org/2115023002
2016-08-09 13:45:56 -07:00
halcanary
8eccc308c8 SkPDF: SkPDFFont organization changes.
SkPDFFont:
  - SkPDFType1Font::populate() encode advances correctly.
  - break out logically independent code into new files:
    * SkPDFConvertType1FontStream
    * SkPDFMakeToUnicodeCmap
    SkPDFFont.cpp is now 380 lines smaller.
    Expose `SkPDFAppendCmapSections()` for testing.

SkPDFFontImpl.h
  - Fold into SkPDFFont.

SkPDFConvertType1FontStream:
  - Now assume given a SkStreamAsset

SkPDFFont:
  - AdvanceMetric now hidden in a anonymous namespace.

No public API changes.
TBR=reed@google.com

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

Review-Url: https://codereview.chromium.org/2221163002
2016-08-09 13:04:34 -07:00
csmartdalton
9bc1187249 Include EXT_window_rectangles API
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2221393004

Review-Url: https://codereview.chromium.org/2221393004
2016-08-09 12:42:47 -07:00
mtklein
b47cd4b3d6 Use SkNVRefCnt for a couple common types.
These types are ref-counted, but don't otherwise need a vtable.
This makes them good candidates for SkNVRefCnt.

Destruction can be a little more direct, and if nothing else,
sizeof(T) will get a little smaller by dropping the vptr.

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

Review-Url: https://codereview.chromium.org/2232433002
2016-08-09 12:20:04 -07:00
hstern
23d9776024 Move seg_to to a new header, define SkSegType enum there
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2221203002

Review-Url: https://codereview.chromium.org/2221203002
2016-08-09 09:38:30 -07:00
csmartdalton
77f2fae49e Encapsulate GrReducedClip result in class members
Updates GrReducedClip to store its result in class members instead of
various pointer arguments. This helps clean up calling code and will
make it easier to reduce the clip higher in the stack.

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

Review-Url: https://codereview.chromium.org/2222873002
2016-08-08 09:55:06 -07:00
halcanary
8b1d32c8d0 SkPDF/SkAdvancedTypefaceMetrics: simplify ATM, PDF takes over
No public API changes.
TBR=reed@google.com

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

Review-Url: https://codereview.chromium.org/2222523003
2016-08-08 09:09:59 -07:00
mtklein
4e97607d9a Use sse4.2 CRC32 instructions to hash when available.
About 9x faster than Murmur3 for long inputs.

Most of this is a mechanical change from SkChecksum::Murmur3(...) to SkOpts::hash(...).

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2208903002
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot;master.client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot

Review-Url: https://codereview.chromium.org/2208903002
2016-08-08 09:06:28 -07:00
bungeman
f95388da1a Remove SK_SUPPORT_LEGACY_DATA_FACTORIES.
The code protected by this flag is no longer used. Remove the flag and
code. This also removes SK_SUPPORT_LEGACY_TYPEFACE_PTR from Android, as
it is no longer needed.

TBR=reed
Only removes already guarded API.

Review-Url: https://codereview.chromium.org/2223933002
2016-08-08 08:09:10 -07:00
halcanary
9be372041e std::move(SkTDArray)
Since we don't support MSVC2013 anymore, we can be more
succinct when defining move constructors of compound types.

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

Review-Url: https://codereview.chromium.org/2227673002
2016-08-08 07:21:42 -07:00
mtklein
9c5052f16b SkLite*
SkLiteRecorder, a new SkCanvas, fills out SkLiteDL, a new SkDrawable.

This SkDrawable is a display list similar to SkRecord and SkBigPicture / SkRecordedDrawable, but with a few new design points inspired by Android and slimming paint:

  1) SkLiteDL is structured as one big contiguous array rather than the two layer structure of SkRecord.  This trades away flexibility and large-op-count performance for better data locality for small to medium size pictures.

  2) We keep a global freelist of SkLiteDLs, both reusing the SkLiteDL struct itself and its contiguous byte array.  This keeps the expected number of mallocs per display list allocation <1 (really, ~0) for cyclical use cases.

These two together mean recording is faster.  Measuring against the code we use at head, SkLiteRecorder trends about ~3x faster across various size pictures, matching speed at 0 draws and beating the special-case 1-draw pictures we have today.  (I.e. we won't need those special case implementations anymore, because they're slower than this new generic code.)  This new strategy records 10 drawRects() in about the same time the old strategy took for 2.

This strategy stays the winner until at least 500 drawRect()s on my laptop, where I stopped checking.

A simpler alternative to freelisting is also possible (but not implemented here), where we allow the client to manually reset() an SkLiteDL for reuse when its refcnt is 1.  That's essentially what we're doing with the freelist, except tracking what's available for reuse globally instead of making the client do it.

This code is not fully capable yet, but most of the key design points are there.  The internal structure of SkLiteDL is the area I expect to be most volatile (anything involving Op), but its interface and the whole of SkLiteRecorder ought to be just about done.

You can run nanobench --match picture_overhead as a demo.  Everything it exercises is fully fleshed out, so what it tests is an apples-to-apples comparison as far as recording costs go.  I have not yet compared playback performance.

It should be simple to wrap this into an SkPicture subclass if we want.

I won't start proposing we replace anything old with anything new quite yet until I have more ducks in a row, but this does look pretty promising (similar to the SkRecord over old SkPicture change a couple years ago) and I'd like to land, experiment, iterate, especially with an eye toward Android.

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

Review-Url: https://codereview.chromium.org/2213333002
2016-08-06 12:51:51 -07:00
csmartdalton
c6f411e72b Merge GrClipMaskManager into GrClipStackClip
TBR=bsalomon@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2196393007

Review-Url: https://codereview.chromium.org/2196393007
2016-08-05 22:32:12 -07:00
djsollen
300405a7a2 Enable SK_DEBUG/SK_RELEASE to be defined in the user config.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2204683005

Review-Url: https://codereview.chromium.org/2204683005
2016-08-05 13:04:41 -07:00
lsalzman
40254c2c2d SkBlendARGB32 and S32[A]_Blend_BlitRow32 are currently formulated as: SkAlphaMulQ(src, src_scale) + SkAlphaMulQ(dst, dst_scale), which boils down to ((src*src_scale)>>8) + ((dst*dst_scale)>>8). In particular, note that the intermediate precision is discarded before the two parts are added together, causing the final result to possibly inaccurate.
In Firefox, we use SkCanvas::saveLayer in combination with a backdrop that initializes the layer to the background. When this is blended back onto background using transparency, where the source and destination pixel colors are the same, the resulting color after the blend is not preserved due to the lost precision mentioned above. In cases where this operation is repeatedly performed, this causes substantially noticeable differences in color as evidenced in this downstream Firefox bug report:  https://bugzilla.mozilla.org/show_bug.cgi?id=1200684

In the test-case in the downstream report, essentially it does blend(src=0xFF2E3338, dst=0xFF2E3338, scale=217), which gives the result 0xFF2E3237, while we would expect to get back 0xFF2E3338.

This problem goes away if the blend is instead reformulated to effectively do (src*src_scale + dst*dst_scale)>>8, which keeps the intermediate precision during the addition before shifting it off.

This modifies the blending operations thusly. The performance should remain mostly unchanged, or possibly improve slightly, so there should be no real downside to doing this, with the benefit of making the results more accurate. Without this, it is currently unsafe for Firefox to blend a layer back onto itself that was initialized with a copy of its background.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2097883002
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

[mtklein adds...]
No public API changes.
TBR=reed@google.com

Review-Url: https://codereview.chromium.org/2097883002
2016-08-05 11:48:45 -07:00
bungeman
feb3c1a57f Move to SkDataTable::MakeXXX and sk_sp.
Change SkDataTable::NewXXX to SkDataTable::MakeXXX and return sk_sp.
This updates users of SkDataTable to sk_sp as well.
There do not appear to be any external users of these methods.

Review-Url: https://codereview.chromium.org/2211143002
2016-08-05 06:51:50 -07:00
halcanary
4e44efe504 SkRTConf: eliminate
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2212473002
DOCS_PREVIEW= https://skia.org/?cl=2212473002
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

[mtklein]
TBR=reed@google.com
Only removing unused public API.

Review-Url: https://codereview.chromium.org/2212473002
2016-08-04 10:47:16 -07:00
robertphillips
15c42ca310 Remove SkSurface::MakeRenderTargetDirect
split into:
https://codereview.chromium.org/2182543003/ (Move prepareForExternalIO from GrRenderTarget to GrDrawContext)
https://codereview.chromium.org/2187573002/ (Reduce usage of MakeRenderTargetDirect)
https://codereview.chromium.org/2186073002/ (Rename GrContext's newDrawContext & drawContext to makeDrawContext)
https://codereview.chromium.org/2178353005/ (Remove use of MakeRenderTargetDirect from view system)
https://codereview.chromium.org/2198433003/ (Remove some ancillary users of SkSurface::MakeRenderTargetDirect)
https://codereview.chromium.org/2208483004/ (Remove GrRenderTarget member variable from SkGpuDevice)
https://codereview.chromium.org/2211473002/ (Move GrContext::makeDrawContext to new GrContextPriv object)

TBR=bsalomon@google.com

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

Review-Url: https://codereview.chromium.org/2176333002
2016-08-04 08:45:02 -07:00
mtklein
7a1f45f9e5 spin off easy stuff from Herb's windows GN CL
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2209533004

No public API changes.
TBR=reed@google.com

Review-Url: https://codereview.chromium.org/2209533004
2016-08-04 06:19:33 -07:00
mtklein
b979634012 Revert of SkRTConf: reduce functionality to what we use, increase simplicity (patchset #8 id:150001 of https://codereview.chromium.org/2212473002/ )
Reason for revert:
missed GrVkPipelineStateCache

Original issue's description:
> SkRTConf: reduce functionality to what we use, increase simplicity
>
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2212473002
> DOCS_PREVIEW= https://skia.org/?cl=2212473002
> CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
>
> [mtklein]
> TBR=reed@google.com
> Only removing unused public API.
>
> Committed: https://skia.googlesource.com/skia/+/ef59974708dade6fa72fb0218d4f8a9590175c47

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

Review-Url: https://codereview.chromium.org/2215433003
2016-08-03 19:19:48 -07:00
halcanary
ef59974708 SkRTConf: reduce functionality to what we use, increase simplicity
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2212473002
DOCS_PREVIEW= https://skia.org/?cl=2212473002
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

[mtklein]
TBR=reed@google.com
Only removing unused public API.

Review-Url: https://codereview.chromium.org/2212473002
2016-08-03 15:30:37 -07:00
robertphillips
4fd74aec9f Move GrContext::makeDrawContext to new GrContextPriv object
We don't want external clients to be able to call the wrapping makeDrawContext. The "creating" makeDrawContext needs to be public for external image filters.

The 3 specialized drawContext creators on GrContextPriv (to wrap backend objects) are also to be kept from public use and will be used to remove SkSurface::MakeRenderTargetDirect.

Split out of: https://codereview.chromium.org/2176333002/ (Remove SkSurface::MakeRenderTargetDirect)

TBR=bsalomon@google.com

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

Review-Url: https://codereview.chromium.org/2211473002
2016-08-03 14:26:53 -07:00
mtklein
62e1a1a4ba Make SK_BUILD_FOR_WIN32 auto-detection work.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2205173003

No public API changes
TBR=reed@google.com

Review-Url: https://codereview.chromium.org/2205173003
2016-08-03 11:09:59 -07:00
robertphillips
a746f7894a Fix dtor bug in SkLights
The overriding problem was that the SkTDArray wasn't calling the SkLight destructors.

TBR=reed@google.com

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

Review-Url: https://codereview.chromium.org/2206823003
2016-08-03 09:40:39 -07:00
bungeman
38d909ec28 Move off SK_SUPPORT_LEGACY_DATA_FACTORIES.
This moves Skia code off of SK_SUPPORT_LEGACY_DATA_FACTORIES.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2206633004

Review-Url: https://codereview.chromium.org/2206633004
2016-08-02 14:40:46 -07:00
msarett
a25f470bc7 Delete SkNinePatch
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2206663002

Review-Url: https://codereview.chromium.org/2206663002
2016-08-02 13:55:10 -07:00
mtklein
091cb8d72d Delete SkARGBImageEncoder.
It appears to be unused now except by its unit test, also deleted.

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

No public API changes.
TBR=reed@google.com

Review-Url: https://codereview.chromium.org/2208433002
2016-08-02 12:57:33 -07:00
mtklein
5dbd274846 gn: fix fiddle
- __SK_FORCE_IMAGE_DECODER_LINKING makes sure the PNG encoder is linked
  - updated path to make working with sample draw.cpp easier.

No public API changes.
TBR=reed@google.com

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

Review-Url: https://codereview.chromium.org/2202353002
2016-08-02 11:13:49 -07:00
bungeman
b1dd067128 Remove 'Ulta' width.
All users of this old name appear to be updated.

TBR=reed
Removing unused and mis-spelled API.

Review-Url: https://codereview.chromium.org/2206453003
2016-08-02 10:43:29 -07:00
msarett
c573a40ed5 Add drawImageLattice() and drawBitmapLattice() APIs
The specified image/bitmap is divided into rects, which
can be draw stretched, shrunk, or at a fixed size.  Will be
used by Android to draw 9patch (which are acutally N-patch)
images.

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

Review-Url: https://codereview.chromium.org/1992283002
2016-08-02 08:05:56 -07:00