OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "core/html/canvas/ContextAttributeHelpers.h" |
| 7 |
| 8 #include "core/frame/Settings.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 Canvas2DContextAttributes to2DContextAttributes(const CanvasContextCreationAttri
butes& attrs) |
| 13 { |
| 14 Canvas2DContextAttributes result; |
| 15 result.setAlpha(attrs.alpha()); |
| 16 return result; |
| 17 } |
| 18 |
| 19 WebGLContextAttributes toWebGLContextAttributes(const CanvasContextCreationAttri
butes& attrs) |
| 20 { |
| 21 WebGLContextAttributes result; |
| 22 result.setAlpha(attrs.alpha()); |
| 23 result.setDepth(attrs.depth()); |
| 24 result.setStencil(attrs.stencil()); |
| 25 result.setAntialias(attrs.antialias()); |
| 26 result.setPremultipliedAlpha(attrs.premultipliedAlpha()); |
| 27 result.setPreserveDrawingBuffer(attrs.preserveDrawingBuffer()); |
| 28 result.setFailIfMajorPerformanceCaveat(attrs.failIfMajorPerformanceCaveat())
; |
| 29 return result; |
| 30 } |
| 31 |
| 32 WebGraphicsContext3D::Attributes toWebGraphicsContext3DAttributes(const WebGLCon
textAttributes& attrs, const blink::WebString& topDocumentURL, Settings* setting
s, unsigned webGLVersion) |
| 33 { |
| 34 blink::WebGraphicsContext3D::Attributes result; |
| 35 result.alpha = attrs.alpha(); |
| 36 result.depth = attrs.depth(); |
| 37 result.stencil = attrs.stencil(); |
| 38 result.antialias = attrs.antialias(); |
| 39 if (attrs.antialias()) { |
| 40 if (settings && !settings->openGLMultisamplingEnabled()) |
| 41 result.antialias = false; |
| 42 } |
| 43 result.premultipliedAlpha = attrs.premultipliedAlpha(); |
| 44 result.failIfMajorPerformanceCaveat = attrs.failIfMajorPerformanceCaveat(); |
| 45 |
| 46 result.noExtensions = true; |
| 47 result.shareResources = false; |
| 48 result.preferDiscreteGPU = true; |
| 49 |
| 50 result.topDocumentURL = topDocumentURL; |
| 51 |
| 52 result.webGL = true; |
| 53 result.webGLVersion = webGLVersion; |
| 54 return result; |
| 55 } |
| 56 |
| 57 } // namespace blink |
OLD | NEW |