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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 const GrGLInterface* interface, GrContext* grContext) { | 333 const GrGLInterface* interface, GrContext* grContext) { |
334 GrBackendRenderTargetDesc desc; | 334 GrBackendRenderTargetDesc desc; |
335 desc.fWidth = SkScalarRoundToInt(this->width()); | 335 desc.fWidth = SkScalarRoundToInt(this->width()); |
336 desc.fHeight = SkScalarRoundToInt(this->height()); | 336 desc.fHeight = SkScalarRoundToInt(this->height()); |
337 // TODO: Query the actual framebuffer for sRGB capable. However, to | 337 // TODO: Query the actual framebuffer for sRGB capable. However, to |
338 // preserve old (fake-linear) behavior, we don't do this. Instead, rely | 338 // preserve old (fake-linear) behavior, we don't do this. Instead, rely |
339 // on the flag (currently driven via 'C' mode in SampleApp). | 339 // on the flag (currently driven via 'C' mode in SampleApp). |
340 // | 340 // |
341 // Also, we may not have real sRGB support (ANGLE, in particular), so check
for | 341 // Also, we may not have real sRGB support (ANGLE, in particular), so check
for |
342 // that, and fall back to L32: | 342 // that, and fall back to L32: |
343 desc.fConfig = grContext->caps()->srgbSupport() && SkImageInfoIsGammaCorrect
(info()) | 343 // |
344 ? kSkiaGamma8888_GrPixelConfig | 344 // ... and, if we're using a 10-bit/channel FB0, it doesn't do sRGB conversi
on on write, |
345 : kSkia8888_GrPixelConfig; | 345 // so pretend that it's non-sRGB 8888: |
| 346 desc.fConfig = |
| 347 grContext->caps()->srgbSupport() && |
| 348 SkImageInfoIsGammaCorrect(info()) && |
| 349 (attachmentInfo.fColorBits != 30) |
| 350 ? kSkiaGamma8888_GrPixelConfig : kSkia8888_GrPixelConfig; |
346 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 351 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
347 desc.fSampleCnt = attachmentInfo.fSampleCount; | 352 desc.fSampleCnt = attachmentInfo.fSampleCount; |
348 desc.fStencilBits = attachmentInfo.fStencilBits; | 353 desc.fStencilBits = attachmentInfo.fStencilBits; |
349 GrGLint buffer; | 354 GrGLint buffer; |
350 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer); | 355 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer); |
351 desc.fRenderTargetHandle = buffer; | 356 desc.fRenderTargetHandle = buffer; |
352 return grContext->textureProvider()->wrapBackendRenderTarget(desc); | 357 return grContext->textureProvider()->wrapBackendRenderTarget(desc); |
353 } | 358 } |
354 | 359 |
355 #endif | 360 #endif |
OLD | NEW |