--- a/jdk/src/share/native/sun/font/layout/AnchorTables.cpp Wed Oct 16 18:19:11 2013 -0700
+++ b/jdk/src/share/native/sun/font/layout/AnchorTables.cpp Thu Oct 17 09:23:49 2013 -0700
@@ -37,55 +37,54 @@
U_NAMESPACE_BEGIN
-void AnchorTable::getAnchor(LEGlyphID glyphID, const LEFontInstance *fontInstance,
- LEPoint &anchor) const
+void AnchorTable::getAnchor(const LETableReference &base, LEGlyphID glyphID, const LEFontInstance *fontInstance,
+ LEPoint &anchor, LEErrorCode &success) const
{
- switch(SWAPW(anchorFormat)) {
+ switch(SWAPW(anchorFormat)) {
case 1:
{
- const Format1AnchorTable *f1 = (const Format1AnchorTable *) this;
-
- f1->getAnchor(fontInstance, anchor);
+ LEReferenceTo<Format1AnchorTable> f1(base, success);
+ f1->getAnchor(f1, fontInstance, anchor, success);
break;
}
case 2:
{
- const Format2AnchorTable *f2 = (const Format2AnchorTable *) this;
-
- f2->getAnchor(glyphID, fontInstance, anchor);
+ LEReferenceTo<Format2AnchorTable> f2(base, success);
+ f2->getAnchor(f2, glyphID, fontInstance, anchor, success);
break;
}
case 3:
{
- const Format3AnchorTable *f3 = (const Format3AnchorTable *) this;
-
- f3->getAnchor(fontInstance, anchor);
+ LEReferenceTo<Format3AnchorTable> f3(base, success);
+ f3->getAnchor(f3, fontInstance, anchor, success);
break;
}
default:
+ {
// unknown format: just use x, y coordinate, like format 1...
- const Format1AnchorTable *f1 = (const Format1AnchorTable *) this;
-
- f1->getAnchor(fontInstance, anchor);
+ LEReferenceTo<Format1AnchorTable> f1(base, success);
+ f1->getAnchor(f1, fontInstance, anchor, success);
break;
}
+ }
}
-void Format1AnchorTable::getAnchor(const LEFontInstance *fontInstance, LEPoint &anchor) const
+void Format1AnchorTable::getAnchor(const LEReferenceTo<Format1AnchorTable>& base, const LEFontInstance *fontInstance, LEPoint &anchor, LEErrorCode &success) const
{
le_int16 x = SWAPW(xCoordinate);
le_int16 y = SWAPW(yCoordinate);
LEPoint pixels;
fontInstance->transformFunits(x, y, pixels);
-
fontInstance->pixelsToUnits(pixels, anchor);
}
-void Format2AnchorTable::getAnchor(LEGlyphID glyphID, const LEFontInstance *fontInstance, LEPoint &anchor) const
+void Format2AnchorTable::getAnchor(const LEReferenceTo<Format2AnchorTable>& base,
+ LEGlyphID glyphID, const LEFontInstance *fontInstance, LEPoint &anchor
+ , LEErrorCode &success) const
{
LEPoint point;
@@ -100,7 +99,8 @@
fontInstance->pixelsToUnits(point, anchor);
}
-void Format3AnchorTable::getAnchor(const LEFontInstance *fontInstance, LEPoint &anchor) const
+void Format3AnchorTable::getAnchor(const LEReferenceTo<Format3AnchorTable> &base, const LEFontInstance *fontInstance,
+ LEPoint &anchor, LEErrorCode &success) const
{
le_int16 x = SWAPW(xCoordinate);
le_int16 y = SWAPW(yCoordinate);
@@ -111,15 +111,15 @@
fontInstance->transformFunits(x, y, pixels);
if (dtxOffset != 0) {
- const DeviceTable *dtx = (const DeviceTable *) ((char *) this + dtxOffset);
- le_int16 adjx = dtx->getAdjustment((le_int16) fontInstance->getXPixelsPerEm());
+ LEReferenceTo<DeviceTable> dt(base, success, dtxOffset);
+ le_int16 adjx = dt->getAdjustment(dt, (le_int16) fontInstance->getXPixelsPerEm(), success);
pixels.fX += adjx;
}
if (dtyOffset != 0) {
- const DeviceTable *dty = (const DeviceTable *) ((char *) this + dtyOffset);
- le_int16 adjy = dty->getAdjustment((le_int16) fontInstance->getYPixelsPerEm());
+ LEReferenceTo<DeviceTable> dt(base, success, dtyOffset);
+ le_int16 adjy = dt->getAdjustment(dt, (le_int16) fontInstance->getYPixelsPerEm(), success);
pixels.fY += adjy;
}