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

Side by Side Diff: include/gpu/GrTypesPriv.h

Issue 1012723002: Use C locale for numerics when emitting shaders. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix mac includes Created 5 years, 9 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 | « no previous file | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('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 #ifndef GrTypesPriv_DEFINED 8 #ifndef GrTypesPriv_DEFINED
9 #define GrTypesPriv_DEFINED 9 #define GrTypesPriv_DEFINED
10 10
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 bool operator!=(const GrScissorState& other) const { return !(*this == other ); } 257 bool operator!=(const GrScissorState& other) const { return !(*this == other ); }
258 258
259 bool enabled() const { return fEnabled; } 259 bool enabled() const { return fEnabled; }
260 const SkIRect& rect() const { return fRect; } 260 const SkIRect& rect() const { return fRect; }
261 261
262 private: 262 private:
263 bool fEnabled; 263 bool fEnabled;
264 SkIRect fRect; 264 SkIRect fRect;
265 }; 265 };
266 266
267
268 /**
269 * Helper class for ensuring that we don't use the wrong locale when building sh aders. Android
270 * doesn't support locale in the NDK, so this is a no-op there.
271 */
272 #if !defined(SK_BUILD_FOR_ANDROID)
273 #include <locale.h>
267 #endif 274 #endif
275
276 #if defined(SK_BUILD_FOR_MAC)
277 #include <xlocale.h>
278 #endif
279
280 class GrAutoLocaleSetter {
281 public:
282 GrAutoLocaleSetter (const char* name) {
283 #if defined(SK_BUILD_FOR_WIN)
284 fOldPerThreadLocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
285 fOldLocale = setlocale(LC_ALL, name);
286 #elif !defined(SK_BUILD_FOR_ANDROID)
287 fLocale = newlocale(LC_ALL, name, 0);
288 fOldLocale = uselocale(fLocale);
289 #else
290 (void) name; // suppress unused param warning.
291 #endif
292 }
293
294 ~GrAutoLocaleSetter () {
295 #if defined(SK_BUILD_FOR_WIN)
296 setlocale(LC_ALL, fOldLocale);
297 _configthreadlocale(fOldPerThreadLocale);
298 #elif !defined(SK_BUILD_FOR_ANDROID)
299 SkASSERT(uselocale(fOldLocale) == fLocale);
300 freelocale(fLocale);
301 #endif
302 }
303
304 private:
305 #if defined(SK_BUILD_FOR_WIN)
306 int fOldPerThreadLocale;
307 const char* fOldLocale;
308 #elif !defined(SK_BUILD_FOR_ANDROID)
309 locale_t fOldLocale;
310 locale_t fLocale;
311 #endif
312 };
313
314 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698