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

Unified Diff: include/core/SkTemplates.h

Issue 14314008: Add FontMgr to DirectWrite. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Add matcher, fix GrGLCaps. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/utils/win/SkTScopedComPtr.h » ('j') | src/gpu/gl/GrGLCaps.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkTemplates.h
===================================================================
--- include/core/SkTemplates.h (revision 8915)
+++ include/core/SkTemplates.h (working copy)
@@ -295,11 +295,17 @@
template <size_t N, typename T> class SK_API SkAutoSTMalloc : SkNoncopyable {
public:
+ SkAutoSTMalloc() {
+ fPtr = NULL;
+ }
+
SkAutoSTMalloc(size_t count) {
- if (count <= N) {
+ if (count > N) {
+ fPtr = (T*)sk_malloc_flags(count * sizeof(T), SK_MALLOC_THROW | SK_MALLOC_TEMP);
+ } else if (count) {
fPtr = fTStorage;
} else {
- fPtr = (T*)sk_malloc_flags(count * sizeof(T), SK_MALLOC_THROW | SK_MALLOC_TEMP);
+ fPtr = NULL;
}
}
@@ -314,10 +320,12 @@
if (fPtr != fTStorage) {
sk_free(fPtr);
}
- if (count <= N) {
+ if (count > N) {
+ fPtr = (T*)sk_malloc_flags(count * sizeof(T), SK_MALLOC_THROW | SK_MALLOC_TEMP);
+ } else if (count) {
fPtr = fTStorage;
} else {
- fPtr = (T*)sk_malloc_flags(count * sizeof(T), SK_MALLOC_THROW | SK_MALLOC_TEMP);
+ fPtr = NULL;
}
}
« no previous file with comments | « no previous file | include/utils/win/SkTScopedComPtr.h » ('j') | src/gpu/gl/GrGLCaps.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698