Commit Graph

19147 Commits

Author SHA1 Message Date
halcanary
66a82f3872 SkPDF: fall back on paths for unembeddable fonts.
Add GM, SkPDFFont::CanEmbedTypeface

BUG=skia:3866

Review URL: https://codereview.chromium.org/1401763002
2015-10-12 13:05:04 -07:00
reed
88d064d0e4 add applyFilter() to SkImage
Result:
- clients can get a filtered version of an image without having to setup a temp drawing environment
- for some cases, the process is more efficient even than (deprecated) drawSprite, since there is no need to draw/copy the result

Impl:
- made Proxy virtual so we don't need to have an existing device to use it

This, in conjunction with LocalMatrixImageFilter, should allow us to simplify and optimize ApplyImageFilter() in cc/output/gl_renderer.cc

BUG=skia:

Review URL: https://codereview.chromium.org/1390913005
2015-10-12 11:30:02 -07:00
reed
f028003cf4 change more effects to only expose factories
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1395403002
2015-10-12 11:10:10 -07:00
fmalita
063675ba37 Remove SK_SUPPORT_LEGACY_GRADIENT_DITHERING from Skia proper
Migrating the flag to embedder defines (Chromium already guarded).

Also augment gradient-focused GMs to generate both dithered/undithered
results.

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

Review URL: https://codereview.chromium.org/1400813006
2015-10-12 10:41:48 -07:00
bsalomon
afa95e270c Remove image usage type enum. Use GrTextureParams instead.
BUG=skia:

Review URL: https://codereview.chromium.org/1404433002
2015-10-12 10:39:46 -07:00
msarett
04965c6f11 SkBitmapRegionDecoder clean-up
Use SkCodecPrintf instead of SkDebugf.

Check if the conversion is possible rather than starting many decodes
that will certainly fail.

Small refactor to code that deals with subsets that fall outside
of the image.

BUG=skia:

Review URL: https://codereview.chromium.org/1395383002
2015-10-12 10:24:38 -07:00
halcanary
34422610ac SkPDF: Optionally output PDF/A-2b archive format.
Note: this format does not yet pass validation tests.

Add skia_pdf_generate_pdfa GYP flag.  Default to off for now.
PDF/A files are not reproducable, so they make correctness
testing harder.

Turn the Metadata struct into te SkPDFMetadata struct.  This
splits out a lot of functionality around both kinds of metadata.

When PDF/A is used, add an ID entry to the trailer.

Add SkPDFObjNumMap::addObjectRecursively.

Test with

    GYP_DEFINES=skia_pdf_generate_pdfa=1 bin/sync-and-gyp
    ninja -C out/Release dm
    out/Release/dm --config pdf --src skp gm -w /tmp/dm

With skia_pdf_generate_pdfa=0, all PDFs generated from GMs and
SKPs are identical.  With skia_pdf_generate_pdfa=1, all PDFs
generated from GMs and SKPs render identically in Pdfium.

BUG=skia:3110

Review URL: https://codereview.chromium.org/1394263003
2015-10-12 10:11:18 -07:00
msarett
14bbe1dcd5 Enable more testing for scaled webps
BUG=skia:

Review URL: https://codereview.chromium.org/1401093002
2015-10-12 08:14:40 -07:00
update-skps
205f1ac915 Update SKP version
Automatic commit by the RecreateSKPs bot.

TBR=
NO_MERGE_BUILDS

Review URL: https://codereview.chromium.org/1401013002
2015-10-11 00:20:57 -07:00
fmalita
b0b45d35e4 [TextBlob] Fall back to TightRunBounds when the font bounds are empty
Empty font bounds are likely an indication of a font bug.  As a best
effort, we can use TightRunBounds in this easily detectable case.

Since TightRunBounds only supports kDefault_Positioning currently, the
CL also reinstates handling of kFull_Positioning and
kHorizontal_Positioning (removed in http://crrev.com/858153007).

BUG=507022
R=reed@google.com,bungeman@google.com

Review URL: https://codereview.chromium.org/1399123002
2015-10-09 14:46:28 -07:00
Brian Salomon
8b3eca95ae Fix SkWindow.cpp includes for non-gpu mode
TBR=bungeman@google.com

Review URL: https://codereview.chromium.org/1400933002 .
2015-10-09 16:54:48 -04:00
bungeman
21f99b7733 Revert of SkPDF: Optionally output PDF/A-2b archive format. (patchset #5 id:80001 of https://codereview.chromium.org/1394263003/ )
Reason for revert:
SkMD5 is not really part of the Skia library. This is breaking the roll by using it, since Chromium doesn't build it.

Original issue's description:
> SkPDF: Optionally output PDF/A-2b  archive format.
>
> Note: this format does not yet pass validation tests.
>
> Add skia_pdf_generate_pdfa GYP flag.  Default to off for now.
> PDF/A files are not reproducable, so they make correctness
> testing harder.
>
> Turn the Metadata struct into te SkPDFMetadata struct.  This
> splits out a lot of functionality around both kinds of metadata.
>
> When PDF/A is used, add an ID entry to the trailer.
>
> Add SkPDFObjNumMap::addObjectRecursively.
>
> Test with
>
>     GYP_DEFINES=skia_pdf_generate_pdfa=1 bin/sync-and-gyp
>     ninja -C out/Release dm
>     out/Release/dm --config pdf --src skp gm -w /tmp/dm
>
> With skia_pdf_generate_pdfa=0, all PDFs generated from GMs and
> SKPs are identical.  With skia_pdf_generate_pdfa=1, all PDFs
> generated from GMs and SKPs render identically in Pdfium.
>
> BUG=skia:3110
>
> Committed: https://skia.googlesource.com/skia/+/939c0fe51f157104758bcb268643c8b6d317a530

TBR=tomhudson@google.com,halcanary@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:3110

Review URL: https://codereview.chromium.org/1398193002
2015-10-09 13:45:50 -07:00
bsalomon
f276ac5c16 Move functions from SkGr to SkGrPriv.h
Review URL: https://codereview.chromium.org/1397123002
2015-10-09 13:36:42 -07:00
jvanverth
cda8ec2b03 Add test with GLFW framework
BUG=skia:

Review URL: https://codereview.chromium.org/1367403006
2015-10-09 13:27:34 -07:00
halcanary
939c0fe51f SkPDF: Optionally output PDF/A-2b archive format.
Note: this format does not yet pass validation tests.

Add skia_pdf_generate_pdfa GYP flag.  Default to off for now.
PDF/A files are not reproducable, so they make correctness
testing harder.

Turn the Metadata struct into te SkPDFMetadata struct.  This
splits out a lot of functionality around both kinds of metadata.

When PDF/A is used, add an ID entry to the trailer.

Add SkPDFObjNumMap::addObjectRecursively.

Test with

    GYP_DEFINES=skia_pdf_generate_pdfa=1 bin/sync-and-gyp
    ninja -C out/Release dm
    out/Release/dm --config pdf --src skp gm -w /tmp/dm

With skia_pdf_generate_pdfa=0, all PDFs generated from GMs and
SKPs are identical.  With skia_pdf_generate_pdfa=1, all PDFs
generated from GMs and SKPs render identically in Pdfium.

BUG=skia:3110

Review URL: https://codereview.chromium.org/1394263003
2015-10-09 13:09:58 -07:00
scroggo
e361781bf7 Fix codec memory leaks in nanobench
SubsetTranslateBench.cpp:
Unref the color table, so it gets deleted.

SkBitmapRegionDecoderInterface.cpp:
Delete the stream if it is not used.

BUG=skia:3418

Review URL: https://codereview.chromium.org/1396113003
2015-10-09 12:15:57 -07:00
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