gfx/skia/trunk/include/gpu/gl/GrGLExtensions.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 /*
michael@0 2 * Copyright 2013 Google Inc.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license that can be
michael@0 5 * found in the LICENSE file.
michael@0 6 */
michael@0 7
michael@0 8 #ifndef GrGLExtensions_DEFINED
michael@0 9 #define GrGLExtensions_DEFINED
michael@0 10
michael@0 11 #include "GrGLFunctions.h"
michael@0 12 #include "SkString.h"
michael@0 13 #include "SkTArray.h"
michael@0 14
michael@0 15 struct GrGLInterface;
michael@0 16
michael@0 17 /**
michael@0 18 * This helper queries the current GL context for its extensions, remembers them, and can be
michael@0 19 * queried. It supports both glGetString- and glGetStringi-style extension string APIs and will
michael@0 20 * use the latter if it is available.
michael@0 21 */
michael@0 22 class SK_API GrGLExtensions {
michael@0 23 public:
michael@0 24 GrGLExtensions() : fInitialized(false), fStrings(SkNEW(SkTArray<SkString>)) {}
michael@0 25
michael@0 26 GrGLExtensions(const GrGLExtensions&);
michael@0 27
michael@0 28 GrGLExtensions& operator=(const GrGLExtensions&);
michael@0 29
michael@0 30 void swap(GrGLExtensions* that) {
michael@0 31 fStrings.swap(&that->fStrings);
michael@0 32 SkTSwap(fInitialized, that->fInitialized);
michael@0 33 }
michael@0 34
michael@0 35 /**
michael@0 36 * We sometimes need to use this class without having yet created a GrGLInterface. This version
michael@0 37 * of init expects that getString is always non-NULL while getIntegerv and getStringi are non-
michael@0 38 * NULL if on desktop GL with version 3.0 or higher. Otherwise it will fail.
michael@0 39 */
michael@0 40 bool init(GrGLStandard standard,
michael@0 41 GrGLGetStringProc getString,
michael@0 42 GrGLGetStringiProc getStringi,
michael@0 43 GrGLGetIntegervProc getIntegerv);
michael@0 44
michael@0 45 bool isInitialized() const { return fInitialized; }
michael@0 46
michael@0 47 /**
michael@0 48 * Queries whether an extension is present. This will fail if init() has not been called.
michael@0 49 */
michael@0 50 bool has(const char[]) const;
michael@0 51
michael@0 52 /**
michael@0 53 * Removes an extension if present. Returns true if the extension was present before the call.
michael@0 54 */
michael@0 55 bool remove(const char[]);
michael@0 56
michael@0 57 /**
michael@0 58 * Adds an extension to list
michael@0 59 */
michael@0 60 void add(const char[]);
michael@0 61
michael@0 62 void reset() { fStrings->reset(); }
michael@0 63
michael@0 64 void print(const char* sep = "\n") const;
michael@0 65
michael@0 66 private:
michael@0 67 bool fInitialized;
michael@0 68 SkAutoTDelete<SkTArray<SkString> > fStrings;
michael@0 69 };
michael@0 70
michael@0 71 #endif

mercurial