aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkImageDecoder.h
Commit message (Collapse)AuthorAge
* SkNonCopyable should be used with private inheritance.Gravatar commit-bot@chromium.org2014-04-07
| | | | | | | | | | | | | | | This is mostly s/public SkNoncopyable/SkNoncopyable/g. Two classes (SkDrawLooper::Context and SkPicture::OperationList) don't actually work with SkNoncopyable because they introduce a virtual destructor. I added SkNoncopyableVirtual to make them work as intended. Sort of questionable whether they really need to be noncopyable in the first place, but I guess it doesn't hurt to keep the behavior the same. BUG=skia: R=reed@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/226183018 git-svn-id: http://skia.googlecode.com/svn/trunk@14081 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove deprecated function.Gravatar commit-bot@chromium.org2014-04-07
| | | | | | | | | | | | | We have switched Android to call decodeSubset, so this function is no longer necessary. R=reed@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/225413013 git-svn-id: http://skia.googlecode.com/svn/trunk@14072 2bbb7eff-a529-9590-31e7-b0007b416f81
* Deprecate two more functions using SK_ATTR_DEPRECATED macro.Gravatar tfarina@chromium.org2014-01-15
| | | | | | | | | | BUG=None TEST=None R=reed@google.com, scroggo@google.com Review URL: https://codereview.chromium.org/136973007 git-svn-id: http://skia.googlecode.com/svn/trunk@13079 2bbb7eff-a529-9590-31e7-b0007b416f81
* SkDecodingImageGenerator now uses SkStreamRewindableGravatar halcanary@google.com2013-12-09
| | | | | | | | | | | | | | | | | | This makes sense since Android will be giving us a stream and the decoders expect a stream. This also removes some glue code, DecodeMemoryToTarget, that works better using a SkImageGenerator. Motivation: This is a necessary step to move from SkImageRef to SkDiscardablePixelRef. SkImageDecoder::DecodeMemoryToTarget function removed. BUG= R=reed@google.com, scroggo@google.com Review URL: https://codereview.chromium.org/101973005 git-svn-id: http://skia.googlecode.com/svn/trunk@12560 2bbb7eff-a529-9590-31e7-b0007b416f81
* Big Cleanup: SkBitmapFactory, SkLazyPixelRef, SkImageCacheGravatar halcanary@google.com2013-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removed SkBitmapFactory since no clients were using it. New cache selection mechanism can simply pass a SkDiscardableMemory::Factory into the SkDiscardablePixelRef if non-default SkDiscardableMemory should be used. Removed BitmapFactoryTest. SkDiscardableMemory::Factory interface. Android will need this functionality in the future inside their BitmapFactory. Removed SkLazyPixelRef, since it's functionality is now subsumed into SkDiscardablePixelRef. Removed LazyPixelRef test. Modified SkDiscardablePixelRef to optionally allow it to use a SkDiscardableMemory::Factory. This tiny change makes it a replacement for SkLazyPixelRef. This functioanlity is also necessary for moving Android over to SkDiscardablePixelRef from SkImageRef in a later CL. Added a test for this. SkDecodingImageGenerator::Install can optionally pass a factory in to SkDiscardablePixelRef. Removed SkImageCache, SkLruImageCache, and SkPurgeableImageCache. This functionality can be handled much more cleanly by SkDiscardableMemory. New SkDiscardableMemoryPool class to replace SkLruImageCache. In a later CL, we will replace SkImageRef_GlobalPool (used by android) as well. This is a concrete implementation of SkDiscardableMemory::Factory. Added a test for this. modified gm/factory.cpp to remove dependnce on SkBitmapFactory + SkLruImageCache. Now uses SkDecodingImageGenerator + SkDiscardablePixelRef + SkDiscardableMemoryPool. SkImageDecoder::Target replaces SkBitmapFactory::Target. The DecodeMemoryToTarget function may disappear in the future. Moved SkLazyCachingPixelRef::DecodeProc replaces SkBitmapFactory::DecodeProc. This is a short term change, since another CL changes SkLazyCachingPixelRef to use SkImageGenerator instead of DecodeProc. Modified DrawBitmapRectTest to use SkDiscardablePixelRef instead of SkLazyPixelRef. tools/LazyDecodeBitmap.cpp now uses SkDecodingImageGenerator + SkDiscardablePixelRef instead of a SkBitmapFactory. bench_pictures uses the Global SkDiscardableMemoryPool instead of a global gLruImageCache. R=reed@google.com, scroggo@google.com Review URL: https://codereview.chromium.org/103033002 git-svn-id: http://skia.googlecode.com/svn/trunk@12515 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove deprecated setPrefConfigTable.Gravatar scroggo@google.com2013-12-04
| | | | | | | | | | | Safe once its only caller (in Android) has been updated. BUG=skia:1874 R=reed@google.com Review URL: https://codereview.chromium.org/99473004 git-svn-id: http://skia.googlecode.com/svn/trunk@12491 2bbb7eff-a529-9590-31e7-b0007b416f81
* restore [6] for setPrefConfigTable, accidentally changed with A1 CLGravatar reed@google.com2013-12-02
| | | | | | | | BUG= Review URL: https://codereview.chromium.org/99963002 git-svn-id: http://skia.googlecode.com/svn/trunk@12433 2bbb7eff-a529-9590-31e7-b0007b416f81
* Reverting r12427Gravatar rmistry@google.com2013-12-02
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@12428 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2013-12-02
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@12427 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert "Revert "remove kA1_Config, as it is no longer supported""Gravatar commit-bot@chromium.org2013-11-26
| | | | | | | | | | | | | This reverts commit 36d712f2d4c5c79719280ad95523e6aaa88b068e. BUG= R=rmistry@google.com, mtklein@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/86483002 git-svn-id: http://skia.googlecode.com/svn/trunk@12392 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert "remove kA1_Config, as it is no longer supported"Gravatar reed@google.com2013-11-25
| | | | | | This reverts commit 2d72d8b242eac6e9d30228f5b0a407236491c369. git-svn-id: http://skia.googlecode.com/svn/trunk@12387 2bbb7eff-a529-9590-31e7-b0007b416f81
* remove kA1_Config, as it is no longer supportedGravatar reed@google.com2013-11-25
| | | | | | | | | BUG= R=djsollen@google.com Review URL: https://codereview.chromium.org/83093005 git-svn-id: http://skia.googlecode.com/svn/trunk@12384 2bbb7eff-a529-9590-31e7-b0007b416f81
* move SkImage::ColorType into SkColorTypeGravatar reed@google.com2013-11-01
| | | | | | | | | | | | | | | | | | objective -- move clients over to SkImage tasks - use SkImageInfo instead of SkBitmap::Config - add support for colortables to SkImage - add drawImage to SkCanvas - return SkImage from readPixels This CL works towards the first task R=robertphillips@google.com Review URL: https://codereview.chromium.org/54363008 git-svn-id: http://skia.googlecode.com/svn/trunk@12077 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add an option on SkImageDecoder to skip writing 0s.Gravatar scroggo@google.com2013-10-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only implemented for PNG. Add a getter and setter, and sets the default to false in the constructor. Also copies the setting in copyFieldsToOther. Fix an indpendent bug where fDitherImage was not being copied in copyFieldsToOther. In SkScaledBitmapSampler::begin, consolidate the settings passed in by passing a const reference to the decoder. The decoder can be referenced for its settings of dither, unpremultiplied, and now skipping writing zeroes. Update callers to use the new API. In png decoder, rather than passing around a pointer to an initial read of getDitherImage, and potentially changing it, look at the field on the decoder itself, and modify it directly. This is a change in behavior - now if that same decoder is used to decode a different image, the dither setting has changed. I think this is okay because A) the typical use case is to use a new decoder for each decode, B) we do not make any promises that a decode does not change the decoder and C) it makes the code in SkScaledBitmapSampler much cleaner. In SkScaledBitmapScampler, add new row procs for skipping zeroes. Now that choosing the row proc has five dimensions (src config, dst config, dither, skip writing zeroes, unpremultiplied), use a new method: each src/dst combination has a function for choosing the right proc depending on the decoder. SkScaledBitmapScampler::RowProc is now public for convenience. Remove Sample_Gray_D8888_Unpremul, which is effectively no different from Sample_Gray_D8888. In cases where unpremultiplied was trivial, such as 565 and when sampling from gray, decoding may now succeed. Add a benchmark (currently disabled) for comparing the speed of skipping writing zeroes versus not skipping. For this particular image, which is mostly transparent pixels, normal decoding took about 3.6 milliseconds, while skipping zeroes in the decode took only about 2.5 milliseconds (this is on a Nexus 4). Presumably it would be slower on an image with a small amount of transparency, but there will be no slowdown for an image which reports that it has no transparency. In SkImageRef_ashmem, always skip writing zeroes, since ashmem memory is guaranteed to be initialized to 0. Add a flag to skip writing zeroes in skimage. Add a regression test for choosing the rowproc to ensure I did not change any behavior accidentally. BUG=skia:1661 R=reed@google.com Review URL: https://codereview.chromium.org/24269006 git-svn-id: http://skia.googlecode.com/svn/trunk@11558 2bbb7eff-a529-9590-31e7-b0007b416f81
* Change SkImageDecoders to take an SkStreamRewindable.Gravatar scroggo@google.com2013-09-25
| | | | | | | | | | | | | | | | | | | | Only affects factories, static functions that will use the factories, and subset decoding, which all require rewinding. The decoders themselves continue to take an SkStream. This is merely documentation stating which functions will possibly rewind the passed in SkStream. This is part of the general change to coordinate SkStreams with Android's streams, which don't necessarily support rewinding in all cases. Update callers to use SkStreamRewindable. BUG=skia:1572 R=bungeman@google.com, reed@google.com Review URL: https://codereview.chromium.org/23477009 git-svn-id: http://skia.googlecode.com/svn/trunk@11460 2bbb7eff-a529-9590-31e7-b0007b416f81
* Rewrite SkTRegistry to take any trivially-copyable type.Gravatar mtklein@google.com2013-09-04
| | | | | | | | | | | | | | Obviously these are all currently function pointers of type T(*)(P) for various T and P. In bench refactoring, I'm trying to register a function pointer of type T(*)(), which can't be done as is (passing P=void doesn't work). This also lets us register things like primitives, which is conceivable useful. BUG= R=reed@google.com, scroggo@google.com Review URL: https://codereview.chromium.org/23453031 git-svn-id: http://skia.googlecode.com/svn/trunk@11082 2bbb7eff-a529-9590-31e7-b0007b416f81
* Allow decoding JPEG into A8.Gravatar scroggo@google.com2013-07-18
| | | | | | | | | | | | | | | | If the original image is grayscale, allow decoding into A8. Change the size of PrefConfigTable to allow for 8bit gray, a new source config. Add a new sampler to SkScaledBitmapSampler to 'convert' to A8. FIXME: Should there be a dithered option for gray scale? R=reed@google.com Review URL: https://codereview.chromium.org/18083026 git-svn-id: http://skia.googlecode.com/svn/trunk@10157 2bbb7eff-a529-9590-31e7-b0007b416f81
* Allow ico decoder to decode PNG sub-images.Gravatar scroggo@google.com2013-07-09
| | | | | | | | | | | | Since Windows Vista, PNG can be embedded in an ICO file. Update our decoder to support this. BUG=https://code.google.com/p/skia/issues/detail?id=1398 R=djsollen@google.com Review URL: https://codereview.chromium.org/18655007 git-svn-id: http://skia.googlecode.com/svn/trunk@9932 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove bitmap reuse from SkImageDecoder.Gravatar scroggo@google.com2013-07-09
| | | | | | | | | | | | | | | Now that Android is using an SkBitmap::Allocator to reuse bitmap memory, remove the unnecessary code to handle bitmap reuse inside the decoders themselves. Leaves in the code for bitmap reuse in decodeSubset, which still may reuse bitmaps, and cropBitmap, which is called by decodeSubset. R=djsollen@google.com Review URL: https://codereview.chromium.org/17620004 git-svn-id: http://skia.googlecode.com/svn/trunk@9931 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add an option to create unpremultiplied bitmaps.Gravatar scroggo@google.com2013-06-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently they cannot be used directly by Skia, but the pixels can be used elsewhere. SkImageDecoder: Add functions to require unpremultiplied output and query the presence of the requirement SkImageDecoder_libpng: SkImageDecoder_libwebp: SkImageDecoder_WIC: Respect the requirement for unpremultiplied output. TODO: Fix SkImageDecoder_CG. SkScaledBitmapSampler: Add procs to skip premultiplication and a boolean parameter to use those procs. ImageDecodingTest: Test unpremultiplied bitmap decoding. SampleUnpremul: Add a sample which allows visually comparing between the unpremultiplied version (copied into a premultiplied bitmap, since drawing unpremultiplied is not currently supported) and a premultiplied version of image files. gm.h: Add a getter for the resource path, so Samples can use it. As of patch set 13, https://codereview.chromium.org/16816016/ and https://codereview.chromium.org/16983004/, which were approved separately. R=reed@google.com Review URL: https://codereview.chromium.org/16410009 git-svn-id: http://skia.googlecode.com/svn/trunk@9612 2bbb7eff-a529-9590-31e7-b0007b416f81
* Separate core and images project.Gravatar scroggo@google.com2013-05-31
SkImage calls functions on SkImageDecoder and SkImageEncoder. This is desired behavior, and it is also desired to include SkImage as a part of core. In order to keep core from depending on images, update SkImageDecoder_empty.cpp to implement all of SkImageDecoder and SkImageEncoder. This file will be built by chrome (in https://codereview.chromium.org/15960015). Move force_linking from SkImageDecoder.cpp to its own file. It must be called to force linking with the image decoders if desired. Call the function in tools that need it: sk_image render_pictures render_pdfs sk_hello filter bench_pictures debugger SkImageDecoder: Derive from SkNoncopyable, instead of duplicating its hiding of constructors. skhello: Return rather than trying to write a null SkData to the stream. Revert "Hamfistedly removed core dependence on images" (commit 0f05f682a90bc125323677abf3476e1027d174f5) and "Move SkImage::encode to SkImage_Codec.cpp." (commit 83e47a954d0bf65439f3d9c0c93213063dd70da3.) These two commits were temporary fixes that this change cleans up. SkSnapshot.cpp: Check for a NULL encoder returned by SkImageEncoder::Create. BUG=https://code.google.com/p/skia/issues/detail?id=1275 R=djsollen@google.com, robertphillips@google.com Review URL: https://codereview.chromium.org/15806010 git-svn-id: http://skia.googlecode.com/svn/trunk@9364 2bbb7eff-a529-9590-31e7-b0007b416f81