diff options
author | scroggo@google.com <scroggo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-24 15:19:43 +0000 |
---|---|---|
committer | scroggo@google.com <scroggo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-24 15:19:43 +0000 |
commit | affeb0e73adaf4441957363136eaf04f0f8dc488 (patch) | |
tree | f80edbd2efd5ed4f67937cebb808e22288072d3e /cc/resources/picture.cc | |
parent | 0112c4cbc68aa7a0f9497e3f9424f726cf0926fb (diff) | |
download | chromium_src-affeb0e73adaf4441957363136eaf04f0f8dc488.zip chromium_src-affeb0e73adaf4441957363136eaf04f0f8dc488.tar.gz chromium_src-affeb0e73adaf4441957363136eaf04f0f8dc488.tar.bz2 |
Use the new function signature for EncodeBitmap.
Recent changes to Skia (https://codereview.chromium.org/15489004/)
modified the signature of SkPicture::EncodeBitmap. Modify chromium's
callers to use the new signature.
In gpu_benchmarking_extension's implementation of EncodeBitmap,
give priority to refEncodedData, which was previously the job
of SkOrderedWriteBuffer::writeBitmap, but no longer is.
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/15496006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202089 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/resources/picture.cc')
-rw-r--r-- | cc/resources/picture.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc index 93681ae..0c21e71 100644 --- a/cc/resources/picture.cc +++ b/cc/resources/picture.cc @@ -39,7 +39,7 @@ const int kPictureVersion = 1; // 4 bytes for version, 4 * 4 for each of the 2 rects. const unsigned int kMinPictureSizeBytes = 36; -bool EncodeBitmap(SkWStream* stream, const SkBitmap& bm) { +SkData* EncodeBitmap(size_t* offset, const SkBitmap& bm) { const int kJpegQuality = 80; std::vector<unsigned char> data; @@ -49,7 +49,7 @@ bool EncodeBitmap(SkWStream* stream, const SkBitmap& bm) { if (bm.isOpaque()) { SkAutoLockPixels lock_bitmap(bm); if (bm.empty()) - return false; + return NULL; encoding_succeeded = gfx::JPEGCodec::Encode( reinterpret_cast<unsigned char*>(bm.getAddr32(0, 0)), @@ -63,9 +63,11 @@ bool EncodeBitmap(SkWStream* stream, const SkBitmap& bm) { encoding_succeeded = gfx::PNGCodec::EncodeBGRASkBitmap(bm, false, &data); } - if (encoding_succeeded) - return stream->write(&data.front(), data.size()); - return false; + if (encoding_succeeded) { + *offset = 0; + return SkData::NewWithCopy(&data.front(), data.size()); + } + return NULL; } bool DecodeBitmap(const void* buffer, size_t size, SkBitmap* bm) { |