Commit Graph

2920 Commits

Author SHA1 Message Date
bungeman
a3434d83cf Add skstd::unique_ptr and use it.
TBR=bsalomon@google.com
The one gpu include change is just to fix swap in implementation.

Review URL: https://codereview.chromium.org/1330503006
2015-09-07 12:45:52 -07:00
msarett
10522ff4cf Scanline decoding for gifs
BUG=skia:

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

Review URL: https://codereview.chromium.org/1305123002
2015-09-07 08:54:01 -07:00
jcgregorio
e3330cf2cf Revert of Scanline decoding for gifs (patchset #15 id:380001 of https://codereview.chromium.org/1305123002/ )
Reason for revert:
Breaks the build with SkScanlineDecoder.h not found:

http://build.chromium.org/p/client.skia/builders/Linux%20Builder/builds/3722/steps/compile/logs/stdio

../../third_party/skia/src/utils/SkBitmapRegionCanvas.h:10:10: fatal error: 'SkScanlineDecoder.h' file not found
#include "SkScanlineDecoder.h"

Original issue's description:
> Scanline decoding for gifs
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/e9c10b9121887e8c300bd41357461418e061984d

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

Review URL: https://codereview.chromium.org/1320273004
2015-09-05 10:16:28 -07:00
msarett
e9c10b9121 Scanline decoding for gifs
BUG=skia:

Review URL: https://codereview.chromium.org/1305123002
2015-09-04 13:28:26 -07:00
fmalita
c3470340b6 Handle zero-length encoded images gracefully during deserialization
Image encoding may fail during serialization, resulting in zero-length
encoded data in the SKP.

Instead of invalidating the stream (and preventing deserialization of
the whole picture) we can instantiate placeholder images.

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

Review URL: https://codereview.chromium.org/1308273011
2015-09-04 11:36:39 -07:00
mtklein
714a710c42 SkOncePtr
New abstraction to replace all of: SkOnce, SkLazyPtr, SkLazyFnPtr.

BUG=skia:

Review URL: https://codereview.chromium.org/1301323006
2015-09-04 10:26:27 -07:00
caryclark
6ff734b311 remove unused fields from SkOpSegment
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1322413002
2015-09-04 05:00:15 -07:00
fmalita
2be7125f32 Add a SkPixelSerializer SkImage encode variant
R=reed@google.com
BUG=skia:4285

Review URL: https://codereview.chromium.org/1310633006
2015-09-03 07:17:25 -07:00
halcanary
219f18f30d C API: Add SK_API, also documentation of an example.
SK_API = __declspec(dllexport) / __attribute__((visibility("default")))

Also, add documentation in experimental/c-api-example/c.md

Review URL: https://codereview.chromium.org/1307183006
2015-09-01 10:01:38 -07:00
joshualitt
6335a72976 Move PathRenderers to batches folder
BUG=skia:

Review URL: https://codereview.chromium.org/1306143005
2015-09-01 06:50:55 -07:00
mtklein
a508f3c62d Require Sk4f::toBytes() clamps
BUG=skia:4117

CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot;client.skia.android:Test-Android-GCC-Nexus9-CPU-Denver-Arm64-Release-Trybot

Review URL: https://codereview.chromium.org/1312053004
2015-09-01 06:29:45 -07:00
caryclark
580c40ae71 link test to bug
crbug.com/526025 includes a minimized SVG test case.
Translating that test case into native code (fuzzTNG)
did not reproduce the bug. That test case should
have not been included with skia issue 1323813003,
and is deleted here.

Running the minimal test case in a modified version
of chrome isolated the bug. The modified version
generated the test fuzz763_3 with the edit

#define DEBUGGING_PATHOPS_FROM_HOST 1

in src/pathops/SkPathopsOp.cpp line 188.

Rename fuzz763_3 to issue_526025 to associate the test
with the bug. Note that the bug contains the body of the
CL in comment $5.

R=reed@google.com

Review URL: https://codereview.chromium.org/1315503005
2015-09-01 06:22:36 -07:00
mtklein
dde03ff89f Clean up remaining users of SkPMFloat
This switches over SkXfermodes_opts.h and SkColorMatrixFilter to use Sk4f,
and converts the SkPMFloat benches to Sk4f benches.

No pixels should change here, and no code beyond the Sk4f_ benches should change speed.
The benches are faster than the old versions.

BUG=skia:4117

Review URL: https://codereview.chromium.org/1324743002
2015-08-31 15:26:08 -07:00
reed
99138876a6 simplify bitmap scaler and cache
BUG=skia:

Review URL: https://codereview.chromium.org/1320513005
2015-08-31 15:16:17 -07:00
caryclark
ae576b733d remove duplicate linked list adjustment
The list of intersection points on a curve segment may have
entries that can be safely removed when nearby points have
nearly the same t value and point value. When a path includes
very large curves as well as small ones, as is the case with
this fuzzer, additional points may lie between the similar
points that do not meet the nearby criteria.

After merging the nearby point with its doppelganger,
SkOpSegment::moveNearby() unnecessarily set the doppelganger's
next pointer to the one following the nearby point. While
this usually has no effect, since the merge already updated
the linked list, the explicit call removes the additional
outlier points from the segment.

TBR=reed@google.com
BUG=526025

Review URL: https://codereview.chromium.org/1323813003
2015-08-31 09:46:20 -07:00
caryclark
5ef194c31a Suppress embedding fonts when the skp's fonts match the OS fonts.
The million SKPs generated require >5T of storage. A good deal
of that are copies of system fonts.

Chrome built with
#DEFINE SK_WHITELIST_SERIALIZED_TYPEFACES
will omit the font data if the font matches a precomputed
checksum.

The captured SKP prepends sk_ to the names of fonts that
have their data omitted. The SKP consumer can either add
renamed fonts from the recording machine, or add

gDeserializeTypefaceDelegate = WhitelistDeserializeTypeface;

which strips the sk_ prefix when deserializing typefaces.

whitelist_typefaces --check
Computes the checksums of fallback
fonts and returns 0 if the checksums match the checked-in
file SkWhitelistChecksum.cpp.

whitelist_typefaces --generate
Writes an updated version of SkWhitelistChecksum.cpp.

(Added Mike since this modifies a public header)

R=bungeman@google.com,rmistry@google.com,reed@google.com

Review URL: https://codereview.chromium.org/1317913005
2015-08-31 09:22:38 -07:00
msarett
5406d6f39a Scanline decoding for bmp
Redesigns SkScanlineDecoder.h to indicate the ordering
in which the scanlines are provided

Refactors SkSwizzler::Fill() to include the zeroInit check
and to actually be correct.

BUG=skia:3257
BUG=skia:4198

Review URL: https://codereview.chromium.org/1287423002
2015-08-31 06:55:13 -07:00
bsalomon
c21b09eec9 Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor*
Committed: https://skia.googlesource.com/skia/+/ecfdc251be71f3d634e76afdd6375bf55fc061aa

Review URL: https://codereview.chromium.org/1316513002
2015-08-28 18:46:56 -07:00
rmistry
a511e6ad10 Revert of Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor* (patchset #8 id:140001 of https://codereview.chromium.org/1316513002/ )
Reason for revert:
Primary suspect in failing DEPS rolls:
* https://codereview.chromium.org/1315753006
* https://codereview.chromium.org/1308323006
* https://codereview.chromium.org/1320903004

Primary suspect because the failing win bots did not fail in https://codereview.chromium.org/1315753005

Original issue's description:
> Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor*
>
> Committed: https://skia.googlesource.com/skia/+/ecfdc251be71f3d634e76afdd6375bf55fc061aa

TBR=joshualitt@google.com,wangyix@google.com,robertphillips@google.com,bsalomon@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1313573005
2015-08-28 17:16:50 -07:00
bsalomon
ecfdc251be Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor*
Review URL: https://codereview.chromium.org/1316513002
2015-08-28 14:33:47 -07:00
mdempsky
38f1f6f9e5 Remove overly complicated GR_CREATE_STATIC_PROCESSOR macro
This macro was responsible for producing code like:

    static SkAlignedStorage<sizeof(Foo)> g_gFoo_Storage;
    static Foo* gFoo = new(g_gFoo_Storage.get()) Foo;
    static SkAutoTDestroy<Foo> gFoo_ad(gFoo);

which would allocate static storage for an object of type Foo
(g_gFoo_Storage), lazily instantiate the object in that memory (via
gFoo's initializer), and then ensure that at global destruction time
the object is destroyed (via gFoo_Ad's destructor).

However, the exact same effect is achieved by just writing:

    static Foo gFoo;

Review URL: https://codereview.chromium.org/1314763009
2015-08-27 12:57:01 -07:00
hendrikw
885bf09255 skia: add ability to load command_buffer_gles2
BUG=skia:

Review URL: https://codereview.chromium.org/1306823003
2015-08-27 10:38:39 -07:00
halcanary
96fcdcc219 Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002

Review URL: https://codereview.chromium.org/1316233002
2015-08-27 07:41:16 -07:00
bsalomon
ac856c97ac Remove GrStagedProcessor, remove the word Stage as it applies to FPs
Committed: https://skia.googlesource.com/skia/+/24243446cdf7b7e4e132c2a0c387c7723777e0c7

Review URL: https://codereview.chromium.org/1307223004
2015-08-27 06:30:17 -07:00
halcanary
385fe4d4b6 Style Change: SkNEW->new; SkDELETE->delete
DOCS_PREVIEW= https://skia.org/?cl=1316123003

Review URL: https://codereview.chromium.org/1316123003
2015-08-26 13:07:49 -07:00
mtklein
a16af21b17 Have SkPicture::willPlayBackBitmaps() count SkImages too.
New unit test fails at head but passes with this patch.

BUG=skia:4225

Review URL: https://codereview.chromium.org/1319723002
2015-08-26 08:14:52 -07:00
rmistry
4bf69f7bbc Revert of Remove GrStagedProcessor, remove the word Stage as it applies to FPs (patchset #6 id:90001 of https://codereview.chromium.org/1307223004/ )
Reason for revert:
Causes bot failures:

https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Mac10.9-Clang-MacMini6.2-GPU-HD4000-x86_64-Debug/builds/1639

https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-ShuttleA-GPU-GTX660-x86_64-Debug/builds/1702

https://uberchromegw.corp.google.com/i/client.skia.android/builders/Test-Android-GCC-NexusPlayer-GPU-PowerVR-x86-Debug/builds/1223

Original issue's description:
> Remove GrStagedProcessor, remove the word Stage as it applies to FPs
>
> Committed: https://skia.googlesource.com/skia/+/24243446cdf7b7e4e132c2a0c387c7723777e0c7

TBR=joshualitt@google.com,egdaniel@google.com,bsalomon@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1306803003
2015-08-26 06:48:27 -07:00
bsalomon
24243446cd Remove GrStagedProcessor, remove the word Stage as it applies to FPs
Review URL: https://codereview.chromium.org/1307223004
2015-08-26 05:39:18 -07:00
bungeman
60e0fee6d4 Remove include of stdlib.h from SkTypes.h.
Unfortunately, immintrin.h (which is also included by SkTypes)
includes xmmintrin.h which includes mm_malloc.h which includes
stdlib.h for malloc even though, from the implementation, it is
difficult to see why.

Fortunately, arm_neon.h does not seem to be involved in such
shenanigans, so building for Android will keep things sane.

TBR=reed@google.com
Doesn't change Skia API, just moves an include.

Review URL: https://codereview.chromium.org/1313203003
2015-08-26 05:15:46 -07:00
caryclark
45398dff71 Reland of ix zero-length tangent (patchset #1 id:1 of https://codereview.chromium.org/1312243002/ )
Reason for revert:
Layout suppression has landed, and verified that Skia gm test changes are correct.

Original issue's description:
> Revert of fix zero-length tangent (patchset #2 id:20001 of https://codereview.chromium.org/1311273002/ )
>
> Reason for revert:
> causes layout test to draw differently -- new drawing is more correct. Reverting until layout test ignore is landed.
>
> Original issue's description:
> > fix zero-length tangent
> >
> > If the end point and the control point are the same, computing
> > the tangent will result in (0, 0). In this case, use the prior
> > control point instead.
> >
> > R=reed@google.com
> >
> > BUG=skia:4191
> >
> > Committed: https://skia.googlesource.com/skia/+/7544124fb8ee744f68f549a353f8a9163cd7432d
>
> TBR=reed@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:4191
>
> Committed: https://skia.googlesource.com/skia/+/91298b47c547b2ab4697038c04685af957bd1416

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

Review URL: https://codereview.chromium.org/1320473002
2015-08-25 13:19:06 -07:00
caryclark
91298b47c5 Revert of fix zero-length tangent (patchset #2 id:20001 of https://codereview.chromium.org/1311273002/ )
Reason for revert:
causes layout test to draw differently -- new drawing is more correct. Reverting until layout test ignore is landed.

Original issue's description:
> fix zero-length tangent
>
> If the end point and the control point are the same, computing
> the tangent will result in (0, 0). In this case, use the prior
> control point instead.
>
> R=reed@google.com
>
> BUG=skia:4191
>
> Committed: https://skia.googlesource.com/skia/+/7544124fb8ee744f68f549a353f8a9163cd7432d

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

Review URL: https://codereview.chromium.org/1312243002
2015-08-25 10:02:46 -07:00
caryclark
7544124fb8 fix zero-length tangent
If the end point and the control point are the same, computing
the tangent will result in (0, 0). In this case, use the prior
control point instead.

R=reed@google.com

BUG=skia:4191

Review URL: https://codereview.chromium.org/1311273002
2015-08-25 08:03:01 -07:00
joshualitt
7f9c9eb91e wire up reduced atlas and zero textblob cache to test
BUG=skia:

Review URL: https://codereview.chromium.org/1300813007
2015-08-21 11:08:00 -07:00
senorblanco
0abdf766d3 Reland of Implement canComputeFastBounds() for image filters. (patchset #1 id:1 of https://codereview.chromium.org/1300403003/ )
Reason for revert:
The Mac compile issue was fixed here: fdd331a42a

Original issue's description:
> Revert of Implement canComputeFastBounds() for image filters. (patchset #8 id:130001 of https://codereview.chromium.org/1296943002/ )
>
> Reason for revert:
> This causes a syntax error.
>
> http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_compile_dbg_ng/builds/87819/steps/compile%20%28with%20patch%29/logs/stdio
>
> Original issue's description:
> > Implement canComputeFastBounds() for image filters.
> >
> > Image filters have never implemented this check, which means that
> > filters which affect transparent black falsely claim they can compute
> > their bounds.
> >
> > Implemented an affectsTransparentBlack() virtual for image
> > filters, and a similar helper function for color filters.
> >
> > This will affect the following GMs: imagefiltersscaled
> > (lighting, perlin noise now filter to clip),
> > colorfilterimagefilter (new test case), imagefiltersclipped
> > (perlin noise now filters to clip).
> >
> > Note: I de-inlined SkPaint::canComputeFastBounds() to avoid adding
> > a dependency from SkPaint.h to SkImageFilter.h.h. Skia benches show
> > no impact from this change, but will watch the perf bots carefully.
> >
> > BUG=4212
> >
> > Committed: https://skia.googlesource.com/skia/+/915881fe743f9a789037695f543bc6ea189cd0cb
>
> TBR=reed@google.com,senorblanco@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=4212
>
> Committed: https://skia.googlesource.com/skia/+/12d8472d31ea5edb636d7d5214db253570115c40

TBR=reed@google.com,herb@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=4212

Review URL: https://codereview.chromium.org/1301823005
2015-08-20 11:10:41 -07:00
herb
12d8472d31 Revert of Implement canComputeFastBounds() for image filters. (patchset #8 id:130001 of https://codereview.chromium.org/1296943002/ )
Reason for revert:
This causes a syntax error.

http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_compile_dbg_ng/builds/87819/steps/compile%20%28with%20patch%29/logs/stdio

Original issue's description:
> Implement canComputeFastBounds() for image filters.
>
> Image filters have never implemented this check, which means that
> filters which affect transparent black falsely claim they can compute
> their bounds.
>
> Implemented an affectsTransparentBlack() virtual for image
> filters, and a similar helper function for color filters.
>
> This will affect the following GMs: imagefiltersscaled
> (lighting, perlin noise now filter to clip),
> colorfilterimagefilter (new test case), imagefiltersclipped
> (perlin noise now filters to clip).
>
> Note: I de-inlined SkPaint::canComputeFastBounds() to avoid adding
> a dependency from SkPaint.h to SkImageFilter.h.h. Skia benches show
> no impact from this change, but will watch the perf bots carefully.
>
> BUG=4212
>
> Committed: https://skia.googlesource.com/skia/+/915881fe743f9a789037695f543bc6ea189cd0cb

TBR=reed@google.com,senorblanco@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=4212

Review URL: https://codereview.chromium.org/1300403003
2015-08-20 09:28:45 -07:00
fmalita
ddbbddabef SkImage method for detecting lazy decoding
BUG=skia:4224
R=reed@google.com

Review URL: https://codereview.chromium.org/1305453007
2015-08-20 08:47:26 -07:00
primiano
9a5bd7e860 Introduce interface for memory dumps
BUG=chromium:503168

Review URL: https://codereview.chromium.org/1300103004
2015-08-20 08:00:32 -07:00
bungeman
99fe822606 Use static_assert instead of SK_COMPILE_ASSERT.
Now that static_assert is allowed, there is no need to use a non-
standard compile time assertion

Review URL: https://codereview.chromium.org/1306443004
2015-08-20 07:57:52 -07:00
senorblanco
915881fe74 Implement canComputeFastBounds() for image filters.
Image filters have never implemented this check, which means that
filters which affect transparent black falsely claim they can compute
their bounds.

Implemented an affectsTransparentBlack() virtual for image
filters, and a similar helper function for color filters.

This will affect the following GMs: imagefiltersscaled
(lighting, perlin noise now filter to clip),
colorfilterimagefilter (new test case), imagefiltersclipped
(perlin noise now filters to clip).

Note: I de-inlined SkPaint::canComputeFastBounds() to avoid adding
a dependency from SkPaint.h to SkImageFilter.h.h. Skia benches show
no impact from this change, but will watch the perf bots carefully.

BUG=4212

Review URL: https://codereview.chromium.org/1296943002
2015-08-20 07:42:11 -07:00
herb
ab42ec79d5 Add asserts for shared mutex.
BUG=skia:

Review URL: https://codereview.chromium.org/1285973003
2015-08-19 13:40:12 -07:00
reed
216b643fc7 private iterator to visit all resource cache entries
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1271033002
2015-08-19 12:25:41 -07:00
reed
f5822825ec change asABitmap to isABitmap on shader
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1287263005
2015-08-19 11:46:38 -07:00
mtklein
c6ad06acef unsigned -> int for counts and indices in picture-related code
also, (C)

BUG=skia:

Review URL: https://codereview.chromium.org/1300163002
2015-08-19 09:51:01 -07:00
reed
451af5062e remove SkDeferredCanvas
Waiting a day or so to see if the blink-removal of SkDeferredCanvas sticks

BUG=skia:

Review URL: https://codereview.chromium.org/1269093002
2015-08-19 08:18:04 -07:00
halcanary
d75e21dade SkStream Testing: fix bug in new unit test.
Review URL: https://codereview.chromium.org/1297143004
2015-08-19 07:22:04 -07:00
halcanary
cb9241badd Fix stack overuse error
Review URL: https://codereview.chromium.org/1283193008
2015-08-19 06:12:40 -07:00
halcanary
48305e8353 SkPDF/Deflate: clean up old SkFlate code
Factor out some of https://crrev.com/1227913008

BUG=skia:3030

Review URL: https://codereview.chromium.org/1298243002
2015-08-18 13:30:25 -07:00
msarett
b32758a72f Test scaling for small images
We don't want to test small images on Gold because they are
not interested to look at.  Instead, I wrote a unit test to
verify that scaling small images does not cause crashes.

BUG=skia:

Review URL: https://codereview.chromium.org/1287863004
2015-08-18 13:22:46 -07:00
wangyix
b1daa86732 When getGLInstance is called on a frag proc, the resulting GrGLFragmentProcessor will be the root of a tree of GrGLFragmentProcessors that mirrors the GrFragmentProcessor's tree. This allows setData() to be called recursively (removing the responsibility from compose shader) and allows gl instances direct access to their children gl instances so they can emit their code.
BUG=skia:4182

Review URL: https://codereview.chromium.org/1287023009
2015-08-18 11:29:32 -07:00
caryclark
94c902e63d fix pathops fuzz failures
If a curve has the identical start and control points, the
initial or final tangent can't be trivally determined. The
perpendicular to the tangent is used to measure coincidence.

Add logic for cubics, quadratics, and conics, to use the
secondary control points or the end points if the initial
control point alone can't determine the tangent.

Add debugging (currently untriggered by exhaustive testing)
to detect zero-length tangents which are not at the curve
endpoints.

Increase the number of temporary intersecions gathered from
10 to 12 but reduce the max passed in by cubic intersection from
27 to 12. Also, add checks if the max passed exceeds the
storage allocated.

When cleaning up parallel lines, choose the intersection which
is on the end of both segments over the intersection which
is on the end of a single segment.

TBR=reed@google.com
BUG=425140,516266

Review URL: https://codereview.chromium.org/1288863004
2015-08-18 07:12:44 -07:00
bsalomon
7539856c1b Make GrVertexBatch objects hold their own draws during GrDrawTarget flush
NO_MERGE_BUILDS

Review URL: https://codereview.chromium.org/1286043004
2015-08-17 12:55:38 -07:00
caryclark
6a91ad22a4 remove unused code
R=mtklein@google.com

Review URL: https://codereview.chromium.org/1297013002
2015-08-17 10:01:24 -07:00
fmalita
f433bb2beb SkPaintFilterCanvas should inherit the target canvas state
Currently, SkPaintFilterCanvas does not provide any help in cloning
target canvas state.  While that could be handled in subclasses, it is
easy to miss (see linked bug).

This CL adds a new constructor variant which ensures that the initial
matrix and clip bounds are inherited from the target canvas.

BUG=516790
R=reed@google.com,robertphillips@google.com

Review URL: https://codereview.chromium.org/1294013002
2015-08-17 08:05:13 -07:00
scroggo
cc2feb161f Support more swizzles to 565 in SkCodec
Add more swizzling functions for swizzling to 565. Much of this
code was revived from crrev.com/1055743003 (for BMP). Also added
swizzling functions for WBMP.

Consolidate the static function conversion_possible.

In SkCodec::getPixels, check that the alphatype corresponds to the
colorType. This prevents requesting 565 + non-opaque.

In SkIcoCodec, report that the image is unpremul (instead of
whatever the largest embedded codec thinks), but modify the
requested info to have the alpha type expected/required by the
embedded codec.

Add tests for decoding to 565.

BUG=skia:3257
BUG=skia:3683

Review URL: https://codereview.chromium.org/1277213002
2015-08-14 08:32:46 -07:00
bsalomon
16b991390b Split GrDrawBatch and GrVertexBatch into their own files
TBR=joshualitt@google.com

Review URL: https://codereview.chromium.org/1296483002
2015-08-13 14:55:50 -07:00
bsalomon
abd30f54b7 Introduce GrBatch subclasses GrDrawBatch and GrVertexBatch to prepare for non-drawing batches
Review URL: https://codereview.chromium.org/1293583002
2015-08-13 13:34:48 -07:00
robertphillips
6e83ac778f Defer flushes if kPreferNoIO is specified
Prior to this patch clients who were solely uploading to textures (e.g., SW Mask Mgr) would cause extra flushes b.c., even though kPreferNoIO was being specified, resources with pending IO would still be returned even though there was plenty of space in the resource cache.

Review URL: https://codereview.chromium.org/1286203002
2015-08-13 05:19:14 -07:00
halcanary
d9e57158eb SkPDF: Move SkFlate into src/pdf (part 1/3) [reland]
Rename to SkDeflate so Chromium builders continue to work

Next, we change remove SkFlate from Chromium build files, then we can delete SkFlate.

Review URL: https://codereview.chromium.org/1285913002
2015-08-12 11:24:40 -07:00
bsalomon
cb02b38b2c Check for xfer barriers in GrBatch, auto-issue barriers in GrGpu
Review URL: https://codereview.chromium.org/1287973003
2015-08-12 11:14:50 -07:00
scroggo
d1bc5746ba Update CodexTest to test valid_alpha.
Add a static function to CodexTest, which consolidates decoding,
comparing to an expected SkCodec::Result, and optionally comparing to a
digest.

Test decoding non-opaque to opaque (fails) and premul to unpremul/vice
versa (succeeds).

BUG=skia:3475

Review URL: https://codereview.chromium.org/1277253003
2015-08-12 08:31:44 -07:00
msarett
d0375bc460 Fix bmp RLE "bug"
Chromium's test suite contains an RLE image that reports a certain
file size in the header, but then contains additional encoded data.
Our bmp decoder would only decode half of the image, before stopping.

With this fix, we check for additional data before returning
kIncompleteInput.

If this lands, I will upload the test image to the bots.

Also adding an invalid image test to CodexTest.

BUG=skia:

Review URL: https://codereview.chromium.org/1273853004
2015-08-12 08:08:56 -07:00
halcanary
65cc3e4644 C API: add radial, sweep, and two-point conical gradient shaders
Review URL: https://codereview.chromium.org/1263773006
2015-08-12 07:37:34 -07:00
halcanary
2ccdb636e8 SkPDF: clean up overuse of SK_SUPPORT_PDF
When possible use run-time checks (via SkDocument::CreatePDF)
When PDF is disabled, do not compile tests/PDF*.cpp

Review URL: https://codereview.chromium.org/1278403006
2015-08-11 13:35:12 -07:00
halcanary
8ee06f21a2 SkPDF: allow PDF module to be disabled in DM and SampleApp
To disable PDF:

    GYP_DEFINES='skia_pdf=0' bin/sync-and-gyp
    ninja -C out/Debug dm SampleApp

When disabled, SkDocument::CreatePDF() always returns NULL.

Review URL: https://codereview.chromium.org/1279123007
2015-08-11 10:30:12 -07:00
bsalomon
91d844de47 Rename GrPipelineInfo to GrPipelineOptimizations
TBR=joshualitt@google.com

Review URL: https://codereview.chromium.org/1274513005
2015-08-10 10:47:29 -07:00
joshualitt
74417824cd Make folder for batches
BUG=skia:

Review URL: https://codereview.chromium.org/1277233002
2015-08-07 11:42:17 -07:00
mtklein
469a3fe6ed Add approxBytesUsed to hashes.
BUG=skia:

Review URL: https://codereview.chromium.org/1280653003
2015-08-07 09:33:37 -07:00
bsalomon
9bca52629c Fix StringTest for VS2015
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1280853002
2015-08-06 17:56:13 -07:00
bsalomon
ebc1c10fe1 Fix warnings on VS2015 x86_64 build
TBR=bungeman@google.com

Review URL: https://codereview.chromium.org/1276133002
2015-08-06 17:33:16 -07:00
reed
e47829b6b1 flag to use const& instead of const* for src-rect
BUG=skia:

Review URL: https://codereview.chromium.org/1272713005
2015-08-06 10:02:53 -07:00
bsalomon
fb1141ae1d Don't pass pipeline to GrBatch::generateGeometry()
R=joshualitt@google.com

Review URL: https://codereview.chromium.org/1275083002
2015-08-06 08:52:49 -07:00
fmalita
e2639089bd SkSurface copy-on-write can yield stale GPU render targets.
Prepare_rt_for_external_access() grabs the render target and then fires
access notifications.

But the notification handlers may trigger copy-on-write, causing the
returned render target to be stale (pointing at the detached snapshot).

We should grab the render target after firing notifications.

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

Review URL: https://codereview.chromium.org/1276713002
2015-08-06 07:04:52 -07:00
bungeman
d3ebb48320 IWYU: 'core' target, files starting A-C.
TBR=reed@google.com
Verbal lgtm, does not change API.

Committed: https://skia.googlesource.com/skia/+/7403d87db8e43d4c2b5b25ac22a0ebc22bd09d69

Review URL: https://codereview.chromium.org/1265033002
2015-08-05 13:57:49 -07:00
msarett
99f567e617 Scanline decoding for wbmp
We are also changing the wbmp to use SkSwizzler.  This
will allow us to take advantage of the sampling routines
that are being implemented in SkSwizzler.

The image in this upload came from:
https://commons.wikimedia.org/wiki/File:Android_robot.png

It is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.

BUG=skia:

Review URL: https://codereview.chromium.org/1254483004
2015-08-05 12:58:26 -07:00
reed
fb8c1fcab1 Revert of IWYU: 'core' target, files starting A-C. (patchset #5 id:80001 of https://codereview.chromium.org/1265033002/ )
Reason for revert:
revert to unblock DEPS roll

../../chrome/browser/chromeos/display/overscan_calibrator.cc:43:10: error: variable has incomplete type 'SkPath'
  SkPath base_path;

Original issue's description:
> IWYU: 'core' target, files starting A-C.
>
> TBR=reed@google.com
> Verbal lgtm, does not change API.
>
> Committed: https://skia.googlesource.com/skia/+/7403d87db8e43d4c2b5b25ac22a0ebc22bd09d69

TBR=reed@google.com,mtklein@google.com,bungeman@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1273613002
2015-08-04 18:44:57 -07:00
bungeman
7403d87db8 IWYU: 'core' target, files starting A-C.
TBR=reed@google.com
Verbal lgtm, does not change API.

Review URL: https://codereview.chromium.org/1265033002
2015-08-04 14:56:53 -07:00
halcanary
9f8754f591 Remove experimental/PdfViewer
Motivation: maintaining this code doesn't seem worth the time,
since no one seems to be using it.  If someone wants to use it
in the future, just revert this CL.

Review URL: https://codereview.chromium.org/1266093003
2015-08-04 14:08:44 -07:00
senorblanco
84cd621670 Implement caching of filled paths in the tessellated path renderer.
Paths are cached as tessellated triangle meshes in vertex buffers on the GPU. Stroked paths are not (yet) cached.

Paths containing no curved segments (linear paths) are reused at all scales. Paths containing curved segments are reused within a scale tolerance threshold.

In order to invalidate the cache when an SkPath is changed or deleted,
this required implementing genID change notification in SkPath. This is
modelled almost exactly on SkPixelRef::GenIDChangeListener.
However, It does not currently implement the check for unique genIDs,
so notifiers will fire when the first instance of an SkPathRef
using a given genID is destroyed.

Another caveat is that you cannot successfully add a change notifier
to an empty path, since it uses the "canonical" empty path which is
never modified or destroyed. For this reason, we prevent adding
listeners to it.

BUG=skia:4121,skia:4122, 497403
DOCS_PREVIEW= https://skia.org/?cl=1114353004

Committed: https://skia.googlesource.com/skia/+/468dfa72eb6694145487be17876804dfca3b7adb

Review URL: https://codereview.chromium.org/1114353004
2015-08-04 10:01:58 -07:00
scroggo
1c005e4a38 Create a scanline decoder without creating a codec
Prior to this CL, if a client wanted to decode scanlines, they had to
create an SkCodec in order to get an SkScanlineDecoder. This introduces
complications if input data is not easily shared between the two
objects.

Instead, add methods to SkScanlineDecoder for creating a new one from
input data, and remove the creation functions from SkCodec.

Update DM and tests.

Review URL: https://codereview.chromium.org/1267583002
2015-08-04 09:24:45 -07:00
mtklein
562a66b093 Revert "Implement caching of filled paths in the tessellated path renderer."
This reverts commit 468dfa72eb.

    This CL caused signficant GM diffs.

Revert "Fix resource cache test."
This reverts commit b001c41ed3.
Revert "Fix SkData leaks at GrResourceKey::setCustomData() call sites."
This reverts commit c369348aa5.

    These CLs depend on the first one.

BUG=skia:
TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1260363007
2015-08-04 08:46:16 -07:00
reed
6f1216ac15 cache private readback for gpu-images
Does not try to cache calls to readPixels at the moment:
- not triggered by drawing
- not clear if we want to perform any pixel transformations (that readPixels allows) on the GPU or CPU

Can consider that another time.

BUG=513695

Review URL: https://codereview.chromium.org/1262923003
2015-08-04 08:10:13 -07:00
wangyix
4b3050b410 Added registerChild; transforms, textures, glKey automatically handled.
BUG=skia:

Review URL: https://codereview.chromium.org/1266633003
2015-08-04 07:59:37 -07:00
Stephen White
c369348aa5 Fix SkData leaks at GrResourceKey::setCustomData() call sites.
BUG=skia:
TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1270103003 .
2015-08-03 21:53:09 -04:00
Stephen White
b001c41ed3 Fix resource cache test.
TBR=bsalomon@chromium.org

Review URL: https://codereview.chromium.org/1257253007 .
2015-08-03 16:30:23 -04:00
senorblanco
468dfa72eb Implement caching of filled paths in the tessellated path renderer.
Paths are cached as tessellated triangle meshes in vertex buffers on the GPU. Stroked paths are not (yet) cached.

Paths containing no curved segments (linear paths) are reused at all scales. Paths containing curved segments are reused within a scale tolerance threshold.

In order to invalidate the cache when an SkPath is changed or deleted,
this required implementing genID change notification in SkPath. This is
modelled almost exactly on SkPixelRef::GenIDChangeListener.
However, It does not currently implement the check for unique genIDs,
so notifiers will fire when the first instance of an SkPathRef
using a given genID is destroyed.

Another caveat is that you cannot successfully add a change notifier
to an empty path, since it uses the "canonical" empty path which is
never modified or destroyed. For this reason, we prevent adding
listeners to it.

BUG=skia:4121,skia:4122, 497403
DOCS_PREVIEW= https://skia.org/?cl=1114353004

Review URL: https://codereview.chromium.org/1114353004
2015-08-03 13:04:03 -07:00
joshualitt
d45fb5a3a5 Add BW masks to random scaler context
TBR=bsalomon@google.com
BUG=skia:

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

Review URL: https://codereview.chromium.org/1270793003
2015-08-01 10:33:40 -07:00
bsalomon
eae6200acb Some cleanup in GrTextureProvider and GrResourceProvider.
Review URL: https://codereview.chromium.org/1261643004
2015-07-31 13:59:31 -07:00
halcanary
7568d0b15e C API: add sk_xfermode.h, impl, test
Review URL: https://codereview.chromium.org/1242403005
2015-07-31 13:38:06 -07:00
joshualitt
65e96b4eb9 Modifying TextBlobCacheTest to use SkRandomScalerContext
BUG=skia:

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

Review URL: https://codereview.chromium.org/1266003002
2015-07-31 11:45:22 -07:00
joshualitt
bdc91a7fdb Revert of Modifying TextBlobCacheTest to use SkRandomScalerContext (patchset #3 id:40001 of https://codereview.chromium.org/1266003002/)
Reason for revert:
breaking android

Original issue's description:
> Modifying TextBlobCacheTest to use SkRandomScalerContext
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/adcdca86ce425cf8c28bfad311cef028df756ee8

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

Review URL: https://codereview.chromium.org/1267623004
2015-07-31 07:55:09 -07:00
joshualitt
adcdca86ce Modifying TextBlobCacheTest to use SkRandomScalerContext
BUG=skia:

Review URL: https://codereview.chromium.org/1266003002
2015-07-31 07:44:11 -07:00
bsalomon
0aff2fa82a Also provides the ResourceProvider to onDrawPath which allows the DF PR to no longer require access to GrContext.
Review URL: https://codereview.chromium.org/1265763002
2015-07-31 06:48:27 -07:00
reed
02d91d1873 lock pixels in image when bitmap is immutable and not-lazy
BUG=skia:

Review URL: https://codereview.chromium.org/1266143003
2015-07-30 20:13:43 -07:00
reed
80c772b2a4 unify pixelref and image ID space, so we can share IDs when we share pixels
I view this as a performance opportunity, not a feature or bug fix per-se.

BUG=skia:

Review URL: https://codereview.chromium.org/1266883002
2015-07-30 18:58:23 -07:00
bsalomon
16921ec30a SRGB read and write pixels working and unit test
Review URL: https://codereview.chromium.org/1264003002
2015-07-30 15:34:56 -07:00
scroggo
ef004e1b49 Remove SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
Now that Chrome no longer depends on it, remove dead code.

Review URL: https://codereview.chromium.org/1263013002
2015-07-30 07:47:45 -07:00
reed
26e0e587f7 SkImage_Raster's pixels are always immutable.
To make this work, we tag their pixelrefs as temporarily immutable, allowing
ourselves to restore the pixels to mutability only when the image drops away.

This should allow us to wobble back and forth between writing to the Surface
and reading from the Image without a COW, with the Surface seeing mutable
pixels and the Image seeing immutable pixels.

The big idea is, Image doesn't need forever-immutable pixels, it just needs
pixels that are immutable as long as it's alive.

BUG=skia:

patch from issue 804523002 at patchset 40001 (http://crrev.com/804523002#ps40001)

Review URL: https://codereview.chromium.org/1254383006
2015-07-29 11:44:52 -07:00
reed
3b2fb981ab rewrite path.getBounds test to work-around compiler bug
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1262143002
2015-07-29 08:37:13 -07:00
bsalomon
f0674516cb Move draw on upload decision in GrGpu
BUG=skia:

Committed: https://skia.googlesource.com/skia/+/0341b4427e5f037e3b501ed6e57dfdb7b40f150e

Review URL: https://codereview.chromium.org/1257073003
2015-07-28 13:26:16 -07:00
bsalomon
c3fb74693e Revert of Move draw on upload decision in GrGpu (patchset #4 id:50001 of https://codereview.chromium.org/1257073003/)
Reason for revert:
breaking write pixels test on bots

Original issue's description:
> Move draw on upload decision in GrGpu
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/0341b4427e5f037e3b501ed6e57dfdb7b40f150e

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

Review URL: https://codereview.chromium.org/1260293004
2015-07-28 12:23:26 -07:00
bsalomon
0341b4427e Move draw on upload decision in GrGpu
BUG=skia:

Review URL: https://codereview.chromium.org/1257073003
2015-07-28 09:13:47 -07:00
reed
562fe4767c remove all guards for changes to drawBitmapRect / drawImageRect
BUG=skia:

Review URL: https://codereview.chromium.org/1239193002
2015-07-28 07:35:14 -07:00
reed
91f283bb4e change getBounds to return 0000 iff there are zero points
This is a contract change for SkPath::getBounds(), which formally was defined to return 0,0,0,0 for a 1-point path, regardless of the coordinates of that point. This seems wacky/inconsistent, and was causing other bugs (incorrect bounds) when this was unioned with other rects.

Does anyone remember why we defined it this way?

BUG=513799

Review URL: https://codereview.chromium.org/1261773002
2015-07-28 06:00:50 -07:00
caryclark
bb13433364 compute split conic endpoints exactly
The divide by w can generate slightly erroneous results even
for t == 0 or t == 1. The error in turn defeats detecting
a point in common for a pair of curves that travel in
opposite directions.

Instead, special case endpoints when the t is 0 or 1.

TBR=reed@google.com
BUG=514118

Review URL: https://codereview.chromium.org/1259513004
2015-07-28 05:12:19 -07:00
fmalita
9a5d1ab54d Make peekPixels() usable with raster surface snapshots
SkSurface_Raster snapshots do not lock their backing bitmaps when the
pixel ref is shared - they only lock on deep-copy.

But since for raster surfaces the pixels are always in memory, I think
it would be OK to also lock in the former case.

This allows for optimized (zero-copy) reads of raster surface snapshot
data.

R=reed@google.com

Review URL: https://codereview.chromium.org/1256993002
2015-07-27 10:27:29 -07:00
Brian Salomon
4239fc2f69 Remove skia_arch_width, fold into skia_arch_type.
DOCS_PREVIEW= https://skia.org/?cl=1228553010

BUG=skia:4042
R=borenet@google.com, mtklein@google.com

Review URL: https://codereview.chromium.org/1228553010
2015-07-27 09:10:36 -04:00
caryclark
d4349723fa fix path ops fuzz buster
Mark collapsed segments as done and remove collapsed
segment references from the coincidence array.

Also add test names to global debugging.

R=fmalita@chromium.org
BUG=512592

Review URL: https://codereview.chromium.org/1250293002
2015-07-23 12:40:22 -07:00
bsalomon
a449779a33 Remove test of illegal behavior that modifies a texture backing an SkImage.
Review URL: https://codereview.chromium.org/1244143004
2015-07-23 12:22:19 -07:00
jvanverth
29c69793f0 Update fallback rsqrt implementation to use optimal constants.
Improves max relative error from 0.00175126 to 0.000650197.
Also add unit tests to check error bounds.

BUG=chromium:511458

Review URL: https://codereview.chromium.org/1251423002
2015-07-23 11:14:29 -07:00
joshualitt
11dfc8e57a Small tweak to TextBlobCacheTest
TBR=bsalomon@google.com
BUG=skia:

Review URL: https://codereview.chromium.org/1251383003
2015-07-23 08:30:25 -07:00
joshualitt
bedf7e5c0e fix memory leak in TextBlobCacheTest
TBR=bsalomon@google.com
BUG=skia:

Review URL: https://codereview.chromium.org/1252593002
2015-07-23 08:09:35 -07:00
bsalomon
398260262f Attempt to somewhat simplify GrContext::readSurfacePixels interaction with GrGpu.
Review URL: https://codereview.chromium.org/1255483005
2015-07-23 08:07:21 -07:00
wangyix
7c157a9888 Added GrGLFragmentProcessor::EmitArgs struct for use with emitCode()
BUG=skia:

Review URL: https://codereview.chromium.org/1251173002
2015-07-22 15:08:53 -07:00
joshualitt
404d9d620d Fix up textblobcachetest
TBR=bsalomon@google.com
BUG=skia:

Review URL: https://codereview.chromium.org/1250003003
2015-07-22 11:00:32 -07:00
scroggo
b636b45971 Add the ability to decode a subset to SkCodec
This allows codecs that support subsets natively (i.e. WEBP) to do so.

Add a field on SkCodec::Options representing the subset.

Add a method on SkCodec to find a valid subset which approximately
matches a desired subset.

Implement subset decodes in SkWebpCodec.

Add a test in DM for decoding subsets.
Notice that we only start on even boundaries. This is due to the
way libwebp's API works. SkWEBPImageDecoder does not take this into
account, which results in visual artifacts.

FIXME: Subsets with scaling are not pixel identical, but close. (This
may be fine, though - they are not perceptually different. We'll just
need to mark another set of images in gold as valid, once
https://skbug.com/4038 is fixed, so we can tests scaled webp without
generating new images on each run.)

Review URL: https://codereview.chromium.org/1240143002
2015-07-22 07:16:20 -07:00
fmalita
8c0144ccb1 Fix SkCanvas::wouldOverwriteEntireSurface() contains test
R=reed@google.com,robertphillips@google.com,bsalomon@google.com

Review URL: https://codereview.chromium.org/1244093005
2015-07-22 05:56:16 -07:00
joshualitt
e49109f3b5 adding unit test for textblob cache / GrBatchAtlas
BUG=skia:

Review URL: https://codereview.chromium.org/1233253003
2015-07-17 12:47:39 -07:00
reed
84984efeb6 Revert[2] of guard to remove DrawBitmapRectFlags
This reverts commit 91110195a2.

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1240753003
2015-07-17 07:09:43 -07:00
scroggo
91110195a2 Revert of guard to remove DrawBitmapRectFlags (patchset #1 id:1 of https://codereview.chromium.org/1235393003/)
Reason for revert:
breaking android framework build

Original issue's description:
> guard to remove DrawBitmapRectFlags
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/6fb0b6779e40ce05c20cf279f0ecff31fa3cd60d

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

Review URL: https://codereview.chromium.org/1230823007
2015-07-17 05:57:34 -07:00
senorblanco
ed7cf27322 Now that the SkImageFilter::CropRect crop edges refer to
width & height, name them appropriately.

BUG=240827

Review URL: https://codereview.chromium.org/1234873005
2015-07-16 15:19:11 -07:00
bsalomon
bea0150d83 Revert of Remove rt flags that are not necessary (patchset #1 id:1 of https://codereview.chromium.org/1226123012/)
Reason for revert:
breaks tests, e.g.
https://build.chromium.org/p/client.skia.android/builders/Test-Android-GCC-Nexus9-GPU-TegraK1-Arm64-Release/builds/752/steps/dm/logs/stdio

Original issue's description:
> Remove rt flags that are not necessary
>
> Committed: https://skia.googlesource.com/skia/+/b6b0a6ef179f4143c94ba7e0e1be6e7ce4b0a23a

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

Review URL: https://codereview.chromium.org/1234503004
2015-07-16 10:00:28 -07:00
bsalomon
b6b0a6ef17 Remove rt flags that are not necessary
Review URL: https://codereview.chromium.org/1226123012
2015-07-16 09:34:57 -07:00
bsalomon
e8d21e8f24 Make readpixels work on GrTextures
Review URL: https://codereview.chromium.org/1234313002
2015-07-16 08:23:13 -07:00
jvanverth
3e5f55542c Various GL testing fixes
Check for GL context when printing NVPR error string.
Fix some indenting.

Review URL: https://codereview.chromium.org/1235283004
2015-07-16 07:46:07 -07:00
mtklein
767d273ea0 Replace buggy_blend_modes GM with an exhaustive test.
The new test is disabled by default, as it's quite slow.
We can run it if we suspect problems by passing -x to DM.

This test would have been failing before the bug fix, and now is passing.

Assuming the Priv on the end means it's not considered public API...
TBR=reed@google.com

BUG=skia:4052

Review URL: https://codereview.chromium.org/1228333003
2015-07-16 07:01:40 -07:00
reed
6fb0b6779e guard to remove DrawBitmapRectFlags
BUG=skia:

Review URL: https://codereview.chromium.org/1235393003
2015-07-16 06:10:02 -07:00
bungeman
91e51cbd64 Fix leak in Android FontMgr test.
FontMgrAndroidParserTest deos not free the font families it creates.
This issue was discovered by asan when enabling this test on Linux
platforms.
2015-07-15 14:29:25 -04:00
jvanverth
eeb8d99b4e Only run test_wrapped_resources() when GL is active
Review URL: https://codereview.chromium.org/1234233002
2015-07-15 10:16:56 -07:00
fmalita
2ecc000536 Preserve SKP cullrects on deserialization
Let's not ignore the offset.

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

Review URL: https://codereview.chromium.org/1235953004
2015-07-14 13:12:25 -07:00
caryclark
e8c5666e03 Very tiny paths are subsumed by the Convexicator
and are treated as convex when they are not.

Allow the SkPath::Iter to leave degenerate path
segments unmolested by passing an additional exact
bool to next().

Treat any non-zero length as significant in addPt().

R=reed@google.com,robertphillips@google.com
BUG=493450

Review URL: https://codereview.chromium.org/1228383002
2015-07-14 11:19:26 -07:00
joshualitt
5ca41c1647 Remove GrRedBlackTree
BUG=skia:

Review URL: https://codereview.chromium.org/1226203013
2015-07-14 11:07:53 -07:00
jvanverth
8895792877 Rename backing texture testing routines
Review URL: https://codereview.chromium.org/1230193006
2015-07-14 11:02:52 -07:00
mtklein
4be181e304 3-15% speedup to HardLight / Overlay xfermodes.
While investigating my bug (skia:4052) I saw this TODO and figured
it'd make me feel better about an otherwise unsuccessful investigation.

This speeds up HardLight and Overlay (same code) by about 15% with SSE, mostly
by rewriting the logic from 1 cheap comparison and 2 expensive div255() calls
to 2 cheap comparisons and 1 expensive div255().

NEON speeds up by a more modest ~3%.

BUG=skia:

Review URL: https://codereview.chromium.org/1230663005
2015-07-14 10:54:19 -07:00
reed
a5517e2b19 add src-rect-constraint to drawImageRect
Follow-on work
- unify around SrcRectConstraint (i.e. drawBitmapRect)
- remove silly drawBitmapRectToRect alias
- clean-up (possibly remove) alias problems around drawBitmapRect + IRect parameter

BUG=skia:

Review URL: https://codereview.chromium.org/1228083004
2015-07-14 10:54:12 -07:00
robertphillips
3d32d768cd Add new SkPoint3 class
The existing Light filter and the upcoming Lighting Shader both need a Point3 class

Review URL: https://codereview.chromium.org/1229693009
2015-07-13 13:16:44 -07:00
mtklein
e20633ed26 Add a GM that reproduces layout test failures with my new xfermode code.
Inspired by https://storage.googleapis.com/chromium-layout-test-archives/linux_blink_rel/69169/layout-test-results/results.html

I think the root cause is overflow.

Also, adds tests for Sk16b::operator<().  It wasn't wrong, but it was suspect
(used in all three of these xfermode implementations) and so it's best to have
tests.

BUG=skia:

Review URL: https://codereview.chromium.org/1228393006
2015-07-13 12:06:33 -07:00
senorblanco
24d2a7b463 Fix for partially-specified crop rects.
When only the left or top edge of a crop rect is given, the
right and bottom should be computed based on the incoming width
and height, not based on the crop rect's width & height. This
complies more accurately with SVG semantics.

BUG=240827

Review URL: https://codereview.chromium.org/1232873002
2015-07-13 10:27:05 -07:00
joshualitt
1c735488cb Start to propagate constness of GrPipelineBuilder up the stack
BUG=skia:

Review URL: https://codereview.chromium.org/1229143007
2015-07-13 08:08:25 -07:00
jvanverth
672bb7fc66 Remove GL-specific code from GMs and tests
TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1232173002
2015-07-13 07:19:57 -07:00
joshualitt
3989205322 remove some unused stuff
BUG=skia:

Review URL: https://codereview.chromium.org/1231163002
2015-07-10 14:14:03 -07:00
scroggo
9b2cdbf481 Allow creating multiple scanline decoders.
Make getScanlineDecoder return a new object each time, which is
owned by the caller, and independent from any existing scanline
decoders and the SkCodec itself.

Since the SkCodec already contains the entire state machine, and it
is used by the scanline decoders, simply create a new SkCodec which
is now owned by the scanline decoder.

Move code that cleans up after using a scanline decoder into its
destructor

One side effect is that creating the first scanline decoder requires
a duplication of the stream and re-reading the header. (With some
more complexity/changes, we could pass the state machine to the
scanline decoder and make the SkCodec recreate its own state machine
instead.) The typical client of the scanline decoder (region decoder)
uses an SkMemoryStream, so the duplication is cheap, although we
should consider the extra time to reread the header/recreate the state
machine. (If/when we use the scanline decoder for other purposes,
where the stream may not be cheaply duplicated, we should consider
passing the state machine.)

One (intended) result of this change is that a client can create a
new scanline decoder in a new thread, and decode different pieces of
the image simultaneously.

In SkPngCodec::decodePalette, use fBitDepth rather than a parameter.

Review URL: https://codereview.chromium.org/1230033004
2015-07-10 12:07:02 -07:00
scroggo
139491fbaa Use the upstream version of libwebp, v0.4.3.
DEPS:
Update to pull v0.4.3 of libwebp from upstream

gyp/libwebp.gyp:
Add new files, as referenced by the gyp file used by Chromium.

resource/tests:
Add regression tests for particular images.

BUG=skia:3442
BUG=skia:3315
BUG=skia:3429

Committed: https://skia.googlesource.com/skia/+/3aa0fb4d80c76b559ff4b82d5e569993aea06da1

Review URL: https://codereview.chromium.org/1178013008
2015-07-10 09:32:09 -07:00
fmalita
ea561bf055 Fix SkImage::asLegacyBitmap() rowBytes assert
When reusing the pixel ref, we need to observe its rowBytes.

R=reed@google.com

Review URL: https://codereview.chromium.org/1227413002
2015-07-09 17:10:31 -07:00
mtklein
694307c9f1 Let's not leak this SkData.
BUG=skia:

Review URL: https://codereview.chromium.org/1231903006
2015-07-09 15:41:11 -07:00
reed
d7c05bfd7c remove getter for imagegenerator factory, update test
BUG=skia:

Review URL: https://codereview.chromium.org/1223413002
2015-07-09 14:08:49 -07:00
reed
1c84634454 add runtime option to provide data->imagegenerator factory
BUG=skia:

Review URL: https://codereview.chromium.org/1229933003
2015-07-09 11:47:36 -07:00
scroggo
5315fd4761 Remove SkImageGenerator pieces only for SkCodec.
Follow up to the split between SkImageGenerator and SkCodec. Now that
SkCodec does not inherit from SkImageGenerator, SkImageGenerator no
longer needs Options or Result, which were added for SkCodec. Remove
them, but keep them behind a flag, since Chromium has its own
subclasses of SkImageGenerator which assume the old signature for
onGetPixels.

Review URL: https://codereview.chromium.org/1226023003
2015-07-09 09:08:00 -07:00
scroggo
eb602a5c94 SkCodec no longer inherits from SkImageGenerator.
SkImageGenerator makes some assumptions that are not necessarily valid
for SkCodec. For example, SkCodec does not assume that it can always be
rewound.

We also have an ongoing question of what an SkCodec should report as
its default settings (i.e. the return from getInfo). It makes sense for
an SkCodec to report that its pixels are unpremultiplied, if that is
the case for the underlying data, but if a client of SkImageGenerator
uses the default settings (as many do), they will receive
unpremultiplied pixels which cannot (currently) be drawn with Skia. We
may ultimately decide to revisit SkCodec reporting an SkImageInfo, but
I have left it unchanged for now.

Import features of SkImageGenerator used by SkCodec into SkCodec.

I have left SkImageGenerator unchanged for now, but it no longer needs
Result or Options. This will require changes to Chromium.

Manually handle the lifetime of fScanlineDecoder, so SkScanlineDecoder.h
can include SkCodec.h (where Result is), and SkCodec.h does not need
to include it (to delete fScanlineDecoder).

In many places, make the following simple changes:
- Now include SkScanlineDecoder.h, which is no longer included by
  SkCodec.h
- Use the enums in SkCodec, rather than SkImageGenerator
- Stop including SkImageGenerator.h where no longer needed

Review URL: https://codereview.chromium.org/1220733013
2015-07-09 08:16:03 -07:00
joshualitt
9cc1775e72 rename GrShaderDataManager -> GrProcessorDataManager
BUG=skia:

Review URL: https://codereview.chromium.org/1228683002
2015-07-09 06:28:14 -07:00
joshualitt
0067ff5e0f fix up test create functions
TBR=bsalomon@google.com
BUG=skia:

Review URL: https://codereview.chromium.org/1213623022
2015-07-08 14:26:19 -07:00