| OLD | NEW |
| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, SkColorProfileType pt) { |
| 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, pt)); |
| 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::kAllowSRGBInputs_Flag) | | 77 uint32_t flags = (props.flags() & ~SkSurfaceProps::kGammaCorrect_Flag) | |
| 78 (SkColorAndProfileAreGammaCorrect(ct, pt) ? SkSurfaceProps::kAllowSRGBIn
puts_Flag : 0); | 78 (SkColorAndProfileAreGammaCorrect(ct, pt) ? SkSurfaceProps::kGammaCorrec
t_Flag : 0); |
| 79 this->setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry())); | 79 this->setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry())); |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool SkWindow::handleInval(const SkRect* localR) { | 82 bool SkWindow::handleInval(const SkRect* localR) { |
| 83 SkIRect ir; | 83 SkIRect ir; |
| 84 | 84 |
| 85 if (localR) { | 85 if (localR) { |
| 86 SkRect devR; | 86 SkRect devR; |
| 87 SkMatrix inverse; | 87 SkMatrix inverse; |
| 88 if (!fMatrix.invert(&inverse)) { | 88 if (!fMatrix.invert(&inverse)) { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 346 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
| 347 desc.fSampleCnt = attachmentInfo.fSampleCount; | 347 desc.fSampleCnt = attachmentInfo.fSampleCount; |
| 348 desc.fStencilBits = attachmentInfo.fStencilBits; | 348 desc.fStencilBits = attachmentInfo.fStencilBits; |
| 349 GrGLint buffer; | 349 GrGLint buffer; |
| 350 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer); | 350 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer); |
| 351 desc.fRenderTargetHandle = buffer; | 351 desc.fRenderTargetHandle = buffer; |
| 352 return grContext->textureProvider()->wrapBackendRenderTarget(desc); | 352 return grContext->textureProvider()->wrapBackendRenderTarget(desc); |
| 353 } | 353 } |
| 354 | 354 |
| 355 #endif | 355 #endif |
| OLD | NEW |