aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pipe/SkGPipeRead.cpp
diff options
context:
space:
mode:
authorGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-17 16:49:40 +0000
committerGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-17 16:49:40 +0000
commit4dffc596aa9fabd3104e66bc1f9957e8de4cb65d (patch)
tree36afc35e9cc8b9b38c17aabfb1be053141e381c0 /src/pipe/SkGPipeRead.cpp
parent284bf502c086d8fd4285f475a02e69d500c40219 (diff)
Use SkFlatDictionary in SkGPipe to take advantage of its new features.
Add a controller class to perform the allocation/unallocation for the dictionary and to provide an entry to be replaced, if replacements are allowed. TODO: Use LRU caching in my custom controller so replacements will be done less often. More refactoring on SkFlatDictionary so picture recording's use of the dictionary does not require going through the path to replace. Review URL: https://codereview.appspot.com/6345102 git-svn-id: http://skia.googlecode.com/svn/trunk@4639 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pipe/SkGPipeRead.cpp')
-rw-r--r--src/pipe/SkGPipeRead.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp
index 6f79e51f9a..e2cd151d28 100644
--- a/src/pipe/SkGPipeRead.cpp
+++ b/src/pipe/SkGPipeRead.cpp
@@ -105,14 +105,19 @@ public:
}
void addBitmap(int index) {
- SkASSERT(fBitmaps.count() == index);
- SkBitmap* bm = new SkBitmap();
+ index--;
+ SkBitmap* bm;
+ if(fBitmaps.count() == index) {
+ bm = SkNEW(SkBitmap);
+ *fBitmaps.append() = bm;
+ } else {
+ bm = fBitmaps[index];
+ }
bm->unflatten(*fReader);
- *fBitmaps.append() = bm;
}
SkBitmap* getBitmap(unsigned index) {
- return fBitmaps[index];
+ return fBitmaps[index - 1];
}
void addTypeface() {