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

Unified Diff: src/views/SkWindow.cpp

Issue 1845283003: Gamma-correctness pushed into Skia, top-down. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove helper function for old pixel-config method of enabling decode Created 4 years, 8 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
Index: src/views/SkWindow.cpp
diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp
index 481a1f9eb23ee490bd72f8bd8c340c30e3c23734..d42dc12b88e434cba4be813cee5ccae63aa806dd 100644
--- a/src/views/SkWindow.cpp
+++ b/src/views/SkWindow.cpp
@@ -70,6 +70,11 @@ void SkWindow::resize(int width, int height) {
void SkWindow::setColorType(SkColorType ct, SkColorProfileType pt) {
const SkImageInfo& info = fBitmap.info();
this->resize(SkImageInfo::Make(info.width(), info.height(), ct, kPremul_SkAlphaType, pt));
+
robertphillips 2016/04/05 12:54:34 // Comment ?
Brian Osman 2016/04/05 15:36:42 Acknowledged.
+ SkSurfaceProps props = this->getSurfaceProps();
+ uint32_t flags = (props.flags() & ~SkSurfaceProps::kAllowSRGBInputs_Flag) |
+ (SkColorAndProfileAreGammaCorrect(ct, pt) ? SkSurfaceProps::kAllowSRGBInputs_Flag : 0);
+ this->setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry()));
}
bool SkWindow::handleInval(const SkRect* localR) {
@@ -333,9 +338,7 @@ GrRenderTarget* SkWindow::renderTarget(const AttachmentInfo& attachmentInfo,
//
// Also, we may not have real sRGB support (ANGLE, in particular), so check for
// that, and fall back to L32:
- desc.fConfig = grContext->caps()->srgbSupport() &&
- (info().profileType() == kSRGB_SkColorProfileType ||
- info().colorType() == kRGBA_F16_SkColorType)
+ desc.fConfig = grContext->caps()->srgbSupport() && SkImageInfoIsGammaCorrect(info())
? kSkiaGamma8888_GrPixelConfig
: kSkia8888_GrPixelConfig;
desc.fOrigin = kBottomLeft_GrSurfaceOrigin;

Powered by Google App Engine
This is Rietveld 408576698