Commit Graph

4962 Commits

Author SHA1 Message Date
cdalton
cdd7907a3d Implement cached nvpr text blobs
BUG=skia:

Review URL: https://codereview.chromium.org/1381073002
2015-10-05 15:37:35 -07:00
msarett
cc7f305c69 SkScaledCodec should implement onRewind()
This is a bug fix.  I'm also adding a test.

BUG=skia:

Review URL: https://codereview.chromium.org/1385703002
2015-10-05 14:20:27 -07:00
reed
af3fbfca0a SkImage doesn't use props, so don't need to store it
BUG=skia:
TBR=bsalomon

Review URL: https://codereview.chromium.org/1372153006
2015-10-04 11:28:36 -07:00
scroggo
e7fc14b55b Move all knowledge of X sampling into SkScaledCodec
Prior to this CL, each SkCodec subclass that allows sampling does an
extra check in onStartScanlineDecode to determine whether the X dimension
is supported for sampling. Remove this check, and provide a way for
SkScaledCodec to directly access the SkSwizzler, and update it to do
sampling. This way, the SkCodec knows nothing of sampling, but we can
still save the extra step of sampling afterwards.

FIXME: SkBmpRLECodec still calls SkScaledCodec::DimensionsSupported. It
seems like it could directly support sampling, rather than dealing with
SkScaledCodec (partially).

Add a new base class for SkSwizzler. It allows updating the swizzler
after it was created, which is done by SkScaledCodec. Modify SkSwizzler's
constructor/factory function to stop taking any info about sampling,
assume the sample size is one, and move modifying that into a virtual
function overridden from the base class.

BUG=skia:4284

Review URL: https://codereview.chromium.org/1372973002
2015-10-02 13:14:46 -07:00
bsalomon
473addf176 Remove separate cache for clip mask textures
Review URL: https://codereview.chromium.org/1377943003
2015-10-02 07:49:06 -07:00
hendrikw
b1ac52fb0f Skia: Add Command Buffer support to Linux/Mac
Code added to load libcommand_buffer_gles2.so on linux or
mac.

Review URL: https://codereview.chromium.org/1346423002
2015-10-01 18:29:34 -07:00
bungeman
77a53de20d Base SkAutoTUnref on skstd::unique_ptr.
To further consolidate the various unique owning classes, this bases
SkAutoTUnref on skstd::unique_ptr. Users are updated because of two
breaking changes, swap now takes a reference and reset no longer
returns its argument.

Review URL: https://codereview.chromium.org/1370803002
2015-10-01 12:28:49 -07:00
vbuzinov
3e77ba96d5 Implement stencil clipping in mixed sampled render targets
This change enables multisampled clipping for mixed sampled
render targets.  Previously clipping in mixed samples config
behaved the same as in the gpu config.

In order to retrofit non-MSAA draw methods, programmable sample
locations are used in order to colocate all samples at (0.5, 0.5).
Requires support for NV_sample_locations.

BUG=skia:4399

Review URL: https://codereview.chromium.org/1232103002
2015-09-30 23:02:06 -07:00
scroggo
3a7701c010 Call rewindIfNeeded in SkCodec
Rather than calling it in each subclass, call it once in the base
class. Call it first, since other steps may modify internal structures
which would be replaced by a call to onRewind.

BUG=skia:4284

Review URL: https://codereview.chromium.org/1381483002
2015-09-30 09:15:14 -07:00
scroggo
46c5747256 Merge SkCodec with SkScanlineDecoder
Benefits:
- This mimics other decoding APIs (including the ones SkCodec relies
on, e.g. a png_struct, which can be used to decode an entire image or
one line at a time).

- It allows a client to ask us to do what we can do efficiently - i.e.
start from encoded data and either decode the whole thing or scanlines.

- It removes the duplicate methods which appeared in both SkCodec and
SkScanlineDecoder (some of which, e.g. in SkJpegScanlineDecoder, just
call fCodec->sameMethod()).

- It simplifies moving more checks into the base class (e.g. the
examples in skbug.com/4284).

BUG=skia:4175
BUG=skia:4284

=====================================================================

SkScanlineDecoder.h/.cpp:
Removed.

SkCodec.h/.cpp:
Add methods, enums, and variables which were previously in
SkScanlineDecoder.
Default fCurrScanline to -1, as a sentinel that start has not been
called.

General changes:
Convert SkScanlineDecoders to SkCodecs.

General changes in SkCodec subclasses:
Merge SkScanlineDecoder implementation into SkCodec. Most (all?) owned
an SkCodec, so they now call this-> instead of fCodec->.

SkBmpCodec.h/.cpp:
Replace the unused rowOrder method with an override for
onGetScanlineOrder.
Make getDstRow const, since it is called by onGetY, which is const.

SkCodec_libpng.h/.cpp:
Make SkPngCodec an abstract class, with two subclasses which handle
scanline decoding separately (they share code for decoding the entire
image). Reimplement onReallyHasAlpha so that it can return the most
recent result (e.g. after a scanline decode which only decoded part
of the image) or a better answer (e.g. if the whole image is known to
be opaque).
Compute fNumberPasses early, so we know which subclass to instantiate.
Make SkPngInterlaceScanlineDecoder use the base class' fCurrScanline
rather than a separate variable.

CodexTest.cpp:
Add tests for the state changes in SkCodec (need to call start before
decoding scanlines; calling getPixels means that start will need to
be called again before decoding more scanlines).
Add a test which decodes in stripes, currently only used for an
interlaced PNG.

TODO: Add tests for onReallyHasAlpha.

Review URL: https://codereview.chromium.org/1365313002
2015-09-30 08:57:14 -07:00
ssid
f0c986503b Add support for light dumps in SkTraceMemoryDump interface.
SkGlyphCache dumps too many glyphs, and to reduce the trace size,
RequestDetails enum is added to SkTraceMemoryDump interface. This
would tell caches to dump only requested details or not a detailed
dump.

BUG=499731

Review URL: https://codereview.chromium.org/1310123007
2015-09-30 04:31:23 -07:00
reed
b39abc4d76 remove unused helper function
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1376603006
2015-09-29 18:27:59 -07:00
herb
e4c17356b6 Unify ThreadID.
BUG=skia:

Review URL: https://codereview.chromium.org/1371303003
2015-09-29 14:38:01 -07:00
mtklein
242397a1c9 Revert of Implement SkImageFilter::Cache with SkResourceCache. (patchset #8 id:140001 of https://codereview.chromium.org/1370323002/ )
Reason for revert:
Landed PS8 temporarily to trigger the perf bots.

Original issue's description:
> Implement SkImageFilter::Cache with SkResourceCache.
>
> The single global cache now uses the global SkResourceCache,
> and any Create()ed cache uses a local SkResourceCache.
>
> No real public API changes (and only deletes).
>
> I don't see any pixel diffs on .skps or GMs.
> Don't see any significant perf difference on 8888 or gpu configs.
> DM peak memory usage did drop by about 113M, close to the 128M cache size.
>
> BUG=skia:3662
>
> Landing PS8 temporarily to trigger the perf bots.
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/75135d8ae1aa12e8e6bfce63291e5e876a77546f

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

Review URL: https://codereview.chromium.org/1381523002
2015-09-29 12:17:08 -07:00
mtklein
75135d8ae1 Implement SkImageFilter::Cache with SkResourceCache.
The single global cache now uses the global SkResourceCache,
and any Create()ed cache uses a local SkResourceCache.

No real public API changes (and only deletes).

I don't see any pixel diffs on .skps or GMs.
Don't see any significant perf difference on 8888 or gpu configs.
DM peak memory usage did drop by about 113M, close to the 128M cache size.

BUG=skia:3662

Landing PS8 temporarily to trigger the perf bots.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1370323002
2015-09-29 12:15:52 -07:00
herb
62a69c26b3 Move Mutexy things to private.
There is no API change.

TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/1368333004
2015-09-29 11:47:45 -07:00
robertphillips
05302f8f24 Handle inverted rects in SkRRect creation methods
An alternative way of addressing this is to alter SkCanvas::drawRoundRect to just reject isEmpty (i.e., un-sorted or truly empty) input rects.

BUG=skia:3786

Review URL: https://codereview.chromium.org/1373293002
2015-09-29 11:24:07 -07:00
mtklein
3d096654b9 update memset16/32 inlining heuristics
I spent some time looking at perf.skia.org and it looks like we can do better.

It is weird, weird, weird that on x86, we see three completely different behaviors:
  - x86 Android: inlining better for small N, custom better for large N;
  - Windows:     inlining better for large N, custom better for small N;
  - other x86:   inlining generally better

BUG=skia:4316,chromium:516426

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

Summaries: https://perf.skia.org/#4179
All traces, log scale: https://perf.skia.org/#4180

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

Review URL: https://codereview.chromium.org/1357193002
2015-09-29 10:38:59 -07:00
bsalomon
e25eea4b36 Use child processors to implement compose color filter.
Review URL: https://codereview.chromium.org/1368423003
2015-09-29 06:38:55 -07:00
herb
e6e41a8a19 Move SkAtomics.h to private.
There are no API changes.

TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/1369333004
2015-09-28 11:24:13 -07:00
herb
9f4dbca329 Make SkPath fFirstDirection atomic to fix tsan.
There is no API change.

TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/1372103003
2015-09-28 11:05:47 -07:00
mtklein
449d9b7e2d simplify code in SkRecords.h
- use C++11 features ({} init, move constructors) to eliminate the need
     for explicit constructors
   - collapse RECORD0...RECORD8 into just one RECORD macro
   - explicitly tag record types instead of using member detectors.

Removing member detectors makes this code significantly less fragile.

This exposes a few places where we didn't really think through what to do
with SkDrawable.  I've marked them TODO for now.

BUG=skia:

Review URL: https://codereview.chromium.org/1360943003
2015-09-28 10:33:02 -07:00
reed
c9e190ddac Revert of change pixel-serializer to support reencoding existing data (patchset #5 id:80001 of https://codereview.chromium.org/1373683003/ )
Reason for revert:
Need to somehow get access to encoders in chrome -- link error on the roll since SkImageEncoder is not built as part of chrome.

Original issue's description:
> change pixel-serializer to support reencoding existing data
>
> Trying to evolve this interface so it can
> - support rich set of backend-encoders (including ones like ETC1 that can cheaply convert to KXT
> - allow for encoding images as well as bitmaps (e.g. for picture serialization)
> - perhaps replace SkImageEncoder as an API (assuming we create a factory that returns a serializer given a format)
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/13f48dc85aa68a60da66aaf39c93d527d11d1278

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

Review URL: https://codereview.chromium.org/1371983003
2015-09-28 09:58:41 -07:00
herb
0869267a7c Add cast and assignment operators to SkAtomic.
This is not really an API change.

TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/1369333002
2015-09-28 08:59:18 -07:00
reed
13f48dc85a change pixel-serializer to support reencoding existing data
Trying to evolve this interface so it can
- support rich set of backend-encoders (including ones like ETC1 that can cheaply convert to KXT
- allow for encoding images as well as bitmaps (e.g. for picture serialization)
- perhaps replace SkImageEncoder as an API (assuming we create a factory that returns a serializer given a format)

BUG=skia:

Review URL: https://codereview.chromium.org/1373683003
2015-09-28 08:58:53 -07:00
bsalomon
f1b7a1d828 Make skpaint->grpaint flow work for composing draws (verts and atlas)
One side effect is that the SkShader's (or implicit shader's) fragment processor is responsible for the transition from an unpremul paint color to a premul color.

Review URL: https://codereview.chromium.org/1348583002
2015-09-28 06:26:29 -07:00
fmalita
2f5891ea64 Remove SkBitmapSource
To avoid breaking existing SKPs, add a deserialization stub which
unflattens SkBitmapSource records to SkImageSources.

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

Review URL: https://codereview.chromium.org/1363913002
2015-09-25 09:15:55 -07:00
reed
d114645d93 SkInstallDiscardablePixelRef is deprecated, enforce that
No functionality change, just a renaming.

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1372593002
2015-09-25 06:56:57 -07:00
mdempsky
00d6e515e5 Eliminate some clutter in SkFlattenable
The Registrar class is unnecessary, as SkFlattenable factory
registration is now handled via initialization routines that can just
call the Register function directly.

Also, no need to lazily initialize gCount to 0, as initializing an int
to a constant value does not require dynamic initialization.  (C++
actually guarantees zero initialization of global ints anyway, but
existing practice in Skia appears to favor the explicit "= 0").

Relatedly, this requires removing the unused/unimplemented
SkLayerDrawLooper::MyRegistrar class.  And removing that allows Clang
to realize that SkLayerDrawLooper::fTopRec is unneeded too, so remove
that too to squelch the compiler warning/error.

This doesn't change any public API.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1361323002
2015-09-24 15:04:45 -07:00
fmalita
3f9deab9fc Remove SkImage::newImage()
All clients converted to newSubset().

R=reed@google.com

Review URL: https://codereview.chromium.org/1364263002
2015-09-24 07:43:41 -07:00
herb
7f0a3d7523 Make mutex semaphore based.
This implementation improves performance of SkMutex acquire / release pair from 42ns -> 13 ns.

SkSharedMutex and SkSpinlock have the same performance.

It also removes specialized windows and linux/mac code.

BUG=skia:

Review URL: https://codereview.chromium.org/1359733002
2015-09-24 07:34:49 -07:00
reed
7b6945bc4e remove unused (by the outside) SkImage::newSurface, and simplify newImage -> newSubset
BUG=skia:

Review URL: https://codereview.chromium.org/1364443002
2015-09-24 00:50:58 -07:00
halcanary
f12a1673f0 SkPDF: add basic metadata support
Motivation: I want too finalize this API before working on the more
complex problem of adding XMP metadata for PDF/A.

BUG=skia:3110

Review URL: https://codereview.chromium.org/1359943003
2015-09-23 12:45:49 -07:00
hendrikw
6f0fdac9e7 skia: Add support for ANGLE on linux
This will allow the ANGLE guys to test the ANGLE gl backend
with nanobench and DM

Review URL: https://codereview.chromium.org/1343193005
2015-09-23 11:35:55 -07:00
bsalomon
aca31fea8c Stop supporting HW dither
Review URL: https://codereview.chromium.org/1359833004
2015-09-22 11:38:46 -07:00
mdempsky
07ed41fa40 Fix possible integer overflow in SkTSearch's midpoint calculation
Probably unlikely to matter in practice, but SkTQSort calculates its
midpoint correctly, so we might as well do it here too.  For more
background, see Joshua Bloch's "Nearly All Binary Searches and
Mergesorts are Broken" post:
http://googleresearch.blogspot.ru/2006/06/extra-extra-read-all-about-it-nearly.html

This doesn't change any public API.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1362613002
2015-09-22 10:32:02 -07:00
bsalomon
87ba62e67c Replace GrExtractAlphaFragmentProcessor with DstIn compose processor
Review URL: https://codereview.chromium.org/1347943003
2015-09-22 06:42:00 -07:00
mdempsky
106b12427e Remove SkNEW and SkDELETE macros
This CL removes the uses of SkNEW that have resprouted since commit
385fe4d, and removes the macros entirely now that Android and Chromium
have been cleaned up to no longer depend on them.

A bunch of files implicitly depend on #include <new> from SkPostConfig.h
still though, so keep that for now.  To be fixed in a followup CL.

[mtklein mucking around]
Only public API removed.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1360653004
2015-09-22 06:10:35 -07:00
mtklein
b758bbd84e Revert of Combined approach. (patchset #2 id:20001 of https://codereview.chromium.org/1356133002/ )
Reason for revert:
whee

Original issue's description:
> Combined approach.
>
> This combines some ideas from these two CLs:
>     - try stosd/w
>     - update memset16/32 inlining heuristics
>
>
> BUG=skia:4316
>
> Blinking in and out for perf.skia.org.
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/46243a7c02a1d5116e55a27ff59218f9c320df97

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

Review URL: https://codereview.chromium.org/1353703006
2015-09-21 11:02:39 -07:00
mtklein
46243a7c02 Combined approach.
This combines some ideas from these two CLs:
    - try stosd/w
    - update memset16/32 inlining heuristics

BUG=skia:4316

Blinking in and out for perf.skia.org.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1356133002
2015-09-21 10:50:56 -07:00
halcanary
0fc1dbe592 SK_API for include/gpu/gl/GrGLInterface.h
Review URL: https://codereview.chromium.org/1357823003
2015-09-21 08:22:19 -07:00
mtklein
b1cc9daa65 Revert of try simplest code: inline whenever vaguely sensible (patchset #1 id:1 of https://codereview.chromium.org/1351403005/ )
Reason for revert:
pingpong

Original issue's description:
> try simplest code: inline whenever vaguely sensible
>
> BUG=skia:4316
>
> Will land and revert.
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/527a0c8235b454f5d0475a9a3e34caa9520db3a2

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

Review URL: https://codereview.chromium.org/1355073002
2015-09-20 19:05:01 -07:00
mtklein
527a0c8235 try simplest code: inline whenever vaguely sensible
BUG=skia:4316

Will land and revert.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1351403005
2015-09-20 19:04:21 -07:00
mtklein
c566fddd37 Revert of try stosd/w (patchset #2 id:20001 of https://codereview.chromium.org/1355063002/ )
Reason for revert:
boink

Original issue's description:
> try stosd/w
>
> While we're trying things and reverting them, might as well try this too.
>
> BUG=skia:4316
>
> Blinking in and out for perf.skia.org.
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/3ca0f626a07e9b534d14a2d8213eedb93c5f7534

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

Review URL: https://codereview.chromium.org/1356983004
2015-09-20 18:06:03 -07:00
mtklein
3ca0f626a0 try stosd/w
While we're trying things and reverting them, might as well try this too.

BUG=skia:4316

Blinking in and out for perf.skia.org.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1355063002
2015-09-20 18:05:23 -07:00
mtklein
b63d816683 Revert of update memset16/32 inlining heuristics (patchset #1 id:1 of https://codereview.chromium.org/1357193002/ )
Reason for revert:
Who wants to land forever?

Original issue's description:
> update memset16/32 inlining heuristics
>
> I spent some time looking at perf.skia.org and it looks like we can do better.
>
> It is weird, weird, weird that on x86, we see three completely different behaviors:
>   - x86 Android: inlining better for small N, custom better for large N;
>   - Windows:     inlining better for large N, custom better for small N;
>   - other x86:   inlining generally better
>
> BUG=skia:4316,chromium:516426
>
> (Temporary, plan to revert.)
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/b68fa409fc00ce2f38e2a0fd6f9dc2379b372481

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

Review URL: https://codereview.chromium.org/1358793002
2015-09-20 15:02:54 -07:00
mtklein
b68fa409fc update memset16/32 inlining heuristics
I spent some time looking at perf.skia.org and it looks like we can do better.

It is weird, weird, weird that on x86, we see three completely different behaviors:
  - x86 Android: inlining better for small N, custom better for large N;
  - Windows:     inlining better for large N, custom better for small N;
  - other x86:   inlining generally better

BUG=skia:4316,chromium:516426

(Temporary, plan to revert.)
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1357193002
2015-09-20 15:02:15 -07:00
herb
966e3d30ba Add debug mode to shared mutex.
Review URL: https://codereview.chromium.org/1307863009
2015-09-18 07:00:48 -07:00
reed
4b3d3bebda use allocator (if present) when we allocate our cache bitmap
Remove some bogus tests on the cache, as they are not thread-reliable. Running w/ discardable these are racy.

BUG=532981

Review URL: https://codereview.chromium.org/1351453004
2015-09-17 13:35:19 -07:00
reed
3322a8137d share code between SkGr and Cacherator
BUG=skia:

Review URL: https://codereview.chromium.org/1351533004
2015-09-16 10:09:24 -07:00