Commit Graph

92 Commits

Author SHA1 Message Date
Matt Sarett
04c3731de8 SkEncoder: Rename files, change webp API, for consistency
Bug: skia:
Change-Id: I3dd6feb3d5661dcad3d2388b4d01fa9d3bbb15bb
Reviewed-on: https://skia-review.googlesource.com/15631
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-05-05 18:56:46 +00:00
Matt Sarett
c367d03fb0 Add support for row-by-row png encodes
Also adds a SkEncoder base class.

Bug: 713862
Change-Id: Ia3f009cd9f376514f6c19396245fab3a43ae6536
Reviewed-on: https://skia-review.googlesource.com/15152
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-05-05 16:34:13 +00:00
Matt Sarett
26b44df233 Add support for row-by-row jpeg encoding
Reland of:
https://skia-review.googlesource.com/c/14641/

Bug: 713862
Change-Id: I9dca5ede4ebf569c5f80edcfb23a506b6cfa935e
Reviewed-on: https://skia-review.googlesource.com/15144
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-05-02 20:40:10 +00:00
Leon Scroggins
c06f309cf5 Revert "Add support for row-by-row jpeg encoding"
This reverts commit 9b848d5749.

Reason for revert: ASAN reports leaked memory [1]. Google3 reports a "delete size mismatch" [2], which I suspect is the same issue.

[1] https://chromium-swarm.appspot.com/task?id=35e2c9fa9eac6310&refresh=10&show_raw=1
[2] https://test.corp.google.com/ui#cl=154838904&flags=CAMQBQ==&id=OCL:154838904:BASE:154839043:1493741642370:9c96115f&t=//chrome/skia/dm_wrapper:dm_wrapper

Original change's description:
> Add support for row-by-row jpeg encoding
> 
> Bug: 713862
> Change-Id: I787b7c49662a00b89ae0ef35845dfbd6be3e6fb1
> Reviewed-on: https://skia-review.googlesource.com/14641
> Commit-Queue: Matt Sarett <msarett@google.com>
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> 

TBR=msarett@google.com,scroggo@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Ic5a8d67e0d4a7733662586055ceff086a2ab335d
Reviewed-on: https://skia-review.googlesource.com/15140
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-05-02 17:08:35 +00:00
Matt Sarett
9b848d5749 Add support for row-by-row jpeg encoding
Bug: 713862
Change-Id: I787b7c49662a00b89ae0ef35845dfbd6be3e6fb1
Reviewed-on: https://skia-review.googlesource.com/14641
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2017-05-02 16:07:15 +00:00
Matt Sarett
68b8e3d50d Revert "Revert "Delete copyTo(Allocator), hide copyTo() behind flag""
This reverts commit 0122af08f6.

Reason for revert: Fixed Android callsite

Original change's description:
> Revert "Delete copyTo(Allocator), hide copyTo() behind flag"
> 
> This reverts commit d4a338f4d0.
> 
> Reason for revert: Looks like I missed something I was supposed to delete in Android.
> 
> Original change's description:
> > Delete copyTo(Allocator), hide copyTo() behind flag
> > 
> > Replace uses of copyTo() in Skia.
> > 
> > Bug: skia:6464
> > Change-Id: I921dc53a1c29a5176d18f05741f7c0b5a008e548
> > Reviewed-on: https://skia-review.googlesource.com/14502
> > Commit-Queue: Matt Sarett <msarett@google.com>
> > Reviewed-by: Mike Reed <reed@google.com>
> > 
> 
> TBR=msarett@google.com,reed@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> 
> Change-Id: I4d252940cc6a2462b030007055ea6c229471fc6e
> Reviewed-on: https://skia-review.googlesource.com/14602
> Reviewed-by: Matt Sarett <msarett@google.com>
> Commit-Queue: Matt Sarett <msarett@google.com>
> 

TBR=msarett@google.com,reviews@skia.org,reed@google.com

Change-Id: I81659a820f79f1958fda23cb62513065b57db99d
Reviewed-on: https://skia-review.googlesource.com/14640
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
2017-04-28 15:49:04 +00:00
Matt Sarett
0122af08f6 Revert "Delete copyTo(Allocator), hide copyTo() behind flag"
This reverts commit d4a338f4d0.

Reason for revert: Looks like I missed something I was supposed to delete in Android.

Original change's description:
> Delete copyTo(Allocator), hide copyTo() behind flag
> 
> Replace uses of copyTo() in Skia.
> 
> Bug: skia:6464
> Change-Id: I921dc53a1c29a5176d18f05741f7c0b5a008e548
> Reviewed-on: https://skia-review.googlesource.com/14502
> Commit-Queue: Matt Sarett <msarett@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> 

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

Change-Id: I4d252940cc6a2462b030007055ea6c229471fc6e
Reviewed-on: https://skia-review.googlesource.com/14602
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-04-27 20:08:45 +00:00
Matt Sarett
d4a338f4d0 Delete copyTo(Allocator), hide copyTo() behind flag
Replace uses of copyTo() in Skia.

Bug: skia:6464
Change-Id: I921dc53a1c29a5176d18f05741f7c0b5a008e548
Reviewed-on: https://skia-review.googlesource.com/14502
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2017-04-27 17:18:03 +00:00
Matt Sarett
d59948a171 SkPngCodec: Do not return kInvalidConversion on corrupt png
In this case, the fuzzer thinks there is a bug because we are
returning kInvalidConversion for a corrupt png file.

Bug: skia:6550
Change-Id: I33f588442f5eaa8a4d642e9328750779f9a9ef5d
Reviewed-on: https://skia-review.googlesource.com/14324
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2017-04-26 17:43:38 +00:00
Leon Scroggins III
249b8e3a2b Switch SkCodec to int for counts and indices
This matches other Skia APIs. size_t was adopted from blink/
GIFImageReader.

Change-Id: Ic83e59f0942f597c4fb834e623acd9886ad483fe
Reviewed-on: https://skia-review.googlesource.com/13274
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Reviewed-by: Chris Blume <cblume@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-04-17 17:38:35 +00:00
Mike Reed
4edb5d219e hide lockpixels api behind flag
guarded by SK_SUPPORT_OBSOLETE_LOCKPIXELS

needs https://codereview.chromium.org/2820873002/# to land first
Bug: skia:6481
Change-Id: I1c39902cbf6fe99f622adfa8192733b95f7fea09

Change-Id: I1c39902cbf6fe99f622adfa8192733b95f7fea09
Reviewed-on: https://skia-review.googlesource.com/13580
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-04-17 15:33:36 +00:00
Matt Sarett
46a45ba907 Revert "Manual revert: Add support for writing ICC profiles to webp encoder"
This reverts commit 4293a1e5f2.

Reason for revert: Relanding, libwebp updated in Android master

Original change's description:
> Manual revert: Add support for writing ICC profiles to webp encoder
> 
> Bug: skia:
> Change-Id: I4e70bee8c2ea8dbd5ae1e84aa097f5a7e2e62721
> Reviewed-on: https://skia-review.googlesource.com/11444
> Reviewed-by: Matt Sarett <msarett@google.com>
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Commit-Queue: Matt Sarett <msarett@google.com>
> 

TBR=msarett@google.com,scroggo@google.com,reviews@skia.org,jzern@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I73aa9e8183241ada4ec6451567bce3d3d18995cc
Reviewed-on: https://skia-review.googlesource.com/11523
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-04-06 20:34:45 +00:00
Matt Sarett
4293a1e5f2 Manual revert: Add support for writing ICC profiles to webp encoder
Bug: skia:
Change-Id: I4e70bee8c2ea8dbd5ae1e84aa097f5a7e2e62721
Reviewed-on: https://skia-review.googlesource.com/11444
Reviewed-by: Matt Sarett <msarett@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-04-06 14:43:11 +00:00
Matt Sarett
7abfb5e154 SkImageEncoder: Be more lenient on inputs
(1) Some clients want us to write ICC profiles, even though they
    have not opted into linear unpremultiplication.  This CL allows
    that behavior.

(2) We should not assert that the transfer function must be linear
    or srgb.  Particularly in non-linear blending modes, skia is
    willing to support a larger set of transfer functions.

(3) We still need to require linear or srgb when in kRespect transfer
    function mode.  We have not yet implemented linear unpremultiplies
    for arbitrary transfer functions.

Bug: skia:
Change-Id: Idce9f07c3d36eca4d78ede5e2650b2cab412904c
Reviewed-on: https://skia-review.googlesource.com/11349
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2017-04-05 22:56:37 +00:00
Matt Sarett
3dbef9f184 Revert "Revert "Add support for writing ICC profiles to webp encoder""
This reverts commit e87d7781db.

Reason for revert: Not the cause of the crashes.

Original change's description:
> Revert "Add support for writing ICC profiles to webp encoder"
> 
> This reverts commit 0c9d0b4e03.
> 
> Reason for revert: Looks like it's breaking a number of bots.
> 
> Original change's description:
> > Add support for writing ICC profiles to webp encoder
> > 
> > Bug: skia:
> > Change-Id: If0a8f84ed88da96924370b841f2283c0ff8e32ab
> > Reviewed-on: https://skia-review.googlesource.com/10212
> > Commit-Queue: Matt Sarett <msarett@google.com>
> > Reviewed-by: Leon Scroggins <scroggo@google.com>
> > 
> 
> TBR=msarett@google.com,scroggo@google.com,reviews@skia.org,jzern@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> 
> Change-Id: Ic06ad9f19a4d743b34f8d3bd33f171b9d74badcb
> Reviewed-on: https://skia-review.googlesource.com/11408
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> 

TBR=jvanverth@google.com,msarett@google.com,scroggo@google.com,reviews@skia.org,jzern@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I42f6ddefaf87c87b155640950b52a456952130ec
Reviewed-on: https://skia-review.googlesource.com/11410
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-04-05 22:33:28 +00:00
Jim Van Verth
e87d7781db Revert "Add support for writing ICC profiles to webp encoder"
This reverts commit 0c9d0b4e03.

Reason for revert: Looks like it's breaking a number of bots.

Original change's description:
> Add support for writing ICC profiles to webp encoder
> 
> Bug: skia:
> Change-Id: If0a8f84ed88da96924370b841f2283c0ff8e32ab
> Reviewed-on: https://skia-review.googlesource.com/10212
> Commit-Queue: Matt Sarett <msarett@google.com>
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> 

TBR=msarett@google.com,scroggo@google.com,reviews@skia.org,jzern@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Ic06ad9f19a4d743b34f8d3bd33f171b9d74badcb
Reviewed-on: https://skia-review.googlesource.com/11408
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2017-04-05 21:56:14 +00:00
Matt Sarett
0c9d0b4e03 Add support for writing ICC profiles to webp encoder
Bug: skia:
Change-Id: If0a8f84ed88da96924370b841f2283c0ff8e32ab
Reviewed-on: https://skia-review.googlesource.com/10212
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2017-04-05 21:33:14 +00:00
Mike Reed
6b3155c4be Revert[4] "clean up (partially) colortable api""""
Fixes:
- create temp api for android to pass nullptr
- don't release and access sk_sp<SkData> at the same time in parameters

This reverts commit b14131c185.

Bug: skia:
Change-Id: Ic0e4f62520ba9f35455499ed30d306ad19d998a8
Reviewed-on: https://skia-review.googlesource.com/11129
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
2017-04-03 19:29:38 +00:00
Mike Reed
b14131c185 Revert "Revert[2] "clean up (partially) colortable api"""
This reverts commit 9920b10f52.

Reason for revert: trying to get details on w2k failure

https://chromium-swarm.appspot.com/task?id=354345d34ba3b310&refresh=10

Caught exception 3221225477 EXCEPTION_ACCESS_VIOLATION, was running:
	unit test  HugeBlurImageFilter
	unit test  FontNames
	unit test  Codec_PngRoundTrip
	unit test  ClampRange
	unit test  FontHost
	unit test  ColorMatrixFilter
	f16 image scaled_codec_premul abnormal.wbmp
	565 image brd_android_codec_divisor_0.167 interlaced3.png_0.167
	unit test  Codec_png
	unit test  ImageFilterBlurLargeImage
	unit test  FontObj
	unit test  DrawText
	unit test  GrShape
	565 image brd_android_codec_divisor_0.333 interlaced2.png_0.333
	unit test  PathOpsOpCubicsThreaded
	unit test  PathOpsOpLoopsThreaded
	unit test  FontMgr
	unit test  ColorToHSVRoundTrip
	unit test  Image_Serialize_Encoding_Failure
Likely culprit:
	unit test  Image_Serialize_Encoding_Failure
step returned non-zero exit code: -1073741819


Original change's description:
> Revert[2] "clean up (partially) colortable api""
> 
> This reverts commit 1d1165ca65.
> 
> Bug: skia:
> Change-Id: Idbc0634ae3cec2e79f592d252de8751b077e6408
> Reviewed-on: https://skia-review.googlesource.com/11024
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
> 

TBR=reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Ia4e73434b083224baa36092c69526c2f59bb16aa
Reviewed-on: https://skia-review.googlesource.com/11025
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-04-01 17:21:52 +00:00
Mike Reed
9920b10f52 Revert[2] "clean up (partially) colortable api""
This reverts commit 1d1165ca65.

Bug: skia:
Change-Id: Idbc0634ae3cec2e79f592d252de8751b077e6408
Reviewed-on: https://skia-review.googlesource.com/11024
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-04-01 16:46:11 +00:00
Mike Klein
1d1165ca65 Revert "clean up (partially) colortable api"
This reverts commit 2e491a6a11.

Reason for revert: Windows unit tests failing?

Original change's description:
> clean up (partially) colortable api
> 
> Needs this to land: https://codereview.chromium.org/2789853002/
> 
> Bug: skia:
> Change-Id: I38d916a546b7fa64d000d973e695ddda24a589e7
> Reviewed-on: https://skia-review.googlesource.com/10600
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Matt Sarett <msarett@google.com>
> 

TBR=msarett@google.com,scroggo@google.com,reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I626e7edfcea82576a440dcaa851a04cedee6233f
Reviewed-on: https://skia-review.googlesource.com/10966
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-03-31 16:45:09 +00:00
Mike Reed
2e491a6a11 clean up (partially) colortable api
Needs this to land: https://codereview.chromium.org/2789853002/

Bug: skia:
Change-Id: I38d916a546b7fa64d000d973e695ddda24a589e7
Reviewed-on: https://skia-review.googlesource.com/10600
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
2017-03-31 15:39:31 +00:00
Matt Sarett
cf3f2347c8 Add SkTransferFunctionBehavior flag: Use in codec and encoder
This is a step towards removing the non-linear blending flag from
SkColorSpace.  The flag on SkColorSpace used to control the premul
behavior - now it is controlled by this option.

BUG=skia:

Change-Id: Ia29bd8c2b0596a93c6aa14332dcd9bd39e388a90
Reviewed-on: https://skia-review.googlesource.com/10008
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-03-24 13:19:53 +00:00
Matt Sarett
5df93de8ad Revert "Revert "Add support for writing icc profiles to the jpeg encoder""
This reverts commit dda14b9b7a.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Revert "Add support for writing icc profiles to the jpeg encoder"
> 
> This reverts commit 4ef0148202.
> 
> Reason for revert: This breaks the android autoroller.
> 
> Original change's description:
> > Add support for writing icc profiles to the jpeg encoder
> > 
> > Also, share the impl for skjpeg_error_mgr between the
> > jpeg decoder and encoder.  They are already identical
> > anyway.
> > 
> > BUG=skia:
> > 
> > Change-Id: I4d67f28126388fef3057d62b6e0b203e21ed4afb
> > Reviewed-on: https://skia-review.googlesource.com/10011
> > Reviewed-by: Leon Scroggins <scroggo@google.com>
> > Commit-Queue: Matt Sarett <msarett@google.com>
> > 
> 
> TBR=msarett@google.com,scroggo@google.com,reviews@skia.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
> 
> Change-Id: Idbb9918370e8384e39d6b7d1c3bcd9545ce4cfd1
> Reviewed-on: https://skia-review.googlesource.com/10017
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Derek Sollenberger <djsollen@google.com>
> 

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

Change-Id: I9c1df3f497a9187ac017e464976fd8f0333bad0e
Reviewed-on: https://skia-review.googlesource.com/10030
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-03-22 21:52:57 +00:00
Derek Sollenberger
dda14b9b7a Revert "Add support for writing icc profiles to the jpeg encoder"
This reverts commit 4ef0148202.

Reason for revert: This breaks the android autoroller.

Original change's description:
> Add support for writing icc profiles to the jpeg encoder
> 
> Also, share the impl for skjpeg_error_mgr between the
> jpeg decoder and encoder.  They are already identical
> anyway.
> 
> BUG=skia:
> 
> Change-Id: I4d67f28126388fef3057d62b6e0b203e21ed4afb
> Reviewed-on: https://skia-review.googlesource.com/10011
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Commit-Queue: Matt Sarett <msarett@google.com>
> 

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

Change-Id: Idbb9918370e8384e39d6b7d1c3bcd9545ce4cfd1
Reviewed-on: https://skia-review.googlesource.com/10017
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2017-03-22 18:54:30 +00:00
Matt Sarett
4ef0148202 Add support for writing icc profiles to the jpeg encoder
Also, share the impl for skjpeg_error_mgr between the
jpeg decoder and encoder.  They are already identical
anyway.

BUG=skia:

Change-Id: I4d67f28126388fef3057d62b6e0b203e21ed4afb
Reviewed-on: https://skia-review.googlesource.com/10011
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-03-22 17:34:32 +00:00
Derek Sollenberger
d68c41df1b Revert "Add support for writing icc profiles to the jpeg encoder"
This reverts commit e3b95ce468.

Reason for revert: This is breaking the Android auto roller. 

Original change's description:
> Add support for writing icc profiles to the jpeg encoder
> 
> Also, share the impl for skjpeg_error_mgr between the
> jpeg decoder and encoder.  They are already identical
> anyway.
> 
> BUG=skia:
> 
> Change-Id: I029312406dee8734744cc3058acd1f153aefcd83
> Reviewed-on: https://skia-review.googlesource.com/9971
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Commit-Queue: Matt Sarett <msarett@google.com>
> 

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

Change-Id: I05fb02610dbf4d9475f158d876d6495b0f7e9db4
Reviewed-on: https://skia-review.googlesource.com/10009
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2017-03-22 16:19:59 +00:00
Matt Sarett
e3b95ce468 Add support for writing icc profiles to the jpeg encoder
Also, share the impl for skjpeg_error_mgr between the
jpeg decoder and encoder.  They are already identical
anyway.

BUG=skia:

Change-Id: I029312406dee8734744cc3058acd1f153aefcd83
Reviewed-on: https://skia-review.googlesource.com/9971
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-03-22 13:57:58 +00:00
Matt Sarett
0e032be6b2 Add support for writing ICC profiles in png encodes
BUG=skia:

Change-Id: I99eb2f157f249ed09d724461ec4a1e31db70816a
Reviewed-on: https://skia-review.googlesource.com/9782
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-03-21 00:05:30 +00:00
Leon Scroggins III
0354c62e0b Set a limit on the size for BMP images
This limit matches the limit used by Chromium. I am not aware of any
real world BMPs that are larger than this (or even close to it), but
there are some invalid BMPs that are larger than this, leading to
crashes when we try to read a row.

BUG:34778578
BUG=skia:3617

Change-Id: I0f662e8d0d7bc0b084e86d0c9288b831e1b296d7
Reviewed-on: https://skia-review.googlesource.com/8966
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-02-24 21:25:44 +00:00
Mike Reed
185130c643 return and take SkImageGenerator as unique_ptr
BUG=skia:

Change-Id: I4bc11042dd1dbf1eabd40af206027bc65acc3186
Reviewed-on: https://skia-review.googlesource.com/8444
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2017-02-15 20:51:28 +00:00
Matt Sarett
5c49617f3d Reland "Respect canvas size and frame offset in webp decoder"
Original Change Reviewed At:
https://skia-review.googlesource.com/c/7800

CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN

BUG=skia:6185

Change-Id: I1a7732832d37920545c1775d7c7c65b43ed810f9
Reviewed-on: https://skia-review.googlesource.com/8157
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-02-07 22:40:13 +00:00
Matt Sarett
2bb94e8147 Revert "Reland "Respect canvas size and frame offset in webp decoder""
This reverts commit 604971e39a.

Reason for revert: Strange vk failures

Original change's description:
> Reland "Respect canvas size and frame offset in webp decoder"
> 
> Original Change Reviewed At:
> https://skia-review.googlesource.com/c/7800
> 
> CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN
> 
> BUG=skia:6185
> 
> Change-Id: I92baa9070e15ef3c62dd347c08c906c2715dda10
> Reviewed-on: https://skia-review.googlesource.com/8050
> Reviewed-by: Matt Sarett <msarett@google.com>
> Commit-Queue: Matt Sarett <msarett@google.com>
> 

TBR=msarett@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:6185
CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN

Change-Id: Ice93b62c55ea13fce83140567be16225ff0e2fdb
Reviewed-on: https://skia-review.googlesource.com/8123
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
2017-02-07 16:39:39 +00:00
Matt Sarett
604971e39a Reland "Respect canvas size and frame offset in webp decoder"
Original Change Reviewed At:
https://skia-review.googlesource.com/c/7800

CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN

BUG=skia:6185

Change-Id: I92baa9070e15ef3c62dd347c08c906c2715dda10
Reviewed-on: https://skia-review.googlesource.com/8050
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-02-06 18:55:41 +00:00
Robert Phillips
b3050b91f0 Revert "Respect canvas size and frame offset in webp decoder"
This reverts commit 0f33970c8d.

Reason for revert: msan complaint

Original change's description:
> Respect canvas size and frame offset in webp decoder
> 
> BUG=skia:6185
> 
> Change-Id: Id543cb689a5e33b800ebbc18f4a234e78a4c4298
> Reviewed-on: https://skia-review.googlesource.com/7800
> Commit-Queue: Matt Sarett <msarett@google.com>
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> 

TBR=borenet@google.com,msarett@google.com,scroggo@google.com,reviews@skia.org
# Not skipping CQ checks because original CL landed > 1 day ago.
BUG=skia:6185

Change-Id: Ie01dc7d7ebfebe36a235335d0d8cb28bccb2ecff
Reviewed-on: https://skia-review.googlesource.com/8046
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-02-06 13:43:16 +00:00
Matt Sarett
0f33970c8d Respect canvas size and frame offset in webp decoder
BUG=skia:6185

Change-Id: Id543cb689a5e33b800ebbc18f4a234e78a4c4298
Reviewed-on: https://skia-review.googlesource.com/7800
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2017-02-03 21:45:30 +00:00
Leon Scroggins III
c9942a15fa Do not crash when the resources are missing
In test_conversion_possible

BUG=skia:5314

Change-Id: Ia0e4178a262820b4161e55e07b0669f18322a64b
Reviewed-on: https://skia-review.googlesource.com/7742
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-01-30 16:41:47 +00:00
Leon Scroggins III
428865794b Set fOptions in SkCodec::getPixels
Subclasses sometimes try to read fOptions, but it used to not get set
for full decodes. As a result, they might be reading the Options from a
previous scanline/incremental decode. In addition to being wrong, this
is bad in the case of an fSubset pointing to a rectangle that no longer
exists.

So set fOptions in getPixels, prior to any attempts to read it by sub-
classes. Use a different workaround for the webp/incomplete bug. Set
fSubset to null prior to calling fillIncompleteImage. It can only be
non-null for webp, and in that case we do not want the fill call to
be using the subset width.

Modify the Codec_jpeg_rewind test to use an incomplete image, so that
it will also test fillIncompleteImage.

DM tests of inc0.webp and inc1.webp will verify that the incomplete
bug has not resurfaced.

BUG=skia:5772

Change-Id: If5e1e3c9a7f337183783299c0a9e58dcbbc84119
Reviewed-on: https://skia-review.googlesource.com/7682
Commit-Queue: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
2017-01-27 18:50:37 +00:00
Matt Sarett
74b16edd98 Add test for bad reuse of SkJpegCodec internal state
This is a test for the following fix:
https://skia-review.googlesource.com/c/7451/

b/34637813

Change-Id: I3fdb0d7d50537948039b75c3a22454e789ca810a
Reviewed-on: https://skia-review.googlesource.com/7454
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2017-01-25 17:27:39 +00:00
Leon Scroggins III
b3b24538e0 Use fixed size buffer for RLE bmps
An RLE bmp reports how many bytes it should contain. This number may be
incorrect, or it may be a very large number. Previously, we buffered
all bytes in a single allocation. Instead, use a fixed size buffer and
only read what fits into the buffer. We already have code to refill the
buffer if there is more data, so rely on that to keep reading.

Choose an arbitrary size for the buffer. It is larger than the maximum
possible number of bytes we need to read at once.

Add a test with a test image that reports a very large number for
the number of bytes it should contain. With the old method, we would
allocate 4 gigs of memory to decode this image, which is unnecessary
and may result in OOM.

BUG=b/33251605

Change-Id: I6d66eace626002725f62237617140cab99ce42f3
Reviewed-on: https://skia-review.googlesource.com/7028
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
2017-01-19 14:21:02 +00:00
Hal Canary
95e3c058ef SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h
* SkAutoFree moved to SkTemplates.h (now implmented with unique_ptr).

  * SkAutoMalloc and SkAutoSMalloc moved to SkAutoMalloc.h

  * "SkAutoFree X(sk_malloc_throw(N));" --> "SkAutoMalloc X(N);"

Revert "Revert 'SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h'"
This reverts commit c456b73fef.

Change-Id: Ie2c1a17c20134b8ceab85a68b3ae3e61c24fbaab
Reviewed-on: https://skia-review.googlesource.com/6886
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-01-11 18:55:34 +00:00
Kevin Lubick
c456b73fef Revert "SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h"
This reverts commit a5494f1170.

Reason for revert: Broke Google3

Original change's description:
> SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h
> 
>   * SkAutoFree moved to SkTemplates.h (now implmented with unique_ptr).
> 
>   * SkAutoMalloc and SkAutoSMalloc moved to SkAutoMalloc.h
> 
>   * "SkAutoFree X(sk_malloc_throw(N));" --> "SkAutoMalloc X(N);"
> 
> Change-Id: Idacd86ca09e22bf092422228599ae0d9bedded88
> Reviewed-on: https://skia-review.googlesource.com/4543
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Hal Canary <halcanary@google.com>
> 

TBR=halcanary@google.com,bungeman@google.com,reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Ie8bd176121c3ee83c110d66c0d0ac65e09bfc9c5
Reviewed-on: https://skia-review.googlesource.com/6884
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2017-01-11 17:22:12 +00:00
Hal Canary
a5494f1170 SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h
* SkAutoFree moved to SkTemplates.h (now implmented with unique_ptr).

  * SkAutoMalloc and SkAutoSMalloc moved to SkAutoMalloc.h

  * "SkAutoFree X(sk_malloc_throw(N));" --> "SkAutoMalloc X(N);"

Change-Id: Idacd86ca09e22bf092422228599ae0d9bedded88
Reviewed-on: https://skia-review.googlesource.com/4543
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-01-11 15:36:45 +00:00
Leon Scroggins III
58f100c02c Update libwebp to v0.5.2-rc2
This matches the version used by Chromium (crbug.com/675306) and
Android (https://android-review.googlesource.com/#/c/316352/).

Update our test. In the new version, we successfully decode a subset
from incomplete input that we previously did not.

Change-Id: I3442bf59ffdf223a723d8aa75f5b9b816b9e9c3c
Reviewed-on: https://skia-review.googlesource.com/6320
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2016-12-20 15:27:27 +00:00
Leon Scroggins III
932efed7c8 GIF: Avoid copying/storing data when possible
If the input SkStream has a length and position, do not copy and store
LZW blocks or ColorMaps. Instead, mark the position and size, and read
from the stream when necessary.

This will save memory in Chromium's use case, which has already
buffered all of its data.

In the case where we *do* need to copy, store it on the SkStreamBuffer.
This allows SkGifImageReader to have simpler code.

Add tests.

Change-Id: Ic65fa766328ae2e5974b2084bc2099e19aced731
Reviewed-on: https://skia-review.googlesource.com/6157
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2016-12-19 15:25:13 +00:00
Leon Scroggins III
0b24cbd9db Stop supporting kUnknown_BmpHeaderType
In SkBmpCodec, if the header size does not match a known header,
stop trying to create an SkCodec. We do not know of any BMPs with
arbitrarily sized headers, so this should not cause any real
regressions.

In addition, this fixes a bug where we attempt to read too much data
from a file. Since we attempt to read the header size in one read,
and a size reported by the "BMP" may be larger than SSIZE_MAX, this
will crash when reading from a file.

Add a test.

BUG:b/33651913

Change-Id: I0f3292db3124dc5ac5cbdbc07196bda130a49ba7
Reviewed-on: https://skia-review.googlesource.com/6150
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
2016-12-15 21:48:03 +00:00
Leon Scroggins III
56e3209c70 SkGifCodec: intersect frameRect with image size
When clearing due to SkCodecAnimation::RestoreBGColor_DisposalMethod,
intersect the frameRect with the image size to prevent clearing outside
the bounds of the allocated memory.

Add a test image, created by the fuzzer.

BUG=skia:6046

Change-Id: I43676d28f82abf093ef801752f3a9e881580924c
Reviewed-on: https://skia-review.googlesource.com/5860
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
2016-12-13 14:00:17 +00:00
Leon Scroggins III
83926346f1 Divide up CodecTest
Split up DEF_TEST(Codec, r) by type. Frequently when I am testing
locally I only want to test one type (e.g. I am testing changes to
SkGifCodec), and this allows me to skip past the ones I do not care
about.

It also speeds up my local runs, since most of the time is spent in
this single long test. Splitting them up means they can run in
parallel, halving run time. (Probably doesn't make a big difference
on bots, where more tests are running.)

Change-Id: Ic6babc20e1288dbb4fb255290f71523a033c7559
Reviewed-on: https://skia-review.googlesource.com/5622
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
2016-12-06 16:57:40 +00:00
Leon Scroggins III
d87fbee775 Do not create an SkRawCodec with zero dimensions
Add a test

BUG=skia:3534
BUG=b/33300701

Change-Id: Ifb3a824a36998c5e626c4ad58466845f49d18ebf
Reviewed-on: https://skia-review.googlesource.com/5568
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
2016-12-02 22:23:35 +00:00
Hal Canary
db6830162e SkImageEncoder: simplify API
(re-land 248ff02 & 2cb6cb7, with changes)

  - Hide SkImageEncoder class in private header.
  - SkImageEncoder::Type becomes SkEncodedImageFormat
  - SkEncodedFormat becomes SkEncodedImageFormat
  - SkImageEncoder static functions replaced with
    single function EncodeImage()
  - utility wrappers for EncodeImage() are in
    sk_tool_utils.h

TODO: remove link-time registration mechanism.
TODO: clean up clients use of API and flip the flag.
TODO: implement EncodeImage() in chromeium/skia/ext

Change-Id: I47d451e50be4d5c6c130869c7fa7c2857243d9f0
Reviewed-on: https://skia-review.googlesource.com/4909
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-on: https://skia-review.googlesource.com/5186
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2016-11-23 16:40:32 +00:00