Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkGraphics.h" | 10 #include "SkGraphics.h" |
| 11 | 11 |
| 12 #include "Sk64.h" | 12 #include "Sk64.h" |
| 13 #include "SkBlitter.h" | 13 #include "SkBlitter.h" |
| 14 #include "SkCanvas.h" | 14 #include "SkCanvas.h" |
| 15 #include "SkDiscardableMemory.h" | |
| 15 #include "SkFloat.h" | 16 #include "SkFloat.h" |
| 16 #include "SkGeometry.h" | 17 #include "SkGeometry.h" |
| 17 #include "SkMath.h" | 18 #include "SkMath.h" |
| 18 #include "SkMatrix.h" | 19 #include "SkMatrix.h" |
| 19 #include "SkPath.h" | 20 #include "SkPath.h" |
| 20 #include "SkPathEffect.h" | 21 #include "SkPathEffect.h" |
| 21 #include "SkPixelRef.h" | 22 #include "SkPixelRef.h" |
| 22 #include "SkRefCnt.h" | 23 #include "SkRefCnt.h" |
| 23 #include "SkRTConf.h" | 24 #include "SkRTConf.h" |
| 24 #include "SkScalerContext.h" | 25 #include "SkScalerContext.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 static const size_t kFontCacheLimitLen = sizeof(kFontCacheLimitStr) - 1; | 138 static const size_t kFontCacheLimitLen = sizeof(kFontCacheLimitStr) - 1; |
| 138 | 139 |
| 139 static const struct { | 140 static const struct { |
| 140 const char* fStr; | 141 const char* fStr; |
| 141 size_t fLen; | 142 size_t fLen; |
| 142 size_t (*fFunc)(size_t); | 143 size_t (*fFunc)(size_t); |
| 143 } gFlags[] = { | 144 } gFlags[] = { |
| 144 { kFontCacheLimitStr, kFontCacheLimitLen, SkGraphics::SetFontCacheLimit } | 145 { kFontCacheLimitStr, kFontCacheLimitLen, SkGraphics::SetFontCacheLimit } |
| 145 }; | 146 }; |
| 146 | 147 |
| 148 void SkGraphics::SetSkDiscardableMemoryFactory( | |
| 149 SkDiscardableMemoryFactory* factory) { | |
| 150 // TODO: Store factory pointer at the right place in Skia. | |
|
scroggo
2013/08/15 14:06:06
A global, like with the font cache uses? (getShare
ernstm
2013/08/15 20:26:37
Using the embedding pattern that was used for SkTh
| |
| 151 } | |
| 152 | |
| 147 /* flags are of the form param; or param=value; */ | 153 /* flags are of the form param; or param=value; */ |
| 148 void SkGraphics::SetFlags(const char* flags) { | 154 void SkGraphics::SetFlags(const char* flags) { |
| 149 if (!flags) { | 155 if (!flags) { |
| 150 return; | 156 return; |
| 151 } | 157 } |
| 152 const char* nextSemi; | 158 const char* nextSemi; |
| 153 do { | 159 do { |
| 154 size_t len = strlen(flags); | 160 size_t len = strlen(flags); |
| 155 const char* paramEnd = flags + len; | 161 const char* paramEnd = flags + len; |
| 156 const char* nextEqual = strchr(flags, '='); | 162 const char* nextEqual = strchr(flags, '='); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 171 if (nextEqual) { | 177 if (nextEqual) { |
| 172 val = (size_t) atoi(nextEqual + 1); | 178 val = (size_t) atoi(nextEqual + 1); |
| 173 } | 179 } |
| 174 (gFlags[i].fFunc)(val); | 180 (gFlags[i].fFunc)(val); |
| 175 break; | 181 break; |
| 176 } | 182 } |
| 177 } | 183 } |
| 178 flags = nextSemi + 1; | 184 flags = nextSemi + 1; |
| 179 } while (nextSemi); | 185 } while (nextSemi); |
| 180 } | 186 } |
| OLD | NEW |