Browse Source

Changed: prefix some private methods with _

v1.x
Tj Holowaychuk 13 years ago
parent
commit
10da42f2c0
  1. 18
      lib/context2d.js
  2. 14
      src/CanvasRenderingContext2d.cc

18
lib/context2d.js

@ -152,9 +152,9 @@ Context2d.prototype.setTransform = function(){
Context2d.prototype.__defineSetter__('fillStyle', function(val){
if (val instanceof CanvasGradient) {
this.lastFillStyle = val;
this.setFillPattern(val);
this._setFillPattern(val);
} else if ('string' == typeof val) {
this.setFillColor(val);
this._setFillColor(val);
}
});
@ -178,9 +178,9 @@ Context2d.prototype.__defineGetter__('fillStyle', function(){
Context2d.prototype.__defineSetter__('strokeStyle', function(val){
if (val instanceof CanvasGradient) {
this.lastStrokeStyle = val;
this.setStrokePattern(val);
this._setStrokePattern(val);
} else if ('string' == typeof val) {
this.setStrokeColor(val);
this._setStrokeColor(val);
}
});
@ -208,7 +208,7 @@ Context2d.prototype.__defineSetter__('font', function(val){
var font;
if (font = parseFont(val)) {
this.lastFontString = val;
this.setFont(
this._setFont(
font.weight
, font.style
, font.size
@ -238,7 +238,7 @@ Context2d.prototype.__defineSetter__('textBaseline', function(val){
var n = baselines.indexOf(val);
if (~n) {
this.lastBaseline = val;
this.setTextBaseline(n);
this._setTextBaseline(n);
}
});
@ -261,17 +261,17 @@ Context2d.prototype.__defineGetter__('textBaseline', function(){
Context2d.prototype.__defineSetter__('textAlign', function(val){
switch (val) {
case 'center':
this.setTextAlignment(0);
this._setTextAlignment(0);
this.lastTextAlignment = val;
break;
case 'left':
case 'start':
this.setTextAlignment(-1);
this._setTextAlignment(-1);
this.lastTextAlignment = val;
break;
case 'right':
case 'end':
this.setTextAlignment(1);
this._setTextAlignment(1);
this.lastTextAlignment = val;
break;
}

14
src/CanvasRenderingContext2d.cc

@ -78,8 +78,6 @@ Context2d::Initialize(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(constructor, "strokeRect", StrokeRect);
NODE_SET_PROTOTYPE_METHOD(constructor, "clearRect", ClearRect);
NODE_SET_PROTOTYPE_METHOD(constructor, "rect", Rect);
NODE_SET_PROTOTYPE_METHOD(constructor, "setTextBaseline", SetTextBaseline);
NODE_SET_PROTOTYPE_METHOD(constructor, "setTextAlignment", SetTextAlignment);
NODE_SET_PROTOTYPE_METHOD(constructor, "measureText", MeasureText);
NODE_SET_PROTOTYPE_METHOD(constructor, "moveTo", MoveTo);
NODE_SET_PROTOTYPE_METHOD(constructor, "lineTo", LineTo);
@ -89,11 +87,13 @@ Context2d::Initialize(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(constructor, "closePath", ClosePath);
NODE_SET_PROTOTYPE_METHOD(constructor, "arc", Arc);
NODE_SET_PROTOTYPE_METHOD(constructor, "arcTo", ArcTo);
NODE_SET_PROTOTYPE_METHOD(constructor, "setFont", SetFont);
NODE_SET_PROTOTYPE_METHOD(constructor, "setFillColor", SetFillColor);
NODE_SET_PROTOTYPE_METHOD(constructor, "setStrokeColor", SetStrokeColor);
NODE_SET_PROTOTYPE_METHOD(constructor, "setFillPattern", SetFillPattern);
NODE_SET_PROTOTYPE_METHOD(constructor, "setStrokePattern", SetStrokePattern);
NODE_SET_PROTOTYPE_METHOD(constructor, "_setFont", SetFont);
NODE_SET_PROTOTYPE_METHOD(constructor, "_setFillColor", SetFillColor);
NODE_SET_PROTOTYPE_METHOD(constructor, "_setStrokeColor", SetStrokeColor);
NODE_SET_PROTOTYPE_METHOD(constructor, "_setFillPattern", SetFillPattern);
NODE_SET_PROTOTYPE_METHOD(constructor, "_setStrokePattern", SetStrokePattern);
NODE_SET_PROTOTYPE_METHOD(constructor, "_setTextBaseline", SetTextBaseline);
NODE_SET_PROTOTYPE_METHOD(constructor, "_setTextAlignment", SetTextAlignment);
proto->SetAccessor(String::NewSymbol("patternQuality"), GetPatternQuality, SetPatternQuality);
proto->SetAccessor(String::NewSymbol("globalCompositeOperation"), GetGlobalCompositeOperation, SetGlobalCompositeOperation);
proto->SetAccessor(String::NewSymbol("globalAlpha"), GetGlobalAlpha, SetGlobalAlpha);

Loading…
Cancel
Save