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

Unified Diff: src/gpu/GrContext.cpp

Issue 1149773005: Add direct getter for GrCaps to GrContext. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: init caps in the right place Created 5 years, 7 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 | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrCoordTransform.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 5baf72209385afdc210faaf90134a07abc8e3cde..ca98ffb416a7f6fec0364cedbc38b8abcda5c6f5 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -138,6 +138,7 @@ static int32_t next_id() {
GrContext::GrContext() : fUniqueID(next_id()) {
fGpu = NULL;
+ fCaps = NULL;
fResourceCache = NULL;
fResourceProvider = NULL;
fPathRendererChain = NULL;
@@ -159,6 +160,7 @@ bool GrContext::init(GrBackend backend, GrBackendContext backendContext,
}
void GrContext::initCommon() {
+ fCaps = SkRef(fGpu->caps());
fResourceCache = SkNEW(GrResourceCache);
fResourceCache->setOverBudgetCallback(OverBudgetCB, this);
fResourceProvider = SkNEW_ARGS(GrResourceProvider, (fGpu, fResourceCache));
@@ -177,6 +179,7 @@ void GrContext::initCommon() {
GrContext::~GrContext() {
if (!fGpu) {
+ SkASSERT(!fCaps);
return;
}
@@ -191,6 +194,7 @@ GrContext::~GrContext() {
SkDELETE(fBatchFontCache);
fGpu->unref();
+ fCaps->unref();
SkSafeUnref(fPathRendererChain);
SkSafeUnref(fSoftwarePathRenderer);
}
@@ -258,18 +262,6 @@ GrTextContext* GrContext::createTextContext(GrRenderTarget* renderTarget,
////////////////////////////////////////////////////////////////////////////////
-bool GrContext::shaderDerivativeSupport() const {
- return fGpu->caps()->shaderCaps()->shaderDerivativeSupport();
-}
-
-bool GrContext::isConfigTexturable(GrPixelConfig config) const {
- return fGpu->caps()->isConfigTexturable(config);
-}
-
-bool GrContext::npotTextureTileSupport() const {
- return fGpu->caps()->npotTextureTileSupport();
-}
-
void GrContext::OverBudgetCB(void* data) {
SkASSERT(data);
@@ -290,18 +282,6 @@ void GrContext::TextBlobCacheOverBudgetCB(void* data) {
context->flush();
}
-int GrContext::getMaxTextureSize() const {
- return fGpu->caps()->maxTextureSize();
-}
-
-int GrContext::getMaxRenderTargetSize() const {
- return fGpu->caps()->maxRenderTargetSize();
-}
-
-int GrContext::getMaxSampleCount() const {
- return fGpu->caps()->maxSampleCount();
-}
-
////////////////////////////////////////////////////////////////////////////////
void GrContext::flush(int flagsBitfield) {
@@ -687,13 +667,9 @@ GrPathRenderer* GrContext::getPathRenderer(const GrDrawTarget* target,
}
////////////////////////////////////////////////////////////////////////////////
-bool GrContext::isConfigRenderable(GrPixelConfig config, bool withMSAA) const {
- return fGpu->caps()->isConfigRenderable(config, withMSAA);
-}
-
int GrContext::getRecommendedSampleCount(GrPixelConfig config,
SkScalar dpi) const {
- if (!this->isConfigRenderable(config, true)) {
+ if (!this->caps()->isConfigRenderable(config, true)) {
return 0;
}
int chosenSampleCount = 0;
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrCoordTransform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698