Commit Graph

2602 Commits

Author SHA1 Message Date
reed
6ae6969434 record drawfilters
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2303033002

Review-Url: https://codereview.chromium.org/2303033002
2016-09-02 04:56:53 -07: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
cblume
33e0cb5e7f Store mipmap levels in deferred texture image
This is a follow-up to https://codereview.chromium.org/2115023002/ and
https://codereview.chromium.org/2034933003/ which were reverted due to
an access violation and a memory leak, respectively.

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=2242883004

Review-Url: https://codereview.chromium.org/2242883004
2016-08-30 12:09:23 -07:00
brianosman
7a99a0a301 Improve the gamma GM significantly
- Switch to portable typeface, to avoid per-platform diffs in the labels
- Stretch out the image slightly, to avoid overlap with larger font
- Fix several tests that were no longer matching ground-truth. We treat
  SkColor as sRGB, so 0x7F is incorrect, for example. Several of the
  XferMode tests had similar math errors now. Computed new values, and
  verified that they work as expected.
- Removed a couple tests that were mixing color and alpha in funny ways

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

Review-Url: https://codereview.chromium.org/2288053003
2016-08-30 07:08:07 -07:00
brianosman
0e22eb8e6e Some tests around surface creation and snapshotting with color space
Verify the rules that we're converging on for surfaces:
- For 8888, we only support sRGB-like gamma, or no color space at all.
- For F16, we require a color space, with linear gamma.
- For all other formats, we do not support color spaces.

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

Review-Url: https://codereview.chromium.org/2270823002
2016-08-30 07:07:59 -07:00
vjiaoblack
a8eabc4a2a Moved ambient lights out of SkLight's light array
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2287553002

Committed: https://skia.googlesource.com/skia/+/8f98f0aa2d3f7571a890b916c7c4b5ee831e9686
Review-Url: https://codereview.chromium.org/2287553002
2016-08-29 10:22:09 -07:00
vjiaoblack
84cddf6fa7 Revert of Moved ambient lights out of SkLight's light array (patchset #7 id:120001 of https://codereview.chromium.org/2287553002/ )
Reason for revert:
Made Deigo's GM miss their ambient lights

Original issue's description:
> Moved ambient lights out of SkLight's light array
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2287553002
>
> Committed: https://skia.googlesource.com/skia/+/8f98f0aa2d3f7571a890b916c7c4b5ee831e9686

TBR=robertphillips@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/2291663002
2016-08-29 08:38:04 -07:00
vjiaoblack
8f98f0aa2d Moved ambient lights out of SkLight's light array
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2287553002

Review-Url: https://codereview.chromium.org/2287553002
2016-08-29 07:08:52 -07:00
fmalita
ab83da7142 drawBitmapRect() should not touch the CTM when mask filters are present
Blur sigma calculations are CTM dependent, so we cannot take the
drawBitmap() fast path in the presence of mask filters.

BUG=skia:5682
R=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2286873002

Review-Url: https://codereview.chromium.org/2286873002
2016-08-26 13:04:14 -07:00
msarett
febb224699 Reduce CPU overhead on drawRegion()
Only batch when the view matrices are the same.

This allows us to skip applying the matrix and uploading
local coords.

drawregion Bench on Nexus 6P:
Before 4.69ms
After  2.83ms

This puts SkiaGL nearly on par with OpenGL.

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

Review-Url: https://codereview.chromium.org/2282983003
2016-08-26 12:49:27 -07:00
bsalomon
cb31e51d93 Converts a drawPaint through a rrect clip to a drawRRect in GrDrawContext.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2271053004

Review-Url: https://codereview.chromium.org/2271053004
2016-08-26 10:48:19 -07:00
fmalita
ce2fc6a045 Add imagemasksubset GM
(GM for non-N32 SkImage subsetting)

BUG=skia:5687
R=bsalomon@google.com,robertphillips@google.com,reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2286733002

Review-Url: https://codereview.chromium.org/2286733002
2016-08-26 10:13:40 -07:00
robertphillips
55713afb7a Move work from ctor to onOnceBeforeDraw in ShowMipLevel GMs
These were making debugging stroking more difficult than necessary

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

Review-Url: https://codereview.chromium.org/2285813002
2016-08-26 10:04:26 -07:00
caryclark
f71ab8f58b avoid generating degenerate conic from arc
R=bsalomon@google.com
BUG=skia:5672
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2281953002

Review-Url: https://codereview.chromium.org/2281953002
2016-08-26 09:54:25 -07:00
robertphillips
ad2344693c Ignore fill when stroke & filling convex line-only paths
This seems to work well for miter and bevel joins with the resulting stroke and fill path remaining convex. There seems to be an issue with round joins where the outer generated shell is usually not convex. Without this CL the resulting stroke & filled paths are always concave.

Perf-wise (on Windows):

convex-lineonly-paths-stroke-and-fill bench

(in ms)   w/o   w/CL    %decrease

8888      2.88  2.01      30.2

gpu       4.4   1.38      68.6

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

Review-Url: https://codereview.chromium.org/2275243003
2016-08-26 05:30:19 -07:00
msarett
44df651ebe Add drawRegion() API to SkCanvas
This will allow us to optimize for the RectGrid macrobench.
Currently, SkiaGL is much slower than OpenGL.
SkiaGL  12 items/s
OpenGL 160 items/s

This contains everything except for the fast implementation on GPU.

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

Review-Url: https://codereview.chromium.org/2277053002
2016-08-25 13:54:30 -07:00
bsalomon
21af9ca1b1 Respecify SkCanvas::drawArc, consolidate conversion to SkPath, add GM for oddball drawArcs
Allows the arc to wind more than 360 degrees when useCenter is true, specs that nothing draws
if the oval is empty or the sweep angle is 0.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2281653002

Review-Url: https://codereview.chromium.org/2281653002
2016-08-25 12:29:24 -07:00
bsalomon
48b2461ee0 Make bleed GM produce consistent bitmaps on all platforms
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2264133003

Review-Url: https://codereview.chromium.org/2264133003
2016-08-25 06:45:29 -07:00
vjiaoblack
e6f5d56231 Made shadows blurry (thru implementing variance mapping)
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2224163005

Review-Url: https://codereview.chromium.org/2224163005
2016-08-25 06:30:23 -07:00
jvanverth
250d00bba1 Add fat stroke test case to roundrects GM.
Prep for supporting fat stroked roundrects in Ganesh.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2272703009

Review-Url: https://codereview.chromium.org/2272703009
2016-08-25 05:53:00 -07:00
caryclark
531191fefe tiny line breaks gl render
This pie cut draws correctly
on raster but extends to the
right on Ganesh.

The path is not convex, and
has a tiny line that contributes
to the error.

TBR=robertphillips@google.com
BUG=640176
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2276083002

Review-Url: https://codereview.chromium.org/2276083002
2016-08-24 11:59:30 -07:00
bsalomon
4c261d0c1e Add cap type variations to circular arcs GMs
BUG=skia:5227
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2269723002

Review-Url: https://codereview.chromium.org/2269723002
2016-08-22 13:10:46 -07:00
bsalomon
ac1d0abfd8 Add stroke-and-fill circular arc test, test near 180deg arc in all circular_arc_tests
BUG=skia:5227
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2261233002

Review-Url: https://codereview.chromium.org/2261233002
2016-08-22 10:00:14 -07:00
bsalomon
36da771226 Adjust angles in circular arcs GMs to test smaller arcs
BUG=skia:5227
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2267713002

Review-Url: https://codereview.chromium.org/2267713002
2016-08-22 07:26:08 -07:00
reed
577e012e40 add translate to exercise non-identity ctm performance
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2261063002

TBR=

Review-Url: https://codereview.chromium.org/2261063002
2016-08-21 15:03:47 -07:00
bsalomon
4c54788e92 Rename circular_arcs_circular_arcs_fill to circular_arcs_fill.
Also fix issue with second paint's alpha getting overwritten.

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

Review-Url: https://codereview.chromium.org/2265643002
2016-08-19 13:41:29 -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
71c5eee9d5 Add GMs for testing drawArc.
This is in preparation for virtualizing this on SkCanvas/SkDevice.

Tests the following variations:

aa and non-aa
stroke/hairline/fill
cap types
using center point and not

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

Review-Url: https://codereview.chromium.org/2264593002
2016-08-19 10:53:14 -07:00
reed
c1fb8e8b59 must call rand in reliable order for bots
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2254403002

TBR=

Review-Url: https://codereview.chromium.org/2254403002
2016-08-18 19:35:52 -07:00
reed
5e0d927694 add simplerect gm
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2257263002

TBR=bsalomon
NOTRY=True

Review-Url: https://codereview.chromium.org/2257263002
2016-08-18 15:01:11 -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
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
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
msarett
36c38cbb29 Fix WIC encoder to support kJPEG_Type
(1) Add support for kJPEG to WIC
(2) Add encoding test.
(3) Turn on WIC jpeg encoder on Windows and CG jpeg
    encoder on Mac.

A follow-up may make Skia's encoders the default on all
platforms.  But, in order to do that, I think we need
to write better encoding unit tests for CG and WIC.

BUG=skia:3969
BUG=skia:5632
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2245453002

Committed: https://skia.googlesource.com/skia/+/b3a7ef1fc0adc24859d2498aee54d3ec2cbcac3a
Review-Url: https://codereview.chromium.org/2245453002
2016-08-15 18:52:17 -07:00
msarett
93963ba84e Revert of Fix WIC encoder to support kJPEG_Type (patchset #3 id:140001 of https://codereview.chromium.org/2245453002/ )
Reason for revert:
Broken Windows bot.

Original issue's description:
> Fix WIC encoder to support kJPEG_Type
>
> (1) Add support for kJPEG to WIC
> (2) Add encoding test.
> (3) Turn on WIC jpeg encoder on Windows and CG jpeg
>     encoder on Mac.
>
> A follow-up may make Skia's encoders the default on all
> platforms.  But, in order to do that, I think we need
> to write better encoding unit tests for CG and WIC.
>
> BUG=skia:3969
> BUG=skia:5632
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2245453002
>
> Committed: https://skia.googlesource.com/skia/+/b3a7ef1fc0adc24859d2498aee54d3ec2cbcac3a

TBR=mtklein@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:3969

Review-Url: https://codereview.chromium.org/2246203002
2016-08-15 13:52:31 -07:00
msarett
b3a7ef1fc0 Fix WIC encoder to support kJPEG_Type
(1) Add support for kJPEG to WIC
(2) Add encoding test.
(3) Turn on WIC jpeg encoder on Windows and CG jpeg
    encoder on Mac.

A follow-up may make Skia's encoders the default on all
platforms.  But, in order to do that, I think we need
to write better encoding unit tests for CG and WIC.

BUG=skia:3969
BUG=skia:5632
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2245453002

Review-Url: https://codereview.chromium.org/2245453002
2016-08-15 13:19:20 -07:00
caryclark
c2ad65e94d add gm that exercises compose shader allocations
This gm triggers the assert in SkSmallAllocator.h
commented out by this CL.

PDFium constructs shaders that resemble the GM.

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

Review-Url: https://codereview.chromium.org/2249703002
2016-08-15 12:03:33 -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
egdaniel
3602d4f16a Allow vulkan to upload data to testing textures with optimal layouts
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2242553002

Review-Url: https://codereview.chromium.org/2242553002
2016-08-12 11:58:53 -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
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
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
vjiaoblack
904527d165 moved code into onDrawShadowedPic, only renders into shadow maps if needed
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2220633002

Review-Url: https://codereview.chromium.org/2220633002
2016-08-09 09:32:09 -07:00
hstern
bb9b2247a2 Rework Overstroke GM to show differences between expected and actual
Draw the perpendiculars of the curve with the stroke width. See Cary's
SampleQuadStroker.cpp for what we are attempting to mimic.

BUG=589769,skia:5405,skia:5406
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2218773003

Review-Url: https://codereview.chromium.org/2218773003
2016-08-09 08:53:30 -07:00
reed
1ec04d9553 rename FoceCopyMode to SkCopyPixelMode
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2220603002

Review-Url: https://codereview.chromium.org/2220603002
2016-08-05 12:07: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
vjiaoblack
955e879c6d Making a sample for shadow maps for more intensive development
Merge branch 'shadow-gm' into shadow-sample

Added variable size shadow maps. Also fixed some bugs

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

Review-Url: https://codereview.chromium.org/2198933002
2016-08-05 07:55:01 -07:00
robertphillips
9aff85a545 Minor clean up related to blur mask filters
This is the non-substantive portion of: https://codereview.chromium.org/2201133002/ (Implement GPU occluded blur mask filter)

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

Review-Url: https://codereview.chromium.org/2214163003
2016-08-05 07:51:30 -07:00
robertphillips
401c1968a1 Add new GM for occluded blurmask filter draws
This splits out just the GM portion of https://codereview.chromium.org/2201993003/ (Add GM to test out blurmaskfilter occluders) which included some API changes

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

Review-Url: https://codereview.chromium.org/2214033002
2016-08-04 12:35:46 -07:00