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

Unified Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 894143002: Adding Blink bindings for WebGL 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updating objects to use the correct Oilpan transition types. Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLCanvasElement.cpp
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp
index 3565f69778a04c9f9a37507d04c985bacd943cfe..5971b63a349b46606c679e717ae1cb5f52263235 100644
--- a/Source/core/html/HTMLCanvasElement.cpp
+++ b/Source/core/html/HTMLCanvasElement.cpp
@@ -40,6 +40,7 @@
#include "core/html/ImageData.h"
#include "core/html/canvas/Canvas2DContextAttributes.h"
#include "core/html/canvas/CanvasRenderingContext2D.h"
+#include "core/html/canvas/WebGL2RenderingContext.h"
#include "core/html/canvas/WebGLContextAttributes.h"
#include "core/html/canvas/WebGLContextEvent.h"
#include "core/html/canvas/WebGLRenderingContext.h"
@@ -209,6 +210,7 @@ void HTMLCanvasElement::getContext(const String& type, const CanvasContextCreati
Context2d = 0,
ContextExperimentalWebgl = 2,
ContextWebgl = 3,
+ ContextWebgl2 = 4,
ContextTypeCount,
};
@@ -229,11 +231,25 @@ void HTMLCanvasElement::getContext(const String& type, const CanvasContextCreati
}
// Accept the the provisional "experimental-webgl" or official "webgl" context ID.
- if (type == "webgl" || type == "experimental-webgl") {
- ContextType contextType = (type == "webgl") ? ContextWebgl : ContextExperimentalWebgl;
+ ContextType contextType;
+ bool is3dContext = true;
+ if (type == "experimental-webgl")
+ contextType = ContextExperimentalWebgl;
+ else if (type == "webgl")
+ contextType = ContextWebgl;
+ else if (type == "webgl2")
+ contextType = ContextWebgl2;
+ else
+ is3dContext = false;
+
+ if (is3dContext) {
if (!m_context) {
blink::Platform::current()->histogramEnumeration("Canvas.ContextType", contextType, ContextTypeCount);
Ken Russell (switch to Gerrit) 2015/02/03 01:23:24 Does any histogram need to be updated on the Chrom
- m_context = WebGLRenderingContext::create(this, attributes);
+ if (contextType == ContextWebgl2) {
+ m_context = WebGL2RenderingContext::create(this, attributes);
+ } else {
+ m_context = WebGLRenderingContext::create(this, attributes);
+ }
RenderStyle* style = computedStyle();
if (style && m_context)
toWebGLRenderingContext(m_context.get())->setFilterLevel(style->imageRendering() == ImageRenderingPixelated ? SkPaint::kNone_FilterLevel : SkPaint::kLow_FilterLevel);

Powered by Google App Engine
This is Rietveld 408576698