Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: include/lazy/SkBitmapFactory.h

Issue 12433020: Improvements/additions to SkImageCache/SkLazyPixelRef. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Respond to comments. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gyp/tools.gyp ('k') | include/lazy/SkImageCache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkBitmapFactory_DEFINED 8 #ifndef SkBitmapFactory_DEFINED
9 #define SkBitmapFactory_DEFINED 9 #define SkBitmapFactory_DEFINED
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 * width, height, rowBytes and pixelref set. If fImageCache is non-NULL, or if fCacheSelector 60 * width, height, rowBytes and pixelref set. If fImageCache is non-NULL, or if fCacheSelector
61 * is set and returns non-NULL, the pixelref will lazily decode, and that S kImageCache will 61 * is set and returns non-NULL, the pixelref will lazily decode, and that S kImageCache will
62 * handle the pixel memory. Otherwise installPixelRef will do an immediate decode. 62 * handle the pixel memory. Otherwise installPixelRef will do an immediate decode.
63 * @param SkData Encoded data. 63 * @param SkData Encoded data.
64 * @param SkBitmap to install the pixel ref on. 64 * @param SkBitmap to install the pixel ref on.
65 * @return bool Whether or not a pixel ref was successfully installed. 65 * @return bool Whether or not a pixel ref was successfully installed.
66 */ 66 */
67 bool installPixelRef(SkData*, SkBitmap*); 67 bool installPixelRef(SkData*, SkBitmap*);
68 68
69 /** 69 /**
70 * A function for selecting an SkImageCache to use based on an SkImage::Inf o. 70 * An object for selecting an SkImageCache to use based on an SkImage::Info .
71 */ 71 */
72 typedef SkImageCache* (*CacheSelector)(const SkImage::Info&); 72 class CacheSelector : public SkRefCnt {
73
74 public:
75 /**
76 * Return an SkImageCache to use based on the provided SkImage::Info. I f the caller decides
77 * to hang on to the result, it will call ref, so the implementation sh ould not add a ref
78 * as a result of this call.
79 */
80 virtual SkImageCache* selectCache(const SkImage::Info&) = 0;
81 };
73 82
74 /** 83 /**
75 * Set the function to be used to select which SkImageCache to use. Mutuall y exclusive with 84 * Set the function to be used to select which SkImageCache to use. Mutuall y exclusive with
76 * fImageCache. 85 * fImageCache.
77 */ 86 */
78 void setCacheSelector(CacheSelector); 87 void setCacheSelector(CacheSelector*);
79 88
80 private: 89 private:
81 DecodeProc fDecodeProc; 90 DecodeProc fDecodeProc;
82 SkImageCache* fImageCache; 91 SkImageCache* fImageCache;
83 CacheSelector fCacheSelector; 92 CacheSelector* fCacheSelector;
84 }; 93 };
85 94
86 #endif // SkBitmapFactory_DEFINED 95 #endif // SkBitmapFactory_DEFINED
OLDNEW
« no previous file with comments | « gyp/tools.gyp ('k') | include/lazy/SkImageCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698