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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLContextAttributeHelpers.cpp

Issue 2698573002: Support offscreen contexts which own their backing surface (Closed)
Patch Set: Rebase and retry again Created 3 years, 10 months 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
OLDNEW
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( 11 WebGLContextAttributes toWebGLContextAttributes(
12 const CanvasContextCreationAttributes& attrs) { 12 const CanvasContextCreationAttributes& attrs) {
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 Platform::ContextAttributes toPlatformContextAttributes( 24 Platform::ContextAttributes toPlatformContextAttributes(
25 const CanvasContextCreationAttributes& attrs, 25 const CanvasContextCreationAttributes& attrs,
26 unsigned webGLVersion) { 26 unsigned webGLVersion,
27 bool supportOwnOffscreenSurface) {
27 Platform::ContextAttributes result; 28 Platform::ContextAttributes result;
28 result.failIfMajorPerformanceCaveat = attrs.failIfMajorPerformanceCaveat(); 29 result.failIfMajorPerformanceCaveat = attrs.failIfMajorPerformanceCaveat();
29 result.webGLVersion = webGLVersion; 30 result.webGLVersion = webGLVersion;
31 if (supportOwnOffscreenSurface) {
32 // Only ask for alpha/depth/stencil/antialias if we may be using the default
33 // framebuffer. They are not needed for standard offscreen rendering.
34 result.supportAlpha = attrs.alpha();
35 result.supportDepth = attrs.depth();
36 result.supportStencil = attrs.stencil();
37 result.supportAntialias = attrs.antialias();
38 }
30 return result; 39 return result;
31 } 40 }
32 41
33 } // namespace blink 42 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698