Commit Graph

2777 Commits

Author SHA1 Message Date
mtklein
00b621cfc0 Add sk_parallel_for()
This should be a drop-in replacement for most for-loops to make them run in parallel:
   for (int i = 0; i < N; i++) { code... }
   ~~~>
   sk_parallel_for(N, [&](int i) { code... });

This is just syntax sugar over SkTaskGroup to make this use case really easy to write.
There's no more overhead that we weren't already forced to add using an interface like batch(),
and no extra heap allocations.

I've replaced 3 uses of SkTaskGroup with sk_parallel_for:
  1) My unit tests for SkOnce.
  2) Cary's path fuzzer.
  3) SkMultiPictureDraw.
Performance should be the same.  Please compare left and right for readability. :)

BUG=skia:

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

Review URL: https://codereview.chromium.org/1184373003
2015-06-17 15:26:15 -07:00
reed
6b7f34e34c simplify release-proc for SkData, removing unneeded size param
request https://codereview.chromium.org/1184953005 to land first

BUG=skia:

Review URL: https://codereview.chromium.org/1193553002
2015-06-17 09:58:25 -07:00
hendrikw
446ee67fda skia: Add runtime option to disable picture IO security precautions
Replaced the compile time file IO security setting with a runtime setting.

Unfortunately the setting is global.

Review URL: https://codereview.chromium.org/1183853003
2015-06-16 09:28:37 -07:00
bsalomon
7a61793d96 Don't clear in SkSurface::NewWrappedRenderTarget
Review URL: https://codereview.chromium.org/1191513002
2015-06-16 08:07:16 -07:00
fmalita
109a23d64f Remove the SkCanvas comment API
No longer used in Chromium/Blink.

R=reed@google.com,robertphillips@google.com,mtklein@google.com

Review URL: https://codereview.chromium.org/1153593003
2015-06-15 13:15:31 -07:00
mtklein
3747875341 Thorough tests for saturatedAdd and mulDiv255Round.
BUG=skia:3951

Committed: https://skia.googlesource.com/skia/+/ce9d11189a5924b47c3629063b72bae9d466c2c7

CQ_EXTRA_TRYBOTS=client.skia.android:Test-Android-GCC-Nexus5-CPU-NEON-Arm7-Release-Trybot

Review URL: https://codereview.chromium.org/1184113003
2015-06-15 10:58:43 -07:00
mtklein
b1bbca8049 Revert of Thorough tests for saturatedAdd and mulDiv255Round. (patchset #1 id:1 of https://codereview.chromium.org/1184113003/)
Reason for revert:
https://code.google.com/p/skia/issues/detail?id=3951

Original issue's description:
> Thorough tests for saturatedAdd and mulDiv255Round.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/ce9d11189a5924b47c3629063b72bae9d466c2c7

TBR=fmalita@chromium.org,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1177123004
2015-06-15 10:03:41 -07:00
junov
da5469d7bc Invalidate GrTexture mipmap on content change notification
This fix is necessary to correctly propagate invalidations that
are external to skia. For example, when drawing video or WebGL
into a 2D canvas in Chrome, with mipmaps enabled.

BUG=crbug.com/498356
TEST=GrTextureMipMapInvalidationTest

Review URL: https://codereview.chromium.org/1177843007
2015-06-15 09:48:15 -07:00
mtklein
ce9d11189a Thorough tests for saturatedAdd and mulDiv255Round.
BUG=skia:

Review URL: https://codereview.chromium.org/1184113003
2015-06-15 08:58:22 -07:00
cdalton
626e1ffe84 Import functionality for new GL backend
Brings in the following functionality:

  ARB_draw_instanced
  ARB_instanced_arrays
  NV_bindless_texture
  EXT_direct_state_access
  KHR_debug

Also cleans up some of the NVPR extension loading.

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/202c4c75fb806f751cf796850bf67fe9793e0643

Review URL: https://codereview.chromium.org/1185573003
2015-06-12 13:56:46 -07:00
djsollen
1fe1858a90 Revert of Import functionality for new GL backend (patchset #2 id:20001 of https://codereview.chromium.org/1185573003/)
Reason for revert:
breaking multiple builds. For example...

https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-Golo-GPU-GT610-x86_64-Debug-ASAN/builds/667

Original issue's description:
> Import functionality for new GL backend
>
> Brings in the following functionality:
>
>   ARB_draw_instanced
>   ARB_instanced_arrays
>   NV_bindless_texture
>   EXT_direct_state_access
>   KHR_debug
>
> Also cleans up some of the NVPR extension loading.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/202c4c75fb806f751cf796850bf67fe9793e0643

TBR=bsalomon@google.com,cdalton@nvidia.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1184863002
2015-06-12 12:01:15 -07:00
cdalton
202c4c75fb Import functionality for new GL backend
Brings in the following functionality:

  ARB_draw_instanced
  ARB_instanced_arrays
  NV_bindless_texture
  EXT_direct_state_access
  KHR_debug

Also cleans up some of the NVPR extension loading.

BUG=skia:

Review URL: https://codereview.chromium.org/1185573003
2015-06-12 10:31:36 -07:00
vbuzinov
dded69693d Implement support for mixed sampled render targets
Adds a new FBO type kStencil_MSFBOType that is selected whenever
NV_framebuffer_mixed_samples extension is available.  In this new
FBO type a non-msaa color buffer is created with a multisampled
stencil buffer attachment.

Replaces numSamples() with separate numColorSamples and numStencilSamples
methods in RenderTarget.

In mixed samples mode non-MSAA codepaths are used to draw simple shapes,
while NVPR-rendered paths and text are rendered with a multisampled
stencil.

BUG=skia:3177

Review URL: https://codereview.chromium.org/1001503002
2015-06-12 08:59:45 -07:00
reed
026beb52a2 SkPath::Direction serves two masters:
- input param to addFoo (e.g. addRect), where only CW or CCW are valid)
- output param from computing functions, that sometimes return kUnknown

This CL's intent is to split these into distinct enums/features:
- Direction (public) loses kUnknown, and is only used for input
- FirstDirection (private) is used for computing the first direction we see when analyzing a contour

BUG=skia:

Review URL: https://codereview.chromium.org/1176953002
2015-06-10 14:23:15 -07:00
mtklein
f2fe0e0320 Remove overly-promiscuous SkNx syntax sugar.
I haven't figured out a pithy way to have these apply to only classes
originating from SkNx, so let's just remove them.  There aren't too
many use cases, and it's not really any less readable without them.

Semantically, this is a no-op.

BUG=skia:

Review URL: https://codereview.chromium.org/1167153002
2015-06-10 08:57:28 -07:00
bsalomon
55812362f1 Towards removing getTexture() on SkImage
Review URL: https://codereview.chromium.org/1166993002
2015-06-10 08:49:28 -07:00
mtklein
519580553a Use SkMScalar as float by default to match Chromium.
Tweak some test values to pass with floats.

As expected, this regresses matrix44_setconcat_general by about 2x.

BUG=skia:

Review URL: https://codereview.chromium.org/1169813006
2015-06-09 15:06:22 -07:00
reed
41e010cb90 Revert[2] SkDraw and all Blitters to use pixmap instead of bitmapi
This reverts commit b3f0ec9f99.

BUG=skia:

Review URL: https://codereview.chromium.org/1168303006
2015-06-09 12:16:53 -07:00
mtklein
1831f990c3 A bunch of little SkMScalar-as-float build fixes.
Landing this before http://crrev.com/1169813006 so the test changes needed
there are clearer.  This just lets things build with floats, and is a no-op for
doubles.

No public API changes we didn't intend to already have...
TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/1173673003
2015-06-09 11:47:01 -07:00
reed
2c55d7b7f3 remove subclassing from ImageFilter::Proxy
BUG=skia:

Review URL: https://codereview.chromium.org/1172693002
2015-06-09 08:18:40 -07:00
reed
b3f0ec9f99 Revert of change SkDraw and all Blitters to use pixmap instead of bitmap (patchset #6 id:100001 of https://codereview.chromium.org/1148793007/)
Reason for revert:
speculative revert to try to unblock DEPS roll

Original issue's description:
> change SkDraw and all Blitters to use pixmap instead of bitmap
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/c31af44336f5eb4a50e83e76e51962d46c3ed458

TBR=scroggo@google.com,jvanverth@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1164373003
2015-06-08 19:58:07 -07:00
cdalton
86ae0a9e46 Add mixed samples support to XPs
BUG=skia:

Review URL: https://codereview.chromium.org/1164973002
2015-06-08 15:11:04 -07:00
reed
c31af44336 change SkDraw and all Blitters to use pixmap instead of bitmap
BUG=skia:

Review URL: https://codereview.chromium.org/1148793007
2015-06-08 10:47:13 -07:00
bungeman
726cf9038a Add cmap 3,0 (symbol) as Unicode fallback.
FreeType automatically selects the 'most Unicode' cmap available,
otherwise the default cmap is NULL. When this happens the fallback
should include the 3,0 symbol cmap, as is outlined in the Apple
TrueType documentation. This cmap should effectively be a Unicode
mapping, but exclusively in the private use area.

BUG=skia:1873,chromium:489452

Review URL: https://codereview.chromium.org/1163833003
2015-06-05 13:38:12 -07:00
djsollen
b500ffa1a2 Add ColorMatrix filter tests from Android CTS.
BUG=skia:3848

Review URL: https://codereview.chromium.org/1134753008
2015-06-05 09:41:18 -07:00
reed
cb67414454 use pixmaps for dst in sprites -- NO BITMAPS
BUG=skia:
TBR=scroggo@google.com

Review URL: https://codereview.chromium.org/1143173011
2015-06-05 06:58:22 -07:00
jschuh
699b852e48 Remove unused PackBits methods and fix length checks
Also a bit of general cleanup.

BUG=chromium:486944

Review URL: https://codereview.chromium.org/1152163004
2015-06-04 15:10:37 -07:00
junov
d26c9fa66c Fixing leaky handling of SkImage in SkDeferredCanvas.
Long lived SkImageHeap objects currently accumulate refs indefinitely.
This leads to massive memory leaks in the gpu-accelerated 2D canvas
code path. This CL does not implement a general fix for SkGPipe, but
it resolves the leak in SkDeferredCanvas (currently the only user
of SkGPipe) by resetting the image heap when the deferral queue is
flushed. This change also fixes the accounting of bytes allocated
by referenced images in order to trigger flushing heuristics
appropriately.

BUG=crbug.com/494148

Review URL: https://codereview.chromium.org/1145893007
2015-06-02 11:47:45 -07:00
cdalton
1fa4572d1a Update XPF invariant info to not account for conflation
Renames getInvariantOutput to getInvariantBlendedColor on GrXPFactory
and redefines it to not account for coverage conflation. This is the
information that all the callsites actually wanted to know.

BUG=skia:

Review URL: https://codereview.chromium.org/1161273005
2015-06-02 10:43:39 -07:00
reed
db74f62c7a Revert[6] of add asserts around results from requestLock
This reverts commit 11e833d91b.

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1159183003
2015-05-30 13:41:15 -07:00
reed
11e833d91b Revert of Revert[4] of add asserts around results from requestLock (patchset #3 id:40001 of https://codereview.chromium.org/1159733006/)
Reason for revert:
gfx_unittests (under linux_asan)

@@@STEP_LOG_LINE@RenderTextTest.HarfBuzz_HorizontalPositions@Direct leak of 368 byte(s) in 1 object(s) allocated from:@@@
@@@STEP_LOG_LINE@RenderTextTest.HarfBuzz_HorizontalPositions@    #0 0x4cc74b in __interceptor_malloc (/b/build/slave/linux_asan/build/src/out/Release/gfx_unittests+0x4cc74b)@@@
@@@STEP_LOG_LINE@RenderTextTest.HarfBuzz_HorizontalPositions@    #1 0x7f2f7060ebdf in _cairo_image_surface_create_for_pixman_image /build/buildd/cairo-1.10.2/src/cairo-image-surface.c:158@@@
@@@STEP_LOG_LINE@RenderTextTest.HarfBuzz_HorizontalPositions@@@@
@@@STEP_LOG_LINE@RenderTextTest.HarfBuzz_HorizontalPositions@Indirect leak of 256 byte(s) in 1 object(s) allocated from:@@@
@@@STEP_LOG_LINE@RenderTextTest.HarfBuzz_HorizontalPositions@    #0 0x4cc74b in __interceptor_malloc (/b/build/slave/linux_asan/build/src/out/Release/gfx_unittests+0x4cc74b)@@@
@@@STEP_LOG_LINE@RenderTextTest.HarfBuzz_HorizontalPositions@    #1 0x7f2f6c7be26a in _pixman_image_allocate /build/buildd/pixman-0.30.2/build/pixman/../../pixman/pixman-image.c:184@@@
@@@STEP_LOG_LINE@RenderTextTest.HarfBuzz_HorizontalPositions@@@@

I think they are creating a cairo surface, but it has no pixels (zero size?). In this CL, if I see no pixels, I ignore the call-back which is used to free the surface (doh).

Original issue's description:
> Revert[4] of add asserts around results from requestLock
>
> This reverts commit 19663e54c0.
>
> BUG=skia:
> TBR=
>
> Committed: https://skia.googlesource.com/skia/+/df91b73a34e3a306c93a5e320704736255c3d9f0

TBR=reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1151063005
2015-05-30 09:20:29 -07:00
reed
df91b73a34 Revert[4] of add asserts around results from requestLock
This reverts commit 19663e54c0.

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1159733006
2015-05-30 06:32:55 -07:00
reed
19663e54c0 Revert of add asserts around results from requestLock (patchset #3 id:40001 of https://codereview.chromium.or… (patchset #1 id:1 of https://codereview.chromium.org/1165583005/)
Reason for revert:
failure in cc_unittests (need to diagnose)

@@@STEP_LOG_LINE@ResourceProviderTests_ResourceProviderTest.TransferInvalidSoftware_1@ResourceProviderTests/ResourceProviderTest.TransferInvalidSoftware/1 (run #1):@@@
@@@STEP_LOG_LINE@ResourceProviderTests_ResourceProviderTest.TransferInvalidSoftware_1@[ RUN      ] ResourceProviderTests/ResourceProviderTest.TransferInvalidSoftware/1@@@
@@@STEP_LOG_LINE@ResourceProviderTests_ResourceProviderTest.TransferInvalidSoftware_1@[17114:17114:0529/180822:15336467671:INFO:SkPixelRef.cpp(168)] ../../third_party/skia/src/core/SkPixelRef.cpp:168: failed assertion "pixels"@@@

Original issue's description:
> add asserts around results from requestLock (patchset #3 id:40001 of https://codereview.chromium.org/1155403003/)"
>
> This reverts commit 3953d36041.
>
> BUG=skia:
> TBR=
>
> Committed: https://skia.googlesource.com/skia/+/6980f5a96455c8062403c995a64b654a0e9a1319

TBR=
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1151573009
2015-05-29 18:36:07 -07:00
reed
6980f5a964 add asserts around results from requestLock (patchset #3 id:40001 of https://codereview.chromium.org/1155403003/)"
This reverts commit 3953d36041.

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1165583005
2015-05-29 15:46:36 -07:00
bsalomon
4061b1262e Remove GrContext from GrDrawTarget
Still exists on clip target (for now).

Review URL: https://codereview.chromium.org/1166553002
2015-05-29 10:26:19 -07:00
bsalomon
edd77a112d Remove GrContext from GrClipMaskCache
Review URL: https://codereview.chromium.org/1144013007
2015-05-29 09:45:57 -07:00
bsalomon
7622863095 Add direct getter for GrCaps to GrContext.
TBR=joshualitt@google.com

Committed: https://skia.googlesource.com/skia/+/9138c46e572085870638b6f7ad7fcdfcdf3cac99

Review URL: https://codereview.chromium.org/1149773005
2015-05-29 08:02:10 -07:00
bsalomon
084d1b61bc Revert of Add direct getter for GrCaps to GrContext. (patchset #4 id:60001 of https://codereview.chromium.org/1149773005/)
Reason for revert:
Breaking

Original issue's description:
> Add direct getter for GrCaps to GrContext.
>
> TBR=joshualitt@google.com
>
> Committed: https://skia.googlesource.com/skia/+/9138c46e572085870638b6f7ad7fcdfcdf3cac99

TBR=joshualitt@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1164443002
2015-05-28 08:20:58 -07:00
bsalomon
9138c46e57 Add direct getter for GrCaps to GrContext.
TBR=joshualitt@google.com

Review URL: https://codereview.chromium.org/1149773005
2015-05-28 08:13:16 -07:00
reed
6e43465039 simplify RawIter - don't return a pt in kClose
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1156893003
2015-05-27 19:53:25 -07:00
cdalton
6fd158ea47 Implement Porter Duff XP with a blend table
Removes the runtime logic used by PorterDuffXferProcessor to decide
blend coeffs and shader outputs, and instead uses a compile-time
constant table of pre-selected blend formulas. Separates out the dst
read fallback into its own XP.

Introduces a new blend strategy for srcCoeff=0 that can apply coverage
with a reverse subtract blend equation instead of dual source
blending.

Adds new macros in GrBlend.h to analyze blend formulas both runtime.

Removes kSetCoverageDrawing_OptFlag and GrSimplifyBlend as they are no
longer used.

Adds a GM that verifies all xfermodes, including arithmetic, with the
color/coverage invariants used by Porter Duff.

Adds a unit test that verifies each Porter Duff formula with every
color/coverage invariant.

Major changes:

 * Uses a reverse subtract blend equation for coverage when srcCoeff=0
   (clear, dst-out [Sa=1], dst-in, modulate). Platforms that don't
   support dual source blending no longer require a dst copy for
   dst-in and modulate.

 * Sets BlendInfo::fWriteColor to false when the blend does not modify
   the dst. GrGLGpu will now use glColorMask instead of blending for
   these modes (dst, dst-in [Sa=1], modulate ignored for [Sc=1]).

 * Converts all SA blend coeffs to One for opaque inputs, and ISA to
   Zero if there is also no coverage. (We keep ISA around when there
   is coverage because we use it to tweak alpha for coverage.)

 * Abandons solid white optimizations for the sake of simplicity
   (screen was the only mode that previous had solid white opts).

Minor differences:

 * Inconsequential differences in opt flags (e.g. we now return
   kCanTweakAlphaForCoverage_OptFlag even when there is no coverage).

 * Src coeffs when the shader outputs 0.

 * IS2C vs IS2A when the secondary output is scalar.

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/9a70920db22b6309c671f8e5d519bb95570e4414

Review URL: https://codereview.chromium.org/1124373002
2015-05-27 15:08:33 -07:00
halcanary
a681433d42 SkPDF: with opaque draws, treat SRC mode as SRC_OVER
BUG=473572

Review URL: https://codereview.chromium.org/1159763004
2015-05-27 08:53:36 -07:00
bungeman
c33db93d1b Revert of Implement Porter Duff XP with a blend table (patchset #12 id:220001 of https://codereview.chromium.org/1124373002/)
Reason for revert:
Blocking DEPS roll into Chromium. Crashing virtual/gpu/fast/canvas/canvas-composite-*.html tests with the assert

../../third_party/skia/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp:281: failed assertion "k110_GrGLSLGeneration != gpu->glslGeneration() || fOutputs.empty()"

Original issue's description:
> Implement Porter Duff XP with a blend table
>
> Removes the runtime logic used by PorterDuffXferProcessor to decide
> blend coeffs and shader outputs, and instead uses a compile-time
> constant table of pre-selected blend formulas.
>
> Introduces a new blend strategy for srcCoeff=0 that can apply coverage
> with a reverse subtract blend equation instead of dual source
> blending.
>
> Adds new macros in GrBlend.h to analyze blend formulas both runtime.
>
> Removes kSetCoverageDrawing_OptFlag and GrSimplifyBlend as they are no
> longer used.
>
> Adds a GM that verifies all xfermodes, including arithmetic, with the
> color/coverage invariants used by Porter Duff.
>
> Adds a unit test that verifies each Porter Duff formula with every
> color/coverage invariant.
>
> Major changes:
>
>  * Uses a reverse subtract blend equation for coverage when srcCoeff=0
>    (clear, dst-out [Sa=1], dst-in, modulate). Platforms that don't
>    support dual source blending no longer require a dst copy for
>    dst-in and modulate.
>
>  * Sets BlendInfo::fWriteColor to false when the blend does not modify
>    the dst. GrGLGpu will now use glColorMask instead of blending for
>    these modes (dst, dst-in [Sa=1], modulate ignored for [Sc=1]).
>
>  * Converts all SA blend coeffs to One for opaque inputs, and ISA to
>    Zero if there is also no coverage. (We keep ISA around when there
>    is coverage because we use it to tweak alpha for coverage.)
>
>  * Abandons solid white optimizations for the sake of simplicity
>    (screen was the only mode that previous had solid white opts).
>
> Minor differences:
>
>  * Inconsequential differences in opt flags (e.g. we now return
>    kCanTweakAlphaForCoverage_OptFlag even when there is no coverage).
>
>  * Src coeffs when the shader outputs 0.
>
>  * IS2C vs IS2A when the secondary output is scalar.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/9a70920db22b6309c671f8e5d519bb95570e4414

TBR=egdaniel@google.com,bsalomon@google.com,cdalton@nvidia.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1153993002
2015-05-22 17:55:26 -07:00
bungeman
c319c80d09 Revert of Fix LCD coverage regression in GrPorterDuffXPFactory (patchset #3 id:40001 of https://codereview.chromium.org/1149883004/)
Reason for revert:
Reverting this fix to revert https://codereview.chromium.org/1124373002

Original issue's description:
> Fix LCD coverage regression in GrPorterDuffXPFactory
>
> Fixes GrPorterDuffXPFactory to not use the blend table when getting
> info about the LCD coverage XP.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/3e2d59ef36e1b9a63e524cf1b27d5f7bcfb5ff0b

TBR=bsalomon@google.com,egdaniel@google.com,cdalton@nvidia.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1153803005
2015-05-22 17:54:44 -07:00
bungeman
d23a395d51 Revert of Move DstCoordTexture to GrXP, rename and remove the word "copy" from dstcopytexture names. (patchset #6 id:100001 of https://codereview.chromium.org/1132093004/)
Reason for revert:
This is asserting on GTX660 bots with '!dst'. This may just be catching an existing issue.

https://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-ShuttleA-GPU-GTX660-x86_64-Debug/builds/622/steps/dm/logs/stdio

https://build.chromium.org/p/client.skia/builders/Test-Win7-MSVC-ShuttleA-GPU-HD2000-x86-Debug-ANGLE/builds/209/steps/dm/logs/stdio

https://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleA-GPU-GTX660-x86_64-Debug/builds/318/steps/dm/logs/stdio

Original issue's description:
> Move DstCoordTexture to GrXP, rename and remove the word "copy" from dstcopytexture names.
>
> Committed: https://skia.googlesource.com/skia/+/bb106b5f6ee18f7453b63f3a95f421b60a957f39

TBR=egdaniel@google.com,bsalomon@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1158453004
2015-05-22 15:22:48 -07:00
bsalomon
bb106b5f6e Move DstCoordTexture to GrXP, rename and remove the word "copy" from dstcopytexture names.
Review URL: https://codereview.chromium.org/1132093004
2015-05-22 14:32:10 -07:00
cdalton
3e2d59ef36 Fix LCD coverage regression in GrPorterDuffXPFactory
Fixes GrPorterDuffXPFactory to not use the blend table when getting
info about the LCD coverage XP.

BUG=skia:

Review URL: https://codereview.chromium.org/1149883004
2015-05-22 14:04:37 -07:00
bsalomon
682c269a15 Store context options on caps.
Committed: https://skia.googlesource.com/skia/+/f28cff71db2cbb1ff18a8fbf1e80ca761d1f69bc

Review URL: https://codereview.chromium.org/1158433006
2015-05-22 14:01:46 -07:00
bsalomon
08bf86d1b7 Revert of Store context options on caps. (patchset #3 id:40001 of https://codereview.chromium.org/1158433006/)
Reason for revert:
breaking chromeos build (???)

Original issue's description:
> Store context options on caps.
>
> Committed: https://skia.googlesource.com/skia/+/f28cff71db2cbb1ff18a8fbf1e80ca761d1f69bc

TBR=joshualitt@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1151603005
2015-05-22 12:41:05 -07:00
bsalomon
f28cff71db Store context options on caps.
Review URL: https://codereview.chromium.org/1158433006
2015-05-22 12:25:41 -07:00
cdalton
9a70920db2 Implement Porter Duff XP with a blend table
Removes the runtime logic used by PorterDuffXferProcessor to decide
blend coeffs and shader outputs, and instead uses a compile-time
constant table of pre-selected blend formulas.

Introduces a new blend strategy for srcCoeff=0 that can apply coverage
with a reverse subtract blend equation instead of dual source
blending.

Adds new macros in GrBlend.h to analyze blend formulas both runtime.

Removes kSetCoverageDrawing_OptFlag and GrSimplifyBlend as they are no
longer used.

Adds a GM that verifies all xfermodes, including arithmetic, with the
color/coverage invariants used by Porter Duff.

Adds a unit test that verifies each Porter Duff formula with every
color/coverage invariant.

Major changes:

 * Uses a reverse subtract blend equation for coverage when srcCoeff=0
   (clear, dst-out [Sa=1], dst-in, modulate). Platforms that don't
   support dual source blending no longer require a dst copy for
   dst-in and modulate.

 * Sets BlendInfo::fWriteColor to false when the blend does not modify
   the dst. GrGLGpu will now use glColorMask instead of blending for
   these modes (dst, dst-in [Sa=1], modulate ignored for [Sc=1]).

 * Converts all SA blend coeffs to One for opaque inputs, and ISA to
   Zero if there is also no coverage. (We keep ISA around when there
   is coverage because we use it to tweak alpha for coverage.)

 * Abandons solid white optimizations for the sake of simplicity
   (screen was the only mode that previous had solid white opts).

Minor differences:

 * Inconsequential differences in opt flags (e.g. we now return
   kCanTweakAlphaForCoverage_OptFlag even when there is no coverage).

 * Src coeffs when the shader outputs 0.

 * IS2C vs IS2A when the secondary output is scalar.

BUG=skia:

Review URL: https://codereview.chromium.org/1124373002
2015-05-22 11:36:57 -07:00
reed
92fc2ae583 add SkPixmap and external locking to bitmaps
BUG=skia:

Review URL: https://codereview.chromium.org/1074983003
2015-05-22 08:06:22 -07:00
bsalomon
eb1cb5c5b5 rename GrDrawTargetCaps.h to GrCaps.h and move to include
Review URL: https://codereview.chromium.org/1135113005
2015-05-22 08:01:09 -07:00
halcanary
e797d0de67 SkBlockMemoryStream implements peek()
Review URL: https://codereview.chromium.org/1146903004
2015-05-21 08:13:27 -07:00
jvanverth
fb5df43af8 Add RGBA half float texture format.
BUG=skia:3829

Review URL: https://codereview.chromium.org/1148243002
2015-05-21 08:12:27 -07:00
reed
ab8657722c add assert that the lock-count on pixelref is balanced
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1147153004
2015-05-21 06:29:05 -07:00
bungeman
41868fe562 Font variations.
Multiple Master and TrueType fonts support variation axes.
This implements back-end support for axes on platforms which
support it.

Committed: https://skia.googlesource.com/skia/+/05773ed30920c0214d1433c07cf6360a05476c97

Committed: https://skia.googlesource.com/skia/+/3489ee0f4fa34f124f9de090d12bdc2107d52aa9

Review URL: https://codereview.chromium.org/1027373002
2015-05-20 09:21:04 -07:00
fs
d8b5771779 Don't fail SkMergeImageFilter if one of the inputs are empty
If one of the inputs to a SkMergeImageFilter was clipped away or
otherwise caused the filterImage(...) invocation for it to return
false, the entire effect would be "failed" and return false --
regardless of if it had produced a result or not.
Instead of returning false directly if filterImage(...) for a source
returned false, consider all the inputs, and then only return false if
all of them do.

BUG=chromium:489046

Review URL: https://codereview.chromium.org/1133523006
2015-05-20 00:52:17 -07:00
mtklein
9db912c2ac Sketch splitting SkPicture into an interface and SkBigPicture.
Adds small pictures for drawRect(), drawTextBlob(), and drawPath().
These cover about 89% of draw calls from Blink SKPs,
and about 25% of draw calls from our GMs.

SkPicture handles:
  - serialization and deserialization
  - unique IDs

Everything else is left to the subclasses:
  - playback(), cullRect()
  - hasBitmap(), hasText(), suitableForGPU(), etc.
  - LayerInfo / AccelData if applicable.

The time to record a 1-op picture improves a good chunk
(2 mallocs to 1), and the time to record a 0-op picture
greatly improves (2 mallocs to none):

    picture_overhead_draw:   450ns -> 350ns
    picture_overhead_nodraw: 300ns -> 90ns

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/c92c129ff85b05a714bd1bf921c02d5e14651f8b

Latest blink_linux_rel:

http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/61248

Committed: https://skia.googlesource.com/skia/+/15877b6eae33a9282458bdb904a6d00440eca0ec

http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/62015

Review URL: https://codereview.chromium.org/1112523006
2015-05-19 11:11:26 -07:00
bsalomon
4b91f768b3 rename GrDrawTargetCaps to GrCaps
Review URL: https://codereview.chromium.org/1133123009
2015-05-19 09:29:46 -07:00
mtklein
72743b1654 Revert of Sketch splitting SkPicture into an interface and SkBigPicture. (patchset #25 id:480001 of https://codereview.chromium.org/1112523006/)
Reason for revert:
win_chromium_compile_dbg_ng

FAILED: ninja -t msvc -e environment.x86 -- E:\b\build\goma/gomacc "E:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\skia\src\core\skia.SkBitmapHeap.obj.rsp /c ..\..\third_party\skia\src\core\SkBitmapHeap.cpp /Foobj\third_party\skia\src\core\skia.SkBitmapHeap.obj /Fdobj\skia\skia.cc.pdb
e:\b\build\slave\win\build\src\third_party\skia\include\core\skpicture.h(176) : error C2487: 'CURRENT_PICTURE_VERSION' : member of dll interface class may not be declared with dll interface

Original issue's description:
> Sketch splitting SkPicture into an interface and SkBigPicture.
>
> Adds small pictures for drawRect(), drawTextBlob(), and drawPath().
> These cover about 89% of draw calls from Blink SKPs,
> and about 25% of draw calls from our GMs.
>
> SkPicture handles:
>   - serialization and deserialization
>   - unique IDs
>
> Everything else is left to the subclasses:
>   - playback(), cullRect()
>   - hasBitmap(), hasText(), suitableForGPU(), etc.
>   - LayerInfo / AccelData if applicable.
>
> The time to record a 1-op picture improves a good chunk
> (2 mallocs to 1), and the time to record a 0-op picture
> greatly improves (2 mallocs to none):
>
>     picture_overhead_draw:   450ns -> 350ns
>     picture_overhead_nodraw: 300ns -> 90ns
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/c92c129ff85b05a714bd1bf921c02d5e14651f8b
>
> Latest blink_linux_rel:
>
> http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/61248
>
> Committed: https://skia.googlesource.com/skia/+/15877b6eae33a9282458bdb904a6d00440eca0ec

TBR=reed@google.com,robertphillips@google.com,fmalita@chromium.org,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1130283004
2015-05-18 14:53:43 -07:00
mtklein
15877b6eae Sketch splitting SkPicture into an interface and SkBigPicture.
Adds small pictures for drawRect(), drawTextBlob(), and drawPath().
These cover about 89% of draw calls from Blink SKPs,
and about 25% of draw calls from our GMs.

SkPicture handles:
  - serialization and deserialization
  - unique IDs

Everything else is left to the subclasses:
  - playback(), cullRect()
  - hasBitmap(), hasText(), suitableForGPU(), etc.
  - LayerInfo / AccelData if applicable.

The time to record a 1-op picture improves a good chunk
(2 mallocs to 1), and the time to record a 0-op picture
greatly improves (2 mallocs to none):

    picture_overhead_draw:   450ns -> 350ns
    picture_overhead_nodraw: 300ns -> 90ns

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/c92c129ff85b05a714bd1bf921c02d5e14651f8b

Latest blink_linux_rel:

http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/61248

Review URL: https://codereview.chromium.org/1112523006
2015-05-18 13:47:17 -07:00
mtklein
cfa90a1aaf Empty picture shaders should draw nothing.
BUG=skia:

Review URL: https://codereview.chromium.org/1142053004
2015-05-18 13:44:35 -07:00
caryclark
4e1a4c9399 fix builder winding again
Record the nesting level when finding the edge winding contribution
so that inner edges can be reversed as needed.

R=fmalita@chromium.org
BUG=skia:3838

Review URL: https://codereview.chromium.org/1140383002
2015-05-18 12:56:58 -07:00
caryclark
5b5ddd73b4 The path ops builder code needs to determine the winding of each contour added, and reverse windings if the contours are nested in other contours.
Cheap (one contour) paths can be evaluated and reversed as needed with a minimum of checking, but multi-contour paths invoke the regular path ops machinery to determine who is contained by whom.

More tests need to be added to verify that all corner cases are considered, but this fixes the cases in the bug thus far.

R=fmalita@chromium.org
TBR=reed@google.com
BUG=skia:3838

Review URL: https://codereview.chromium.org/1129193006
2015-05-18 05:12:56 -07:00
robertphillips
465706820d Revert of Font variations. (patchset #26 id:500001 of https://codereview.chromium.org/1027373002/)
Reason for revert:
Appears to be breaking  Linux ARM bots:

FAILED:
/usr/local/google/home/mosaic-role/slave/repo_clients/chromium_tot/chromium/src/../../prebuilt/toolchain/armv7a/bin/armv7a-cros-linux-gnueabi-g++
... -o obj/third_party/skia/src/ports/skia_library.SkFontHost_FreeType.o
../../third_party/skia/src/ports/SkFontHost_FreeType.cpp:37:31: fatal error:
freetype/ftmm.h: No such file or directory
 #include FT_MULTIPLE_MASTERS_H
                               ^
compilation terminated.

Original issue's description:
> Font variations.
>
> Multiple Master and TrueType fonts support variation axes.
> This implements back-end support for axes on platforms which
> support it.
>
> Committed: https://skia.googlesource.com/skia/+/05773ed30920c0214d1433c07cf6360a05476c97
>
> Committed: https://skia.googlesource.com/skia/+/3489ee0f4fa34f124f9de090d12bdc2107d52aa9

TBR=reed@google.com,mtklein@google.com,djsollen@google.com,halcanary@google.com,bungeman@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1139123008
2015-05-15 11:30:41 -07:00
mtklein
27e517ae53 add Min to SkNi, specialized for u8 and u16 on SSE and NEON
0x8001 / 0x7fff don't seem to work, but we were close: 0x8000 does.

I plan to use this to implement the Difference xfermode,
and it seems generally handy.

BUG=skia:

Review URL: https://codereview.chromium.org/1133933004
2015-05-14 17:53:04 -07:00
scroggo
9d214295e4 Add a test for decoding a gif with sampleSize 4.
Prior to https://codereview.chromium.org/1085253002/, this would crash.

Only happens with interlaced gif images with an odd height. (Maybe
there are more restrictions?)

Test image provided by zoran.jovanovic@sonymobile.com for checking in.

Add include before includes.

Review URL: https://codereview.chromium.org/1091053002
2015-05-14 14:44:14 -07:00
caryclark
fba9da78ac fix path op builder
The rewrite of path ops caused the inner contour direction to be reversed.
This exposed an existing bug in path ops builder, namely that the implicit
winding of the internal sum path could hide inner contours if they ended
up in the wrong direction.

Setting the sum path's fill type to even-odd ensures that the inner
contours aren't discarded.

R=fmalita@chromium.org
BUG=skia:3838

Review URL: https://codereview.chromium.org/1126193004
2015-05-14 14:18:13 -07:00
bungeman
3489ee0f4f Font variations.
Multiple Master and TrueType fonts support variation axes.
This implements back-end support for axes on platforms which
support it.

Committed: https://skia.googlesource.com/skia/+/05773ed30920c0214d1433c07cf6360a05476c97

Review URL: https://codereview.chromium.org/1027373002
2015-05-14 14:18:03 -07:00
caryclark
182b499cd7 look for deleted pts when detecting line/curve coincident edges
TBR=reed@google.com
BUG=skia:3651

Review URL: https://codereview.chromium.org/1129863007
2015-05-14 05:45:54 -07:00
bungeman
5ae1312c9f Revert of Font variations. (patchset #21 id:400001 of https://codereview.chromium.org/1027373002/)
Reason for revert:
Mac failing to build due to CFNumberType in Chromium Canary.

Original issue's description:
> Font variations.
>
> Multiple Master and TrueType fonts support variation axes.
> This implements back-end support for axes on platforms which
> support it.
>
> Committed: https://skia.googlesource.com/skia/+/05773ed30920c0214d1433c07cf6360a05476c97

TBR=reed@google.com,mtklein@google.com,djsollen@google.com,halcanary@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1128913008
2015-05-13 12:16:41 -07:00
joshualitt
1573206f20 fix for angle bot
TBR=
BUG=skia:

Review URL: https://codereview.chromium.org/1137333004
2015-05-13 12:15:14 -07:00
bungeman
05773ed309 Font variations.
Multiple Master and TrueType fonts support variation axes.
This implements back-end support for axes on platforms which
support it.

Review URL: https://codereview.chromium.org/1027373002
2015-05-13 10:57:10 -07:00
caryclark
38a017bf44 clean up tests
Confirm that no path ops tests are flaky, and clean up errors around
that. The test framework was incorrectly checking for >= MAX_ERRORS for
failure and <= MAX_ERRORS for success.

TBR=reed@google.com

Review URL: https://codereview.chromium.org/1140563003
2015-05-13 10:13:17 -07:00
joshualitt
6c891107ce GLProgramsTest 3.0
BUG=skia:

Review URL: https://codereview.chromium.org/1139743002
2015-05-13 08:51:50 -07:00
caryclark
bca19f7747 deal more consistently with unsortable edges
Improve line/curve coincident detection and resolution. This fixed the remaining simple failures.

When an edge is unsortable, use the ray intersection to determine the angles' winding.

Deal with degenerate segments.

TBR=reed@google.com
BUG=skia:3588,skia:3762

Review URL: https://codereview.chromium.org/1140813002
2015-05-13 08:23:48 -07:00
kkinnunen
8f827fe44a Fix SkStrokeRec == to report true for all fills
Fix SkStrokeRec == to report true for all fills, regardless
of the stale stroking data the object might contain.

Review URL: https://codereview.chromium.org/1130153002
2015-05-13 00:02:26 -07:00
reed
80ea19ca4b Revert of Revert of stop calling SkScalarDiv (patchset #1 id:1 of https://codereview.chromium.org/1138263002/)
Reason for revert:
android patched, blink has rolled

Original issue's description:
> Revert of stop calling SkScalarDiv (patchset #4 id:60001 of https://codereview.chromium.org/1135053002/)
>
> Reason for revert:
> need to wait for Blink roll (and patch android)
>
> Original issue's description:
> > stop calling SkScalarDiv
> >
> > BUG=skia:
> > TBR=
> >
> > Committed: https://skia.googlesource.com/skia/+/67d71c898249a7af3523b16c6a69895a63bfae0a
>
> TBR=
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/2629697933b5cc975e45d2a45c48f803fc6cbcec

TBR=
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1135693003
2015-05-12 10:37:34 -07:00
reed
2629697933 Revert of stop calling SkScalarDiv (patchset #4 id:60001 of https://codereview.chromium.org/1135053002/)
Reason for revert:
need to wait for Blink roll (and patch android)

Original issue's description:
> stop calling SkScalarDiv
>
> BUG=skia:
> TBR=
>
> Committed: https://skia.googlesource.com/skia/+/67d71c898249a7af3523b16c6a69895a63bfae0a

TBR=
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1138263002
2015-05-12 10:28:06 -07:00
reed
67d71c8982 stop calling SkScalarDiv
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1135053002
2015-05-12 09:47:22 -07:00
caryclark
624637cc8e Path ops formerly found the topmost unprocessed edge and determined its angle sort order to initialize the winding. This never worked correctly with cubics and was flaky with paths consisting mostly of vertical edges.
This replacement shoots axis-aligned rays through all intersecting edges to find the outermost one either horizontally or vertically. The resulting code is smaller and twice as fast.

To support this, most of the horizontal / vertical intersection code was rewritten and standardized, and old code supporting the top-directed winding was deleted.

Contours were pointed to by an SkTDArray. Instead, put them in a linked list, and designate the list head with its own class to ensure that methods that take lists of contours start at the top. This change removed a large percentage of memory allocations used by path ops.

TBR=reed@google.com
BUG=skia:3588

Review URL: https://codereview.chromium.org/1111333002
2015-05-11 07:21:28 -07:00
reed
b7ed856fad Revert of Sketch splitting SkPicture into an interface and SkBigPicture. (patchset #22 id:420001 of https://codereview.chromium.org/1112523006/)
Reason for revert:
speculative revert to fix failures in DEPS roll

Original issue's description:
> Sketch splitting SkPicture into an interface and SkBigPicture.
>
> Adds small pictures for drawRect(), drawTextBlob(), and drawPath().
> These cover about 89% of draw calls from Blink SKPs,
> and about 25% of draw calls from our GMs.
>
> SkPicture handles:
>   - serialization and deserialization
>   - unique IDs
>
> Everything else is left to the subclasses:
>   - playback(), cullRect()
>   - hasBitmap(), hasText(), suitableForGPU(), etc.
>   - LayerInfo / AccelData if applicable.
>
> The time to record a 1-op picture improves a good chunk
> (2 mallocs to 1), and the time to record a 0-op picture
> greatly improves (2 mallocs to none):
>
>     picture_overhead_draw:   450ns -> 350ns
>     picture_overhead_nodraw: 300ns -> 90ns
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/c92c129ff85b05a714bd1bf921c02d5e14651f8b

TBR=reed@google.com,robertphillips@google.com,mtklein@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1130333002
2015-05-07 17:30:13 -07:00
reed
8b26b99c97 new image from backend desc
BUG=485243

Review URL: https://codereview.chromium.org/1121813002
2015-05-07 15:36:18 -07:00
mtklein
c92c129ff8 Sketch splitting SkPicture into an interface and SkBigPicture.
Adds small pictures for drawRect(), drawTextBlob(), and drawPath().
These cover about 89% of draw calls from Blink SKPs,
and about 25% of draw calls from our GMs.

SkPicture handles:
  - serialization and deserialization
  - unique IDs

Everything else is left to the subclasses:
  - playback(), cullRect()
  - hasBitmap(), hasText(), suitableForGPU(), etc.
  - LayerInfo / AccelData if applicable.

The time to record a 1-op picture improves a good chunk
(2 mallocs to 1), and the time to record a 0-op picture
greatly improves (2 mallocs to none):

    picture_overhead_draw:   450ns -> 350ns
    picture_overhead_nodraw: 300ns -> 90ns

BUG=skia:

Review URL: https://codereview.chromium.org/1112523006
2015-05-07 13:41:07 -07:00
halcanary
96287f7af7 SkPDF: detect YUV-JPEG without relying on ImageGenerator
JPEG/JFIF References:
*   http://www.w3.org/Graphics/JPEG/itu-t81.pdf
*   http://www.w3.org/Graphics/JPEG/jfif3.pdf

BUG=476721
BUG=446940

Review URL: https://codereview.chromium.org/1133443003
2015-05-07 11:46:59 -07:00
mtklein
0d992db1cf Make SkFunction copyable so it can go in containers.
This totally overhauls the implementation to use ordinary inheritance-based type erasure.  I give up for now getting my manual vtable shenanigans to work with MSVC.  Still those same "expected ; before ), also expected ) before ;" errors.

I added support for uninitialized SkFunctions and operator=(), because it was fairly straightforward with this implementation.

The main downside here is that I've removed the inline implementation.  All SkFunctions involve a heap allocation, even when just wrapping function pointers.

BUG=skia:

Review URL: https://codereview.chromium.org/1056673002
2015-05-06 07:40:26 -07:00
reed
d1290843c3 remove dead code behind BOOL_ONGETINFO
need this to land in chrome first https://codereview.chromium.org/1125573002

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1123473004
2015-05-05 11:36:02 -07:00
reed
71a6cbfc58 remove redundant/deprecated TwoPointRadial gradiet -- use TwoPointConical
This CL derived from https://codereview.chromium.org/1114243005/

BUG=skia:

Review URL: https://codereview.chromium.org/1117423003
2015-05-04 08:32:51 -07:00
halcanary
f7a169e225 SkPDF: clean up uses of deprecated calls in tests
BUG=skia:3585

Review URL: https://codereview.chromium.org/1106163002
2015-05-01 07:35:45 -07:00
halcanary
0b9d4118ba SkTime: return timezone information; format in ISO-8601
Motivation: PDF/A metadata will need the creation date embedded in it.

Also, GetDateTime returns local time in Win32.  This now behaves the
same as on Unix systems.

BUG=skia:3110

Review URL: https://codereview.chromium.org/1109593002
2015-05-01 07:06:23 -07:00
bsalomon
d309e7aa0e This replaces the texture creation/caching functions on GrContext with a GrTextureProvider interface. The goal is to pass this narrowly focused object in places that currently take a GrContext but don't need and shouldn't use its other methods. It also has an extended private interface for interacting with non-texture resource types.
Review URL: https://codereview.chromium.org/1107973004
2015-04-30 14:18:54 -07:00
bungeman
3ffa126066 Move resource fonts to common location.
Move resource fonts to resources/fonts, add a destortable font for
testing, and clean up how the tests create fonts from resources.

R=joshualitt@google.com

Review URL: https://codereview.chromium.org/1120823002
2015-04-30 17:12:58 -04:00
reed
1c2c441fed add heuristic to pour small pictures into recordings, rather than ref'ing
BUG=skia:

Review URL: https://codereview.chromium.org/1118693003
2015-04-30 13:09:25 -07:00
cdalton
9954bc38c4 Use texture barriers to read directly from the RT
Updates GrXferProcessor to read directly from the RT texture when
texture barriers are supported and it needs to know the dst color.
Also adds the notion of an Xfer barrier and uses it to issue texture
barriers when the XP will read the RT.

BUG=skia:

Review URL: https://codereview.chromium.org/1040303002
2015-04-29 14:17:00 -07:00
jvanverth
e9c0fc616d Pull out shader-specific caps into GrShaderCaps and GrGLSLCaps
BUG=skia:

Review URL: https://codereview.chromium.org/1116713002
2015-04-29 11:18:05 -07:00
caryclark
aec2510125 minor fixes to cubics code and overall alignment of how bounds and tops are computed for all curve types
All but 17 extended tests work.

A helper function is privately added to SkPath.h to permit a test to modify a given point in a path.

BUG=skia:3588

Review URL: https://codereview.chromium.org/1107353004
2015-04-29 08:28:30 -07:00
msarett
97fdea6c43 Implementing a scanline decoder for jpeg
BUG=skia:3257

Review URL: https://codereview.chromium.org/1092303003
2015-04-29 08:17:15 -07:00
reed
5b6db07fb5 SkRWBuffer for thread-safe 'stream' sharing
WIP
- Can accumulate (write) data in one thread, and share snapshots of it in other threads
  ... e.g. network accumulates image data, and periodically we want to decode/draw it
- If this sort of thing sticks, should we promote SkData to have the same generality as
  SkRBuffer?

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1106113002
2015-04-28 17:50:32 -07:00
jvanverth
cfc18867d9 Use GLSLCaps for creating processor keys and GLSL-specific programs
Effectively all this does is future-proof any GLSL-specific code, as
GLSLCaps is just a typedef of GLCaps.

BUG=skia:

Review URL: https://codereview.chromium.org/1109863004
2015-04-28 08:48:20 -07:00
mtklein
d7c014ff03 Split rsqrt into rsqrt{0,1,2}, with increasing cost and precision on ARM
This is a logical no-op.  Everything was using the equivalent of rsqrt1() before, and is now after.

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/9de16283fdc8cc0d31a84f503578d0ecea4e8297

CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-Arm64-Debug-Android-Trybot

Review URL: https://codereview.chromium.org/1109913002
2015-04-27 14:22:32 -07:00
mtklein
9a22f489e8 Revert of Split rsqrt into rsqrt{0,1,2}, with increasing cost and precision on ARM (patchset #2 id:20001 of https://codereview.chromium.org/1109913002/)
Reason for revert:
arm64 typos

Original issue's description:
> Split rsqrt into rsqrt{0,1,2}, with increasing cost and precision on ARM
>
> This is a logical no-op.  Everything was using the equivalent of rsqrt1() before, and is now after.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/9de16283fdc8cc0d31a84f503578d0ecea4e8297

TBR=reed@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1105233003
2015-04-27 13:55:53 -07:00
mtklein
9de16283fd Split rsqrt into rsqrt{0,1,2}, with increasing cost and precision on ARM
This is a logical no-op.  Everything was using the equivalent of rsqrt1() before, and is now after.

BUG=skia:

Review URL: https://codereview.chromium.org/1109913002
2015-04-27 13:51:28 -07:00
mtklein
1113da72ec Mike's radial gradient CL with better float -> int.
patch from issue 1072303005 at patchset 40001 (http://crrev.com/1072303005#ps40001)

This looks quite launchable.  radial_gradient3, min of 100 samples:
  N5:  985µs -> 946µs
  MBP: 395µs -> 279µs

On my MBP, most of the meat looks like it's now in reading the cache and writing to dst one color at a time.  Is that something we could do in float math rather than with a lookup table?

BUG=skia:

CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Mac10.8-Clang-Arm7-Debug-Android-Trybot,Build-Ubuntu-GCC-Arm7-Release-Android_NoNeon-Trybot

Committed: https://skia.googlesource.com/skia/+/abf6c5cf95e921fae59efb487480e5b5081cf0ec

Review URL: https://codereview.chromium.org/1109643002
2015-04-27 12:08:01 -07:00
mtklein
8d3e9dff3f Revert of Mike's radial gradient CL with better float -> int. (patchset #7 id:120001 of https://codereview.chromium.org/1109643002/)
Reason for revert:
compile failures.

Original issue's description:
> Mike's radial gradient CL with better float -> int.
>
> patch from issue 1072303005 at patchset 40001 (http://crrev.com/1072303005#ps40001)
>
> This looks quite launchable.  radial_gradient3, min of 100 samples:
>   N5:  985µs -> 946µs
>   MBP: 395µs -> 279µs
>
> On my MBP, most of the meat looks like it's now in reading the cache and writing to dst one color at a time.  Is that something we could do in float math rather than with a lookup table?
>
> BUG=skia:
>
> CQ_EXTRA_TRYBOTS=client.skia.android:Test-Android-GCC-Nexus5-CPU-NEON-Arm7-Debug-Trybot,Test-Android-GCC-Nexus9-CPU-Denver-Arm64-Debug-Trybot
>
> Committed: https://skia.googlesource.com/skia/+/abf6c5cf95e921fae59efb487480e5b5081cf0ec

TBR=reed@google.com,robertphillips@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1109883003
2015-04-27 11:21:16 -07:00
mtklein
abf6c5cf95 Mike's radial gradient CL with better float -> int.
patch from issue 1072303005 at patchset 40001 (http://crrev.com/1072303005#ps40001)

This looks quite launchable.  radial_gradient3, min of 100 samples:
  N5:  985µs -> 946µs
  MBP: 395µs -> 279µs

On my MBP, most of the meat looks like it's now in reading the cache and writing to dst one color at a time.  Is that something we could do in float math rather than with a lookup table?

BUG=skia:

CQ_EXTRA_TRYBOTS=client.skia.android:Test-Android-GCC-Nexus5-CPU-NEON-Arm7-Debug-Trybot,Test-Android-GCC-Nexus9-CPU-Denver-Arm64-Debug-Trybot

Review URL: https://codereview.chromium.org/1109643002
2015-04-27 11:13:53 -07:00
jvanverth
505306374d Remove legacy NVPR support
BUG=skia:

Review URL: https://codereview.chromium.org/1110553003
2015-04-27 10:36:27 -07:00
bsalomon
d79c549467 Make non-AA hairline stroke rects snap to pixels centers so they close.
BUG=skia:3717

Review URL: https://codereview.chromium.org/1101663007
2015-04-27 10:07:04 -07:00
tfarina
567ff2f614 Cleanup: Remove unnecessary double-semicolons.
The entries were found by the following command line:

$ find . -regex ".*\.[cChH]\(pp\)?" | xargs git grep -e ';;' --and --not
-e 'for *(.*;;'

Which is a combination of http://stackoverflow.com/a/3858879 and
http://gitster.livejournal.com/27674.html

BUG=None
R=mtklein@google.com

Review URL: https://codereview.chromium.org/1088763005
2015-04-27 07:01:45 -07:00
kkinnunen
1899651ffc Extract gpu line dashing to GrDashLinePathRenderer
Move line dashing logic from GrContext::drawPath to
GrDashLinePathRenderer. This makes it possible to let path renderers render arbitrary dashed paths.

End goal is to implement dashing in GrStencilAndCoverPathRenderer.

Review URL: https://codereview.chromium.org/1100073003
2015-04-26 23:18:50 -07:00
halcanary
130444fdaf SkPDF: Refactor SkPDFObject heiararchy.
Flatten and use a tagged union type

        Δmemory ~= -2.4% ± 0.5%
        Δtime   ~= -1.2% ± 0.2%

BUG=skia:3585

Review URL: https://codereview.chromium.org/1069103003
2015-04-25 06:45:07 -07:00
caryclark
08bc8488fa fix multiple intersection logic
When three or more curves intersect at the same point, ensure that
each curve records the intersections of the others. This fixes a
number of cubic tests.

TBR=reed@google.com
BUG=skia:3588

Review URL: https://codereview.chromium.org/1105943002
2015-04-24 09:08:57 -07:00
caryclark
03b03cad01 working on initial winding for cubics
Path ops works well for all tests except for cubics.
Isolate failures caused by cubics, and do a better job of computing
the initial winding for cubics.

TBR=reed@google.com
BUG=skia:3588

Review URL: https://codereview.chromium.org/1096923003
2015-04-23 09:13:37 -07:00
msarett
4b17fa353e Ensure that we create a NULL codec for images with zero dimensions
BUG=skia:3534
BUG=skia:3257

Review URL: https://codereview.chromium.org/1091043003
2015-04-23 08:53:39 -07:00
mtklein
98b8485a4c O(1) SkPictureUtils::ApproxBytesUsed()
Chrome wants to call this more often, and it's quite slow today.

Seems like this could be clearer if SkPictureUtils::ApproxBytesUsed() were SkPicture::approxBytesUsed().

BUG=chromium:471873

Review URL: https://codereview.chromium.org/1090943004
2015-04-21 15:24:00 -07:00
senorblanco
42a2c1d231 Revert "One more ASAN fix."
This reverts commit 409fd66a5a.

We don't expect to pass this test until the ASAN bots are
correctly configured, and can run GPU tests.

BUG=skia:
TBR=robertphillips@google.com

Review URL: https://codereview.chromium.org/1080393003
2015-04-21 11:13:17 -07:00
senorblanco
409fd66a5a One more ASAN fix.
Don't fail the GL validation check if the GL context fails to create.

TBR=robertphillips@google.com
BUG=skia:

Review URL: https://codereview.chromium.org/1096113003
2015-04-21 09:43:08 -07:00
senorblanco
c8e934007a Yet more ASAN fixes.
More nullptr checks for factories I have added.
Other checks more Yoda-like I have made. (Skia style this is.)

BUG=skia:

Review URL: https://codereview.chromium.org/1086393004
2015-04-21 07:20:36 -07:00
senorblanco
84bfd3958f Another speculative ASAN fix.
Add a GrContext nullptr check in SurfaceTest.

TBR=robertphillips@google.com

Review URL: https://codereview.chromium.org/1098993004
2015-04-21 06:59:17 -07:00
mtklein
33d73c39dd SkTHash: remove()
BUG=skia:

Review URL: https://codereview.chromium.org/1057043003
2015-04-21 06:53:56 -07:00
senorblanco
0e95b116fc Speculative fix for ASAN build.
Check for NULL GrContext in TessellatingPathRendererTests.
Also fix an upload nag (no #includes before GPU #ifdef).

TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1097943004
2015-04-20 15:00:06 -07:00
caryclark
1049f1246e Now, path ops natively intersect conics, quads, and cubics in any combination. There are still a class of cubic tests that fail and a handful of undiagnosed failures from skps and fuzz tests, but things are much better overall.
Extended tests (150M+) run to completion in release in about 6 minutes; the standard test suite exceeds 100K and finishes in a few seconds on desktops.

TBR=reed
BUG=skia:3588

Review URL: https://codereview.chromium.org/1037953004
2015-04-20 08:31:59 -07:00
halcanary
a8448bc3df PDF: Correctly embed JPEG images directly into PDF output.
We only embed images with YUV planes.  That should only grab the
subset of color JPEGs supported by PDF.

BUG=skia:3180

Review URL: https://codereview.chromium.org/1025773002
2015-04-17 13:27:24 -07:00
reed
ca1a22ee53 Revert of Revert of remove unused (by clients) SkPathUtils (patchset #1 id:1 of https://codereview.chromium.org/1060703003/)
Reason for revert:
fix (removal from gypi/gn files) has landed in chrome.

Original issue's description:
> Revert of remove unused (by clients) SkPathUtils (patchset #1 id:1 of https://codereview.chromium.org/1088383003/)
>
> Reason for revert:
> This change is causing the DEPS roll to fail:
>
>
> http://build.chromium.org/p/tryserver.chromium.linux/builders/android_chromium_gn_compile_rel/builds/78771/steps/gn/logs/stdio
>
> Original issue's description:
> > remove unused (by clients) SkPathUtils
> >
> > BUG=skia:
> >
> > Committed: https://skia.googlesource.com/skia/+/aab35d91b8b80acd1902594bbf542083fdfa4bb7
>
> TBR=scroggo@google.com,reed@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/bdb0bf5f8858043878d8a4fa8130c6c87bef3fd4

TBR=scroggo@google.com,jcgregorio@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1091963002
2015-04-16 20:10:55 -07:00
egdaniel
8dc7c3a839 Rename GrStencilBuffer to GrStencilAttachment
BUG=skia:

Review URL: https://codereview.chromium.org/1083133002
2015-04-16 11:22:42 -07:00
cdalton
72badbd99e Add ReverseIter to GrTRecorder
BUG=skia:

Review URL: https://codereview.chromium.org/1035083004
2015-04-16 10:42:49 -07:00
jcgregorio
bdb0bf5f88 Revert of remove unused (by clients) SkPathUtils (patchset #1 id:1 of https://codereview.chromium.org/1088383003/)
Reason for revert:
This change is causing the DEPS roll to fail:

http://build.chromium.org/p/tryserver.chromium.linux/builders/android_chromium_gn_compile_rel/builds/78771/steps/gn/logs/stdio

Original issue's description:
> remove unused (by clients) SkPathUtils
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/aab35d91b8b80acd1902594bbf542083fdfa4bb7

TBR=scroggo@google.com,reed@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1060703003
2015-04-16 09:47:36 -07:00
reed
aab35d91b8 remove unused (by clients) SkPathUtils
BUG=skia:

Review URL: https://codereview.chromium.org/1088383003
2015-04-16 06:16:38 -07:00
msarett
e16b04aa60 SkJpegCodec
Enables basic decoding for jpegs

Includes rewinding

565, YUV, and Jpeg encoding are not yet implemented

BUG=skia:3257

Review URL: https://codereview.chromium.org/1076923002
2015-04-15 07:32:20 -07:00
mtklein
115acee938 Sk4h and Sk8h for SSE
These will underly the SkPMFloat-like class for uint16_t components.

Sk4h will back a single-pixel version, and Sk8h any larger number than that.

BUG=skia:

Review URL: https://codereview.chromium.org/1088883005
2015-04-14 14:02:52 -07:00
caryclark
30ac464d48 early return from stream peek
Don't assert if resources are missing

R=scroggo@google.com
BUG=skia:3719

Review URL: https://codereview.chromium.org/1080073002
2015-04-14 06:08:04 -07:00
reed
ffab15f60e use anon namespace to avoid (silent) collisions between local test classes
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1079813002
2015-04-11 19:29:31 -07:00
reed
51985e3f5e setDrawFilter needs to trigger any deferred saves
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1077353002
2015-04-11 08:04:56 -07:00
msarett
3c309db75b Implementing filling for SkBmpCodec
The bmp codec currently returns kIncompleteInput
when the stream is truncated, which we treat as a
partial success.  However, we neglect the fill the
remaining pixels in the image, leaving these
uninitialized.

This CL addresses this problem by initializing the
remaining pixels in the image to default values.

BUG=skia:3257

Review URL: https://codereview.chromium.org/1075243003
2015-04-10 14:36:49 -07:00
msarett
29be7958de Fix ASAN error
BUG=skia:

TBR=

Review URL: https://codereview.chromium.org/1072183002
2015-04-09 13:14:40 -07:00
msarett
438b2adefb ***Disables swizzles to 565.
We may want to enable swizzles to 565
for images that are encoded in a format
similar to 565, however, we do not want
to take images that decode naturally to
kN32 and then convert them to 565.

***Enable swizzles to kIndex_8.  For images
encoded in a color table format, we suggest
that they be decoded to kIndex_8.  When we
decode, we only allow conversion to kIndex_8
if it matches the suggested color type (except
wbmp which seems good as is).

***Modify dm to test images that decode to
kIndex_8.

BUG=skia:3257
BUG=skia:3440

Review URL: https://codereview.chromium.org/1055743003
2015-04-09 12:43:10 -07:00
reed
0b18c3554c add test for opaque-preserving colormatrixfilters
BUG=skia:

Review URL: https://codereview.chromium.org/1069463002
2015-04-09 08:27:27 -07:00
stephana
195f62d07d BUG=skia:
Review URL: https://codereview.chromium.org/1054073003
2015-04-09 07:57:54 -07:00
mtklein
29b1afc169 Rearrange SkRecord with small N in mind
This rearranges the record pointers and types so they can go in a single array, then preallocates some space for them and for the SkVarAlloc.

picture_overhead_draw bench drops from ~1000ns to 500-600ns, with no effect on picture_overhead_nodraw.

I don't see any significant effect on large picture recording times from our .skps.

BUG=chromium:470553

Committed: https://skia.googlesource.com/skia/+/e2dd9408cd711777afaa9410427fb0d761ab004a

Review URL: https://codereview.chromium.org/1061783002
2015-04-09 07:46:41 -07:00
mtklein
35f55764b8 Revert of Rearrange SkRecord with small N in mind (patchset #8 id:120001 of https://codereview.chromium.org/1061783002/)
Reason for revert:
https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug/builds/149/steps/dm/logs/stdio

Original issue's description:
> Rearrange SkRecord with small N in mind
>
> This rearranges the record pointers and types so they can go in a single array, then preallocates some space for them and for the SkVarAlloc.
>
> picture_overhead_draw bench drops from ~1000ns to 500-600ns, with no effect on picture_overhead_nodraw.
>
> I don't see any significant effect on large picture recording times from our .skps.
>
> BUG=chromium:470553
>
> Committed: https://skia.googlesource.com/skia/+/e2dd9408cd711777afaa9410427fb0d761ab004a

TBR=reed@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:470553

Review URL: https://codereview.chromium.org/1068383003
2015-04-08 14:09:41 -07:00
mtklein
e2dd9408cd Rearrange SkRecord with small N in mind
This rearranges the record pointers and types so they can go in a single array, then preallocates some space for them and for the SkVarAlloc.

picture_overhead_draw bench drops from ~1000ns to 500-600ns, with no effect on picture_overhead_nodraw.

I don't see any significant effect on large picture recording times from our .skps.

BUG=chromium:470553

Review URL: https://codereview.chromium.org/1061783002
2015-04-08 14:02:32 -07:00
mtklein
feaadee1c3 SkCanvas::resetForNextPicture()
No diffs against head for DM --config 8888 gpu 2ndpic-8888 2ndpic-gpu.

  picture_overhead_draw	1.62us ->  1.6us	0.99x
picture_overhead_nodraw	 792ns ->  342ns	0.43x

tiles and serialization modes will also test this a bit.

BUG=chromium:470553

Committed: https://skia.googlesource.com/skia/+/f920e468ac66a36c9653d1b11181480295044c7d

Review URL: https://codereview.chromium.org/1067893002
2015-04-08 11:25:48 -07:00
bsalomon
3f324321cd Add mechanism to proactively purge old resources in GrResourceCache.
This change leaves the feature turned off by default.

Review URL: https://codereview.chromium.org/1032873002
2015-04-08 11:01:55 -07:00
halcanary
2ad228e8ff SkPDF: Remove Array's unused set(i) and get(i) (leaving only append())
BUG=skia:3585

Review URL: https://codereview.chromium.org/1071583003
2015-04-08 08:40:36 -07:00
bsalomon
e4579adfdf Add helper for creating a SkSurface from a client created texture.
Review URL: https://codereview.chromium.org/1071603002
2015-04-08 08:38:40 -07:00
caryclark
95bc5f3495 change isNestedRect to isNestedFillRect
R=reed@google.com, bsalomon@google.com

Let isNested(Fill)Rect return true if drawn path describes filled
rectangles.

Review URL: https://codereview.chromium.org/1073473002
2015-04-08 08:34:15 -07:00
bungeman
693e993057 Remove unused InstCounterClass.
This was added with r4719 (f7943035) to support testing
SkTRefArray. With 703d3c70 SkTRefArray and the associated test was
removed, but the supporting InstCounterClass was not.

Review URL: https://codereview.chromium.org/1063403003
2015-04-08 08:06:26 -07:00
joshualitt
f1f8895cbe add realloc method to SkAutoSTMalloc
BUG=skia:

Review URL: https://codereview.chromium.org/1069013002
2015-04-08 07:33:33 -07:00
reed
687fa1c745 restore clipstack to heap-ptr, so clients can ref it
BUG=skia:

Review URL: https://codereview.chromium.org/1068883004
2015-04-07 08:00:56 -07:00
scroggo
0a7e69cb9b Get rid of leaks in SkCodec::NewFromStream.
SkCodec::NewFromStream claims to delete the passed in SkStream on
failure. This allows the caller to pass an SkStream to the function
and not worry about deleting it depending on the return value.

Most of our SkCodecs did not honor this contract though. Update them
to delete the stream on failure. Further, update SkCodec::NewFromStream
to delete the stream if it did not match any subclass, and delete the
SkCodec if we decided to return NULL because it was too big.

Add a test which tests streams which represent the beginnings of
supported format types but do not contain enough data to create an
SkCodec. The interesting part of the test is when we run it on ASAN,
which will report that we leaked something without the other changes.

BUG=skia:3257

Review URL: https://codereview.chromium.org/1058873006
2015-04-03 07:22:22 -07:00
mtklein
3d626834b4 New names for SkPMFloat methods.
BUG=skia:

Review URL: https://codereview.chromium.org/1055123002
2015-04-03 07:05:20 -07:00
mtklein
a156a8ffbe Use switch operator[](int) to kth<int>() so we can use vget_lane.
#floats

BUG=skia:
BUG=skia:3592

Review URL: https://codereview.chromium.org/1059743002
2015-04-03 06:16:13 -07:00
scroggo
028a4135aa Add a method to read a stream without advancing it.
Add a virtual method on SkStream which will do a "peek" some bytes, so
that those bytes are read, but the next call to read will be
unaffected.

Implement peek for SkMemoryStream, where the implementation is simple
and obvious.

Implement peek on SkFrontBufferedStream.

Add tests.

Motivated by decoding streams which cannot be rewound.

TBR=reed@google.com

BUG=skia:3257

Review URL: https://codereview.chromium.org/1044953002
2015-04-02 13:19:51 -07:00
borenet
4808757d7a Remove all code related to NaCl
BUG=skia:3600
DOCS_PREVIEW= https://skia.org/?cl=1036283002

Review URL: https://codereview.chromium.org/1036283002
2015-04-02 12:16:36 -07:00
mtklein
b41f05787e That last CL subverted the purpose of the test. Put it back how it was.
BUG=skia:

Review URL: https://codereview.chromium.org/1055633003
2015-04-01 13:36:23 -07:00
mtklein
03e5161bed Implicit constructors for SkFunction are much more readable.
BUG=skia:

Review URL: https://codereview.chromium.org/1052663004
2015-04-01 13:08:50 -07:00
msarett
68b204e61c Ico test with embedded png
BUG=skia:3257

Review URL: https://codereview.chromium.org/1054673002
2015-04-01 12:09:22 -07:00
mtklein
74415278ce Constructor and call argument forwarding for SkFunction.
BUG=skia:

Review URL: https://codereview.chromium.org/1050113003
2015-04-01 11:26:31 -07:00
scroggo
5842154480 SkCodec::onGetScanlineDecoder must call rewind.
This mirrors the behavior in onGetPixels, and allows the implementation
to share code for handling calls to rewindIfNeeded.

This also fixes a bug where getScanlineDecoder was calling
rewindIfNeeded and treating the result as a bool.

In SkPngCodec, factor out the code to call rewindIfNeeded, and call it
in both onGetPixels and onGetScanlineDecoder.

Update the test to include testing the scanline decoder. Rename "gen"
to "codec" now that it must be an SkCodec.

BUG=skia:3257

Depends on https://codereview.chromium.org/1048423003/ (DIFFERENT ISSUE).

Review URL: https://codereview.chromium.org/1050893002
2015-04-01 11:25:20 -07:00
mtklein
fb8307c6b7 Add SkTHashSet::find()
BUG=skia:

Review URL: https://codereview.chromium.org/1058553002
2015-04-01 11:21:27 -07:00
scroggo
65a8e12287 Acknowledge that SkIcoCodec can rewind and test it.
Since SkIcoCodec has an SkCodec for its encoded images, backed by
SkMemoryStreams, the SkMemoryStream can always rewind, and will be
rewound by the sub-codec if necessary (now that SkBmpCodec and
SkPngCodec support rewinding).

Depends on https://codereview.chromium.org/1057483003/ and
https://codereview.chromium.org/1048423003/ (DIFFERENT ISSUES).

BUG=skia:3257

Review URL: https://codereview.chromium.org/1054603002
2015-04-01 10:24:37 -07:00
scroggo
3eada2a49f Make SkPngCodec support rewinding properly.
Separate out the code for reading the header, and use it to reinitialize
fPng_ptr and fInfo_ptr after a rewind.

Use common code to clean up fPng_ptr and fInfo_ptr, and set them to
NULL and treat them as NULL as appropriate.

Update the test to expect SkPngCodec to succeed.

BUG=skia:3257

Review URL: https://codereview.chromium.org/1048423003
2015-04-01 09:33:23 -07:00
mtklein
97312d0f79 small-object optimization for SkFunction
Anything <= sizeof(void*) will be inlined, avoiding heap allocation.

BUG=skia:

Review URL: https://codereview.chromium.org/1048243002
2015-04-01 08:11:16 -07:00
scroggo
79e378d9b7 Handle rewinds in SkBmpCodec.
Factor our BMP code for reading the header, and call it after a rewind.

BUG=skia:3257

Review URL: https://codereview.chromium.org/1057483003
2015-04-01 07:39:40 -07:00
mtklein
4a9426f0fa Sketch SkFunction
Let's start with baby steps in case some bot can't handle this.
I have left many TODOs, most of which I know how to do if this
looks feasible and useful.

BUG=skia:

Review URL: https://codereview.chromium.org/1049223003
2015-03-31 14:24:27 -07:00
halcanary
37c46cad21 SkPDF: Factor SkPDFCatalog into SkPDFObjNumMap and SkPDFSubstituteMap
Motivation: Keep separate features separate.  Also, future
linearization work will need to have several objNumMap
objects share a substituteMap.  Also "catalog" has a
specific meaning in PDF.  This catalog did not map to that
catalog.

-   Modify SkPDFObject::emitObject and SkPDFObject::addResources
    interface to requiore SkPDFObjNumMap and SkPDFSubstituteMap.
-   SkPDFObjNumMap const in SkPDFObject::emitObject.
-   Remove SkPDFCatalog.cpp/.h
-   Modify SkDocument_PDF.cpp to use new functions
-   Fold in SkPDFStream::populate
-   Fold in SkPDFBitmap::emitDict
-   Move SkPDFObjNumMap and SkPDFSubstituteMap to SkPDFTypes.h
-   Note (via assert) that SkPDFArray & SkPDFDict don't need to
    check substitutes.
-   Remove extra space from SkPDFDict serialization.
-   SkPDFBitmap SkPDFType0Font SkPDFGraphicState SkPDFStream
    updated to new interface.
-   PDFPrimitivesTest updated for new interface.

BUG=skia:3585

Review URL: https://codereview.chromium.org/1049753002
2015-03-31 12:30:20 -07:00
halcanary
af9c85dee1 SkPDF: remove SK_NO_FLATE & dead code in SkPDFStream
SkPDFStream copy constructor
    SkPDFStream Substitute mechanism
    SkPDFStream::setData(NULL);
    SkPDFStream SK_NO_FLATE logic

BUG=skia:3585
TBR=bsalomon@google.com,reed@google.com

Review URL: https://codereview.chromium.org/1041183002
2015-03-31 08:22:01 -07:00
mtklein
0340df5b36 back to Sk4f for SkPMColor
#floats

BUG=skia:
BUG=skia:3592

Review URL: https://codereview.chromium.org/1047823002
2015-03-31 08:17:00 -07:00
mtklein
c9adb05b64 Refactor Sk2x<T> + Sk4x<T> into SkNf<N,T> and SkNi<N,T>
The primary feature this delivers is SkNf and SkNd for arbitrary power-of-two N.  Non-specialized types or types larger than 128 bits should now Just Work (and we can drop in a specialization to make them faster).  Sk4s is now just a typedef for SkNf<4, SkScalar>; Sk4d is SkNf<4, double>, Sk2f SkNf<2, float>, etc.

This also makes implementing new specializations easier and more encapsulated.  We're now using template specialization, which means the specialized versions don't have to leak out so much from SkNx_sse.h  and SkNx_neon.h.

This design leaves us room to grow up, e.g to SkNf<8, SkScalar> == Sk8s, and to grown down too, to things like SkNi<8, uint16_t> == Sk8h.

To simplify things, I've stripped away most APIs (swizzles, casts, reinterpret_casts) that no one's using yet.  I will happily add them back if they seem useful.

You shouldn't feel bad about using any of the typedef Sk4s, Sk4f, Sk4d, Sk2s, Sk2f, Sk2d, Sk4i, etc.  Here's how you should feel:
  - Sk4f, Sk4s, Sk2d: feel awesome
  - Sk2f, Sk2s, Sk4d: feel pretty good

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

BUG=skia:3592

Review URL: https://codereview.chromium.org/1048593002
2015-03-30 10:50:27 -07:00
reed
7da19014fd use Sk4f for matrix math
Need to land SK_SUPPORT_LEGACY_SCALAR_MAPPOINTS in chrome to suppress Affine
version which causes slight differences (which will need to be rebaselined)

BUG=skia:

Review URL: https://codereview.chromium.org/1045493002
2015-03-29 11:58:48 -07:00
halcanary
a096d7a6d0 SkCodec: add wbmp class
Review URL: https://codereview.chromium.org/1006583005
2015-03-27 12:16:53 -07:00
reed
daee7eadd1 impl SkConvertQuadToCubic w/ Sk2s
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1041573002
2015-03-26 20:22:33 -07:00
reed
a644116c33 Revert of Make the canvas draw looper setup update the canvas save count (patchset #1 id:1 of https://codereview.chromium.org/1034033004/)
Reason for revert:
makes internalSave and internalSaveLayer inconsistent. Need to find a different solution.

Original issue's description:
> Make the canvas draw looper setup update the canvas save count
>
> Image filter in a paint would leave save count in wrong state
> for normal draws. This could be observed through the canvas
> references during the draw call. An example of this is
> inspecting the canvas during a draw looper.
>
> patch from issue 993863002 at patchset 20001 (http://crrev.com/993863002#ps20001)
>
> BUG=skia:
> TBR=kkinnunen@nvidia.com
>
> Committed: https://skia.googlesource.com/skia/+/fd3a91e1fc4de69611b5297f624a1cd65db4ced1

TBR=kkinnunen@nvidia.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1037653004
2015-03-26 13:40:09 -07:00
reed
fd3a91e1fc Make the canvas draw looper setup update the canvas save count
Image filter in a paint would leave save count in wrong state
for normal draws. This could be observed through the canvas
references during the draw call. An example of this is
inspecting the canvas during a draw looper.

patch from issue 993863002 at patchset 20001 (http://crrev.com/993863002#ps20001)

BUG=skia:
TBR=kkinnunen@nvidia.com

Review URL: https://codereview.chromium.org/1034033004
2015-03-26 13:29:56 -07:00
mtklein
3d4c4a5a9f SkPMFloat::trunc()
Add and test trunc(), which is what get() used to be before rounding.
Using trunc() is a ~40% speedup on our linear gradient bench.

#neon #floats
BUG=skia:3592
#n5
#n9
CQ_INCLUDE_TRYBOTS=client.skia.android:Test-Android-Nexus5-Adreno330-Arm7-Debug-Trybot;client.skia.android:Test-Android-Nexus9-TegraK1-Arm64-Release-Trybot

Review URL: https://codereview.chromium.org/1032243002
2015-03-26 12:32:29 -07:00
reed
5501103881 use new faster/vector impl for chopping conics
BUG=skia:

Review URL: https://codereview.chromium.org/1035943002
2015-03-26 09:10:22 -07:00
caryclark
54359294a7 cumulative pathops patch
Replace the implicit curve intersection with a geometric curve intersection. The implicit intersection proved mathematically unstable and took a long time to zero in on an answer.

Use pointers instead of indices to refer to parts of curves. Indices required awkward renumbering.

Unify t and point values so that small intervals can be eliminated in one pass.

Break cubics up front to eliminate loops and cusps.

Make the Simplify and Op code more regular and eliminate arbitrary differences.

Add a builder that takes an array of paths and operators.

Delete unused code.

BUG=skia:3588
R=reed@google.com

Review URL: https://codereview.chromium.org/1037573004
2015-03-26 07:52:43 -07:00
reed
c08330f160 remove slower scalar code in favor of vectors
BUG=skia:

Review URL: https://codereview.chromium.org/1001833006
2015-03-26 07:26:08 -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
15391ee4ac Update 4-at-a-time APIs.
There is no reason to require the 4 SkPMFloats (registers) to be adjacent.
The only potential win in loads and stores comes from the SkPMColors being adjacent.

Makes no difference to existing bench.

BUG=skia:

Review URL: https://codereview.chromium.org/1035583002
2015-03-25 13:43:34 -07:00
halcanary
d4714af018 SkPDF SkPDFObject::addResources signature simplified
-   SkPDFcatalog keeps a ordered list of object pointers
-   Elimiante SkTSet template class
-   SkPDFObject::addResources signature changes

BUG=skia:3585

Review URL: https://codereview.chromium.org/1038523004
2015-03-25 13:23:13 -07:00
halcanary
f41061cc8d SKPDF: refactor pdfcatalog and pdfdocument
SkPDFCatalog:
-   remove first-page-specific code (no longer needed, never
    used) (e.g. addObject()).
-   Make use of SkHashMap for lookups (simplifies code).
-   inline all small methods
-   emitXrefTable moved to SkPDFDocument.cpp
-   no longer store offsets in this data structure (moved to
    SkPDFDocument.cpp)
-   setFileOffset gone.
-   own substitute refs directly.

SkPDFDocument::EmitPDF()
-   All sites that call into SkPDFCatalog modified.
-   catalog.addObject only called in a single place, after the
    resouceSet is built
-   offsets moved to local array.

SkPDFPage:
-   finalizePage no longer deals with SkPDFCatalog or resource sets.
-   GeneratePageTree no longer deals with SkPDFCatalog

SkPDFObjRef
-   emitObject respects the substitution map

Unit Tests:
-   respect SkPDFCatalog::addObject signature change.

SkTHash:
-   #include SkChecksum for SkGoodHash
-   Copyright notice added

Review URL: https://codereview.chromium.org/1033543002
2015-03-25 11:29:18 -07:00
reed
6b9ef90c02 SkChopCubicAt2 using Sk2s -- 2x faster
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1036753002
2015-03-24 19:24:34 -07:00
halcanary
f3d53a037d SkPDF: unit test cleanup
BUG=skia:3585

Review URL: https://codereview.chromium.org/1033833002
2015-03-24 15:29:39 -07:00
reed
0dc4dd6dda Revert of pathops version two (patchset #16 id:150001 of https://codereview.chromium.org/1002693002/)
Reason for revert:
ASAN investigation

Original issue's description:
> pathops version two
>
> R=reed@google.com
>
> marked 'no commit' to attempt to get trybots to run
>
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/ccec0f958ffc71a9986d236bc2eb335cb2111119

TBR=caryclark@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1029993002
2015-03-24 13:55:33 -07:00
caryclark
82dec0e16a Revert of remove obsolete tests (patchset #1 id:1 of https://codereview.chromium.org/1030883002/)
Reason for revert:
working on asan fix

Original issue's description:
> remove obsolete tests
>
> remove tests that are breaking the build -- uninitialized memory
>
> TBR=reed
>
> Committed: https://skia.googlesource.com/skia/+/e02c944e97ad6a3b8befb1f4f784919767941ba6

TBR=reed@android.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1036633002
2015-03-24 13:52:49 -07:00
caryclark
74c464a6af Revert of fix destructor order to fix build (patchset #1 id:1 of https://codereview.chromium.org/1033703002/)
Reason for revert:
working on asan fix

Original issue's description:
> fix destructor order to fix build
>
> TBR=reed
>
> Committed: https://skia.googlesource.com/skia/+/c207f9b2e8d6fb5386197fa8a8d258d2c4603418

TBR=reed@android.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1033803002
2015-03-24 13:47:57 -07:00
mtklein
4b65059e6e Go back to storeAligned / LoadAligned for SkPMFloat <->Sk4f.
This seems to fix the miscompilation bug on ARM64 / Release / GCC 4.9.

We switched this over originally for perf issues with NEON, but I can't see any now.  Will keep an eye out.

BUG=skia:3570

Review URL: https://codereview.chromium.org/1026403002
2015-03-24 09:47:12 -07:00
caryclark
c207f9b2e8 fix destructor order to fix build
TBR=reed

Review URL: https://codereview.chromium.org/1033703002
2015-03-24 09:16:25 -07:00
caryclark
e02c944e97 remove obsolete tests
remove tests that are breaking the build -- uninitialized memory

TBR=reed

Review URL: https://codereview.chromium.org/1030883002
2015-03-24 08:17:16 -07:00
caryclark
ccec0f958f pathops version two
R=reed@google.com

marked 'no commit' to attempt to get trybots to run

TBR=reed@google.com

Review URL: https://codereview.chromium.org/1002693002
2015-03-24 07:28:17 -07:00
mtklein
470fa6f74b aacc + bbdd
SkMatrix::mapPts() using aacc/bbdd was always worse than using badc():
  - On Intel, it was faster than exisiting swizzle, but badc() is 10% faster still (one pshufd instead of two).
  - On ARM, existing swizzle < badc() < aacc()+bbdd(), even though aacc() then bbdd() is really a single vtrn instruction.

I will revert SkMatrix.cpp before submitting.  Just thought you might like to look.

Will think more and try to gear up Instruments on ARM.

BUG=skia:

Review URL: https://codereview.chromium.org/1012573003
2015-03-24 06:16:30 -07:00
mtklein
2e220fb9ec Start fresh on swizzles
This removes all the existing Sk4x swizzles and adds badc(), which is
both fast on all implementations and currently useful.

BUG=skia:

Review URL: https://codereview.chromium.org/997353005
2015-03-23 13:19:03 -07:00
mtklein
92d04da38f Replace _mm_cvtps_epi32(x) with _mm_cvttps_epi32(_mm_add_ps(0.5f), x).
We don't have control over which way _mm_cvtps_epi32 rounds.

  - This makes the SSE SkPMFloat rounding consistent with _neon and _none.
  - Sk4f::cast<Sk4i>() is closer to (int)float's behavior.  (Correct when >=0).

Add tests that would fail at head.

BUG=skia:

Review URL: https://codereview.chromium.org/1029163002
2015-03-23 12:01:46 -07:00
reed
8010632f24 remove meaningless matrix benches, add mapPts() and add new benches
mapPts definitely faster than mapPoints (identity and perspective same speed). Up to 3x for large values of N.

cloned from https://codereview.chromium.org/1031443002/

BUG=skia:

Review URL: https://codereview.chromium.org/1030653002
2015-03-23 08:15:14 -07:00
robertphillips
3e5c2b1041 Preserve texture compression when saving a revised skp from debugger
Without this CL, saving a revised skp out the debugger can greatly expand the memory it requires.

Review URL: https://codereview.chromium.org/1020103005
2015-03-23 05:46:51 -07:00
kkinnunen
8dcb8b04f8 Do not playback pending commands for full deferred canvas writePixels
Do not playback pending commands for full deferred canvas writePixels.

Changes the test to catch cases where discard is done without
a snapshot.

Review URL: https://codereview.chromium.org/939103002
2015-03-23 02:18:02 -07:00
mtklein
02f46cf878 Some usability ideas around SkTHash.
- By default, use new SkGoodHash to hash keys, which is:
    * for 4 byte values, use SkChecksum::Mix,
    * for SkStrings, use SkChecksum::Murmur3 on the data,
    * for other structs, shallow hash the struct with Murmur3.
  - Expand SkChecksum::Murmur3 to support non-4-byte-aligned data.
  - Add const foreach() methods.
  - Have foreach() take a functor, which allows lambdas.

BUG=skia:

Review URL: https://codereview.chromium.org/1021033002
2015-03-20 13:48:42 -07:00
reed
b640203cd5 use Sk2s for conics
BUG=skia:

Review URL: https://codereview.chromium.org/1025033002
2015-03-20 13:23:43 -07:00
mtklein
cea9f35fee Sk2x::invert() and Sk2x::approxInvert()
BUG=skia:

Review URL: https://codereview.chromium.org/1024993002
2015-03-20 13:17:42 -07:00