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

Side by Side Diff: src/views/SkWindow.cpp

Issue 2188463002: Remove SkSurfaceProps gamma-correctness flag entirely. (Closed) Base URL: https://skia.googlesource.com/skia.git@remove-is-gamma-correct
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | tests/SRGBMipMapTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkWindow.h" 8 #include "SkWindow.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkOSMenu.h" 10 #include "SkOSMenu.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 this->setSize(SkIntToScalar(fBitmap.width()), SkIntToScalar(fBitmap.height() )); 63 this->setSize(SkIntToScalar(fBitmap.width()), SkIntToScalar(fBitmap.height() ));
64 } 64 }
65 65
66 void SkWindow::resize(int width, int height) { 66 void SkWindow::resize(int width, int height) {
67 this->resize(fBitmap.info().makeWH(width, height)); 67 this->resize(fBitmap.info().makeWH(width, height));
68 } 68 }
69 69
70 void SkWindow::setColorType(SkColorType ct, sk_sp<SkColorSpace> cs) { 70 void SkWindow::setColorType(SkColorType ct, sk_sp<SkColorSpace> cs) {
71 const SkImageInfo& info = fBitmap.info(); 71 const SkImageInfo& info = fBitmap.info();
72 this->resize(SkImageInfo::Make(info.width(), info.height(), ct, kPremul_SkAl phaType, cs)); 72 this->resize(SkImageInfo::Make(info.width(), info.height(), ct, kPremul_SkAl phaType, cs));
73
74 // Set the global flag that enables or disables "legacy" mode, depending on our format.
75 // With sRGB 32-bit or linear FP 16, we turn on gamma-correct handling of in puts:
76 SkSurfaceProps props = this->getSurfaceProps();
77 uint32_t flags = (props.flags() & ~SkSurfaceProps::kGammaCorrect_Flag) |
78 (SkColorAndColorSpaceAreGammaCorrect(ct, cs.get())
79 ? SkSurfaceProps::kGammaCorrect_Flag : 0);
80 this->setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry()));
81 } 73 }
82 74
83 bool SkWindow::handleInval(const SkRect* localR) { 75 bool SkWindow::handleInval(const SkRect* localR) {
84 SkIRect ir; 76 SkIRect ir;
85 77
86 if (localR) { 78 if (localR) {
87 SkRect devR; 79 SkRect devR;
88 SkMatrix inverse; 80 SkMatrix inverse;
89 if (!fMatrix.invert(&inverse)) { 81 if (!fMatrix.invert(&inverse)) {
90 return false; 82 return false;
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; 344 desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
353 desc.fSampleCnt = attachmentInfo.fSampleCount; 345 desc.fSampleCnt = attachmentInfo.fSampleCount;
354 desc.fStencilBits = attachmentInfo.fStencilBits; 346 desc.fStencilBits = attachmentInfo.fStencilBits;
355 GrGLint buffer; 347 GrGLint buffer;
356 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer); 348 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer);
357 desc.fRenderTargetHandle = buffer; 349 desc.fRenderTargetHandle = buffer;
358 return grContext->textureProvider()->wrapBackendRenderTarget(desc); 350 return grContext->textureProvider()->wrapBackendRenderTarget(desc);
359 } 351 }
360 352
361 #endif 353 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | tests/SRGBMipMapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698