Commit Graph

2613 Commits

Author SHA1 Message Date
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
mtklein
bf0c56f82b Hack around skia:3570 for now.
BUG=skia:3570

Review URL: https://codereview.chromium.org/1021353002
2015-03-20 12:21:53 -07:00
mtklein
01a78130dc Add divide to Sk2x, use native vdiv and vsqrt on ARM 64.
Tests pass on N7 + N9.

BUG=skia:

CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Mac10.7-Clang-Arm7-Debug-iOS-Trybot,Build-Ubuntu-GCC-Arm64-Release-Android-Trybot

Review URL: https://codereview.chromium.org/1027753003
2015-03-20 11:28:52 -07:00
mtklein
f224f138da Allow negative error for Sk4f::sqrt() test.
BUG=skia:

Review URL: https://codereview.chromium.org/1028743002
2015-03-20 11:20:12 -07:00
mtklein
92de013c9f Sk2x/Sk4x: add negate(), operator -()
BUG=skia:

Review URL: https://codereview.chromium.org/1027783002
2015-03-20 08:12:06 -07:00
senorblanco
8c874eee94 Move SkMatrixImageFilter into core, and add a factory fn for it.
BUG=skia:

Review URL: https://codereview.chromium.org/1011273003
2015-03-20 06:38:17 -07:00
reed
40b7dd57ef use Sk2s for EvalQuadTangent and ChopQuadAt
cloned from https://codereview.chromium.org/1026633002/

BUG=skia:

Review URL: https://codereview.chromium.org/1024873003
2015-03-20 06:01:08 -07:00
mtklein
26bf90e5d6 operator overloads for Sk4x, use them all where possible
BUG=skia:
NOTRY=true

Review URL: https://codereview.chromium.org/1024633003
2015-03-20 06:00:57 -07:00
reed
adf9990cb5 add SkMatrix::decomposeScale
BUG=skia:

Review URL: https://codereview.chromium.org/1006173005
2015-03-19 16:10:54 -07:00
mtklein
d800d878ca Try out operator overloads for Sk2x.
BUG=skia:

Review URL: https://codereview.chromium.org/1024473005
2015-03-19 14:28:31 -07:00
mtklein
950e986b1b Port to real Sk2f.
The bench improves from 39 to 30, about half from porting to Sk2f, half from
x.add(x) instead of x.multiply(two).

Remove Sk4f Load2/store2 now that we have Sk2f.

BUG=skia:

Review URL: https://codereview.chromium.org/1019773004
2015-03-19 12:03:29 -07:00
mtklein
bbecae0832 Sk2x
This adds an API, an SSE impl, a portable impl, and some tests for Sk2f/Sk2d/Sk2s.

BUG=skia:

Review URL: https://codereview.chromium.org/1025463002
2015-03-19 10:44:27 -07:00
reed
65cb2cd2f7 alt SkEvalQuadAt that returns its answer, using Sk2f
BUG=skia:

Review URL: https://codereview.chromium.org/1011493003
2015-03-19 10:18:47 -07:00
reed
3ef71e343b guarded change to SkImageGenerator to make getInfo() const
BUG=skia:

Review URL: https://codereview.chromium.org/1017293002
2015-03-19 08:31:14 -07:00
reed
422677ceab Add Load2/store2 to Sk4x (dumb impl for now)
patch from issue 1001003002 at patchset 1 (http://crrev.com/1001003002#ps1)

BUG=skia:

Review URL: https://codereview.chromium.org/1001453006
2015-03-18 12:56:46 -07:00
senorblanco
24e06d5244 Remove uniqueID from all filter serialization.
(This is essentially a revert of https://codereview.chromium.org/503833002/.)

This was necessary back when SkPaint was flattened even for in-process use. Now that we only flatten SkPaint for cross-process use, there's no need to serialize UniqueIDs.

Note: SkDropShadowImageFilter is being constructed with a croprect and UniqueID (of 0) in Blink. I've made the uniqueID param default to 0 temporarily, until this rolls in and Blink can be changed. (Blink can't be changed first, since unlike the other filters, there's no constructor that takes a cropRect but not a uniqueID.)

BUG=skia:

Review URL: https://codereview.chromium.org/1019493002
2015-03-18 12:11:33 -07:00
mtklein
97ca98d74e Let's find out what's up with the TSAN bot test failures.
BUG=skia:

Review URL: https://codereview.chromium.org/1020573002
2015-03-18 11:32:21 -07:00
dml
78acf96a67 Indexed PNG decoding: Ensure color table is large enough that the bit depth of the image will not allow reads beyond its end.
BUG=skia:3440
R=rmistry@google.com, scroggo@google.com

Committed: https://skia.googlesource.com/skia/+/493c1ce1cd406ef28683203146274154783452ce

Review URL: https://codereview.chromium.org/948163002
2015-03-18 06:03:30 -07:00
scroggo
cdeca44619 Revert "Indexed PNG decoding: Ensure color table is large enough that the bit depth of the image will not allow reads beyond its end."
This reverts commit 493c1ce1cd.

NOTRY=true
NOTREECHECKS=true
TBR=egdaniel@google.com,dml@google.com
BUG=skia:

Review URL: https://codereview.chromium.org/1014553003
2015-03-17 05:25:54 -07:00
Leon Scroggins III
493c1ce1cd Indexed PNG decoding: Ensure color table is large enough that the bit depth of the image will not allow reads beyond its end.
BUG=skia:3440
R=rmistry@google.com, scroggo@google.com

Review URL: https://codereview.chromium.org/948163002
2015-03-17 08:14:07 -04:00
scroggo
9552662e9f Option for SkCodec to treat dst as all zeroes.
This recreates SkImageDecoder's feature to skip writing zeroes for
SkCodec.

Review URL: https://codereview.chromium.org/980903002
2015-03-17 05:02:17 -07:00
smcgruer
b83205a538 Fix build for UCLIBC platforms
malloc_usable_size does not exist in UCLIBC, so fall back to just
returning 0 for SkVarAlloc::heap_size().

BUG=skia:

Review URL: https://codereview.chromium.org/1006073003
2015-03-16 14:45:01 -07:00
bsalomon
6f7f2012ee Move GrAutoLocaleSetter to new file and fix issue with null locale
TBR=egdaniel@google.com
NOTREECHECKS=true

Review URL: https://codereview.chromium.org/1002623004
2015-03-16 14:00:52 -07:00
bsalomon
3318ee7d5e Use C locale for numerics when emitting shaders.
BUG=skia:3330

Review URL: https://codereview.chromium.org/1012723002
2015-03-16 11:56:29 -07:00
reed
93a1215fe0 SkPaint::FilterLevel -> SkFilterQuality
clone (+rebase) of https://codereview.chromium.org/1009183002/

BUG=skia:
TBR=scroggo@google.com

Review URL: https://codereview.chromium.org/1014533004
2015-03-16 10:08:34 -07:00
robertphillips
2a679ae8f5 Fix bug with very large round rects with large radii
BUG=463920

Review URL: https://codereview.chromium.org/998903003
2015-03-13 09:53:01 -07:00
reed
c1b11f1db6 Handle paths that do not report empty, but have no edges.
patch from issue 999963005 at patchset 1 (http://crrev.com/999963005#ps1)

BUG=skia:3527

Review URL: https://codereview.chromium.org/1008883002
2015-03-13 08:48:27 -07:00
msarett
6e8f9033bb Ico security issues fix
BUG=skia:3401
BUG=skia:3426
BUG=skia:3441

Review URL: https://codereview.chromium.org/996173005
2015-03-13 08:07:01 -07:00
scroggo
dd8c637bc7 Fix Windows build.
SK_BUILD_FOR_WIN is no longer a valid way to check for building on
Windows (go figure). Build everywhere.

Remove the REPORTER_ASSERT, which was the failing part. It also isn't
necessary for the test, which is just that we are not leaking an
SkColorTable.

Also fix indentation.

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

BUG=skia:3457

Review URL: https://codereview.chromium.org/1002583002
2015-03-11 13:58:17 -07:00
dml
f45796ee0e Fix a memory leak when decoding corrupted indexed PNGs.
Commit to branch refs/heads/png-leak

BUG=skia:3457

Committed: https://skia.googlesource.com/skia/+/561a1ca9559a1ea7589ab93350124284fcef3315

Review URL: https://codereview.chromium.org/951663002
2015-03-11 11:12:54 -07:00
reed
9b3aa54bc9 optimization/fix: dirty the clip-bounds when we mod the clip in savelayer
Before the fix, we could use a stale cache of the clipbounds in quickReject. Often this could return false negatives, meaning we would try to draw more than we should (it would eventually be really clipped). Occasionally this could also report false positives (if the layer were outside of the normal canvas bounds, e.g. a layer with an offset imagefilter).

BUG=skia:
NOTREECHECKS=True

Review URL: https://codereview.chromium.org/983243003
2015-03-11 08:47:12 -07:00
reed
cedc36f18b Use ComposColorFilter to collaps hierarchy (when possible).
Clarify asColorFilter ...
1. Rename to isColorFilterNode for DAG reduction
2. Add asAColorFilter for removing the imagefilter entirely (future use-case)

Need layouttest rebaseline suppression before this can land in chrome...
https://codereview.chromium.org/984023004/

BUG=skia:

Review URL: https://codereview.chromium.org/982933002
2015-03-08 04:42:52 -07:00
reed
8371b7e8ef Revert of Fix a memory leak when decoding corrupted indexed PNGs. (patchset #2 id:20001 of https://codereview.chromium.org/951663002/)
Reason for revert:
speculative revert due to many failures in tree

Original issue's description:
> Fix a memory leak when decoding corrupted indexed PNGs.
> Commit to branch refs/heads/png-leak
>
> BUG=skia:3457
>
> Committed: https://skia.googlesource.com/skia/+/561a1ca9559a1ea7589ab93350124284fcef3315

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

Review URL: https://codereview.chromium.org/980203005
2015-03-07 06:05:51 -08:00
dml
561a1ca955 Fix a memory leak when decoding corrupted indexed PNGs.
Commit to branch refs/heads/png-leak

BUG=skia:3457

Review URL: https://codereview.chromium.org/951663002
2015-03-06 16:25:28 -08:00
schenney
23d8593f81 Update SkPicture cull rects with RTree information
When computed, the RTree for an SkPicture will have a root
bounds that reflects the best bounding information available,
rather than the best estimate at the time the picture recorder
is created. Given that creators frequently don't know ahead of
time what will be drawn, the RTree bound is often tighter.

Perf testing on Chrome indicates a small raster performance
advantage. For upcoming painting changes in Chrome the
performance advantage is much larger.

BUG=

Committed: https://skia.googlesource.com/skia/+/2dd3b6647dc726f36fd8774b3d0d2e83b493aeac

Review URL: https://codereview.chromium.org/971803002
2015-03-06 16:20:28 -08:00
mtklein
a27cdefae1 Make Sk4f(float) constructor explicit.
BUG=skia:

Review URL: https://codereview.chromium.org/985003003
2015-03-06 16:20:22 -08:00
kkinnunen
a9d9a39238 Read pixels in BGRA non-premul mode in few tests
The tests assert on Sk_ColorGREEN, which is in BRGA non-premul. Read the
pixels in same color format.

Currently the tests pass on all platforms because GREEN is fully opaque
and the component stays in the same place both on BGRA and
RGBA. However, hypothetically somebody could copy-paste the assertion
for further tests but use, say, RED. This creates latent error that is
only visible on some platforms like mac.

Review URL: https://codereview.chromium.org/989463002
2015-03-06 07:16:01 -08:00
reed
5c518a8622 Revert of check for inputs before reporting asColorFilter (patchset #7 id:110001 of https://codereview.chromium.org/967833003/)
Reason for revert:
Need to suppress these for rebaselining, so reverting for now.

Regressions: Unexpected image-only failures (5)
  css3/filters/effect-brightness-clamping-hw.html [ ImageOnlyFailure ]
  css3/filters/effect-combined-hw.html [ ImageOnlyFailure ]
  virtual/slimmingpaint/css3/filters/effect-brightness-clamping-hw.html [ ImageOnlyFailure ]
  virtual/slimmingpaint/css3/filters/effect-combined-hw.html [ ImageOnlyFailure ]

Original issue's description:
> Use ComposeColorFilter in factory to collapse consecutive filters (when possible).
> Change asColorFilter to reflect its reliance on the new factory behavior.
>
> patch from issue 967143002 at patchset 80001 (http://crrev.com/967143002#ps80001)
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/dac843bf046c2cd79fd955cb177aee241d7a4b0c

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

Review URL: https://codereview.chromium.org/978923005
2015-03-05 14:47:29 -08:00
joshualitt
a0865b4620 Revert of Update SkPicture cull rects with RTree information (patchset #6 id:140001 of https://codereview.chromium.org/971803002/)
Reason for revert:
Might be breaking deps roll

Original issue's description:
> Update SkPicture cull rects with RTree information
>
> When computed, the RTree for an SkPicture will have a root
> bounds that reflects the best bounding information available,
> rather than the best estimate at the time the picture recorder
> is created. Given that creators frequently don't know ahead of
> time what will be drawn, the RTree bound is often tighter.
>
> Perf testing on Chrome indicates a small raster performance
> advantage. For upcoming painting changes in Chrome the
> performance advantage is much larger.
>
> BUG=
>
> Committed: https://skia.googlesource.com/skia/+/2dd3b6647dc726f36fd8774b3d0d2e83b493aeac

TBR=mtklein@google.com,schenney@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review URL: https://codereview.chromium.org/977413003
2015-03-05 12:18:38 -08:00
mtklein
548bf38b28 4-at-a-time SkPMColor -> SkPMFloat API.
Please see if this looks usable.  It may even give a perf boost if you use it, even without custom implementations for each instruction set.

I've been trying this morning to beat this naive loop implementation, but so far no luck with either _SSE2.h or _SSSE3.h.  It's possible this is an artifact of the microbenchmark, because we're not doing anything between the conversions.  I'd like to see how this fits into real code, what assembly's generated, what the hot spots are, etc.

I've updated the tests to test these new APIs, and splintered off a pair of new benchmarks that use the new APIs.  This required some minor rejiggering in the benches.

BUG=skia:

Review URL: https://codereview.chromium.org/978213003
2015-03-05 11:31:59 -08:00
reed
dac843bf04 Use ComposeColorFilter in factory to collapse consecutive filters (when possible).
Change asColorFilter to reflect its reliance on the new factory behavior.

patch from issue 967143002 at patchset 80001 (http://crrev.com/967143002#ps80001)

BUG=skia:

Review URL: https://codereview.chromium.org/967833003
2015-03-05 10:22:20 -08:00
schenney
2dd3b6647d Update SkPicture cull rects with RTree information
When computed, the RTree for an SkPicture will have a root
bounds that reflects the best bounding information available,
rather than the best estimate at the time the picture recorder
is created. Given that creators frequently don't know ahead of
time what will be drawn, the RTree bound is often tighter.

Perf testing on Chrome indicates a small raster performance
advantage. For upcoming painting changes in Chrome the
performance advantage is much larger.

BUG=

Review URL: https://codereview.chromium.org/971803002
2015-03-05 07:43:10 -08:00
reed
dc812222a7 add impl limit for number of leaf-nodes in composecolorfilter
BUG=skia:

Review URL: https://codereview.chromium.org/972153010
2015-03-05 07:21:02 -08:00
kkinnunen
a9baa652bb Revert of Add image as a draw type that can be filtered (patchset #4 id:60001 of https://codereview.chromium.org/960783003/)
Reason for revert:
Fails on mac for some reason.
Also is a bit wrong, but this should not be reason for the failure..

Original issue's description:
> Add image as a draw type that can be filtered
>
> Add image as a draw type that can be filtered.
>
> This is needed when SkImage is added as an object to be drawn so that
> the draw is forwarded to SkBaseDevice. This would be used in making
> filters use SkImages.
>
> BUG=skia:3388
>
> Committed: https://skia.googlesource.com/skia/+/fa77eb1e51b9317ff993d1be504ada173b561e5f

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

Review URL: https://codereview.chromium.org/980273002
2015-03-05 06:33:54 -08:00
kkinnunen
fa77eb1e51 Add image as a draw type that can be filtered
Add image as a draw type that can be filtered.

This is needed when SkImage is added as an object to be drawn so that
the draw is forwarded to SkBaseDevice. This would be used in making
filters use SkImages.

BUG=skia:3388

Review URL: https://codereview.chromium.org/960783003
2015-03-05 00:39:45 -08:00
msarett
c877a71b35 4x library for NEON
CQ_EXTRA_TRYBOTS=client.skia.android:Test-Android-Nexus5-Adreno330-Arm7-Debug-Trybot

BUG=skia:

Review URL: https://codereview.chromium.org/975303003
2015-03-04 15:55:54 -08:00
mtklein
4e644f5d50 Update SkPMFloat API a bit.
Instead of set(SkPMColor), add a constructor SkPMFloat(SkPMColor).
Replace setA(), setR(), etc. with a 4 float constructor.

And, promise to stick to SkPMColor order.

BUG=skia:

Review URL: https://codereview.chromium.org/977773002
2015-03-04 11:25:27 -08:00
mtklein
0aebf5d0d3 Test and fix SkPMFloat rounding.
SSE rounds for free (that was a happy accident: they also have a truncating version).
NEON does not, nor obviously the portable code, so they add 0.5 before truncating.

NOPRESUBMIT=true

BUG=skia:

Review URL: https://codereview.chromium.org/974643002
2015-03-03 08:57:07 -08:00
mtklein
60d2a32b2d Make SkPMFloats store floats in [0,255] instead of [0,1].
This pushes the cost of the *255 and *1/255 conversions onto only those code
paths that need it.  We're not doing it any more efficiently than can be done
with Sk4f.

In microbenchmark isolation, this is about a 15% speedup.

BUG=skia:
NOPRESUBMIT=true

Review URL: https://codereview.chromium.org/973603002
2015-03-03 07:46:15 -08:00
reed
cff10b21a9 change colorfilter to return an array of frag processors
BUG=skia:

Review URL: https://codereview.chromium.org/973593002
2015-03-03 06:41:45 -08:00
caryclark
b421650e13 add double precision convex test
BUG=389050

Review URL: https://codereview.chromium.org/975523002
2015-03-02 13:02:34 -08:00
caryclark
5ccef57790 treat backwards quads as not convex
If a quad, cubic, or conic goes back on itself, assume it's not convex.
In a future CL, we could check to see if the curve is linear so that
linear curves are treated the same as lines.

BUG=skia:3469

Review URL: https://codereview.chromium.org/971773002
2015-03-02 10:07:56 -08:00
senorblanco
a2b6d28755 Fix for out-of-bounds intersection (found by fuzzer).
Sometimes, the intersection returned by check_intersection() is
out-of-bounds for both edges (above both tops or below both bottoms)
due to floating-point inaccuracy. This causes split_edge() to create a
tiny negative-length edge on one side (which would then assert).
Although we could safely remove this assert and allow the negative
length edge to be removed, it's faster/safer to simply avoid its
creation in the first place by adjusting one edge to the other edge's
endpoint.

Added a new unit test to exercise this case.

Review URL: https://codereview.chromium.org/968993002
2015-03-02 09:34:13 -08:00
halcanary
3d32d50364 PDF: Switch some unit tests to higher level API.
Also, clean up some headers.

Review URL: https://codereview.chromium.org/968683002
2015-03-01 06:55:20 -08:00
robertphillips
a9061de9ff Add rewind capability to SkChunkAlloc
Split off from https://codereview.chromium.org/940533003/ (Decrease GrInOrderDrawBuffer::Cmd's reliance on GrInOrderDrawBuffer)

Review URL: https://codereview.chromium.org/967553003
2015-02-27 08:31:57 -08:00
mtklein
e6cf9cb685 miniz support in SkFlate / PDF
- Adds miniz.c v115_r4 (latest release) to third_party.
   - Merges SkDeflateWStream into SkFlate so including "miniz.c" links
     without duplicating symbols.

The only interesting code change I've made is to remove the line
     fImpl->fZStream.data_type = Z_BINARY;
from SkDeflateWStream::SkDeflateWStream().  miniz doesn't have Z_BINARY
defined, and as far as I can tell, both zlib and miniz ignore data_type.

We should be able to swap skflate.gyp's dependency between zlib.gyp:zlib and
zlib.gyp:miniz at will (except of course on Windows) if we're interested in
zlib itself.  I've left android framework on its own zlib.  I think this all
means we can stop defining SK_NO_FLATE on Windows.

I'll leave the possible cleanup of SK_NO_FLATE itself for another time.  Might
be we always want to keep this dependency optional.

CQ_EXTRA_TRYBOTS=client.skia:Test-Win8-ShuttleA-HD7770-x86-Debug-Trybot

BUG=skia:

Review URL: https://codereview.chromium.org/957323003
2015-02-26 13:25:05 -08:00
mtklein
24aa0f0679 Add sqrt() and rsqrt() to Sk4f.
This doesn't add them to the second-stringer Sk4i.  It's unclear we should be
doing that often, and we don't have efficient ways to do it except via floats.

BUG=skia:

Review URL: https://codereview.chromium.org/964603002
2015-02-26 12:48:05 -08:00
mtklein
2719552fb1 Think implicit promotion is a good idea?
Things like foo.multiply(Sk4f(t,t,t,t)) can just be foo.multiply(t).

BUG=skia:

Review URL: https://codereview.chromium.org/960773005
2015-02-26 12:21:25 -08:00
mtklein
870b9ea386 add auto SkPMFloat <-> Sk4f conversion
BUG=skia:

Review URL: https://codereview.chromium.org/954323002
2015-02-26 10:43:16 -08:00
senorblanco
d6ed19cc75 Tessellating GPU path renderer.
This path renderer converts paths to linear contours, resolves intersections via Bentley-Ottman, implements a trapezoidal decomposition a la Fournier and Montuno to produce triangles, and renders those with a single draw call. It does not currently do antialiasing, so it must be used in conjunction with multisampling.

A fair amount of the code is to handle floating point edge cases in intersections. Rather than perform exact computations (which would require arbitrary precision arithmetic), we reconnect the mesh to reflect the intersection points. For example, intersections can occur above the current vertex, and force edges to be merged into the current vertex, requiring a restart of the intersections. Splitting edges for intersections can also force them to merge with formerly-distinct edges in the same polygon, or to violate the ordering of the active edge list, or the active edge state of split edges.

BUG=skia:

Review URL: https://codereview.chromium.org/855513004
2015-02-26 06:58:17 -08:00
joshualitt
570d2f81a6 I'd really like to land this before the branch so speedy reviews are appreciated.
BUG=skia:

Committed: https://skia.googlesource.com/skia/+/586d5d640b19860dfbbd903a5188da1bbbe87336

Review URL: https://codereview.chromium.org/936943002
2015-02-25 13:19:48 -08:00
joshualitt
2907059d0e Revert of Pass clip to context (patchset #8 id:180001 of https://codereview.chromium.org/936943002/)
Reason for revert:
Strange blur problems on nexus 5

Original issue's description:
> I'd really like to land this before the branch so speedy reviews are appreciated.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/586d5d640b19860dfbbd903a5188da1bbbe87336

TBR=jvanverth@google.com,senorblanco@google.com,bsalomon@google.com,senorblanco@chromium.org,joshualitt@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/956083002
2015-02-25 13:04:44 -08:00
joshualitt
586d5d640b I'd really like to land this before the branch so speedy reviews are appreciated.
BUG=skia:

Review URL: https://codereview.chromium.org/936943002
2015-02-25 11:21:21 -08:00
caryclark
63c684a8a6 fuzzer fixes
Fix path bugs exposed by the path fuzzer.

Changes to existing gm and samplecode files defer their calls to construct
SkPath objects until the first draw instead of at test initialization.

Add an experimental call to SkPath to validate the internal SkPathRef.

Fix SkPath::addPoly to set the last moveto after adding a close verb.

Fix stroke to handle failures when computing the unit normal.

Add a unit test for the unit normal failure.

R=reed@google.com

Review URL: https://codereview.chromium.org/953383002
2015-02-25 09:04:04 -08:00
reed
83787d0ff0 only notify bitmaps that have been added to the cache
old code:
- calls=2677 hit-rate=3.51139%

new code:
- calls=94 hit-rate=97.8723%

BUG=skia:

Review URL: https://codereview.chromium.org/960563002
2015-02-25 07:17:11 -08:00