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 if (attrs.hasStorage()) { |
| 17 result.setStorage(attrs.storage()); |
| 18 } |
| 19 return result; |
| 20 } |
| 21 |
| 22 WebGLContextAttributes toWebGLContextAttributes(const CanvasContextCreationAttri
butes& attrs) |
| 23 { |
| 24 WebGLContextAttributes result; |
| 25 result.setAlpha(attrs.alpha()); |
| 26 result.setDepth(attrs.depth()); |
| 27 result.setStencil(attrs.stencil()); |
| 28 result.setAntialias(attrs.antialias()); |
| 29 result.setPremultipliedAlpha(attrs.premultipliedAlpha()); |
| 30 result.setPreserveDrawingBuffer(attrs.preserveDrawingBuffer()); |
| 31 result.setFailIfMajorPerformanceCaveat(attrs.failIfMajorPerformanceCaveat())
; |
| 32 return result; |
| 33 } |
| 34 |
| 35 WebGraphicsContext3D::Attributes toWebGraphicsContext3DAttributes(const WebGLCon
textAttributes& attrs, const blink::WebString& topDocumentURL, Settings* setting
s, unsigned webGLVersion) |
| 36 { |
| 37 blink::WebGraphicsContext3D::Attributes result; |
| 38 result.alpha = attrs.alpha(); |
| 39 result.depth = attrs.depth(); |
| 40 result.stencil = attrs.stencil(); |
| 41 result.antialias = attrs.antialias(); |
| 42 if (attrs.antialias()) { |
| 43 if (settings && !settings->openGLMultisamplingEnabled()) |
| 44 result.antialias = false; |
| 45 } |
| 46 result.premultipliedAlpha = attrs.premultipliedAlpha(); |
| 47 result.failIfMajorPerformanceCaveat = attrs.failIfMajorPerformanceCaveat(); |
| 48 |
| 49 result.noExtensions = true; |
| 50 result.shareResources = false; |
| 51 result.preferDiscreteGPU = true; |
| 52 |
| 53 result.topDocumentURL = topDocumentURL; |
| 54 |
| 55 result.webGL = true; |
| 56 result.webGLVersion = webGLVersion; |
| 57 return result; |
| 58 } |
| 59 |
| 60 } // namespace blink |
OLD | NEW |