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

Unified Diff: src/gpu/GrContext.cpp

Issue 2164363002: Add SkColorSpace to GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove ':' from comment Created 4 years, 5 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/GrDrawContext.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 4cb90c658e1b3346d9220812a202332d7970a6f2..6bb3ea6a2c977efe990c7cf605bfbb099723791e 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -357,7 +357,10 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
}
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top));
- sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(renderTarget)));
+ // TODO: Need to decide the semantics of this function for color spaces. Do we support
+ // conversion from 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<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(renderTarget), nullptr));
if (!drawContext) {
return false;
}
@@ -444,10 +447,14 @@ bool GrContext::readSurfacePixels(GrSurface* src,
tempDrawInfo.fTempSurfaceFit= SkBackingFit::kApprox;
}
}
+ // 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<GrDrawContext> tempDC = this->newDrawContext(tempDrawInfo.fTempSurfaceFit,
tempDrawInfo.fTempSurfaceDesc.fWidth,
tempDrawInfo.fTempSurfaceDesc.fHeight,
tempDrawInfo.fTempSurfaceDesc.fConfig,
+ nullptr,
tempDrawInfo.fTempSurfaceDesc.fSampleCnt,
tempDrawInfo.fTempSurfaceDesc.fOrigin);
if (tempDC) {
@@ -534,7 +541,8 @@ bool GrContext::applyGamma(GrRenderTarget* dst, GrTexture* src, SkScalar gamma){
SkSurfaceProps props(SkSurfaceProps::kGammaCorrect_Flag,
SkSurfaceProps::kLegacyFontHost_InitType);
- sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(dst), &props));
+ // TODO: Supply color space?
+ sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(dst), nullptr, &props));
if (!drawContext) {
return false;
}
@@ -596,7 +604,7 @@ bool GrContext::copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRe
src->flushWrites();
return fGpu->copySurface(dst, src, clippedSrcRect, clippedDstPoint);
}
- sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(dst->asRenderTarget())));
+ sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(dst->asRenderTarget()), nullptr));
if (!drawContext) {
return false;
}
@@ -636,14 +644,16 @@ int GrContext::getRecommendedSampleCount(GrPixelConfig config,
sk_sp<GrDrawContext> GrContext::drawContext(sk_sp<GrRenderTarget> rt,
+ sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* surfaceProps) {
ASSERT_SINGLE_OWNER
- return fDrawingManager->drawContext(std::move(rt), surfaceProps);
+ return fDrawingManager->drawContext(std::move(rt), std::move(colorSpace), surfaceProps);
}
sk_sp<GrDrawContext> GrContext::newDrawContext(SkBackingFit fit,
int width, int height,
GrPixelConfig config,
+ sk_sp<SkColorSpace> colorSpace,
int sampleCnt,
GrSurfaceOrigin origin,
const SkSurfaceProps* surfaceProps,
@@ -667,7 +677,7 @@ sk_sp<GrDrawContext> GrContext::newDrawContext(SkBackingFit fit,
}
sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(tex->asRenderTarget()),
- surfaceProps));
+ std::move(colorSpace), surfaceProps));
if (!drawContext) {
return nullptr;
}
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDrawContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698