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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 #include "GrContext.h" | 319 #include "GrContext.h" |
320 #include "gl/GrGLInterface.h" | 320 #include "gl/GrGLInterface.h" |
321 #include "gl/GrGLUtil.h" | 321 #include "gl/GrGLUtil.h" |
322 #include "SkGr.h" | 322 #include "SkGr.h" |
323 | 323 |
324 GrRenderTarget* SkWindow::renderTarget(const AttachmentInfo& attachmentInfo, | 324 GrRenderTarget* SkWindow::renderTarget(const AttachmentInfo& attachmentInfo, |
325 const GrGLInterface* interface, GrContext* grContext) { | 325 const GrGLInterface* interface, GrContext* grContext) { |
326 GrBackendRenderTargetDesc desc; | 326 GrBackendRenderTargetDesc desc; |
327 desc.fWidth = SkScalarRoundToInt(this->width()); | 327 desc.fWidth = SkScalarRoundToInt(this->width()); |
328 desc.fHeight = SkScalarRoundToInt(this->height()); | 328 desc.fHeight = SkScalarRoundToInt(this->height()); |
329 desc.fConfig = kSkia8888_GrPixelConfig; | 329 // TODO: Query the actual framebuffer for sRGB capable. However, to |
| 330 // preserve old (fake-linear) behavior, we don't do this. Instead, rely |
| 331 // on the flag (currently driven via 'C' mode in SampleApp). |
| 332 desc.fConfig = (info().profileType() == kSRGB_SkColorProfileType || |
| 333 info().colorType() == kRGBA_F16_SkColorType) |
| 334 ? kSRGBA_8888_GrPixelConfig // This may not be the right byte-order |
| 335 : kSkia8888_GrPixelConfig; |
330 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 336 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
331 desc.fSampleCnt = attachmentInfo.fSampleCount; | 337 desc.fSampleCnt = attachmentInfo.fSampleCount; |
332 desc.fStencilBits = attachmentInfo.fStencilBits; | 338 desc.fStencilBits = attachmentInfo.fStencilBits; |
333 GrGLint buffer; | 339 GrGLint buffer; |
334 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer); | 340 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer); |
335 desc.fRenderTargetHandle = buffer; | 341 desc.fRenderTargetHandle = buffer; |
336 return grContext->textureProvider()->wrapBackendRenderTarget(desc); | 342 return grContext->textureProvider()->wrapBackendRenderTarget(desc); |
337 } | 343 } |
338 | 344 |
339 #endif | 345 #endif |
OLD | NEW |