aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkOrderedReadBuffer.cpp
Commit message (Collapse)AuthorAge
* Band-aid for subsetted bitmaps in SKPs.Gravatar scroggo@google.com2013-05-16
| | | | | | | | | | | | | | | | | | | | | | Partial fix for https://code.google.com/p/skia/issues/detail?id=1301. Instead of firing an assert when the recorded width and height do not match the encoded data's width and height, take a subset of the bitmap of the correct size. The bitmap may be drawn incorrectly, since it will not necessarily be the correct subset (though it will be the correct size). The complete fix will be to record the offset to the stream. Holding off on that since it will change the PICTURE_VERSION. There is still more work to do on read/writeBitmap, and I would like to change PICTURE_VERSION as few times as possible. BUG=https://code.google.com/p/skia/issues/detail?id=1301 R=djsollen@google.com Review URL: https://codereview.chromium.org/15159004 git-svn-id: http://skia.googlecode.com/svn/trunk@9169 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert "Allow supporting 1 older PICTURE_VERSION."Gravatar scroggo@google.com2013-05-07
| | | | | | | | | | | | | | This reverts commit deb9d6990ef2d153230340d960d86b0966f261e1. That change was just to allow us to bump the PICTURE_VERSION without changing the SKPs to the new one. Since it is not entirely reliable, I am removing it. R=rmistry@google.com Review URL: https://codereview.chromium.org/14741007 git-svn-id: http://skia.googlecode.com/svn/trunk@9035 2bbb7eff-a529-9590-31e7-b0007b416f81
* Allow supporting 1 older PICTURE_VERSION.Gravatar scroggo@google.com2013-04-30
| | | | | | | | | | | Allows https://codereview.chromium.org/14230022/ to be submitted without breaking bench_pictures and render_pictures. After DEPS roll and SKP capture, this will be reverted. Review URL: https://codereview.chromium.org/14158015 git-svn-id: http://skia.googlecode.com/svn/trunk@8918 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fixes for piping bitmaps with encoded data.Gravatar scroggo@google.com2013-04-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar goals as https://codereview.chromium.org/14437012. Builds on patch set 1 from that issue (https://codereview.chromium.org/14437012/#ps1). Instead of the changes in patch set 2 from that issue, this changes SkOrderedWriteBuffer::writeBitmap to store whether an SkBitmapHeap was used when to store the index of the SkBitmap. SkOrderedReadBuffer::readBitmap now uses that information to distinguish between using the heap and unflattening. In addition, writeBitmap now records the width/height first in all cases. If now SkBitmapHeapReader is attached, but an SkBitmapHeap was used to record the bitmap, reading will fail and provide the same red SkBitmap as in the case where the SkBitmap was encoded but could not be decoded. Updates the PICTURE_VERSION as well. The key differences in this CL to look at are in: SkOrderedWriteBuffer, SkOrderedReadBuffer, and SkPicture. BUG= R=djsollen@google.com Review URL: https://codereview.chromium.org/14230022 git-svn-id: http://skia.googlecode.com/svn/trunk@8917 2bbb7eff-a529-9590-31e7-b0007b416f81
* Use SkError for a bitmap that could not be decoded.Gravatar scroggo@google.com2013-04-25
| | | | | | | | | | | | When recreating an SkPicture from an SkStream, use the new error reporting system to report that an SkBitmap could not be decoded. Add a test that the parse error is thrown. Review URL: https://codereview.chromium.org/13892009 git-svn-id: http://skia.googlecode.com/svn/trunk@8866 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix a bunch of warnings, mainly around rowBytes.Gravatar scroggo@google.com2013-02-25
| | | | | | | | | | | My recent change changed the way SkBitmap::fRowBytes is stored, and parameter/return values referring to rowBytes were changed to type size_t. Change the storage back, and eliminate warnings resulting from returning a size_t. Review URL: https://codereview.appspot.com/7396059 git-svn-id: http://skia.googlecode.com/svn/trunk@7855 2bbb7eff-a529-9590-31e7-b0007b416f81
* Create SkLazyPixelRef which performs lazy decoding.Gravatar scroggo@google.com2013-02-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new pixel ref behaves similarly to SkImageRef, with some key differences: It does not depend on the images project. It requires an SkImageCache, which handles allocation and caching of the pixel memory. It takes a function signature for decoding which decodes into already allocated pixel memory rather than into an SkBitmap. Add two implementations of SkImageCache: SkLruImageCache and SkAshmemImageCache. Replace SkSerializationHelpers::DecodeBitmap with SkPicture::InstallPixelRefProc, and update sites that referenced it. SkBitmapFactory now sets the pixel ref to a new object of the new class SkLazyPixelRef, provided it has an SkImageCache for caching. Provide an option to do lazy decodes in render_pictures and bench_pictures. SkPicture: Eliminate the default parameters in the constructor. If a proc for decoding bitmaps is installed, use it to decode any encoded data in subpictures. When parsing deserializing subpictures, check for success. When serializing subpictures, pass the picture's bitmap encoder to the subpicture's call to serialize. Update BitmapFactoryTest to test its new behavior. BUG=https://code.google.com/p/skia/issues/detail?id=1008 BUG=https://code.google.com/p/skia/issues/detail?id=1009 Review URL: https://codereview.appspot.com/7060052 git-svn-id: http://skia.googlecode.com/svn/trunk@7835 2bbb7eff-a529-9590-31e7-b0007b416f81
* fix warning from scalar --> int32 conversionGravatar humper@google.com2013-01-07
| | | | | | | | BUG= Review URL: https://codereview.appspot.com/7065050 git-svn-id: http://skia.googlecode.com/svn/trunk@7061 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fixing refcount leak in SkBitmapHeap caused by collisions in SkFlatDictionaryGravatar junov@chromium.org2012-10-17
| | | | | | | | BUG=http://code.google.com/p/chromium/issues/detail?id=155875 TEST=DeferredCanvas unit test, subtest TestDeferredCanvasBitmapShaderNoLeak Review URL: https://codereview.appspot.com/6713048 git-svn-id: http://skia.googlecode.com/svn/trunk@5982 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add the ability to provide function pointers to SkPicture serializationGravatar scroggo@google.com2012-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Refactor Bitmap Storage for SkPicture using SkPipe's design.Gravatar djsollen@google.com2012-08-07
| | | | | | | | | | | | | | | | | | | | | Refactor Picture and Pipe bitmap storage into common data structure Update SkFlattenable buffers to be more modular. This CL is an effort to stage the conversion to named parameters for all SkFlattenable commands. This particular stage only does the following two things... 1. Move flattenable buffers from SkFlattenable.h into their own header. 2. Update and Add new read write methods for better clarity and convenience. BUG= Review URL: https://codereview.appspot.com/6445079 git-svn-id: http://skia.googlecode.com/svn/trunk@4994 2bbb7eff-a529-9590-31e7-b0007b416f81
* Update SkFlattenable buffers to be more modular.Gravatar djsollen@google.com2012-08-07
| | | | | | | | | | | | | | | | | This CL is an effort to stage the conversion to named parameters for all SkFlattenable commands. This particular stage only does the following two things... 1. Move flattenable buffers from SkFlattenable.h into their own header. 2. Update and Add new read write methods for better clarity and convenience. BUG= Review URL: https://codereview.appspot.com/6448095 git-svn-id: http://skia.googlecode.com/svn/trunk@4980 2bbb7eff-a529-9590-31e7-b0007b416f81
* Pipe factory names independently from the flattenables using them.Gravatar scroggo@google.com2012-08-01
| | | | | | | | | | | | | | | | Avoids an issue where a flattenable written twice might be written differently (the first time the flat data may have a name, whereas the second time it will have an index). Also add a test which confirms that identical flattenables will have the same SkFlatData representation. BUG=https://code.google.com/p/skia/issues/detail?id=721 TEST=FlatDataTest.cpp Review URL: https://codereview.appspot.com/6431057 git-svn-id: http://skia.googlecode.com/svn/trunk@4896 2bbb7eff-a529-9590-31e7-b0007b416f81
* export flags on the state of the world when a picture was serialized.Gravatar reed@google.com2012-06-25
| | | | | | | e.g. don't read/write functionptrs in that case (sizeof may be different for one) Review URL: https://codereview.appspot.com/6331050 git-svn-id: http://skia.googlecode.com/svn/trunk@4318 2bbb7eff-a529-9590-31e7-b0007b416f81
* Compiler complaints + some minor cleanupGravatar robertphillips@google.com2012-06-12
| | | | | | | | http://codereview.appspot.com/6295070/ git-svn-id: http://skia.googlecode.com/svn/trunk@4238 2bbb7eff-a529-9590-31e7-b0007b416f81
* Decouple the SkFlattenable from SkReader32/SkWriter32.Gravatar djsollen@google.com2012-04-12
The current impl for SkFlattenable read/write buffers is that they extend from SkReader32 and SkWriter32, but that dependency must be abstract if we are to add any other serialization format. Review URL: https://codereview.appspot.com/5999045 git-svn-id: http://skia.googlecode.com/svn/trunk@3654 2bbb7eff-a529-9590-31e7-b0007b416f81