Skip to content

Commit

Permalink
Changed: prefix some private methods with _
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Aug 30, 2011
1 parent bc11343 commit 10da42f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
18 changes: 9 additions & 9 deletions lib/context2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});

Expand All @@ -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);
}
});

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
});

Expand All @@ -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;
}
Expand Down
14 changes: 7 additions & 7 deletions src/CanvasRenderingContext2d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 10da42f

Please sign in to comment.