aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrContext.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-04-24 10:57:28 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-25 11:44:20 +0000
commitdd3b3f41829d32d7eaf3eb4903570d49c2ba9ff8 (patch)
tree10b4a5919c2a7565510c7f6c4e2cbb311bb2822a /src/gpu/GrContext.cpp
parentc1889823de68ffd2ef08b5c1969d41c98034ec6a (diff)
Rm makeRenderTargetContext in favor of deferred version (take 3)
This is a reland of: https://skia-review.googlesource.com/c/13001/ (Rm makeRenderTargetContext in favor of deferred version) TBR=bsalomon@google.com Change-Id: If81f4d9fb889c091cd37ffde133d906fb3e37773 Reviewed-on: https://skia-review.googlesource.com/14027 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rw-r--r--src/gpu/GrContext.cpp63
1 files changed, 3 insertions, 60 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 7d6a90a44d..2a3852ce03 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -484,7 +484,7 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src,
// TODO: Need to decide the semantics of this function for color spaces. Do we support
// conversion to a passed-in color space? For now, specifying nullptr means that this
// path will do no conversion, so it will match the behavior of the non-draw path.
- sk_sp<GrRenderTargetContext> tempRTC = fContext->makeRenderTargetContext(
+ sk_sp<GrRenderTargetContext> tempRTC = fContext->makeDeferredRenderTargetContext(
tempDrawInfo.fTempSurfaceFit,
tempDrawInfo.fTempSurfaceDesc.fWidth,
tempDrawInfo.fTempSurfaceDesc.fHeight,
@@ -771,23 +771,6 @@ static inline GrPixelConfig GrPixelConfigFallback(GrPixelConfig config) {
}
}
-sk_sp<GrRenderTargetContext> GrContext::makeRenderTargetContextWithFallback(
- SkBackingFit fit,
- int width, int height,
- GrPixelConfig config,
- sk_sp<SkColorSpace> colorSpace,
- int sampleCnt,
- GrSurfaceOrigin origin,
- const SkSurfaceProps* surfaceProps,
- SkBudgeted budgeted) {
- if (!this->caps()->isConfigRenderable(config, sampleCnt > 0)) {
- config = GrPixelConfigFallback(config);
- }
-
- return this->makeRenderTargetContext(fit, width, height, config, std::move(colorSpace),
- sampleCnt, origin, surfaceProps, budgeted);
-}
-
sk_sp<GrRenderTargetContext> GrContext::makeDeferredRenderTargetContextWithFallback(
SkBackingFit fit,
int width, int height,
@@ -805,48 +788,6 @@ sk_sp<GrRenderTargetContext> GrContext::makeDeferredRenderTargetContextWithFallb
sampleCnt, origin, surfaceProps, budgeted);
}
-sk_sp<GrRenderTargetContext> GrContext::makeRenderTargetContext(SkBackingFit fit,
- int width, int height,
- GrPixelConfig config,
- sk_sp<SkColorSpace> colorSpace,
- int sampleCnt,
- GrSurfaceOrigin origin,
- const SkSurfaceProps* surfaceProps,
- SkBudgeted budgeted) {
- if (!this->caps()->isConfigRenderable(config, sampleCnt > 0)) {
- return nullptr;
- }
-
- GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fOrigin = origin;
- desc.fWidth = width;
- desc.fHeight = height;
- desc.fConfig = config;
- desc.fSampleCnt = sampleCnt;
-
- sk_sp<GrTexture> tex;
- if (SkBackingFit::kExact == fit) {
- tex = this->resourceProvider()->createTexture(desc, budgeted);
- } else {
- tex.reset(this->resourceProvider()->createApproxTexture(desc, 0));
- }
- if (!tex) {
- return nullptr;
- }
-
- sk_sp<GrRenderTargetContext> renderTargetContext(
- this->contextPriv().makeWrappedRenderTargetContext(sk_ref_sp(tex->asRenderTarget()),
- std::move(colorSpace), surfaceProps));
- if (!renderTargetContext) {
- return nullptr;
- }
-
- renderTargetContext->discard();
-
- return renderTargetContext;
-}
-
sk_sp<GrRenderTargetContext> GrContext::makeDeferredRenderTargetContext(
SkBackingFit fit,
int width, int height,
@@ -856,6 +797,8 @@ sk_sp<GrRenderTargetContext> GrContext::makeDeferredRenderTargetContext(
GrSurfaceOrigin origin,
const SkSurfaceProps* surfaceProps,
SkBudgeted budgeted) {
+ SkASSERT(kDefault_GrSurfaceOrigin != origin);
+
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fOrigin = origin;