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

Side by Side Diff: src/gpu/gl/GrGLExtensions.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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 | « src/gpu/gl/GrGLCreateNullInterface.cpp ('k') | src/gpu/gl/GrGLFragmentProcessor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gl/GrGLExtensions.h" 8 #include "gl/GrGLExtensions.h"
9 #include "gl/GrGLDefines.h" 9 #include "gl/GrGLDefines.h"
10 #include "gl/GrGLUtil.h" 10 #include "gl/GrGLUtil.h"
(...skipping 13 matching lines...) Expand all
24 return -1; 24 return -1;
25 } 25 }
26 SkString extensionStr(ext); 26 SkString extensionStr(ext);
27 int idx = SkTSearch<SkString, extension_compare>(&strings.front(), 27 int idx = SkTSearch<SkString, extension_compare>(&strings.front(),
28 strings.count(), 28 strings.count(),
29 extensionStr, 29 extensionStr,
30 sizeof(SkString)); 30 sizeof(SkString));
31 return idx; 31 return idx;
32 } 32 }
33 33
34 GrGLExtensions::GrGLExtensions(const GrGLExtensions& that) : fStrings(SkNEW(SkTA rray<SkString>)) { 34 GrGLExtensions::GrGLExtensions(const GrGLExtensions& that) : fStrings(new SkTArr ay<SkString>) {
35 *this = that; 35 *this = that;
36 } 36 }
37 37
38 GrGLExtensions& GrGLExtensions::operator=(const GrGLExtensions& that) { 38 GrGLExtensions& GrGLExtensions::operator=(const GrGLExtensions& that) {
39 *fStrings = *that.fStrings; 39 *fStrings = *that.fStrings;
40 fInitialized = that.fInitialized; 40 fInitialized = that.fInitialized;
41 return *this; 41 return *this;
42 } 42 }
43 43
44 bool GrGLExtensions::init(GrGLStandard standard, 44 bool GrGLExtensions::init(GrGLStandard standard,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return find_string(*fStrings, ext) >= 0; 105 return find_string(*fStrings, ext) >= 0;
106 } 106 }
107 107
108 bool GrGLExtensions::remove(const char ext[]) { 108 bool GrGLExtensions::remove(const char ext[]) {
109 SkASSERT(fInitialized); 109 SkASSERT(fInitialized);
110 int idx = find_string(*fStrings, ext); 110 int idx = find_string(*fStrings, ext);
111 if (idx >= 0) { 111 if (idx >= 0) {
112 // This is not terribly effecient but we really only expect this functio n to be called at 112 // This is not terribly effecient but we really only expect this functio n to be called at
113 // most a handful of times when our test programs start. 113 // most a handful of times when our test programs start.
114 SkAutoTDelete< SkTArray<SkString> > oldStrings(fStrings.detach()); 114 SkAutoTDelete< SkTArray<SkString> > oldStrings(fStrings.detach());
115 fStrings.reset(SkNEW(SkTArray<SkString>(oldStrings->count() - 1))); 115 fStrings.reset(new SkTArray<SkString>(oldStrings->count() - 1));
116 fStrings->push_back_n(idx, &oldStrings->front()); 116 fStrings->push_back_n(idx, &oldStrings->front());
117 fStrings->push_back_n(oldStrings->count() - idx - 1, &(*oldStrings)[idx] + 1); 117 fStrings->push_back_n(oldStrings->count() - idx - 1, &(*oldStrings)[idx] + 1);
118 return true; 118 return true;
119 } else { 119 } else {
120 return false; 120 return false;
121 } 121 }
122 } 122 }
123 123
124 void GrGLExtensions::add(const char ext[]) { 124 void GrGLExtensions::add(const char ext[]) {
125 int idx = find_string(*fStrings, ext); 125 int idx = find_string(*fStrings, ext);
126 if (idx < 0) { 126 if (idx < 0) {
127 // This is not the most effecient approach since we end up doing a full sort of the 127 // This is not the most effecient approach since we end up doing a full sort of the
128 // extensions after the add 128 // extensions after the add
129 fStrings->push_back().set(ext); 129 fStrings->push_back().set(ext);
130 SkTLessFunctionToFunctorAdaptor<SkString, extension_compare> cmp; 130 SkTLessFunctionToFunctorAdaptor<SkString, extension_compare> cmp;
131 SkTQSort(&fStrings->front(), &fStrings->back(), cmp); 131 SkTQSort(&fStrings->front(), &fStrings->back(), cmp);
132 } 132 }
133 } 133 }
134 134
135 void GrGLExtensions::print(const char* sep) const { 135 void GrGLExtensions::print(const char* sep) const {
136 if (NULL == sep) { 136 if (NULL == sep) {
137 sep = " "; 137 sep = " ";
138 } 138 }
139 int cnt = fStrings->count(); 139 int cnt = fStrings->count();
140 for (int i = 0; i < cnt; ++i) { 140 for (int i = 0; i < cnt; ++i) {
141 SkDebugf("%s%s", (*fStrings)[i].c_str(), (i < cnt - 1) ? sep : ""); 141 SkDebugf("%s%s", (*fStrings)[i].c_str(), (i < cnt - 1) ? sep : "");
142 } 142 }
143 } 143 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLCreateNullInterface.cpp ('k') | src/gpu/gl/GrGLFragmentProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698