Re-enable the content mask.

Do not use getters/setters unless we're overridding one from a superclass.
The getters and setters hide implementation details: you never
know if a getter is doing massive amounts of computation, and it looks like
a simple field access. The nice parenthesis required for normal function
calls are a reminder to the coder that maybe they should stash that value
in a local variable if they're going to use it many times.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4448 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-11-10 01:32:40 +00:00
parent 92205abedf
commit 6dddf9c234
+24 -24
View File
@@ -152,9 +152,9 @@ public class MediaContainer extends Box
info.addEventListener(ProgressEvent.PROGRESS, loadProgress);
// create a mask to prevent the media from drawing out of bounds
if (maxContentWidth < int.MAX_VALUE &&
maxContentHeight < int.MAX_VALUE) {
configureMask(maxContentWidth, maxContentHeight);
if (getMaxContentWidth() < int.MAX_VALUE &&
getMaxContentHeight() < int.MAX_VALUE) {
configureMask(getMaxContentWidth(), getMaxContentHeight());
}
// start it loading, add it as a child
@@ -266,23 +266,23 @@ public class MediaContainer extends Box
/**
* Get the width of the content, bounded by the maximum.
*/
public function get contentWidth () :int
public function getContentWidth () :int
{
return Math.min(Math.abs(_w * getMediaScaleX()), maxContentWidth);
return Math.min(Math.abs(_w * getMediaScaleX()), getMaxContentWidth());
}
/**
* Get the height of the content, bounded by the maximum.
*/
public function get contentHeight () :int
public function getContentHeight () :int
{
return Math.min(Math.abs(_h * getMediaScaleY()), maxContentHeight);
return Math.min(Math.abs(_h * getMediaScaleY()), getMaxContentHeight());
}
/**
* Get the maximum allowable width for our content.
*/
public function get maxContentWidth () :int
public function getMaxContentWidth () :int
{
return int.MAX_VALUE;
}
@@ -290,7 +290,7 @@ public class MediaContainer extends Box
/**
* Get the maximum allowable height for our content.
*/
public function get maxContentHeight () :int
public function getMaxContentHeight () :int
{
return int.MAX_VALUE;
}
@@ -429,21 +429,21 @@ public class MediaContainer extends Box
*/
protected function configureMask (ww :int, hh :int) :void
{
// var mask :Shape;
// if (_media.mask != null) {
// mask = (_media.mask as Shape);
//
// } else {
// mask = new Shape();
// // the mask must be added to the display list (which is wacky)
// rawChildren.addChild(mask);
// _media.mask = mask;
// }
//
// mask.graphics.clear();
// mask.graphics.beginFill(0xFFFFFF);
// mask.graphics.drawRect(0, 0, ww, hh);
// mask.graphics.endFill();
var mask :Shape;
if (_media.mask != null) {
mask = (_media.mask as Shape);
} else {
mask = new Shape();
// the mask must be added to the display list (which is wacky)
rawChildren.addChild(mask);
_media.mask = mask;
}
mask.graphics.clear();
mask.graphics.beginFill(0xFFFFFF);
mask.graphics.drawRect(0, 0, ww, hh);
mask.graphics.endFill();
}
/**