5a7c6be72b
and deserialization for encoding and decoding bitmaps. Remove kForceFlattenBitmapPixels_Flag, which is no longer used. When an SkOrderedReadBuffer needs to read a bitmap, if it does not have an image decoder, use a dummy bitmap. In GM, add a tolerance option for color differences, used when testing picture serialization, so it can assume two images are the same even though PNG encoding/decoding may have resulted in small differences. Create dummy implementations for SkImageDecoder and SkImageEncoder functions in SkImageDecoder_empty so that a project that does not want to include the images project it can still build. Allow ports to build without images project. In Mac's image encoder, copy 4444 to 8888 before encoding. Add SkWriter32::reservePad, to provide a pointer to write non 4 byte aligned data, padded with zeroes. In bench_ and render_ pictures, pass decode function to SkPicture creation from a stream. BUG=https://code.google.com/p/skia/issues/detail?id=842 Review URL: https://codereview.appspot.com/6551071 git-svn-id: http://skia.googlecode.com/svn/trunk@5818 2bbb7eff-a529-9590-31e7-b0007b416f81
36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
|
|
/*
|
|
* Copyright 2012 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkSerializationHelpers_DEFINED
|
|
#define SkSerializationHelpers_DEFINED
|
|
|
|
class SkBitmap;
|
|
class SkStream;
|
|
class SkWStream;
|
|
|
|
namespace SkSerializationHelpers {
|
|
/**
|
|
* Function to encode an SkBitmap to an SkWStream. A function with this signature can be passed
|
|
* to SkPicture::serialize() and SkOrderedWriteBuffer. The function should return true if it
|
|
* succeeds. Otherwise it should return false so that SkOrderedWriteBuffer can switch to
|
|
* another method of storing SkBitmaps.
|
|
*/
|
|
typedef bool (*EncodeBitmap)(SkWStream*, const SkBitmap&);
|
|
|
|
/**
|
|
* Function to decode an SkBitmap from an SkStream. A function with this signature can be
|
|
* passed to the SkStream constructor for SkPicture and SkOrderedReadBuffer to decode SkBitmaps
|
|
* which were previously encoded. The function should return true if it succeeds. Otherwise it
|
|
* should return false so that SkOrderedReadBuffer can skip the data and provide a dummy
|
|
* SkBitmap.
|
|
*/
|
|
typedef bool (*DecodeBitmap)(SkStream*, SkBitmap*);
|
|
}
|
|
|
|
#endif // SkSerializationHelpers_DEFINED
|