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

Side by Side Diff: src/core/SkImageCacherator.h

Issue 1291803002: Extend SkImageGenerator to support natively generated GrTextures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « include/gpu/SkGr.h ('k') | src/core/SkImageCacherator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 /*
17 * Internal class to manage caching the output of an ImageGenerator.
18 */
19 class SkImageCacherator {
20 public:
21 // Takes ownership of the generator
22 SkImageCacherator(SkImageGenerator* gen);
23 ~SkImageCacherator();
24
25 const SkImageInfo& info() const { return fGenerator->getInfo(); }
26 SkImageGenerator* generator() const { return fGenerator; }
27
28 /**
29 * On success (true), bitmap will point to the pixels for this generator. I f this returns
30 * false, the bitmap will be reset to empty.
31 *
32 * The cached bitmap is valid until it goes out of scope.
33 */
34 bool lockAsBitmap(SkBitmap*);
35
36 /**
37 * Returns a ref() on the texture produced by this generator. The caller mu st call unref()
38 * when it is done. Will return NULL on failure.
39 *
40 * The cached texture is valid until it is unref'd.
41 */
42 GrTexture* lockAsTexture(GrContext*, SkImageUsageType);
43
44 private:
45 bool tryLockAsBitmap(SkBitmap*);
46 GrTexture* tryLockAsTexture(GrContext*, SkImageUsageType);
47
48 SkImageGenerator* fGenerator;
49 };
50
51 #endif
OLDNEW
« no previous file with comments | « include/gpu/SkGr.h ('k') | src/core/SkImageCacherator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698