Add ol.dom.createCanvasContext2D function

This commit is contained in:
Frederic Junod
2014-04-01 16:25:02 +02:00
parent 0b21c6bea7
commit 55de0a54b9
12 changed files with 63 additions and 118 deletions

View File

@@ -15,6 +15,7 @@ goog.require('goog.style');
goog.require('goog.webgl');
goog.require('ol.Tile');
goog.require('ol.css');
goog.require('ol.dom');
goog.require('ol.layer.Image');
goog.require('ol.layer.Tile');
goog.require('ol.render.Event');
@@ -66,13 +67,6 @@ ol.renderer.webgl.Map = function(container, map) {
this.canvas_.className = ol.css.CLASS_UNSELECTABLE;
goog.dom.insertChildAt(container, this.canvas_, 0);
/**
* @private
* @type {HTMLCanvasElement}
*/
this.clipTileCanvas_ = /** @type {HTMLCanvasElement} */
(goog.dom.createElement(goog.dom.TagName.CANVAS));
/**
* @private
* @type {number}
@@ -83,8 +77,7 @@ ol.renderer.webgl.Map = function(container, map) {
* @private
* @type {CanvasRenderingContext2D}
*/
this.clipTileContext_ = /** @type {CanvasRenderingContext2D} */
(this.clipTileCanvas_.getContext('2d'));
this.clipTileContext_ = ol.dom.createCanvasContext2D();
/**
* @private
@@ -217,7 +210,7 @@ ol.renderer.webgl.Map.prototype.bindTileTexture =
var texture = gl.createTexture();
gl.bindTexture(goog.webgl.TEXTURE_2D, texture);
if (tileGutter > 0) {
var clipTileCanvas = this.clipTileCanvas_;
var clipTileCanvas = this.clipTileContext_.canvas;
var clipTileContext = this.clipTileContext_;
if (this.clipTileCanvasSize_ != tileSize) {
clipTileCanvas.width = tileSize;