OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2015 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #ifndef SkImageCacherator_DEFINED | |
9 #define SkImageCacherator_DEFINED | |
10 | |
11 #include "SkImageGenerator.h" | |
12 | |
13 class GrContext; | |
14 class SkBitmap; | |
15 | |
16 class SkImageCacherator { | |
17 public: | |
18 // Takes ownership of the generator | |
19 SkImageCacherator(SkImageGenerator* gen); | |
scroggo
2015/08/13 19:59:13
Maybe this should be a factory, so we don't end up
reed1
2015/08/13 20:57:08
Done.
| |
20 ~SkImageCacherator(); | |
21 | |
22 const SkImageInfo& info() const { return fGenerator->getInfo(); } | |
23 SkImageGenerator* generator() const { return fGenerator; } | |
24 | |
25 /** | |
26 * On success (true), bitmap will point to the pixels for this generator. I f this returns | |
27 * false, the bitmap will be reset to empty. | |
28 * | |
29 * The cached bitmap is valid until it goes out of scope. | |
scroggo
2015/08/13 19:59:13
Are you saying the bitmap passed to this function
reed1
2015/08/13 20:57:08
Fixed.
| |
30 */ | |
31 bool lockAsBitmap(SkBitmap*); | |
32 | |
33 /** | |
34 * Returns a ref() on the texture produced by this generator. The caller mu st call unref() | |
35 * when it is done. Will return NULL on failure. | |
scroggo
2015/08/13 19:59:13
nullptr?
reed1
2015/08/13 20:57:08
Hmmm, I'm not sure that distinction is important i
| |
36 * | |
37 * The cached texture is valid until it is unref'd. | |
38 */ | |
39 GrTexture* lockAsTexture(GrContext*, SkImageUsageType); | |
40 | |
41 private: | |
42 bool tryLockAsBitmap(SkBitmap*); | |
43 GrTexture* tryLockAsTexture(GrContext*, SkImageUsageType); | |
44 | |
45 SkImageGenerator* fGenerator; | |
46 }; | |
47 | |
48 #endif | |
OLD | NEW |