Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: Source/core/html/canvas/ContextAttributeHelpers.cpp

Issue 795833004: Use dictionaries for context creation attributes. Eliminate custom bindings. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW
« no previous file with comments | « Source/core/html/canvas/ContextAttributeHelpers.h ('k') | Source/core/html/canvas/WebGLContextAttributes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698