Commit Graph

84 Commits

Author SHA1 Message Date
Mike Reed
0ca21466da remove dead code for STREAM_API
Bug: skia:
Change-Id: I5c5a65710af443c60a3d13fb309ce31309be7f74
Reviewed-on: https://skia-review.googlesource.com/49460
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-09-20 20:43:50 +00:00
Mike Reed
98c5d92ee6 Revert "Revert "use unique_ptr for stream api""
This reverts commit 7031b247c9.

Bug: skia:
Change-Id: I24c34bbee703f02994be8e206bcb9c10b5427d84
Reviewed-on: https://skia-review.googlesource.com/47541
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-09-16 02:04:23 +00:00
Mike Reed
7031b247c9 Revert "use unique_ptr for stream api"
This reverts commit 49f1f34438.

Reason for revert: broke win-chrome

../../third_party/skia/src/ports/SkFontMgr_win_dw.cpp(89): error C2228: left of '.release' must have class/struct/union
../../third_party/skia/src/ports/SkFontMgr_win_dw.cpp(89): note: type is 'SkStreamAsset *'
../../third_party/skia/src/ports/SkFontMgr_win_dw.cpp(89): note: did you intend to use '->' instead?


Original change's description:
> use unique_ptr for stream api
> 
> Bug: skia:6888
> Change-Id: I3459b4913982a7cae1c0061697c82cc65ad9a2d8
> Reviewed-on: https://skia-review.googlesource.com/26740
> Reviewed-by: Mike Klein <mtklein@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=mtklein@chromium.org,mtklein@google.com,bungeman@google.com,reed@google.com

Change-Id: Ic1e4af557317abd06b7f6b7f5056645df7e469f0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6888
Reviewed-on: https://skia-review.googlesource.com/47440
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-09-15 21:04:07 +00:00
Mike Reed
49f1f34438 use unique_ptr for stream api
Bug: skia:6888
Change-Id: I3459b4913982a7cae1c0061697c82cc65ad9a2d8
Reviewed-on: https://skia-review.googlesource.com/26740
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2017-09-15 18:46:45 +00:00
Hal Canary
4b972d1db3 SkFILEStream::Make: fix leak.
Change-Id: I218ae89f049df3d05380b46ca672bb1f6fcb5ea4
Reviewed-on: https://skia-review.googlesource.com/38962
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2017-08-28 20:36:07 +00:00
Ben Wagner
a93a14a998 Convert NULL and 0 to nullptr.
This was created by looking at warnings produced by clang's
-Wzero-as-null-pointer-constant. This updates most issues in
Skia code. However, there are places where GL and Vulkan want
pointer values which are explicitly 0, external headers which
use NULL directly, and possibly more uses in un-compiled
sources (for other platforms).

Change-Id: Id22fbac04d5c53497a53d734f0896b4f06fe8345
Reviewed-on: https://skia-review.googlesource.com/39521
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2017-08-28 17:48:57 +00:00
Mike Reed
847068ce83 add Make factory to SkMemoryStream (simplify call-sites)
Bug: skia:6888
Change-Id: Ia4e432673ed089a91229697c8dde0489f220000d
Reviewed-on: https://skia-review.googlesource.com/26884
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-26 15:59:49 +00:00
Hal Canary
6fee59b514 SkStream: DynamicMemoryWStream gets writeToAndReset
This is similar to copyToAndReset().

Also use this in SkPDF, for minor memory savings:
Single-threaded DM's peak RSS drops from 239MB
to 228MB.

Change-Id: I352a980e6dd54eb05d74cd057bd50e02312753b0
Reviewed-on: https://skia-review.googlesource.com/17714
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-05-24 19:49:35 +00:00
Leon Scroggins III
8d9201a798 Remove unnecessary SkFILEStream::getMemoryBase
It overrides the SkStream:: version, but does the same thing.

Change-Id: I857f2119a85bb3f942707ab3cef58b45a2cf4b7a
Reviewed-on: https://skia-review.googlesource.com/14828
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-05-01 15:17:15 +00:00
Brian Salomon
d3b65972aa Mark overridden destructors with 'override' and remove 'virtual'
This silences a new warning in clang 5.0

Change-Id: Ieb5b75a6ffed60107c3fd16075d2ecfd515b55e8
Reviewed-on: https://skia-review.googlesource.com/10006
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2017-03-22 16:06:18 +00:00
Mike Reed
2a65cc0ff1 test (and fix) clip_restriction in canvas
BUG=skia:

Change-Id: I86d25d0fd82be35d01471fba59f77b360be5373c
Reviewed-on: https://skia-review.googlesource.com/9995
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2017-03-22 14:59:56 +00:00
Hal Canary
0b83319b7f SkDynamicMemoryWStream::detachAsStream() returns unique_ptr
https://crrev.com/2747183002 must land first.
Change-Id: I65d1285a24d63c2c2f18662d511dea1c399511e1
Reviewed-on: https://skia-review.googlesource.com/9682
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2017-03-15 19:25:45 +00:00
Hal Canary
dabe8acb7f SkDynamicMemoryWStream::detachAsData more memory efficent
I did some testing with very large datasets, and the difference in max
RSS is measurable and significant.

Change-Id: I6bb2f795d5b4f6ebdba42c3089dc85a278355d48
Reviewed-on: https://skia-review.googlesource.com/9686
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2017-03-15 12:54:49 +00:00
Ben Wagner
4d1955c43a Fix SkFILEStream.
Change-Id: I8c66e4e3e857227aed3d0bc497982f4c0d96d917
Reviewed-on: https://skia-review.googlesource.com/9498
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2017-03-10 19:58:46 +00:00
Mike Reed
ff80c2ab30 remove SkMemoryWStream -- unused externally
BUG=skia:

Change-Id: Idbc9af4e703238871f56f623cd616fb7a5e686d3
Reviewed-on: https://skia-review.googlesource.com/6727
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-01-08 03:06:06 +00:00
Mike Reed
c3063e54cb remove SkDebugWStream and other cleanups
BUG=skia:

Change-Id: I06c07559b24411bd8bc4cba55bd8880f56486f76
Reviewed-on: https://skia-review.googlesource.com/6729
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-01-07 21:49:07 +00:00
Ben Wagner
884300dca5 Remove SkDynamicMemoryWStream::getOffset.
This method does the same thing as ::bytesWritten but has a confusing
name. It appears there are no external users, so remove it.

Change-Id: I06aed269200c34c2dda36605092f8ea37fcec693
Reviewed-on: https://skia-review.googlesource.com/6188
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2016-12-16 19:02:53 +00:00
Mike Reed
9c457ad27b speedup dynamicwstream
- move bytesWritten calculation to query the tail, allowing write() to be faster since it doesn't have to update anything extra per-write.
- enforce that all blocks are multiple-of-4 bytes big
- update the minimum block size to 4K

Before: 30ms
After:  23ms for non-4-bytes writes
        13ms for 4-bytes writes

BUG=skia:

Change-Id: Id06ecad3b9fe426747e02accf1393595e3356ce3
Reviewed-on: https://skia-review.googlesource.com/6087
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2016-12-15 19:49:31 +00:00
Mike Reed
5adaf8bf24 remove unused dynamicwstream.snapshotAsData()
Checking to invalidate this on every write() call has a measurable cost, so removing it both simplifies the class and speeds it up.

BUG=skia:

Change-Id: Idf0baa265c9a0b5d26d82fce948c61ed9b0810b1
Reviewed-on: https://skia-review.googlesource.com/6096
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2016-12-15 19:01:02 +00:00
bungeman
8dc1f62d23 Remove strange 'write' overload on SkDynamicMemoryWStream.
This should have been names 'overwrite' and appears to be unused.

Change-Id: Ic9dd21e6789fb079fcbc209ed5d074a77f3587cc
Reviewed-on: https://skia-review.googlesource.com/6092
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2016-12-14 22:24:45 +00:00
Mike Reed
09d9435835 remove lots of legacy flags
BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4209

Change-Id: I49ae36a9b2bb51a6470638d3264923ff4a4dea0a
Reviewed-on: https://skia-review.googlesource.com/4209
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2016-10-31 19:35:15 +00:00
bungeman
f93d71122e SkFontData to use smart pointers.
The SkFontData type is not exposed externally, so any method which uses
it can be updated to use smart pointers without affecting external
users. Updating this first will make updating the public API much
easier.

This also updates SkStreamAsset* SkStream::NewFromFile(const char*) to
std::unique_ptr<SkStreamAsset> SkStream::MakeFromFile(const char*). It
appears that no one outside Skia is currently using SkStream::NewfromFile
so this is a good time to update it as well.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2339273002

Committed: https://skia.googlesource.com/skia/+/d8c2476a8b1e1e1a1771b17e8dd4db8645914f8c
Review-Url: https://codereview.chromium.org/2339273002
2016-09-16 06:24:20 -07:00
bungeman
606add3dfb Revert of SkFontData to use smart pointers. (patchset #3 id:40001 of https://codereview.chromium.org/2339273002/ )
Reason for revert:
Killing Mac

Original issue's description:
> SkFontData to use smart pointers.
>
> The SkFontData type is not exposed externally, so any method which uses
> it can be updated to use smart pointers without affecting external
> users. Updating this first will make updating the public API much
> easier.
>
> This also updates SkStreamAsset* SkStream::NewFromFile(const char*) to
> std::unique_ptr<SkStreamAsset> SkStream::MakeFromFile(const char*). It
> appears that no one outside Skia is currently using SkStream::NewfromFile
> so this is a good time to update it as well.
>
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2339273002
>
> Committed: https://skia.googlesource.com/skia/+/d8c2476a8b1e1e1a1771b17e8dd4db8645914f8c

TBR=mtklein@chromium.org,halcanary@google.com,mtklein@google.com,reed@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.chromium.org/2343933002
2016-09-15 10:57:39 -07:00
bungeman
d8c2476a8b SkFontData to use smart pointers.
The SkFontData type is not exposed externally, so any method which uses
it can be updated to use smart pointers without affecting external
users. Updating this first will make updating the public API much
easier.

This also updates SkStreamAsset* SkStream::NewFromFile(const char*) to
std::unique_ptr<SkStreamAsset> SkStream::MakeFromFile(const char*). It
appears that no one outside Skia is currently using SkStream::NewfromFile
so this is a good time to update it as well.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2339273002

Review-Url: https://codereview.chromium.org/2339273002
2016-09-15 10:03:27 -07:00
reed
42943c8aa9 change SkStreams to work with sk_sp<SkData> instead of SkData*
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2333713002

Review-Url: https://codereview.chromium.org/2333713002
2016-09-12 12:01:44 -07:00
halcanary
cbc060a700 SkWStream::writeText inlined.
Motivation: This function is used throughout SkPDF.

Note that the compiler can usually inline the result of strlen() for literal strings.

Before:
    out/Release/nanobench -m WStreamWriteText -q
        Timer overhead: 24.2ns
        ! -> high variance, ? -> moderate variance
            micros   	bench
              6.10  	WStreamWriteText	nonrendering

After:
    out/Release/nanobench -m WStreamWriteText -q
        Timer overhead: 23.9ns
        ! -> high variance, ? -> moderate variance
            micros   	bench
              2.51  	WStreamWriteText	nonrendering

PDF runtime change: -0.8% ±0.04%.

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1844343004

Review URL: https://codereview.chromium.org/1844343004
2016-04-11 19:41:48 -07:00
caryclark
15e2a539fc add missing API
SkMemoryWStream needs SK_API to be accessible from PDFium.

R=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1808683002

Review URL: https://codereview.chromium.org/1808683002
2016-03-16 06:51:55 -07:00
reed
fde05114e6 Make sp variants for SkData
Review URL: https://codereview.chromium.org/1779263003
2016-03-11 13:02:28 -08:00
caryclark
7471fa4920 add fsync to try to get complete skps from webpage picture capture
R=reed@google.com,mtklein@google.com
BUG=skia:4691
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1530783003

Review URL: https://codereview.chromium.org/1530783003
2015-12-16 13:41:23 -08:00
scroggo
d61c384342 Allow SkStream::peek() to partially succeed
If the stream can peek less than requested, peek that amount. Return
the number of bytes peeked.

This simplifies crrev.com/1472123002. For a stream that is smaller than
14 bytes, it can successfully peek, meaning the client will not need to
fall back to read() + rewind(), which may fail if the stream can peek
but not rewind.

This CL revives code from patch set 3 of crrev.com/1044953002, where I
initially introduced peek() (including tests).

Add a test for SkFrontBufferedStream that verifies that peeking does
not make rewind() fail (i.e. by reading past the internal buffer).

BUG=skia:3257

Review URL: https://codereview.chromium.org/1490923005
2015-12-07 11:37:13 -08:00
halcanary
d76be9c79b Eliminate SkFILE: it always is the same as FILE.
Review URL: https://codereview.chromium.org/1467533003
2015-11-20 13:47:49 -08:00
mtklein
2766c00fc0 remove SkInstCnt
It's been outclassed by Valgrind and leak sanitizer,
and it seems to be causing problems for external folks building Skia.

I'm not sure why our own builds seem unaffected.

Latest thread:
https://groups.google.com/forum/#!topic/skia-discuss/oj9FsQwwSF0

BUG=skia:

Review URL: https://codereview.chromium.org/1217573002
2015-06-26 11:45:03 -07:00
scroggo
028a4135aa Add a method to read a stream without advancing it.
Add a virtual method on SkStream which will do a "peek" some bytes, so
that those bytes are read, but the next call to read will be
unaffected.

Implement peek for SkMemoryStream, where the implementation is simple
and obvious.

Implement peek on SkFrontBufferedStream.

Add tests.

Motivated by decoding streams which cannot be rewound.

TBR=reed@google.com

BUG=skia:3257

Review URL: https://codereview.chromium.org/1044953002
2015-04-02 13:19:51 -07:00
scroggo
5cffba8d8e Remove SkMemoryStream::peek()
I'd like to add a new API to SkStream for peeking - i.e. reading some
bytes without advancing the stream. This will be implemented for the
streams where it makes sense. I think the function should look
something like the following:

size_t peek(void* buffer, size_t bytesToRead) {
     return this->onPeek(buffer, bytesToRead);
}

virtual size_t onPeek(void* buffer, size_t bytesToRead) {
    return 0;   // unimplemented base class.
}

In order to avoid confusion, I'd like to remove SkMemoryStream::peek(),
which is not currently used internally, by Chrome, or by Android as far
as I can tell. There is also another function does the same thing:
getPosition().

BUG=skia:3257

Review URL: https://codereview.chromium.org/1039373002
2015-03-27 13:27:51 -07:00
mtklein
36352bf5e3 C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla}
NOPRESUBMIT=true

BUG=skia:
DOCS_PREVIEW= https://skia.org/?cl=1037793002

Review URL: https://codereview.chromium.org/1037793002
2015-03-25 18:17:32 -07:00
halcanary
7af21501a6 SkStream: Add SkDynamicMemoryWStream::writeToStream(SkWStream*)
Review URL: https://codereview.chromium.org/943423002
2015-02-23 12:18:00 -08:00
bungeman
2dca817edb Remove staging SkStream::unref().
SkStream::unref() was added to ease transitioning off of SkStream
deriving from SkRefCnt. It is no longer needed, remove it.

TBR=reed@google.com

Review URL: https://codereview.chromium.org/861413002
2015-01-22 06:08:31 -08:00
scroggo
a1193e4b0e Make SkStream *not* ref counted.
SkStream is a stateful object, so it does not make sense for it to have
multiple owners. Make SkStream inherit directly from SkNoncopyable.

Update methods which previously called SkStream::ref() (e.g.
SkImageDecoder::buildTileIndex() and SkFrontBufferedStream::Create(),
which required the existing owners to call SkStream::unref()) to take
ownership of their SkStream parameters and delete when done (including
on failure).

Switch all SkAutoTUnref<SkStream>s to SkAutoTDelete<SkStream>s. In some
cases this means heap allocating streams that were previously stack
allocated.

Respect ownership rules of SkTypeface::CreateFromStream() and
SkImageDecoder::buildTileIndex().

Update the comments for exceptional methods which do not affect the
ownership of their SkStream parameters (e.g.
SkPicture::CreateFromStream() and SkTypeface::Deserialize()) to be
explicit about ownership.

Remove test_stream_life, which tested that buildTileIndex() behaved
correctly when SkStream was a ref counted object. The test does not
make sense now that it is not.

In SkPDFStream, remove the SkMemoryStream member. Instead of using it,
create a new SkMemoryStream to pass to fDataStream (which is now an
SkAutoTDelete).

Make other pdf rasterizers behave like SkPDFDocumentToBitmap.

SkPDFDocumentToBitmap delete the SkStream, so do the same in the
following pdf rasterizers:

SkPopplerRasterizePDF
SkNativeRasterizePDF
SkNoRasterizePDF

Requires a change to Android, which currently treats SkStreams as ref
counted objects.

Review URL: https://codereview.chromium.org/849103004
2015-01-21 12:09:53 -08:00
mtklein
6f07665768 Simplify SkInstCnt
This code requires fewer macros to use it (just one), has less code in macro
definitions, and has simpler synchronization code (just atomic ints, no SkOnce,
no SkMutex, etc.)

A minor downside, we lose indentation and reverse-ordering in the final report:
  Leaked SkRefCntBase: 7
     Leaked SkFontMgr: 1
     Leaked SkWeakRefCnt: 1
         Leaked SkTypeface: 1
     Leaked SkFlattenable: 3
         Leaked SkXfermode: 3
     Leaked SkPathRef: 1
     Leaked SkPixelRef: 1
         Leaked SkMallocPixelRef: 1
becomes
  Leaked SkXfermode: 3
  Leaked SkMallocPixelRef: 1
  Leaked SkPixelRef: 1
  Leaked SkPathRef: 1
  Leaked SkFlattenable: 3
  Leaked SkTypeface: 1
  Leaked SkWeakRefCnt: 1
  Leaked SkFontMgr: 1
  Leaked SkRefCntBase: 7

This is motivated by wanting to land https://codereview.chromium.org/806473006/,
which makes sure all static use of SkOnce are in global scope.  The current
implementation of SkInstCnt uses them in function scope, which isn't safe.
BUG=skia:

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

Review URL: https://codereview.chromium.org/841263004
2015-01-13 08:22:44 -08:00
mtklein
72c9faab45 Fix up all the easy virtual ... SK_OVERRIDE cases.
This fixes every case where virtual and SK_OVERRIDE were on the same line,
which should be the bulk of cases.  We'll have to manually clean up the rest
over time unless I level up in regexes.

for f in (find . -type f); perl -p -i -e 's/virtual (.*)SK_OVERRIDE/\1SK_OVERRIDE/g' $f; end

BUG=skia:

Review URL: https://codereview.chromium.org/806653007
2015-01-09 10:06:40 -08:00
djsollen
c87dd2ce96 Enable unused param checking for public includes.
This CL cleans up the existing violations and enables the
build time check to ensure that we don't regress.

The motiviation behind this change is to allow clients who include
our headers to be able to build with this warning enabled.

Review URL: https://codereview.chromium.org/726923002
2014-11-14 11:11:46 -08:00
reed
83658305a1 remove confusing/unused stream methods
BUG=skia:
R=bungeman@google.com, djsollen@google.com

Author: reed@google.com

Review URL: https://codereview.chromium.org/563273003
2014-09-12 08:49:54 -07:00
commit-bot@chromium.org
490fb6b471 Add size_t bytesWritten() const to SkWStream.
BUG=skia:
R=reed@google.com, mtklein@google.com, robertphillips@google.com, bungeman@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/187653003

git-svn-id: http://skia.googlecode.com/svn/trunk@13684 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-03-06 17:16:26 +00:00
commit-bot@chromium.org
dcb8e54ffd This CL is motivated by the desire to make the skpinfo tool work a bit better. The main concern is that the assumptions made w.r.t. written bytes may not be valid for all SkWStream sub-classes.
R=bungeman@gmail.com, bungeman@google.com, reed@google.com, mtklein@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/182733008

git-svn-id: http://skia.googlecode.com/svn/trunk@13673 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-03-05 18:25:20 +00:00
commit-bot@chromium.org
eef834f2be DM: read image files without an extra copy
BUG=skia:
R=halcanary@google.com, reed@google.com, bsalomon@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/185263012

git-svn-id: http://skia.googlecode.com/svn/trunk@13669 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-03-05 15:37:11 +00:00
bungeman@google.com
04306921f4 Remove backward compatibility shims from SkStream.h.
R=reed@google.com

Review URL: https://codereview.chromium.org/68773009

git-svn-id: http://skia.googlecode.com/svn/trunk@12275 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-11-13 19:53:46 +00:00
bungeman@google.com
fab44db294 Clean up SkTypes.h.
This change removes sk_stdint.h since it is only needed for vs2008 and earlier.
This change removes SK_MMAP_SUPPORT define since it is no longer used.
This change removes the stdio.h include from SkTypes.h since on many systems
this is a very large header, few Skia files actually use it, it is
available everywhere standard, and SkDebugf should be used instead.

After this change there is no need for external users to put Skia's
include/config into their own list of includes, saving the headache
of having two header files of the same name and sometimes getting the
wrong one depending on include order.

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

Review URL: https://codereview.chromium.org/27044002

git-svn-id: http://skia.googlecode.com/svn/trunk@11738 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-11 18:50:45 +00:00
scroggo@google.com
4d213ab944 Handle SkStream::rewind properly.
include/core/SkStream.h:
Update documentation to state that rewinding a stream at the beginning
should return true. This is important because our decoders fail if
rewind returns false, assuming that the stream is not at the beginning.

src/images/SkImageDecoder_libpng.cpp:
If rewind fails, call png_error.

src/images/SkImageDecoder_libwebp.cpp:
If rewind fails, report an error and return false.

src/images/SkImageRef.cpp:
If rewind fails report an error and return false.
FIXME: Need to handle flattening properly. Should I perhaps move
writeStream into SkOrderedWriteBuffer?

src/images/SkJpegUtility.cpp:
Report a jpeg error on failure to rewind.

BUG=https://b.corp.google.com/issue?id=8432093
R=bungeman@google.com, djsollen@google.com, reed@google.com

Review URL: https://codereview.chromium.org/22861028

git-svn-id: http://skia.googlecode.com/svn/trunk@10977 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-28 13:08:54 +00:00
bungeman@google.com
c29f3d8c6d Add a detachAsStream to SkDynamicMemoryWStream.
R=reed@google.com

Committed: https://code.google.com/p/skia/source/detail?r=10171

Committed: https://code.google.com/p/skia/source/detail?r=10178

Review URL: https://codereview.chromium.org/19677002

git-svn-id: http://skia.googlecode.com/svn/trunk@10218 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-07-19 22:32:11 +00:00
bungeman@google.com
88682b77d1 Add a detachAsStream to SkDynamicMemoryWStream.
R=reed@google.com

Committed: https://code.google.com/p/skia/source/detail?r=10171

Review URL: https://codereview.chromium.org/19677002

git-svn-id: http://skia.googlecode.com/svn/trunk@10178 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-07-19 13:55:41 +00:00