| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/webgl/WebGLContextAttributeHelpers.h" | 5 #include "modules/webgl/WebGLContextAttributeHelpers.h" |
| 6 | 6 |
| 7 #include "core/frame/Settings.h" | 7 #include "core/frame/Settings.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| 11 WebGLContextAttributes toWebGLContextAttributes(const CanvasContextCreationAttri
butes& attrs) | 11 WebGLContextAttributes toWebGLContextAttributes(const CanvasContextCreationAttri
butes& attrs) |
| 12 { | 12 { |
| 13 WebGLContextAttributes result; | 13 WebGLContextAttributes result; |
| 14 result.setAlpha(attrs.alpha()); | 14 result.setAlpha(attrs.alpha()); |
| 15 result.setDepth(attrs.depth()); | 15 result.setDepth(attrs.depth()); |
| 16 result.setStencil(attrs.stencil()); | 16 result.setStencil(attrs.stencil()); |
| 17 result.setAntialias(attrs.antialias()); | 17 result.setAntialias(attrs.antialias()); |
| 18 result.setPremultipliedAlpha(attrs.premultipliedAlpha()); | 18 result.setPremultipliedAlpha(attrs.premultipliedAlpha()); |
| 19 result.setPreserveDrawingBuffer(attrs.preserveDrawingBuffer()); | 19 result.setPreserveDrawingBuffer(attrs.preserveDrawingBuffer()); |
| 20 result.setFailIfMajorPerformanceCaveat(attrs.failIfMajorPerformanceCaveat())
; | 20 result.setFailIfMajorPerformanceCaveat(attrs.failIfMajorPerformanceCaveat())
; |
| 21 return result; | 21 return result; |
| 22 } | 22 } |
| 23 | 23 |
| 24 WebGraphicsContext3D::Attributes toWebGraphicsContext3DAttributes(const WebGLCon
textAttributes& attrs, const WebString& topDocumentURL, Settings* settings, unsi
gned webGLVersion) | 24 WebGraphicsContext3D::Attributes toWebGraphicsContext3DAttributes(const WebGLCon
textAttributes& attrs, const WebString& topDocumentURL, unsigned webGLVersion) |
| 25 { | 25 { |
| 26 WebGraphicsContext3D::Attributes result; | 26 WebGraphicsContext3D::Attributes result; |
| 27 result.alpha = attrs.alpha(); | |
| 28 result.depth = attrs.depth(); | |
| 29 result.stencil = attrs.stencil(); | |
| 30 result.antialias = attrs.antialias(); | |
| 31 if (attrs.antialias()) { | |
| 32 if (settings && !settings->openGLMultisamplingEnabled()) | |
| 33 result.antialias = false; | |
| 34 } | |
| 35 result.failIfMajorPerformanceCaveat = attrs.failIfMajorPerformanceCaveat(); | 27 result.failIfMajorPerformanceCaveat = attrs.failIfMajorPerformanceCaveat(); |
| 36 | |
| 37 result.shareResources = false; | 28 result.shareResources = false; |
| 38 result.preferDiscreteGPU = true; | 29 result.preferDiscreteGPU = true; |
| 39 | |
| 40 result.topDocumentURL = topDocumentURL; | 30 result.topDocumentURL = topDocumentURL; |
| 41 | |
| 42 result.webGLVersion = webGLVersion; | 31 result.webGLVersion = webGLVersion; |
| 43 return result; | 32 return result; |
| 44 } | 33 } |
| 45 | 34 |
| 46 } // namespace blink | 35 } // namespace blink |
| OLD | NEW |