Commit Graph

19131 Commits

Author SHA1 Message Date
msarett
e6dd004c1b Fill incomplete images in SkCodec parent class
Rather than implementing some sort of "fill" in every
SkCodec subclass for incomplete images, let's make the
parent class handle this situation.

This includes an API change to SkCodec.h

SkCodec::getScanlines() now returns the number of lines it
read successfully, rather than an SkCodec::Result enum.
getScanlines() most often fails on an incomplete input, in
which case it is useful to know how many lines were
successfully decoded - this provides more information than
kIncomplete vs kSuccess.  We do lose information when the
API is used improperly, as we are no longer able to return
kInvalidParameter or kScanlineNotStarted.

Known Issues:
Does not work for incomplete fFrameIsSubset gifs.
Does not work for incomplete icos.

BUG=skia:

Review URL: https://codereview.chromium.org/1332053002
2015-10-09 11:07:34 -07:00
egdaniel
79da63fa0b Fix gpu drawBitmap to work when BM is A8 and we have a shader
BUG=skia:

Review URL: https://codereview.chromium.org/1399763002
2015-10-09 10:55:16 -07:00
fmalita
37d8688927 Optional gradient dithering
Update raster gradient impls to observe the paint dithering flag.

For now this new behavior is disabled pending internal/external
client updates to mitigate diffs.

BUG=skia:4436
R=reed@google.com,mtklein@google.com,tomhudson@google.com

Review URL: https://codereview.chromium.org/1391303002
2015-10-09 10:22:46 -07:00
scroggo
2c3b218f74 Focus SkScaledCodec on BitmapRegionDecoder
The primary goal of SkScaledCodec is to replace the current
implementation of BitmapRegionDecoder, which depends on modified
versions of libjpeg and libpng, with an implementation that uses
standard versions of the libaries. Since BitmapRegionDecoder only
supports PNG, WEBP and JPEG, limit SkScaledCodec to those classes.
We will focus on those three until we complete this primary goal.
Then we can continue to make SkScaledCodec work for other formats.

Fix some bugs in SkScaledCodec::NewFromStream:
- Handle a NULL input stream properly
- Ensure that the input stream is deleted as expected on bad data

Add tests for these error cases.

BUG=skia:4428

Review URL: https://codereview.chromium.org/1389053002
2015-10-09 08:40:59 -07:00
scroggo
0a3cac8a90 Reland of Pass --images '' to nanobench to disable image benchmarking. (patchset #1 id:1 of https://codereview.chromium.org/1400633002/ )
Reason for revert:
Still breaking. e.g.

http://build.chromium.org/p/client.skia/builders/Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug/builds/1466/steps/nanobench/logs/stdio

http://build.chromium.org/p/client.skia.android/builders/Perf-Android-GCC-Nexus7-GPU-Tegra3-Arm7-Release/builds/2280/steps/nanobench/logs/stdio

Original issue's description:
> Revert of Pass --images '' to nanobench to disable image benchmarking. (patchset #1 id:1 of https://codereview.chromium.org/1381703003/ )
>
> Reason for revert:
> I have attempted to fix the problems that caused running nanobench with images to fail, so testing to see if they are in fact fixed.
>
> Original issue's description:
> > Pass --images '' to nanobench to disable image benchmarking.
> >
> > Enabling image benchmarking has caused most nanobench runs to fail,
> > both Debug and Release.
> >
> > BUG=skia:3418
> > NOTREECHECKS=true
> > TBR=scroggo@google.com
> >
> > Committed: https://skia.googlesource.com/skia/+/1f7039c6c5f0f118b629994b0bac255345e5abd6
>
> BUG=skia:3418
>
> Committed: https://skia.googlesource.com/skia/+/c2e59caa0a466040f4b4f08cb5604c86b2615efa

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

Review URL: https://codereview.chromium.org/1396843003
2015-10-08 14:44:51 -07:00
scroggo
c2e59caa0a Revert of Pass --images '' to nanobench to disable image benchmarking. (patchset #1 id:1 of https://codereview.chromium.org/1381703003/ )
Reason for revert:
I have attempted to fix the problems that caused running nanobench with images to fail, so testing to see if they are in fact fixed.

Original issue's description:
> Pass --images '' to nanobench to disable image benchmarking.
>
> Enabling image benchmarking has caused most nanobench runs to fail,
> both Debug and Release.
>
> BUG=skia:3418
> NOTREECHECKS=true
> TBR=scroggo@google.com
>
> Committed: https://skia.googlesource.com/skia/+/1f7039c6c5f0f118b629994b0bac255345e5abd6

BUG=skia:3418

Review URL: https://codereview.chromium.org/1400633002
2015-10-08 14:09:41 -07:00
scroggo
ab12c27158 Update Subset benches to support interlacing and fix bugs
Instead of decoding one line at a time, if the ScanlineOrder is kNone,
decode all of the lines in one pass, and then copy the subset into the
output. This will allow us to more realistically test subset decodes
for interlaced png. It also makes running them not take forever.

Do *not* support other modes (besides kTopDown), since they are not
used by the big three we need to replace BitmapRegionDecoder
implementation (skbug.com/4428).

Fix a bug in SubsetTranslateBench and SubsetZoomBench:
When we decode another subset, we need to reset the scanline decode
first. This bug appears to have been present since the introduction of
these tests in crrev.com/1160953002

BUG=skia:4205
BUG=skia:3418

Review URL: https://codereview.chromium.org/1387233002
2015-10-08 12:01:39 -07:00
reed
33366974d4 remove internalDrawBitmap, as it is no longer shared with any other caller, and can be folded into onDrawBitmap
BUG=skia:

Review URL: https://codereview.chromium.org/1391333004
2015-10-08 09:22:02 -07:00
cdalton
8585dd26bf Updates nvpr text blobs to not store a direct reference to the
per-glyph GPU path object, but rather store a key for looking it up in
the resource cache. This allows the cache to purge glyphs when needed.
Also indirectly fixes a memory leak that was introduced with nvpr text
blobs.

BUG=skia:

Review URL: https://codereview.chromium.org/1374853004
2015-10-08 08:04:09 -07:00
mtklein
bf90520f63 SkPath::fFirstDirection: seq-cst -> relaxed
We landed this originally with lazily-correct sequentially-consistent memory
order.  It turns out that's regressed performance, we think particularly when
recording paths.  We also think there's no need for anything but relaxed memory
order here.

We should see this chart go down if all goes well: https://perf.skia.org/#4329
There are also Chrome performance charts to watch in the linked bug.

BUG=chromium:537700

CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-TSAN-Trybot,Test-Ubuntu-GCC-Golo-GPU-GT610-x86_64-Release-TSAN

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

Review URL: https://codereview.chromium.org/1393833003
2015-10-07 12:46:43 -07:00
mtklein
ab8296b48a Automatically add TSAN bots to the CQ for changes affecting SkAtomics.h
BUG=skia:

Review URL: https://codereview.chromium.org/1396523002
2015-10-07 11:49:00 -07:00
jvanverth
9011bcf36e Add DrawShipSim sample.
Adds a version of the DrawShip sample that uses drawRect with a bitmap.
For testing batching.

BUG=skia:

Review URL: https://codereview.chromium.org/1395533002
2015-10-07 10:43:05 -07:00
bsalomon
c988d2c1c8 Remove ClipMaskType from GrCMM
Review URL: https://codereview.chromium.org/1391653002
2015-10-07 09:30:05 -07:00
bsalomon
0ba8c2401e Insert clip fragment processor outside GrCMM
Review URL: https://codereview.chromium.org/1393553002
2015-10-07 09:20:28 -07:00
reed
5ea95df02d Revert "Revert of factories should return baseclass, allowing the impl to specialize (patchset #4 id:60001 of https://codereview.chromium.org/1390523005/ )"
This reverts commit 95376a0dde.

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1389083002
2015-10-06 14:05:32 -07:00
schenney
95376a0dde Revert of factories should return baseclass, allowing the impl to specialize (patchset #4 id:60001 of https://codereview.chromium.org/1390523005/ )
Reason for revert:
Breaks Chrome with this link error: ../../third_party/skia/include/effects/SkMorphologyImageFilter.h:75: error: undefined reference to 'SkMorphologyImageFilter::SkMorphologyImageFilter(int, int, SkImageFilter*, SkImageFilter::CropRect const*)'
../../third_party/skia/include/effects/SkMorphologyImageFilter.h:104: error: undefined reference to 'SkMorphologyImageFilter::SkMorphologyImageFilter(int, int, SkImageFilter*, SkImageFilter::CropRect const*)'

Presumably due to code in third_party/WebKit/Source/platform/graphics/filters/FEMorphology.cpp that contains:
#include "SkMorphologyImageFilter.h"

...

    if (m_type == FEMORPHOLOGY_OPERATOR_DILATE)
        return adoptRef(SkDilateImageFilter::Create(radiusX, radiusY, input.get(), &rect));
    return adoptRef(SkErodeImageFilter::Create(radiusX, radiusY, input.get(), &rect));

Original issue's description:
> factories should return baseclass, allowing the impl to specialize
>
> waiting on https://codereview.chromium.org/1386163002/# to land
>
> BUG=skia:4424
>
> Committed: https://skia.googlesource.com/skia/+/80a6dcaa1b757826ed7414f64b035d512d9ccbf8

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

Review URL: https://codereview.chromium.org/1389063002
2015-10-06 12:59:55 -07:00
egdaniel
ccb88bcab0 Blacklisting imagefilterscropexpand on s4 since it often causes the bot to hang and crash.
BUG=skia:4079

Review URL: https://codereview.chromium.org/1373763005
2015-10-06 11:20:09 -07:00
reed
80a6dcaa1b factories should return baseclass, allowing the impl to specialize
waiting on https://codereview.chromium.org/1386163002/# to land

BUG=skia:4424

Review URL: https://codereview.chromium.org/1390523005
2015-10-06 11:12:23 -07:00
scroggo
85f0d5d6e6 Allow SkIcoCodec to fail due to conversion
Even if the client chooses dimensions that were suggested by
SkIcoCodec, it is possible for the color conversion to be incorrect,
so it can still reach the exit case of kInvalidConversion.

For example, when running nanobench, we attempt to decode the image
to Alpha_8, which the codec does not support. This allows running
nanobench in debug mode without asserting.

BUG=skia:3418

Review URL: https://codereview.chromium.org/1389943002
2015-10-06 10:47:52 -07:00
halcanary
8b2bc252fa SkPDF: when drawing stroked path, draw using SVG rules for zero-length segments
The "zeroPath" and emptystroke GMs capture this issue.

This CL changes the following PDF GMs: emptystroke dashing4
lineclosepath dashing3 zeroPath linepath
complexclip3_complex complexclip3_simple roundrects
degeneratesegments filltypes strokerect pathfill
inverse_paths desk_chalkboard.skp

After this change, all PDF GMs look better (closer to 8888).
The dashing4, emptystroke, and zeroPath GMs still need a lot
of work to make them look right.

BUG=538726

Review URL: https://codereview.chromium.org/1374383004
2015-10-06 09:41:47 -07:00
bsalomon
4a33952961 Bye bye processor data manager.
Review URL: https://codereview.chromium.org/1388113002
2015-10-06 08:40:51 -07:00
joshualitt
e1f8296999 Fix for visualbench loops forever
TBR=robertphillips@google.com
BUG=skia:

Review URL: https://codereview.chromium.org/1387823004
2015-10-06 08:25:15 -07:00
joshualitt
5a74afebb7 nvpr removal from VisualBench base context
TBR=bsalomon@google.com
BUG=skia:

Review URL: https://codereview.chromium.org/1391633002
2015-10-06 08:05:10 -07:00
msarett
4aa02d8e73 Fix SkGifCodec to handle gifs where frameSize != imageSize
These are quite rare, causing us to miss a few bugs in how
we deal with these images.

Additionally, there is a behavior change.  If the imageSize
is not large enough to contain the frame, we will "fix" the
image by increasing the image size.

SkScaledCodec is still buggy with regard to these gifs.
See skbug.com/4421. We will fix that after 1332053002
lands.

BUG=skia:

Review URL: https://codereview.chromium.org/1386973002
2015-10-06 07:46:03 -07:00
herb
39e2e75f73 Remove duplicate .cpp which should have been a .h
Review URL: https://codereview.chromium.org/1389923002
2015-10-06 07:42:53 -07:00
robertphillips
2d70dcbe5c Dynamically allocate the GrDrawContexts
This CL moves the allocation and storage of the GrTextContexts into the DrawingManager. The GrDrawContexts now just get their GrTextContext from the DrawingManager.

Review URL: https://codereview.chromium.org/1375153007
2015-10-06 07:38:23 -07:00
fmalita
b0cd8b7146 [SkDebugger] Handle path empty-bounds gracefully
Paths with empty bounds crash the debugger: mapping their bounds onto
the shapshot area gets the canvas into an unhappy state.

R=robertphillips@google.com

Review URL: https://codereview.chromium.org/1387173003
2015-10-06 07:24:03 -07:00
mtklein
8d57faf318 Revert of Stop using SkScalerContext::getAdvance() in SkGlyphCache. (patchset #2 id:20001 of https://codereview.chromium.org/1321243004/ )
Reason for revert:
Suspect this is the cause of regressions in crbug.com/527445.  It's triggering on Windows and Linux, where getting advances does less than getting full metrics.  It's not triggering on Mac, where this CL was a no-op.

Original issue's description:
> Stop using SkScalerContext::getAdvance() in SkGlyphCache.
>
> We think it'll simplify things to just always get the full metrics.
> On most platforms, it's no different, and we think the platforms that
> do differ (FreeType) will be nearly just as cheap.
>
> Removing this distinction helps us make SkGlyphCaches concurrent by
> removing a state (we-have-only-advances) from its logical state machine.
>
> We see no significant changes running SKPs before and after this CL.
> That makes sense, of course, because the SKPs bake some of this into drawPosText.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/518a2923f11b819fa44ed5cff54155326959540f

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

Review URL: https://codereview.chromium.org/1383403003
2015-10-06 07:00:45 -07:00
cdalton
d1201058bf Make path range loading explicit
Requires the caller to explicitly preload paths within a range before
calling drawPaths. This allows us to remove the implicit lazy load,
thereby eliminating a redundant check on every redraw of a text blob.

BUG=skia:

Review URL: https://codereview.chromium.org/1382013002
2015-10-05 15:56:34 -07:00
cdalton
cdd7907a3d Implement cached nvpr text blobs
BUG=skia:

Review URL: https://codereview.chromium.org/1381073002
2015-10-05 15:37:35 -07:00
cdalton
02015e51d9 Use SkTextBlob for nvpr color bitmap fallbacks
BUG=skia:

Review URL: https://codereview.chromium.org/1381873003
2015-10-05 15:28:21 -07:00
cdalton
3bd909a44c Add TextRun object to nvpr text
Adds a TextRun object that defines a resolution-independent, paint-
indepent draw for a string of nvpr text.

BUG=skia:

Review URL: https://codereview.chromium.org/1375353004
2015-10-05 14:57:20 -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
joshualitt
cb54e8ed45 Cleanup timing state machine
BUG=skia:

Review URL: https://codereview.chromium.org/1386933002
2015-10-05 13:58:26 -07:00
herb
1562855b19 Add more .h files to the .gypi
BUG=skia:

Review URL: https://codereview.chromium.org/1386963002
2015-10-05 13:28:59 -07:00
joshualitt
dc5db59514 move visual bench interactive module to timing state machine
BUG=skia:

Review URL: https://codereview.chromium.org/1382883003
2015-10-05 13:24:55 -07:00
fmalita
92d976c3ad Validate text blob runs after SkTextBlob construction.
This avoids tripping CFI when casting uninitialized SkTextBlob ptrs.

BUG=chromium:538754
R=bungeman@google.com,reed@google.com,krasin@google.com

Review URL: https://codereview.chromium.org/1388543005
2015-10-05 11:09:58 -07:00
jvanverth
2f5bb3abfa Add ship sample
BUG=skia:

Review URL: https://codereview.chromium.org/1359033005
2015-10-05 11:05:07 -07:00
scroggo
303fa35012 Specify bench_type & source_type for image benches
This will allow us to use perf filtering for comparing SkImageDecoder
to SkCodec.

BUG=skia:3418

Review URL: https://codereview.chromium.org/1387863002
2015-10-05 11:03:34 -07:00
mtklein
1f7039c6c5 Pass --images '' to nanobench to disable image benchmarking.
Enabling image benchmarking has caused most nanobench runs to fail,
both Debug and Release.

BUG=skia:3418
NOTREECHECKS=true
TBR=scroggo@google.com

Review URL: https://codereview.chromium.org/1381703003
2015-10-05 10:24:59 -07:00
egdaniel
c00389e45a Fix gpu dashing for case where all intervals are 0.
BUG=skia:4409

Review URL: https://codereview.chromium.org/1381803005
2015-10-05 08:11:49 -07:00
mtklein
6f6264fbbc Force cache SkTestScalerContext path bounds.
Looks like a race on this:

http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-ASAN/builds/2608/steps/dm/logs/stdio

BUG=skia:

Review URL: https://codereview.chromium.org/1373363007
2015-10-05 07:29:22 -07:00
joshualitt
98d2e2f095 Factor out VisualBench timing code into a helper class
BUG=skia:

Review URL: https://codereview.chromium.org/1375363003
2015-10-05 07:23:30 -07:00
robertphillips
d8982d7e92 Revert of Have GrRectBlurEffect use Linear filtering (rather than Nearest Neighbor) (patchset #2 id:20001 of https://codereview.chromium.org/1378023004/ )
Reason for revert:
Trial run confirmed layout test expectations - will reland after suppressions

Original issue's description:
> Have GrRectBlurEffect use Linear filtering (rather than Nearest Neighbor)
>
> Committed: https://skia.googlesource.com/skia/+/2d70bcccc9ba8f3898a7ae506ba7410ed8e9c9db
>
> Committed: https://skia.googlesource.com/skia/+/5175b9563055926b4969d57f06e4ae49b86e055b

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

Review URL: https://codereview.chromium.org/1378813004
2015-10-04 12:21:33 -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
robertphillips
588b9cab10 Fix memory leak in ClipMaskManager
TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1385823002
2015-10-04 08:40:31 -07:00
robertphillips
5175b95630 Have GrRectBlurEffect use Linear filtering (rather than Nearest Neighbor)
Committed: https://skia.googlesource.com/skia/+/2d70bcccc9ba8f3898a7ae506ba7410ed8e9c9db

Review URL: https://codereview.chromium.org/1378023004
2015-10-04 08:36:51 -07:00
update-skps
1f7e7ec195 Update SKP version
Automatic commit by the RecreateSKPs bot.

TBR=
NO_MERGE_BUILDS

Review URL: https://codereview.chromium.org/1390433002
2015-10-04 00:22:10 -07:00
cdalton
7d5c950e85 Simplify nvpr text
- Drops device-space glyphs in favor of perf/simplicity.

- Removes residual complexities that would flip glyphs vertically for
  compatibility with nvpr glyph loading, which is no longer used.

- Drops hairline support since they required new paths for every draw
  matrix, and could only be supported under certain circumstances.

- Quits checking for color bitmap fonts in canDrawText since the
  normal color emoji fallback will handle them anyway.

BUG=skia:

Review URL: https://codereview.chromium.org/1380973002
2015-10-03 13:28:35 -07:00
msarett
19ae315dd0 Stop calling jpeg_finish_decompress()
jpeg_finish_decompress() does several things:
(1) Reads to the end of the image stream.
(2) Calls term_src(), a client provided function that
indicates we are done with the memory stream.  Our current
implementation of term_src() does nothing.
(3) Calls jpeg_abort() which aborts the decode and cleans
up some memory.

I don't think we need to call this anymore.

(1) seems irrelevant.

It seems a little dangerous to get rid of (2), but it is
fine while our implementation of term_src() does nothing.

(3) We will call jpeg_destroy() on destruction of the
JpegDecoderManager.  This should free all the memory,
making it unnecessary to call jpeg_abort() beforehand.

BUG=skia:4040

Review URL: https://codereview.chromium.org/1370323004
2015-10-02 13:44:13 -07:00