diff options
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rw-r--r-- | src/gpu/GrContext.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index af9472409b..09985e6f79 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -335,6 +335,42 @@ sk_sp<GrContextThreadSafeProxy> GrContext::threadSafeProxy() { return fThreadSafeProxy; } +SkSurfaceCharacterization GrContextThreadSafeProxy::createCharacterization( + size_t cacheMaxResourceBytes, + const SkImageInfo& ii, const GrBackendFormat& backendFormat, + int sampleCnt, GrSurfaceOrigin origin, + const SkSurfaceProps& surfaceProps, + bool isMipMapped) { + if (!backendFormat.isValid()) { + return SkSurfaceCharacterization(); // return an invalid characterization + } + + // We're assuming GrFSAAType::kMixedSamples will never be specified via this code path + GrFSAAType FSAAType = sampleCnt > 1 ? GrFSAAType::kUnifiedMSAA : GrFSAAType::kNone; + + if (!fCaps->mipMapSupport()) { + isMipMapped = false; + } + + GrPixelConfig config = kUnknown_GrPixelConfig; + if (!fCaps->getConfigFromBackendFormat(backendFormat, ii.colorType(), &config)) { + return SkSurfaceCharacterization(); // return an invalid characterization + } + + // This surface characterization factory assumes that the resulting characterization is + // textureable. + if (!fCaps->isConfigTexturable(config)) { + return SkSurfaceCharacterization(); // return an invalid characterization + } + + return SkSurfaceCharacterization(sk_ref_sp<GrContextThreadSafeProxy>(this), + cacheMaxResourceBytes, + origin, ii.width(), ii.height(), config, FSAAType, sampleCnt, + SkSurfaceCharacterization::Textureable(true), + SkSurfaceCharacterization::MipMapped(isMipMapped), + ii.refColorSpace(), surfaceProps); +} + void GrContext::abandonContext() { ASSERT_SINGLE_OWNER @@ -1082,6 +1118,7 @@ bool GrContext::validPMUPMConversionExists() { ////////////////////////////////////////////////////////////////////////////// +// DDL TODO: remove 'maxResources' void GrContext::getResourceCacheLimits(int* maxResources, size_t* maxResourceBytes) const { ASSERT_SINGLE_OWNER if (maxResources) { |