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

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

Issue 2069173002: Lots of progress switching to SkColorSpace rather than SkColorProfileType (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bad assert Created 4 years, 6 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/image/SkImage_Gpu.cpp ('k') | tests/ReadPixelsTest.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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 fBitmap.allocPixels(info); 60 fBitmap.allocPixels(info);
61 this->inval(nullptr); 61 this->inval(nullptr);
62 } 62 }
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, SkColorProfileType pt) { 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, pt)); 72 this->resize(SkImageInfo::Make(info.width(), info.height(), ct, kPremul_SkAl phaType, cs));
73 73
74 // Set the global flag that enables or disables "legacy" mode, depending on our format. 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: 75 // With sRGB 32-bit or linear FP 16, we turn on gamma-correct handling of in puts:
76 SkSurfaceProps props = this->getSurfaceProps(); 76 SkSurfaceProps props = this->getSurfaceProps();
77 uint32_t flags = (props.flags() & ~SkSurfaceProps::kGammaCorrect_Flag) | 77 uint32_t flags = (props.flags() & ~SkSurfaceProps::kGammaCorrect_Flag) |
78 (SkColorAndProfileAreGammaCorrect(ct, pt) ? SkSurfaceProps::kGammaCorrec t_Flag : 0); 78 (SkColorAndColorSpaceAreGammaCorrect(ct, cs.get())
79 ? SkSurfaceProps::kGammaCorrect_Flag : 0);
79 this->setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry())); 80 this->setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry()));
80 } 81 }
81 82
82 bool SkWindow::handleInval(const SkRect* localR) { 83 bool SkWindow::handleInval(const SkRect* localR) {
83 SkIRect ir; 84 SkIRect ir;
84 85
85 if (localR) { 86 if (localR) {
86 SkRect devR; 87 SkRect devR;
87 SkMatrix inverse; 88 SkMatrix inverse;
88 if (!fMatrix.invert(&inverse)) { 89 if (!fMatrix.invert(&inverse)) {
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; 352 desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
352 desc.fSampleCnt = attachmentInfo.fSampleCount; 353 desc.fSampleCnt = attachmentInfo.fSampleCount;
353 desc.fStencilBits = attachmentInfo.fStencilBits; 354 desc.fStencilBits = attachmentInfo.fStencilBits;
354 GrGLint buffer; 355 GrGLint buffer;
355 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer); 356 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer);
356 desc.fRenderTargetHandle = buffer; 357 desc.fRenderTargetHandle = buffer;
357 return grContext->textureProvider()->wrapBackendRenderTarget(desc); 358 return grContext->textureProvider()->wrapBackendRenderTarget(desc);
358 } 359 }
359 360
360 #endif 361 #endif
OLDNEW
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | tests/ReadPixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698