aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/factory.cpp
Commit message (Collapse)AuthorAge
* "NULL !=" = NULLGravatar bsalomon2014-09-05
| | | | | | | | R=reed@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/544233002
* Cleanup usage of GetResourcePath() after commit ↵Gravatar tfarina2014-07-01
| | | | | | | | | | | | | | | | | bcbc1788b478b1e54079318ad073e8490aa66fae. There was a clean up opportunity left over after https://skia.googlesource.com/skia/+/bcbc1788b478b1e54079318ad073e8490aa66fae, that could make use of the default parameter of GetResourcePath() function to make some call sites cleaner. We decided to make it in a separate CL to make reviewer's and author's life easier, so we could catch errors and/or mistakes easily. BUG=None TEST=make all && out/Debug/dm && out/Debug/SampleApp R=mtklein@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/351133003
* Refactor how we handle resources path in Tests.Gravatar tfarina2014-06-18
| | | | | | | | | | | | | This idea emerged while doing https://codereview.chromium.org/321723002/ (commit 880914c35c8f7fc2e9c57134134c883baf66e538). BUG=None TEST=make tests && out/Debug/tests R=mtklein@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/346453002
* Cleanup: Get rid of make_isize() function from gm.h.Gravatar tfarina2014-06-09
| | | | | | | | | | | | | | | This helper function is not necessary. The same thing can be achieved by using SkISize::Make() provided by SkTSize API. BUG=skia:2645 TEST=make dm && out/Debug/dm R=robertphillips@google.com, reed@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/326523002
* Reland "Clean up Test's resourcePath code."Gravatar tfarina2014-06-09
| | | | | | | | | | | | | This relands commit 91359bed48bc006a4319da86eb26db3b2e6d4afb (Clean up Test's resourcePath code." BUG=None TEST=make dm && out/Debug/dm R=mtklein@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/321723002
* Revert of Clean up Test's resourcePath code. ↵Gravatar mtklein2014-06-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/319473003/) Reason for revert: Some benchmarks are written in a way that makes this change unsafe (e.g. const char* resPath = GetResourcePath().c_str(); in SkipZeroesBench) and Valgrind and ASAN caught that. We can try again after a more careful cleanup of GetResourcePath(). Original issue's description: > Clean up resourcePath code. > > 1) Make the implementation of SetResourcePath/GetResourcePath of GM and SkBenchmark match with the one in Test. > 2) Make gResourcePath a static pointer to const char and move it inside the classes. > > BUG=None > TEST=make tests && out/Debug/tests > make gm && out/Debug/gm > make bench && out/Debug/bench > R=mtklein@google.com > > Committed: https://skia.googlesource.com/skia/+/52e4f413ffe2d281f9e90ff2147db08083ffcba7 R=tfarina@chromium.org TBR=tfarina@chromium.org NOTREECHECKS=true NOTRY=true BUG=None Author: mtklein@google.com Review URL: https://codereview.chromium.org/320733002
* Clean up resourcePath code.Gravatar tfarina2014-06-07
| | | | | | | | | | | | | | | | 1) Make the implementation of SetResourcePath/GetResourcePath of GM and SkBenchmark match with the one in Test. 2) Make gResourcePath a static pointer to const char and move it inside the classes. BUG=None TEST=make tests && out/Debug/tests make gm && out/Debug/gm make bench && out/Debug/bench R=mtklein@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/319473003
* hide discardable factory from public imagegenerator apiGravatar commit-bot@chromium.org2014-05-27
| | | | | | | | | | | BUG=skia: R=halcanary@google.com, scroggo@google.com, djsollen@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/295243006 git-svn-id: http://skia.googlecode.com/svn/trunk@14889 2bbb7eff-a529-9590-31e7-b0007b416f81
* SkDiscardableMemoryPool to abstract classGravatar commit-bot@chromium.org2014-04-04
| | | | | | | | | | | | Motivation - we want to keep our public headers small. R=scroggo@google.com, reed@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/223403012 git-svn-id: http://skia.googlecode.com/svn/trunk@14063 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add Options to SkDecodingImageGenerator, simplify API.Gravatar halcanary@google.com2014-01-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: We want to remove redundant classes from Skia. To that end we want to remove SkImageRef and its subclasses and replace their uses with SkDiscardablePixelRef + SkDecodingImageGenerator. Since Android uses SkImageRef, we need to make sure that SkDecodingImageGenerator allows all of the settings that Android exposes in BitmapFactory.Options. To that end, we have created an Options struct for the SkDecodingImageGenerator which lets the client of the generator set sample size, dithering, and bitmap config. We have made the SkDecodingImageGenerator constructor private and replaced the SkDecodingImageGenerator::Install functions with a SkDecodingImageGenerator::Create functions (one for SkData and one for SkStream) which now take a SkDecodingImageGenerator::Options struct. Also added a ImageDecoderOptions test which loops through a list of sets of options and tries them on a set of 5 small encoded images. Also updated several users of SkDecodingImageGenerator::Install to follow new call signature - gm/factory.cpp, LazyDecodeBitmap.cpp, and PictureTest.cpp, CachedDecodingPixelRefTest.cpp. We also added a new ImprovedBitmapFactory Test which simulates the exact function that Android will need to modify to use this, installPixelRef() in BitmapFactory. R=reed@google.com, scroggo@google.com Committed: https://code.google.com/p/skia/source/detail?r=12744 Review URL: https://codereview.chromium.org/93703004 git-svn-id: http://skia.googlecode.com/svn/trunk@12855 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert of https://codereview.chromium.org/93703004/Gravatar commit-bot@chromium.org2013-12-18
| | | | | | | | | | | | | | | Reason for revert: Test failures R=scroggo@google.com, djsollen@google.com, reed@google.com, halcanary@google.com TBR=djsollen@google.com, halcanary@google.com, reed@google.com, scroggo@google.com NOTREECHECKS=true NOTRY=true Author: robertphillips@google.com Review URL: https://codereview.chromium.org/103753007 git-svn-id: http://skia.googlecode.com/svn/trunk@12747 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add Options to SkDecodingImageGenerator, simplify API.Gravatar halcanary@google.com2013-12-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: We want to remove redundant classes from Skia. To that end we want to remove SkImageRef and its subclasses and replace their uses with SkDiscardablePixelRef + SkDecodingImageGenerator. Since Android uses SkImageRef, we need to make sure that SkDecodingImageGenerator allows all of the settings that Android exposes in BitmapFactory.Options. To that end, we have created an Options struct for the SkDecodingImageGenerator which lets the client of the generator set sample size, dithering, and bitmap config. We have made the SkDecodingImageGenerator constructor private and replaced the SkDecodingImageGenerator::Install functions with a SkDecodingImageGenerator::Create functions (one for SkData and one for SkStream) which now take a SkDecodingImageGenerator::Options struct. Also added a ImageDecoderOptions test which loops through a list of sets of options and tries them on a set of 5 small encoded images. Also updated several users of SkDecodingImageGenerator::Install to follow new call signature - gm/factory.cpp, LazyDecodeBitmap.cpp, and PictureTest.cpp, CachedDecodingPixelRefTest.cpp. We also added a new ImprovedBitmapFactory Test which simulates the exact function that Android will need to modify to use this, installPixelRef() in BitmapFactory. R=reed@google.com, scroggo@google.com Review URL: https://codereview.chromium.org/93703004 git-svn-id: http://skia.googlecode.com/svn/trunk@12744 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
* Fixes for factory GM.Gravatar commit-bot@chromium.org2013-08-16
| | | | | | | | | | | | | | | | | | | Skip cross process pipe playback in gm/factory.cpp. Add a new flag to gm.h to skip only this form of pipe playback. In gmmain.cpp, use a bitmap encoder function for serialization that stores the encoded data if present, and use a bitmap decoder on deserialization. This allows gm/factory to work through serialization. Also respect the new pipe skipping flag. BUG=https://code.google.com/p/skia/issues/detail?id=1231 R=borenet@google.com Author: scroggo@google.com Review URL: https://chromiumcodereview.appspot.com/23192004 git-svn-id: http://skia.googlecode.com/svn/trunk@10786 2bbb7eff-a529-9590-31e7-b0007b416f81
* Reland 'Add path utils, plus a test for it.'Gravatar scroggo@google.com2013-05-28
| | | | | | | | | | | | | | | Build SkPathJoin and SkBasename on windows also. Previous CL did not build on Windows because the two functions were accidentally placed inside an ifdef that did not include windows. Move the functions to the top of the file, and add a comment by the endif for clarity. Previously reviewed at https://codereview.chromium.org/15747004/ Review URL: https://codereview.chromium.org/15740024 git-svn-id: http://skia.googlecode.com/svn/trunk@9295 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert "Add path utils, plus a test for it."Gravatar scroggo@google.com2013-05-24
| | | | | | | | | | This reverts commit d172374b46cae0bd5d7c024b9848f5bdafcc6a16. This CL broke on Windows. Review URL: https://codereview.chromium.org/15986004 git-svn-id: http://skia.googlecode.com/svn/trunk@9278 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add path utils, plus a test for it.Gravatar scroggo@google.com2013-05-24
| | | | | | | | | | | | | | | | | | | | | | | | SkOSFile: Added class SkOSPath with functions for modifying strings representing path names. OSPathTest.cpp: Test of the new utilities. factory.cpp: Use SkPathJoin. gmmain and gm_expectations: Use SkOSPath::SkPathJoin instead of a local version. skimage_main.cpp: Use the new location of SkPathJoin and SkBasename. R=epoger@google.com Review URL: https://codereview.chromium.org/15747004 git-svn-id: http://skia.googlecode.com/svn/trunk@9277 2bbb7eff-a529-9590-31e7-b0007b416f81
* Move MMap to SkData.Gravatar commit-bot@chromium.org2013-04-24
| | | | | | | | | | R=reed@google.com Author: bungeman@google.com Review URL: https://chromiumcodereview.appspot.com/14336003 git-svn-id: http://skia.googlecode.com/svn/trunk@8848 2bbb7eff-a529-9590-31e7-b0007b416f81
* Provide an option in bench_pictures to count pixel ram.Gravatar scroggo@google.com2013-03-04
| | | | | | | | | | | | | | In SkLruImageCache, provide an option to keep all pixels, and document the new behavior. In gm/factory.cpp, set the budget for the Lru image cache to 1, to retain (basically) the old behavior. BUG=https://code.google.com/p/skia/issues/detail?id=1010 Review URL: https://codereview.chromium.org/12378075 git-svn-id: http://skia.googlecode.com/svn/trunk@7972 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
* Create a factory to decode an SkBitmap from an SkData.Gravatar scroggo@google.com2012-11-29
Add a test and a GM for the factory, and a PNG file for it to decode. The PNG file is copyright-free, obtained from http://openclipart.org/detail/29213/paper-plane-by-ddoo In cmykjpeg, do not attempt to decode in the constructor, since it currently crashes on Mac (if you provide the correct resource path). Even when we fix this crash there is no need to do it in the constructor, since we create all of the gms in order to get their names (to determine whether to run them). Review URL: https://codereview.appspot.com/6847122 git-svn-id: http://skia.googlecode.com/svn/trunk@6618 2bbb7eff-a529-9590-31e7-b0007b416f81