Commit Graph

2553 Commits

Author SHA1 Message Date
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
reed
7eeba25877 Notify resource caches when pixelref genID goes stale
patch from issue 954443002 at patchset 40001 (http://crrev.com/954443002#ps40001)

BUG=skia:

Review URL: https://codereview.chromium.org/950363002
2015-02-24 13:54:23 -08:00
robertphillips
fe1b180bee Fix radii scaling bug in SkRRect::setNinePatch
BUG=skia:3466

Review URL: https://codereview.chromium.org/951323004
2015-02-24 11:18:48 -08:00
kkinnunen
73953e7d00 Make SkNewImageFromBitmap take pixel ref origin into account
Make SkNewImageFromBitmap take pixel ref origin into account.

BUG=skia:3388

Review URL: https://codereview.chromium.org/951483002
2015-02-23 22:12:12 -08:00
joshualitt
44701df5ce Move clip off of draw target
BUG=skia:

Review URL: https://codereview.chromium.org/947443003
2015-02-23 14:44:58 -08:00
robertphillips
b8de1f4659 Reset conicWeights in SkPath::consumeDegenerateSegments when rewinding to last Move op
Without this patch the iterator can end up running off the end of the conic weights if there is a mixture of degenerate and non-degenerate ops

Note: we might want to suppress the generation of degenerate conics and lines in SkPath::addRRect

BUG=459897

Review URL: https://codereview.chromium.org/954453003
2015-02-23 11:17:01 -08:00
mtklein
a2f4be76a9 Sketch SkPMFloat
BUG=skia:

Committed: https://skia.googlesource.com/skia/+/50d2b3114b3e59dc84811881591bf25b2c1ecb9f

CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu13.10-GCC4.8-Arm7-Release-Android_Neon-Trybot

http://build.chromium.org/p/client.skia.compile/builders/Build-Ubuntu13.10-GCC4.8-Arm7-Release-Android_Neon/builds/2120/steps/build%20most/logs/stdio

Review URL: https://codereview.chromium.org/936633002
2015-02-23 10:04:34 -08:00
mtklein
088302756b Revert of Sketch SkPMFloat (patchset #15 id:270001 of https://codereview.chromium.org/936633002/)
Reason for revert:
http://build.chromium.org/p/client.skia.compile/builders/Build-Ubuntu13.10-GCC4.8-Arm7-Release-Android_Neon/builds/2120/steps/build%20most/logs/stdio

Original issue's description:
> Sketch SkPMFloat
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/50d2b3114b3e59dc84811881591bf25b2c1ecb9f

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

Review URL: https://codereview.chromium.org/952453004
2015-02-23 09:44:34 -08:00
mtklein
50d2b3114b Sketch SkPMFloat
BUG=skia:

Review URL: https://codereview.chromium.org/936633002
2015-02-23 09:39:27 -08:00
bsalomon
6bc1b5fab8 Dynamically create stencil buffer when needed.
Review URL: https://codereview.chromium.org/938383004
2015-02-23 09:06:38 -08:00
fmalita
7a048690d3 [SVGDevice] Text whitespace unittest
Plumb SkDOM as needed to make it suitable for an SkXMLWriter backend.

Also fix a potential null typeface issue in
SkSVGDevice::AutoElement::addTextAttributes().

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

Review URL: https://codereview.chromium.org/940283002
2015-02-20 13:54:40 -08:00
mtklein
2aa1f7e679 Port GrGLCaps over to use SkTHash.
I've written some new hashtable interfaces that should be easier to use,
and I've been trying to roll them out bit by bit, hopefully replacing
SkTDynamicHash, SkTMultiMap, SkTHashCache, etc.

This turns the cache in GrGLCaps::readPixelsSupported() into an SkTHashMap,
mapping the format key to a bool.  Functionally, it's the same.

BUG=skia:

Review URL: https://codereview.chromium.org/948473002
2015-02-20 12:35:32 -08:00
halcanary
a1f1ee98a1 PDF : New factory function for SkPDFDevice
SkPDFDevice now has factory function that matches what callers need.

Review URL: https://codereview.chromium.org/941023005
2015-02-20 06:17:26 -08:00
scroggo
87fa631969 Rename onGetPixelsEnum back to onGetPixels.
Replace the old signature of onGetPixels (return bool) to return an
enum (Result). Remove onGetPixelsEnum.

Add a define for onGetPixelsEnum to onGetPixels. This is for staging
in Chromium, where some implementations override onGetPixelsEnum.

Add the define in skia_for_chromium_defines. Remove
SK_SUPPORT_LEGACY_IMAGE_GENERATOR_RETURN, which is no longer needed by
Chromium.

BUG=skia:3257

Review URL: https://codereview.chromium.org/939113002
2015-02-19 18:44:58 -08:00
bsalomon
b602d4dff8 Speculative fix for nexus player unit test failure
TBR=robertphillips@google.com

NOTREECHECKS=true

Review URL: https://codereview.chromium.org/941433006
2015-02-19 12:05:58 -08:00
bsalomon
ddf30e64fe Handle the case when the GrResourceCache timestamp wraps.
NOTREECHECKS=true

Review URL: https://codereview.chromium.org/916103006
2015-02-19 11:38:45 -08:00
bsalomon
02a44a4886 Recycle stencil buffers across render targets.
Review URL: https://codereview.chromium.org/939093002
2015-02-19 09:09:00 -08:00
mtklein
90c6bc4e85 Revert of notify resource caches when pixelref genID goes stale (patchset #4 id:60001 of https://codereview.chromium.org/825263005/)
Reason for revert:
Crazy failures.

http://build.chromium.org/p/client.skia/builders/Test-Mac10.8-MacMini4.1-GeForce320M-x86_64-Debug/builds/1428/steps/dm/logs/stdio

Original issue's description:
> notify resource caches when pixelref genID goes stale
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/4675819b9dbb3ad71ec851776e5de26d342f29fe

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

Review URL: https://codereview.chromium.org/936423002
2015-02-19 08:53:52 -08:00
mtklein
cabc08c429 PDF: why do we have flags no one uses (or can use)?
BUG=skia:

Review URL: https://codereview.chromium.org/936403002
2015-02-19 08:29:24 -08:00
bsalomon
f99e961f55 Allow resources' unique keys to be changed.
Review URL: https://codereview.chromium.org/938943002
2015-02-19 08:24:16 -08:00
reed
4675819b9d notify resource caches when pixelref genID goes stale
BUG=skia:

Review URL: https://codereview.chromium.org/825263005
2015-02-19 08:22:54 -08:00
bsalomon
8718aafec2 Rename GrContentKey to GrUniqueKey
Review URL: https://codereview.chromium.org/940463006
2015-02-19 07:24:21 -08:00
kkinnunen
297aaf97a3 Avoid wrong memory access due to double substitution and %%
Use the form SkDebugf("%s", arbitraryString) instead of
SkDebugf(arbitraryString).

Fixes the case where SkString::appendf-ing a string with "%%" and then
printing the string with SkDebugf would cause uninitialized read and
corrupted debug print.

ninja -C out/Debug tools && valgrind --leak-check=full
./out/Debug/render_pictures --config gpu  -w q -r ...

...

==7307== Conditional jump or move depends on uninitialised value(s)
==7307==    at 0x6908475: __printf_fp (printf_fp.c:1180)
==7307==    by 0x6904267: vfprintf (vfprintf.c:1629)
==7307==    by 0x6906E53: buffered_vfprintf (vfprintf.c:2313)
==7307==    by 0x690188D: vfprintf (vfprintf.c:1316)
==7307==    by 0x67E8F5: SkDebugf(char const*, ...) (SkDebug_stdio.cpp:18)
==7307==    by 0x7983F1: GrContext::printCacheStats() const (GrTest.cpp:54)
==7307==    by 0x408ECF: tool_main(int, char**) (render_pictures_main.cpp:480)
==7307==    by 0x40913E: main (render_pictures_main.cpp:511)
==7307==
Budget: 2048 items 100663296 bytes
		Entry Count: current 652 (651 budgeted, 0 wrapped, 297 locked, 638 scratch 32 0.000000ull), high 652
		Entry Bytes: current 51087658 (budgeted 49826658, 49 0.000000ull, 1261000 unbudgeted) high 51087658

(observe "ull" instead of "% full")

(from mtklein)
This CL is not editing public API.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/943453002
2015-02-19 06:32:12 -08:00
halcanary
1b5c604d9d PDF: Add (low-memory) SkPDFBitmap class
Also: Add SkDeflateWStream and associated unit tests.

SkPDFBitmap is a replacement for SkPDFImage.  As of now, it only
supports 8888 bitmaps (the most common case).

SkPDFBitmap takes very little extra memory (aside from refing the
bitmap's pixels), and its emitObject() does not cache any data.

The SkPDFBitmap::Create function will check the canon for duplicates.
This can reduce the size of the output PDF.

Motivation:  this gives another ~40% decrease in PDF memory overhead

TODO: Support other ColorTypes and scrap SkPDFImage.

BUG=skia:3030

Review URL: https://codereview.chromium.org/918813002
2015-02-18 11:29:57 -08:00
halcanary
91d1d621de zlib/pdf: remove HaveFlate(), depend on preprocessor defines
Review URL: https://codereview.chromium.org/933523007
2015-02-17 14:43:06 -08:00
mtklein
1e4e814c03 SK_NO_FLATE
Also remove skia_zlib_static.  We're not using it.  We don't even have zlib in DEPS.

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

BUG=skia:

Review URL: https://codereview.chromium.org/936583002
2015-02-17 13:10:43 -08:00
egdaniel
305a8897cd Decrease number of allowed stages for Angle on GLProgramTest
BUG=skia:3435

Review URL: https://codereview.chromium.org/931783003
2015-02-17 11:18:38 -08:00
djsollen
50da1d8c3b Fix broken build due to updated #define
TBR=scroggo@google.com

Review URL: https://codereview.chromium.org/934803003
2015-02-17 09:09:53 -08:00
djsollen
523cda3943 Remove android specific srcPath from SkPath
Review URL: https://codereview.chromium.org/926693002
2015-02-17 08:06:33 -08:00
bungeman
3d47e2133c Labels when dumping fonts in Android parser test.
When the FontConfigParserAndroid test runs, it optionally dumps the
configurations it creates for manual inspection. This is useful, but
since three different configurations exist, it can be difficult to tell
them apart. This simply prints a short header before each dump so that
the dump can be identified.

Review URL: https://codereview.chromium.org/927533004
2015-02-13 18:30:11 -08:00
joshualitt
43466a1ade Multi-string shaders
BUG=skia:

Committed: https://skia.googlesource.com/skia/+/1c3c2d83364ee228e0751df0e1b9c161c0ba8c1e

Review URL: https://codereview.chromium.org/929503002
2015-02-13 17:18:27 -08:00
joshualitt
b8a82f2bce Revert of Multi-string shaders (patchset #4 id:60001 of https://codereview.chromium.org/929503002/)
Reason for revert:
windows warnings

Original issue's description:
> Multi-string shaders
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/1c3c2d83364ee228e0751df0e1b9c161c0ba8c1e

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

Review URL: https://codereview.chromium.org/924973002
2015-02-13 16:31:46 -08:00
joshualitt
1c3c2d8336 Multi-string shaders
BUG=skia:

Review URL: https://codereview.chromium.org/929503002
2015-02-13 16:23:49 -08:00
halcanary
3a6672ae0c C++11 Unit Test for RValue semantics.
Motivation:  test that these works on all possible bots and for all possible clients (clients do run these unit tests, right?)

Dear clients:  if this unit test fails, let us know!

BUG=skia:3427

Review URL: https://codereview.chromium.org/922043004
2015-02-13 15:12:52 -08:00
reed
694b0d115d fix more tricky-float cases in SkRRect validate
BUG=458524,458522

Review URL: https://codereview.chromium.org/921163003
2015-02-13 14:33:02 -08:00
bsalomon
3582d3ee9f Split out methods in GrGpuResource::CacheAccess that can be called outside of the cache.
Review URL: https://codereview.chromium.org/923143002
2015-02-13 14:20:05 -08:00
scroggo
0864908ca5 Make SkImageGenerator::getPixels() return an enum.
The new enum describes the nature of the failure. This is in
preparation for writing a replacement for SkImageDecoder, which will
use this interface.

Update the comments for getPixels() to specify what it means to pass
an SkImageInfo with a different size.

Make SkImageGenerator Noncopyable.

Leave onGetYUV8Planes alone, since we have separate discussions
regarding modifying that API.

Make callers of SkImageDecoder consistently handle kPartialSuccess.
Previously, some callers considered it a failure, and others considered
it a success.

BUG=skia:3257

Review URL: https://codereview.chromium.org/919693002
2015-02-13 11:13:34 -08:00
bsalomon
3555bd88a6 Add a templated priority queue class.
Review URL: https://codereview.chromium.org/914003004
2015-02-13 11:08:21 -08:00
ajuma
8e8c940ee3 Fix leak in ComposedImageFilterOffset test
This fixes a leak in the ComposedImageFilterOffset test that was
introduced in https://codereview.chromium.org/908273002/.

BUG=chromium:453924

Review URL: https://codereview.chromium.org/922063005
2015-02-13 10:15:46 -08:00
ajuma
5788faaa2a Fix SkComposeImageFilter's bounds computation and offset handling
This makes SkComposeImageFilter::computeFastBounds compose its
filters' bounds (rather than falling back to
SkImageFilter::computeFastBounds, which takes the union of the bounds).

This also makes SkComposeImageFilter::onFilterImage correctly handle
an offset produced when applying the inner filter; such offsets were
previously ignored.

BUG=chromium:453924

Review URL: https://codereview.chromium.org/908273002
2015-02-13 09:05:47 -08:00
egdaniel
e36914cb20 Pass in ProcOptInfos into willNeedDstCopy on XPs
BUG=skia:

Review URL: https://codereview.chromium.org/912413002
2015-02-13 09:00:33 -08:00
bungeman
9a0808fd8e Verify all parsed test font files start with cap.
All of the Android test font configuration files have file names which
start with a capital latin letter. Verify this is true of the parsed file
names. This would have caught previous issues with slicing, and will
hopefully prevent such issues going unnoticed in the future.

Review URL: https://codereview.chromium.org/925933003
2015-02-13 08:55:16 -08:00
fmalita
79ca081b90 Minimize SkTHash object copying
AKA ref-constify the world.

R=mtklein@google.com

Review URL: https://codereview.chromium.org/919193002
2015-02-12 17:32:49 -08:00
Mike Klein
201c98d08d fix windows build
BUG=skia:

Review URL: https://codereview.chromium.org/917363002
2015-02-12 16:41:57 -05:00
mtklein
979e0eacbd Spin off SkTHashTable, SkTHashMap, SkTHashSet
SkTHashTable is very similar to SkTDynamicHash, except it's generalized to support non-pointer value types.

It doesn't support remove(), just to keep things simple (it's not hard to add).
Instead of an iterator, it has foreach(), again, to keep things simple.

SkTHashMap<K,V> and SkTHashSet<T> build a friendlier experience on top of SkTHashTable.

BUG=skia:

Review URL: https://codereview.chromium.org/925613002
2015-02-12 13:20:08 -08:00
robertphillips
2de5939115 Revert of Fix Chromium build (patchset #2 id:20001 of https://codereview.chromium.org/916763003/)
Reason for revert:
Chrome

Original issue's description:
> Fix Chromium build
>
> TBR=jvanverth@google.com
>
> Committed: https://skia.googlesource.com/skia/+/f5e89c8f685ac8a5c4d117e087b4111d613106db

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

Review URL: https://codereview.chromium.org/916963002
2015-02-11 13:18:14 -08:00
robertphillips
f5e89c8f68 Fix Chromium build
TBR=jvanverth@google.com

Review URL: https://codereview.chromium.org/916763003
2015-02-11 11:38:44 -08:00
bsalomon
0ea80f43a1 Rename GrResourceCache2->GrResourceCache
TBR=robertphillips@google.com

Review URL: https://codereview.chromium.org/921453002
2015-02-11 10:49:59 -08:00
bungeman
c3c694342a Fix append_fallback_font_families_for_locale.
The language was being set to garbage, now set to part of the file name.
Add a test to ensure we continue to parse fallback directories correctly.

BUG=chromium:422180

Review URL: https://codereview.chromium.org/912053003
2015-02-11 07:18:51 -08:00
bsalomon
3632f8473a Add tests for STArray swap
Review URL: https://codereview.chromium.org/909583003
2015-02-10 19:46:58 -08:00
mtklein
bfd5bff75c Simplify SkBBH::insert API
No one's exploiting the ability to take ownership of the array anymore.

BUG=skia:

Review URL: https://codereview.chromium.org/913833002
2015-02-10 13:44:27 -08:00
halcanary
bf799cd228 Simplify reference management in SkPDF
Prior to this change, SkPDFObject subclasses were required
to track their resources separately from the document
structure.  (An object has a resource if it depends, via an
indirect reference, on another object).  This led to a lot
of extra code to duplicate effort.  I replace the
getResources() function with the much simpler addResources()
function.  I only define a non-trivial addResources() method
on arrays, dictionaries, and indirect object references.
All other specialized classes simply rely on their parent
class's implementation.

SkPDFObject::addResources() works by recursively walking the
directed graph of object (direct and indirect) references
and adding resources to a set.  It doesn't matter that there
are closed loops in the graph, since we check the set before
walking down a branch.

-  Add SkPDFObject::addResources() virtual function, with
   four implementations
-  Remove SkPDFObject::getResources() virtual function and
   all implementations.
-  Remove SkPDFObject::GetResourcesHelper()
-  Remove SkPDFObject::AddResourceHelper()
-  In SkPDFCatalog::findObjectIndex(), add an object to the
   catalog if it doesn't exist yet.
-  SkPDFCatalog::setSubstitute() no longer sets up resources
-  SkPDFDocument.cpp no longer needs the Streamer object
-  SkPDFDocument.cpp calls fDocCatalog->addResources to build
   the resource list.
-  SkPDFFont::addResource() removed
-  All SkPDF-::fResource sets removed (they are redundant).
-  removed SkPDFImage::addSMask() function
-  SkPDFResourceDict::getReferencedResources() removed.

Motivation: this removes quite a bit of code and makes the
objects slightly slimmer in memory.  Most importantly, this
will lead the way towards removing SkPDFObject's inheritance
from SkRefCnt, which will greatly simplify everything.

Testing: I usually test changes to the PDF backend by
comparing checksums of PDF files rendered from GMs and SKPs
before and after the change.  This change both re-orders and
re-numbers the indirect PDF objects.  I used the qpdf
program to normalize the PDFs and then compared the
normalized outputs from before and after the change; they
matched.

Review URL: https://codereview.chromium.org/870333002
2015-02-10 13:32:09 -08:00
reed
454fa71cc3 check for nonfinites in rrects
BUG=457128

Review URL: https://codereview.chromium.org/913743002
2015-02-10 08:46:22 -08:00
bungeman
eb2be7fa44 Additional cleanups to Android config parsing.
Properly labels several methods as static.
Use XML_GetBuffer to avoid an extra copy.
Set the memory allocators to Skia's.
Set define in 'defines' instead of cflags.
Update debug dumper.

Review URL: https://codereview.chromium.org/915443002
2015-02-10 07:51:12 -08:00
reed
d5d27d9b14 use conics for arcTo
guarded by SK_SUPPORT_LEGACY_ARCTO_QUADS

BUG=skia:

Review URL: https://codereview.chromium.org/892703002
2015-02-09 13:54:43 -08:00
reed
31223e0cb7 cull edges that are to the right of the clip
BUG=skia:

Review URL: https://codereview.chromium.org/913503002
2015-02-09 08:33:07 -08:00
bsalomon
23e619cf46 Reimplement gpu message bus for invalidated bitmap gen IDs
Review URL: https://codereview.chromium.org/902873002
2015-02-06 11:54:28 -08:00
bsalomon
d0423587ac One createTexture function, attempt to recycle scratch in createTexture.
Review URL: https://codereview.chromium.org/864383003
2015-02-06 08:49:24 -08:00
bungeman
7fa87cd09f Add factory for Android font manager.
This allows users to create an Android font manager with their own set
of fonts, or augment the system set. This will allow for removal of
the current globals which are used for a similar, but more constained,
purpose.

BUG=skia:2817,skia:3314,chromium:407340

Review URL: https://codereview.chromium.org/887113002
2015-02-06 07:59:19 -08:00
bsalomon
50785a3d10 Revert of Revert of Move DstCopy on gpu into the GrXferProcessor. (patchset #1 id:1 of https://codereview.chromium.org/901663007/)
Reason for revert:
The revert didn't help the 10.9 bot. Unreverting by reverting the revert (which is basically relanding the original patch which itself was a revert of a revert). Revert.

Original issue's description:
> Revert of Move DstCopy on gpu into the GrXferProcessor. (patchset #11 id:200001 of https://codereview.chromium.org/885923002/)
>
> Reason for revert:
> Testing to see if reverting fixes 10.9 bots.
>
> Original issue's description:
> > Move DstCopy on gpu into the GrXferProcessor.
> >
> > BUG=skia:
> >
> > Committed: https://skia.googlesource.com/skia/+/74a11753604768bf461b80cabb66060e8564d82c
> >
> > Committed: https://skia.googlesource.com/skia/+/5e1378d0e075a323144ba14e0a4cbcca35eccc69
>
> TBR=joshualitt@google.com,egdaniel@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/21b2c53218ab25f4268e3992e51d916076a2a7ee

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

Review URL: https://codereview.chromium.org/873723009
2015-02-06 07:02:37 -08:00
bsalomon
21b2c53218 Revert of Move DstCopy on gpu into the GrXferProcessor. (patchset #11 id:200001 of https://codereview.chromium.org/885923002/)
Reason for revert:
Testing to see if reverting fixes 10.9 bots.

Original issue's description:
> Move DstCopy on gpu into the GrXferProcessor.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/74a11753604768bf461b80cabb66060e8564d82c
>
> Committed: https://skia.googlesource.com/skia/+/5e1378d0e075a323144ba14e0a4cbcca35eccc69

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

Review URL: https://codereview.chromium.org/901663007
2015-02-05 14:18:05 -08:00