diff options
author | Brian Salomon <bsalomon@google.com> | 2018-05-11 10:14:21 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-11 14:47:27 +0000 |
commit | c7fe0f708ccbf12bf2ad1374ff307940d2c93880 (patch) | |
tree | cc4e63c994ac6af6ddab2f0fa063dbf800e2dd8a /src/image | |
parent | 244f754cdd6ba1c5917a65cd94fe0bf87e3a7339 (diff) |
Make GrCaps and GrShaderCaps private.
Moves getCaps() from GrContext to GrContextPriv and removes unused refCaps().
Change-Id: Ic6a8951b656c0d1b2773eae73bff8e88af819866
Reviewed-on: https://skia-review.googlesource.com/127389
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 16 | ||||
-rw-r--r-- | src/image/SkImage_Lazy.cpp | 6 | ||||
-rw-r--r-- | src/image/SkSurface_Gpu.cpp | 30 |
3 files changed, 27 insertions, 25 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 17a0a25f5a..62b97ae131 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -374,7 +374,7 @@ bool validate_backend_texture(GrContext* ctx, const GrBackendTexture& tex, GrPix return false; } - return ctx->caps()->validateBackendTexture(tex, ct, config); + return ctx->contextPriv().caps()->validateBackendTexture(tex, ct, config); } sk_sp<SkImage> SkImage::MakeFromTexture(GrContext* ctx, @@ -694,7 +694,8 @@ sk_sp<SkImage> SkImage_Gpu::MakePromiseTexture(GrContext* context, return nullptr; } GrPixelConfig config = kUnknown_GrPixelConfig; - if (!context->caps()->getConfigFromBackendFormat(backendFormat, colorType, &config)) { + if (!context->contextPriv().caps()->getConfigFromBackendFormat(backendFormat, colorType, + &config)) { return nullptr; } @@ -748,12 +749,13 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromEncoded(GrContext* context, sk_sp<Sk } // Some backends or drivers don't support (safely) moving resources between contexts - if (!context || !context->caps()->crossContextTextureSupport()) { + if (!context || !context->contextPriv().caps()->crossContextTextureSupport()) { return codecImage; } - if (limitToMaxTextureSize && (codecImage->width() > context->caps()->maxTextureSize() || - codecImage->height() > context->caps()->maxTextureSize())) { + auto maxTextureSize = context->contextPriv().caps()->maxTextureSize(); + if (limitToMaxTextureSize && + (codecImage->width() > maxTextureSize || codecImage->height() > maxTextureSize)) { SkAutoPixmapStorage pmap; SkImageInfo info = as_IB(codecImage)->onImageInfo(); if (!dstColorSpace) { @@ -801,7 +803,7 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromPixmap(GrContext* context, SkColorSpace* dstColorSpace, bool limitToMaxTextureSize) { // Some backends or drivers don't support (safely) moving resources between contexts - if (!context || !context->caps()->crossContextTextureSupport()) { + if (!context || !context->contextPriv().caps()->crossContextTextureSupport()) { return SkImage::MakeRasterCopy(originalPixmap); } @@ -814,7 +816,7 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromPixmap(GrContext* context, const SkPixmap* pixmap = &originalPixmap; SkAutoPixmapStorage resized; - int maxTextureSize = context->caps()->maxTextureSize(); + int maxTextureSize = context->contextPriv().caps()->maxTextureSize(); int maxDim = SkTMax(originalPixmap.width(), originalPixmap.height()); if (limitToMaxTextureSize && maxDim > maxTextureSize) { float scale = static_cast<float>(maxTextureSize) / maxDim; diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp index 035ddccfb8..9ca9d0d782 100644 --- a/src/image/SkImage_Lazy.cpp +++ b/src/image/SkImage_Lazy.cpp @@ -724,7 +724,7 @@ sk_sp<SkColorSpace> SkImage_Lazy::getColorSpace(GrContext* ctx, SkColorSpace* ds // may want to know what space the image data is in, so return it. return fInfo.refColorSpace(); } else { - CachedFormat format = this->chooseCacheFormat(dstColorSpace, ctx->caps()); + CachedFormat format = this->chooseCacheFormat(dstColorSpace, ctx->contextPriv().caps()); SkImageInfo cacheInfo = this->buildCacheInfo(format); return cacheInfo.refColorSpace(); } @@ -759,7 +759,7 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(GrContext* ctx, // Determine which cached format we're going to use (which may involve decoding to a different // info than the generator provides). - CachedFormat format = this->chooseCacheFormat(dstColorSpace, ctx->caps()); + CachedFormat format = this->chooseCacheFormat(dstColorSpace, ctx->contextPriv().caps()); // Fold the cache format into our texture key GrUniqueKey key; @@ -808,7 +808,7 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(GrContext* ctx, // 3. Ask the generator to return YUV planes, which the GPU can convert. If we will be mipping // the texture we fall through here and have the CPU generate the mip maps for us. if (!proxy && !willBeMipped && !ctx->contextPriv().disableGpuYUVConversion()) { - const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(cacheInfo, *ctx->caps()); + const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(cacheInfo, *ctx->contextPriv().caps()); ScopedGenerator generator(fSharedGenerator); Generator_GrYUVProvider provider(generator); diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index c81fc28417..b4e6acf0c2 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -6,22 +6,21 @@ */ #include "SkSurface_Gpu.h" - #include "GrBackendSurface.h" +#include "GrCaps.h" #include "GrContextPriv.h" #include "GrRenderTarget.h" #include "GrRenderTargetContextPriv.h" #include "GrRenderTargetProxyPriv.h" #include "GrTexture.h" - #include "SkCanvas.h" #include "SkDeferredDisplayList.h" #include "SkGpuDevice.h" +#include "SkImagePriv.h" #include "SkImage_Base.h" #include "SkImage_Gpu.h" -#include "SkImagePriv.h" -#include "SkSurface_Base.h" #include "SkSurfaceCharacterization.h" +#include "SkSurface_Base.h" #if SK_SUPPORT_GPU @@ -334,7 +333,7 @@ sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrContext* context, return nullptr; } - if (!SkSurface_Gpu::Valid(context->caps(), c.config(), c.colorSpace())) { + if (!SkSurface_Gpu::Valid(context->contextPriv().caps(), c.config(), c.colorSpace())) { return nullptr; } @@ -389,7 +388,7 @@ sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrContext* ctx, SkBudgeted budgeted sampleCount = SkTMax(1, sampleCount); GrMipMapped mipMapped = shouldCreateWithMips ? GrMipMapped::kYes : GrMipMapped::kNo; - if (!ctx->caps()->mipMapSupport()) { + if (!ctx->contextPriv().caps()->mipMapSupport()) { mipMapped = GrMipMapped::kNo; } @@ -433,17 +432,17 @@ bool validate_backend_texture(GrContext* ctx, const GrBackendTexture& tex, GrPix return false; } - if (!ctx->caps()->validateBackendTexture(tex, ct, config)) { + if (!ctx->contextPriv().caps()->validateBackendTexture(tex, ct, config)) { return false; } // We don't require that the client gave us an exact valid sample cnt. However, it must be // less than the max supported sample count and 1 if MSAA is unsupported for the color type. - if (!ctx->caps()->getRenderTargetSampleCount(sampleCnt, *config)) { + if (!ctx->contextPriv().caps()->getRenderTargetSampleCount(sampleCnt, *config)) { return false; } - if (texturable && !ctx->caps()->isConfigTexturable(*config)) { + if (texturable && !ctx->contextPriv().caps()->isConfigTexturable(*config)) { return false; } return true; @@ -467,7 +466,7 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context, const GrB if (!context) { return nullptr; } - if (!SkSurface_Gpu::Valid(context->caps(), texCopy.config(), colorSpace.get())) { + if (!SkSurface_Gpu::Valid(context->contextPriv().caps(), texCopy.config(), colorSpace.get())) { return nullptr; } sampleCnt = SkTMax(1, sampleCnt); @@ -501,15 +500,15 @@ bool validate_backend_render_target(GrContext* ctx, const GrBackendRenderTarget& return false; } - if (!ctx->caps()->validateBackendRenderTarget(rt, ct, config)) { + if (!ctx->contextPriv().caps()->validateBackendRenderTarget(rt, ct, config)) { return false; } if (rt.sampleCnt() > 1) { - if (ctx->caps()->maxRenderTargetSampleCount(*config) <= 1) { + if (ctx->contextPriv().caps()->maxRenderTargetSampleCount(*config) <= 1) { return false; } - } else if (!ctx->caps()->isConfigRenderable(*config)) { + } else if (!ctx->contextPriv().caps()->isConfigRenderable(*config)) { return false; } @@ -530,7 +529,7 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context, if (!validate_backend_render_target(context, rtCopy, &rtCopy.fConfig, colorType, colorSpace)) { return nullptr; } - if (!SkSurface_Gpu::Valid(context->caps(), rtCopy.config(), colorSpace.get())) { + if (!SkSurface_Gpu::Valid(context->contextPriv().caps(), rtCopy.config(), colorSpace.get())) { return nullptr; } @@ -565,7 +564,8 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont if (!context) { return nullptr; } - if (!tex.isValid() || !SkSurface_Gpu::Valid(context->caps(), tex.config(), colorSpace.get())) { + if (!tex.isValid() || + !SkSurface_Gpu::Valid(context->contextPriv().caps(), tex.config(), colorSpace.get())) { return nullptr; } sampleCnt = SkTMax(1, sampleCnt); |