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

Side by Side Diff: src/gpu/GrLayerCache.h

Issue 217343006: Add a GrLayerCache to GrContext (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 8 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 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 GrLayerCache_DEFINED
9 #define GrLayerCache_DEFINED
10
11 #include "GrAllocPool.h"
12 #include "GrTHashTable.h"
13 #include "GrPictureUtils.h"
14 #include "GrRect.h"
15
16 class GrAtlasMgr;
17 class GrGpu;
18 class GrPlot;
19 class SkPicture;
20
21 // GrAtlasLocation captures an atlased item's position in the atlas. This
22 // means the plot in which it resides and its bounds inside the plot.
23 // TODO: Make GrGlyph use one of these?
24 class GrAtlasLocation {
25 public:
26 GrAtlasLocation() : fPlot(NULL) {}
27
28 private:
29 GrPlot* fPlot;
30 GrIRect16 fBounds; // only valid is fPlot != NULL
31 };
32
33 // A GrAtlasedLayer encapsulates the atlasing information for a single saveLayer .
34 // It is roughly equivalent to a GrGlyph in the font caching system
35 class GrAtlasedLayer {
36 public:
37 GrAtlasedLayer() : fPicture(NULL) { }
38
39 const SkPicture* picture() const { return fPicture; }
40 int id() const { return fID; }
41
42 void init(SkPicture* picture, int id) {
43 fPicture = picture;
44 fID = id;
45 }
46
47 private:
48 SkPicture* fPicture;
bsalomon 2014/04/01 15:26:35 A bare ptr?
robertphillips 2014/04/01 16:51:49 I would greatly prefer a GenID on pictures.
bsalomon 2014/04/01 16:59:04 Is that something that could reasonably be done fi
49 int fID; // only valid if fPicture != NULL
50 GrAtlasLocation fLocation;
51 };
52
53 // The GrLayerCache caches pre-computed saveLayers for later rendering.
54 // Unlike the GrFontCache, this cache only has one GrAtlasMgr (for 8888)
55 // and one GrPlot (for the entire atlas). As such, the GrLayerCache
56 // roughly combines the functionality of the GrFontCache and GrTextStrike
57 // classes.
58 class GrLayerCache {
59 public:
60 GrLayerCache(GrGpu*);
61 ~GrLayerCache();
62
63 void freeAll();
64
65 const GrAtlasedLayer* findLayer(SkPicture* picture, int id);
66
67 private:
68 SkAutoTUnref<GrGpu> fGpu;
69 SkAutoTDelete<GrAtlasMgr> fAtlasMgr; // TODO: could lazily allocate
70
71 class PictureLayerKey;
72 GrTHashTable<GrAtlasedLayer, PictureLayerKey, 7> fLayerHash;
73 GrTAllocPool<GrAtlasedLayer> fLayerPool;
74
75 void init();
76 GrAtlasedLayer* createLayer(SkPicture* picture, int id);
77
78 };
79
80 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrLayerCache.cpp » ('j') | src/gpu/GrLayerCache.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698