Commit Graph

619 Commits

Author SHA1 Message Date
scroggo@google.com
8d2392487c Add an option on SkImageDecoder to skip writing 0s.
Only implemented for PNG.

Add a getter and setter, and sets the default to false in the
constructor. Also copies the setting in copyFieldsToOther.

Fix an indpendent bug where fDitherImage was not being copied in
copyFieldsToOther.

In SkScaledBitmapSampler::begin, consolidate the settings passed in
by passing a const reference to the decoder. The decoder can be
referenced for its settings of dither, unpremultiplied, and now
skipping writing zeroes. Update callers to use the new API. In png
decoder, rather than passing around a pointer to an initial
read of getDitherImage, and potentially changing it, look at the
field on the decoder itself, and modify it directly. This is a
change in behavior - now if that same decoder is used to decode
a different image, the dither setting has changed. I think this is
okay because A) the typical use case is to use a new decoder for
each decode, B) we do not make any promises that a decode does not
change the decoder and C) it makes the code in SkScaledBitmapSampler
much cleaner.

In SkScaledBitmapScampler, add new row procs for skipping zeroes. Now
that choosing the row proc has five dimensions (src config, dst config,
dither, skip writing zeroes, unpremultiplied), use a new method: each
src/dst combination has a function for choosing the right proc depending
on the decoder.

SkScaledBitmapScampler::RowProc is now public for convenience.

Remove Sample_Gray_D8888_Unpremul, which is effectively no different
from Sample_Gray_D8888.

In cases where unpremultiplied was trivial, such as 565 and when
sampling from gray, decoding may now succeed.

Add a benchmark (currently disabled) for comparing the speed of skipping
writing zeroes versus not skipping. For this particular image, which is
mostly transparent pixels, normal decoding took about 3.6 milliseconds,
while skipping zeroes in the decode took only about 2.5 milliseconds
(this is on a Nexus 4). Presumably it would be slower on an image
with a small amount of transparency, but there will be no slowdown
for an image which reports that it has no transparency.

In SkImageRef_ashmem, always skip writing zeroes, since ashmem
memory is guaranteed to be initialized to 0.

Add a flag to skip writing zeroes in skimage.

Add a regression test for choosing the rowproc to ensure I did not
change any behavior accidentally.

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

Review URL: https://codereview.chromium.org/24269006

git-svn-id: http://skia.googlecode.com/svn/trunk@11558 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-01 17:27:15 +00:00
commit-bot@chromium.org
3400f4b00a Add 3 color variant to gradient bench, include scale in name, add more benchs
R=reed@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/25294003

git-svn-id: http://skia.googlecode.com/svn/trunk@11536 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-30 19:41:09 +00:00
mtklein@google.com
9cb5177619 Fix asan build. Duh, don't return a stack address...
BUG=
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/25026004

git-svn-id: http://skia.googlecode.com/svn/trunk@11497 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-27 13:39:14 +00:00
commit-bot@chromium.org
97b4b67ee7 Remove uses of unnamed namespace in bench/ directory.
Skia prefers to use static over unnamed namespace.

BUG=None
TEST=None, no functional changes.
R=bsalomon@google.com, robertphillips@google.com

Author: tfarina@chromium.org

Review URL: https://chromiumcodereview.appspot.com/24660003

git-svn-id: http://skia.googlecode.com/svn/trunk@11483 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-26 19:23:03 +00:00
commit-bot@chromium.org
2c86fbb0b1 Add SkDivMod with a special case for ARM.
BUG=skia:1663
R=djsollen@google.com, tomhudson@google.com, reed@google.com

Author: mtklein@google.com

Review URL: https://chromiumcodereview.appspot.com/24159009

git-svn-id: http://skia.googlecode.com/svn/trunk@11482 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-26 19:22:54 +00:00
scroggo@google.com
b90a2cacfe Fix a warning.
git-svn-id: http://skia.googlecode.com/svn/trunk@11462 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-25 22:01:17 +00:00
scroggo@google.com
111fd11e11 Bench baseline for mostly 0 image.
Add a baseline for decoding a mostly 0 image. This is in advance of
https://codereview.chromium.org/24269006/ which provides an option to
skip writing those 0s (as part of BUG=skia:1661). On my Nexus 4, the
benchmark does not slow down after that change.

As suggested in https://codereview.chromium.org/24269006/ add a
resourcePath flag to bench. Will require a change in buildbot in order
to actually use the flag.

Add an image used by the test.

Until https://codereview.chromium.org/24448002 is submitted,
the test will not actually be run by the bots (since it
won't know where to find the file).

BUG=skia:1661
R=djsollen@google.com, mtklein@google.com

Review URL: https://codereview.chromium.org/24440002

git-svn-id: http://skia.googlecode.com/svn/trunk@11461 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-25 21:42:12 +00:00
bensong@google.com
7d9a21bb36 Deletes bench_expectations.txt and change comments to refer to the new per-bot expectation files.
Review URL: https://codereview.chromium.org/23830009

git-svn-id: http://skia.googlecode.com/svn/trunk@11456 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-25 20:51:16 +00:00
reed@google.com
d28ba8010c promote SkImage::AlphaType to SkAlphaType
BUG=
R=bsalomon@google.com

Review URL: https://codereview.chromium.org/24130009

git-svn-id: http://skia.googlecode.com/svn/trunk@11421 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-20 19:33:52 +00:00
mtklein@google.com
519f9677a4 Add sk_calloc. Remove SkMemory_stdlib, which seems unused.
I'm seeing basically no difference between malloc + bzero and calloc on my desktop, but on a Galaxy Nexus calloc is never slower, and significantly faster once the allocation size becomes large, both for allocation and for _reading_.

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

Review URL: https://codereview.chromium.org/24251008

git-svn-id: http://skia.googlecode.com/svn/trunk@11414 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-20 14:31:45 +00:00
mtklein@google.com
b352627436 1) Don't allocate 100,000 ints when we only need 1,000.
2) Don't sort past the end of the array when using SkTQSort.
3) Don't allocate any arrays until we need them (in onDraw).

Also, propagate the constant N everywhere through the bench.

BUG=
R=bungeman@google.com

Review URL: https://codereview.chromium.org/23890033

git-svn-id: http://skia.googlecode.com/svn/trunk@11329 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-17 19:37:34 +00:00
mtklein@google.com
93d2f559b8 also limit loops-per-canvas in picture_record_dictionaries, which has the same problem as unique_paint
BUG=
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/23513065

git-svn-id: http://skia.googlecode.com/svn/trunk@11327 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-17 18:58:53 +00:00
bensong@google.com
1dd9194fc2 Splits bench_expectations into per-bot files in preparation for growth.
Next steps are switching bots to using per-bot expectations, and deleting the existing bench_expectations.txt.
Review URL: https://codereview.chromium.org/24075008

git-svn-id: http://skia.googlecode.com/svn/trunk@11323 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-17 17:21:02 +00:00
mtklein@google.com
5e5239ed35 switch to a new canvas every once in a while in picture_record_unique
BUG=
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/23995020

git-svn-id: http://skia.googlecode.com/svn/trunk@11321 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-17 17:14:25 +00:00
fmalita@google.com
ef45a646a7 [External patch] Source-over support for SkLumaXfermode.
This is a patch by Andrei Parvu <parvu@adobe.com> (Adobe CLA signer).

Original CL/review: https://codereview.chromium.org/24078006/

GM:lumamode will need rebaselining after landing this.

---

  In order to use CSS luminance masking, we need to be able to create an
  instance of SkLumaXfermode which can receive a kSrcOver mode, and applies
  that mode after converting the source using the luminance-to-alpha
  coefficients.

BUG=289420
R=reed@google.com

Review URL: https://codereview.chromium.org/23710053

git-svn-id: http://skia.googlecode.com/svn/trunk@11312 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-17 13:09:16 +00:00
skia.committer@gmail.com
a604c4f971 Sanitizing source files in Housekeeper-Nightly
git-svn-id: http://skia.googlecode.com/svn/trunk@11309 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-17 07:01:20 +00:00
borenet@google.com
4e061d3f15 Allow use of "--config defaults" in bench, like GM
R=mtklein@google.com, scroggo@google.com

Review URL: https://codereview.chromium.org/23855006

git-svn-id: http://skia.googlecode.com/svn/trunk@11298 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-16 19:12:19 +00:00
robertphillips@google.com
24ddde9758 Revert 11247, 11250, 11251, 11257, and 11279 to unblock DEPS roll (https://codereview.chromium.org/24159002/)
11279 Sanitizing source files in Housekeeper-Nightly - https://code.google.com/p/skia/source/detail?r=11279
11257 Canary build fix - https://codereview.chromium.org/23532068
11251 More warnings as errors fixes - https://code.google.com/p/skia/source/detail?r=11251
11250 Warnings as errors fix - https://code.google.com/p/skia/source/detail?r=11250
11247 Initial error handling code - https://chromiumcodereview.appspot.com/23021015



git-svn-id: http://skia.googlecode.com/svn/trunk@11288 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-16 14:04:05 +00:00
robertphillips@google.com
ba6e954140 Revert the revert of 11247, 11250, 11251 and 11279 (Chrome already relies on changes in r11247)
git-svn-id: http://skia.googlecode.com/svn/trunk@11287 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-16 13:40:12 +00:00
robertphillips@google.com
478884f7d3 Revert 11247, 11250, 11251 and 11279 to unblock DEPS roll (https://codereview.chromium.org/24159002/)
11279 Sanitizing source files in Housekeeper-Nightly - https://code.google.com/p/skia/source/detail?r=11279
11251 More warnings as errors fixes - https://code.google.com/p/skia/source/detail?r=11251
11250 Warnings as errors fix - https://code.google.com/p/skia/source/detail?r=11250
11247 Initial error handling code - https://chromiumcodereview.appspot.com/23021015



git-svn-id: http://skia.googlecode.com/svn/trunk@11285 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-16 13:19:11 +00:00
skia.committer@gmail.com
dc9888c409 Sanitizing source files in Housekeeper-Nightly
git-svn-id: http://skia.googlecode.com/svn/trunk@11279 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-14 07:01:34 +00:00
mtklein@google.com
9ef1d21dc8 OK windows, please take my infinity.
BUG=

Review URL: https://codereview.chromium.org/23526045

git-svn-id: http://skia.googlecode.com/svn/trunk@11272 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-13 20:39:50 +00:00
mtklein@google.com
dbd41c8857 It looks like we're not always running long enough to give the GPU counters time to converge (and possibly the same for CPU too, but GPU is definitely worse off).
This CL changes our convergence logic from
  - did the last run take more than x milliseconds?
to
  - did the last run take more x milliseconds and are the last two runs within y% of each other?

There's also now an upper limit where we bail out with an error if we haven't yet met the convergence criteria.  Keeping the lower bound is important for benches where the constant overhead is much larger than the work done in the loop; without it we'll see T(1 loop) == T(2 loops) and converge way too early.

This CL also exposed that DeferredCanvasBench had a bug: it was running N^2 loops when we told it to run N.  (My fault.)

I threw in a couple other linty changes that I'd be happy to split off.

BUG=
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/23536046

git-svn-id: http://skia.googlecode.com/svn/trunk@11267 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-13 20:11:09 +00:00
mtklein@google.com
410e6e80f0 Refactoring: get rid of the SkBenchmark void* parameter.
While I was doing massive sed-ing, I also converted every bench to use DEF_BENCH instead of registering the ugly manual way.

BUG=
R=scroggo@google.com

Review URL: https://codereview.chromium.org/23876006

git-svn-id: http://skia.googlecode.com/svn/trunk@11263 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-13 19:52:27 +00:00
robertphillips@google.com
96bf2b53f2 N7 Performance trigger rebaselines
git-svn-id: http://skia.googlecode.com/svn/trunk@11256 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-13 15:42:08 +00:00
mtklein@google.com
b87bf83f48 Add explicit double -> SkScalar conversion to fix werror on Windows.
BUG=

Review URL: https://codereview.chromium.org/23432008

git-svn-id: http://skia.googlecode.com/svn/trunk@11190 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-10 19:51:10 +00:00
mtklein@google.com
78d0379dcc Add missing dependency to unbreak NOGPU build.
BUG=

Review URL: https://codereview.chromium.org/23527004

git-svn-id: http://skia.googlecode.com/svn/trunk@11188 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-10 19:42:07 +00:00
mtklein@google.com
c289743864 Major bench refactoring.
- Use FLAGS_.
   - Remove outer repeat loop.
   - Tune inner loop automatically.

BUG=skia:1590
R=epoger@google.com, scroggo@google.com

Review URL: https://codereview.chromium.org/23478013

git-svn-id: http://skia.googlecode.com/svn/trunk@11187 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-10 19:23:38 +00:00
borenet@google.com
8ad29cea42 Fix bench logging for --repeat 1
Addressing https://code.google.com/p/skia/issues/detail?id=1607

R=scroggo@google.com

Review URL: https://codereview.chromium.org/23923011

git-svn-id: http://skia.googlecode.com/svn/trunk@11181 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-10 17:22:43 +00:00
commit-bot@chromium.org
e0e7cfe44b Change old PRG to be SkLCGRandom; change new one to SkRandom
The goal here is to get people to start using the new random number
generator, while leaving the old one in place so we don't have to 
rebaseline GMs.

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

Author: jvanverth@google.com

Review URL: https://chromiumcodereview.appspot.com/23576015

git-svn-id: http://skia.googlecode.com/svn/trunk@11169 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-09 20:09:12 +00:00
skia.committer@gmail.com
b3ec29d2d8 Sanitizing source files in Housekeeper-Nightly
git-svn-id: http://skia.googlecode.com/svn/trunk@11143 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-07 07:01:16 +00:00
commit-bot@chromium.org
6485b0be74 Switch out random number generator for tests, benches, samples.
This change makes tests, benches and samples use the new SkMWCRandom PRNG. GMs will be saved for another time, as they'll require rebaselining.

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

Author: jvanverth@google.com

Review URL: https://chromiumcodereview.appspot.com/23653018

git-svn-id: http://skia.googlecode.com/svn/trunk@11136 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-06 19:05:11 +00:00
robertphillips@google.com
b7061176c7 Push sigma-based blur interface into our GMs/benches/tests/samplecode
https://codereview.chromium.org/23701006/



git-svn-id: http://skia.googlecode.com/svn/trunk@11129 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-06 14:16:12 +00:00
robertphillips@google.com
fd47a121dc Win7 Performance trigger rebaseline
git-svn-id: http://skia.googlecode.com/svn/trunk@11108 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-05 17:56:42 +00:00
mtklein@google.com
bd6343b1d6 Rewrite SkTRegistry to take any trivially-copyable type.
Obviously these are all currently function pointers of type T(*)(P) for various
T and P.  In bench refactoring, I'm trying to register a function pointer of
type T(*)(), which can't be done as is (passing P=void doesn't work).  This
also lets us register things like primitives, which is conceivable useful.

BUG=
R=reed@google.com, scroggo@google.com

Review URL: https://codereview.chromium.org/23453031

git-svn-id: http://skia.googlecode.com/svn/trunk@11082 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-04 17:20:18 +00:00
commit-bot@chromium.org
5b2e2640ed Revise SVD code to remove arctangents.
Also added bench for timing matrix decomposition.

R=reed@google.com

Author: jvanverth@google.com

Review URL: https://chromiumcodereview.appspot.com/23596006

git-svn-id: http://skia.googlecode.com/svn/trunk@11066 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-03 19:08:14 +00:00
robertphillips@google.com
87d949938a Nexus7 Performace trigger baselines
git-svn-id: http://skia.googlecode.com/svn/trunk@11050 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-01 11:23:31 +00:00
skia.committer@gmail.com
e0c170f7bb Sanitizing source files in Housekeeper-Nightly
git-svn-id: http://skia.googlecode.com/svn/trunk@11049 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-31 07:01:28 +00:00
sglez@google.com
0d60db6010 Add missing .outs
Review URL: https://codereview.chromium.org/23567005

git-svn-id: http://skia.googlecode.com/svn/trunk@11042 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-30 18:54:54 +00:00
sglez@google.com
3e3cdadefd Fix rtree bench
R=caryclark@google.com

Review URL: https://codereview.chromium.org/23609009

git-svn-id: http://skia.googlecode.com/svn/trunk@11041 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-30 18:38:53 +00:00
sglez@google.com
8c902126a9 R-Tree -- Don't sort draw commands unless specified.
We expect Webkit and Bink to give us draw commands in a reasonable x,y order.
We can maintain correctness and get a 17% recording speedup for the R-Tree by
not sorting in x and y when bulk-loading.

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

Review URL: https://codereview.chromium.org/23480002

git-svn-id: http://skia.googlecode.com/svn/trunk@11037 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-30 17:27:47 +00:00
robertphillips@google.com
73672254a3 Patch for 10995
git-svn-id: http://skia.googlecode.com/svn/trunk@10997 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-29 12:40:26 +00:00
robertphillips@google.com
1f2f338e23 Split SkDevice into SkBaseDevice and SkBitmapDevice
https://codereview.chromium.org/22978012/



git-svn-id: http://skia.googlecode.com/svn/trunk@10995 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-29 11:54:56 +00:00
commit-bot@chromium.org
515dcd3603 Replace uses of GR_DEBUG by SK_DEBUG.
BUG=None
R=bsalomon@google.com, robertphillips@google.com

Author: tfarina@chromium.org

Review URL: https://chromiumcodereview.appspot.com/23137022

git-svn-id: http://skia.googlecode.com/svn/trunk@10978 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-28 14:17:03 +00:00
robertphillips@google.com
d162092bb4 Performance trigger rebaselines of theverge on Nexus7 for r10936 (Blur refactoring)
git-svn-id: http://skia.googlecode.com/svn/trunk@10975 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-28 12:37:31 +00:00
shawnsingh@chromium.org
63bf68df05 Add performance benchmark before landing perf improvements that remove sk_bezero in SkMatrix44
BUG=skia:1558
R=jvanverth@google.com

Review URL: https://codereview.chromium.org/22872015

git-svn-id: http://skia.googlecode.com/svn/trunk@10967 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-28 05:07:26 +00:00
robertphillips@google.com
7ce661d19c Blur refactoring
https://codereview.chromium.org/21835004/



git-svn-id: http://skia.googlecode.com/svn/trunk@10936 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-27 16:14:03 +00:00
robertphillips@google.com
d3707a7559 Performance trigger rebaselines
git-svn-id: http://skia.googlecode.com/svn/trunk@10890 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-23 14:17:16 +00:00
commit-bot@chromium.org
eaa7797990 Add luminance mask transfer modes.
This adds kSrcInLum_Mode and kDstInLum_Mode, to support CSS and SVG luminance masks (http://www.w3.org/TR/css-masking/#MaskValues , http://www.w3.org/TR/SVG/masking.html#Masking ).

The transfer coefficient is computed according to http://www.w3.org/TR/2011/REC-SVG11-20110816/filters.html#feColorMatrixElement "luminance-to-alpha":

  luma = 0.2125 * r + 0.7154 * g + 0.0721 * b


R=bsalomon@google.com, reed@google.com, robertphillips@google.com, vandebo@chromium.org

Author: fmalita@chromium.org

Review URL: https://chromiumcodereview.appspot.com/22918012

git-svn-id: http://skia.googlecode.com/svn/trunk@10887 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-23 13:13:12 +00:00
mtklein@google.com
330313a8a8 My clang now doesn't complain about !"foo".
BUG=
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/22875037

git-svn-id: http://skia.googlecode.com/svn/trunk@10874 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-22 15:37:26 +00:00