aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-05-22 12:41:05 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-22 12:41:05 -0700
commit08bf86d1b7b03cc6829f2488d9adcb0502e84b97 (patch)
tree8f500d64bce505989fec53c8e4164cdda44df363 /include/gpu
parentf28cff71db2cbb1ff18a8fbf1e80ca761d1f69bc (diff)
Revert of Store context options on caps. (patchset #3 id:40001 of https://codereview.chromium.org/1158433006/)
Reason for revert: breaking chromeos build (???) Original issue's description: > Store context options on caps. > > Committed: https://skia.googlesource.com/skia/+/f28cff71db2cbb1ff18a8fbf1e80ca761d1f69bc TBR=joshualitt@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1151603005
Diffstat (limited to 'include/gpu')
-rw-r--r--include/gpu/GrCaps.h12
-rw-r--r--include/gpu/GrContext.h26
-rw-r--r--include/gpu/GrContextOptions.h24
-rw-r--r--include/gpu/GrTypesPriv.h10
4 files changed, 27 insertions, 45 deletions
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h
index be62d8a851..580017a9fe 100644
--- a/include/gpu/GrCaps.h
+++ b/include/gpu/GrCaps.h
@@ -14,8 +14,6 @@
#include "SkRefCnt.h"
#include "SkString.h"
-struct GrContextOptions;
-
class GrShaderCaps : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrShaderCaps)
@@ -105,7 +103,7 @@ class GrCaps : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrCaps)
- GrCaps(const GrContextOptions&);
+ GrCaps();
virtual SkString dump() const;
@@ -188,11 +186,6 @@ public:
return fConfigTextureSupport[config];
}
- bool suppressPrints() const { return fSupressPrints; }
-
- bool drawPathMasksToCompressedTexturesSupport() const {
- return fDrawPathMasksToCompressedTextureSupport; }
-
protected:
SkAutoTUnref<GrShaderCaps> fShaderCaps;
@@ -221,9 +214,6 @@ protected:
bool fConfigTextureSupport[kGrPixelConfigCnt];
private:
- bool fSupressPrints : 1;
- bool fDrawPathMasksToCompressedTextureSupport : 1;
-
typedef SkRefCnt INHERITED;
};
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index b6fef3d80c..a6fdf75d89 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -20,7 +20,6 @@
class GrAARectRenderer;
class GrBatchFontCache;
-struct GrContextOptions;
class GrDrawTarget;
class GrFragmentProcessor;
class GrGpu;
@@ -47,11 +46,20 @@ class SK_API GrContext : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(GrContext)
+ struct Options {
+ Options() : fDrawPathToCompressedTexture(false), fSuppressPrints(false) { }
+
+ // EXPERIMENTAL
+ // May be removed in the future, or may become standard depending
+ // on the outcomes of a variety of internal tests.
+ bool fDrawPathToCompressedTexture;
+ bool fSuppressPrints;
+ };
+
/**
* Creates a GrContext for a backend context.
*/
- static GrContext* Create(GrBackend, GrBackendContext, const GrContextOptions& options);
- static GrContext* Create(GrBackend, GrBackendContext);
+ static GrContext* Create(GrBackend, GrBackendContext, const Options* opts = NULL);
/**
* Only defined in test apps.
@@ -522,6 +530,7 @@ public:
GrResourceProvider* resourceProvider() { return fResourceProvider; }
const GrResourceProvider* resourceProvider() const { return fResourceProvider; }
GrResourceCache* getResourceCache() { return fResourceCache; }
+ bool suppressPrints() const { return fOptions.fSuppressPrints; }
// Called by tests that draw directly to the context via GrDrawTarget
void getTestTarget(GrTestTarget*);
@@ -539,6 +548,12 @@ public:
GrPathRendererChain::DrawType drawType = GrPathRendererChain::kColor_DrawType,
GrPathRendererChain::StencilSupport* stencilSupport = NULL);
+ /**
+ * This returns a copy of the the GrContext::Options that was passed to the
+ * constructor of this class.
+ */
+ const Options& getOptions() const { return fOptions; }
+
/** Prints cache stats to the string if GR_CACHE_STATS == 1. */
void dumpCacheStats(SkString*) const;
void printCacheStats() const;
@@ -584,10 +599,11 @@ private:
int fMaxTextureSizeOverride;
+ const Options fOptions;
const uint32_t fUniqueID;
- GrContext(); // init must be called after the constructor.
- bool init(GrBackend, GrBackendContext, const GrContextOptions& options);
+ GrContext(const Options&); // init must be called after the constructor.
+ bool init(GrBackend, GrBackendContext);
void initMockContext();
void initCommon();
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
deleted file mode 100644
index a2b2d2d9d7..0000000000
--- a/include/gpu/GrContextOptions.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrContextOptions_DEFINED
-#define GrContextOptions_DEFINED
-
-#include "GrTypes.h"
-
-struct GrContextOptions {
- GrContextOptions() : fDrawPathToCompressedTexture(false), fSuppressPrints(false) {}
-
- // EXPERIMENTAL
- // May be removed in the future, or may become standard depending
- // on the outcomes of a variety of internal tests.
- bool fDrawPathToCompressedTexture;
- // Suppress prints for the GrContext.
- bool fSuppressPrints;
-};
-
-#endif
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
index 9202742df9..eaf1aa4050 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -265,13 +265,13 @@ private:
};
#ifdef SK_DEBUG
-// Takes a pointer to a GrCaps, and will suppress prints if required
-#define GrCapsDebugf(caps, ...) \
- if (!caps->suppressPrints()) { \
- SkDebugf(__VA_ARGS__); \
+// Takes a pointer to a GrContext, and will suppress prints if required
+#define GrContextDebugf(context, ...) \
+ if (!context->suppressPrints()) { \
+ SkDebugf(__VA_ARGS__); \
}
#else
-#define GrCapsDebugf(caps, ...)
+#define GrContextDebugf(context, ...)
#endif
#endif