jdk/src/share/native/sun/font/layout/SegmentSingleProcessor.cpp
changeset 16891 91e99bed64ae
parent 5506 202f599c92aa
equal deleted inserted replaced
16890:36b30720a997 16891:91e99bed64ae
    44 
    44 
    45 SegmentSingleProcessor::SegmentSingleProcessor()
    45 SegmentSingleProcessor::SegmentSingleProcessor()
    46 {
    46 {
    47 }
    47 }
    48 
    48 
    49 SegmentSingleProcessor::SegmentSingleProcessor(const MorphSubtableHeader *morphSubtableHeader)
    49 SegmentSingleProcessor::SegmentSingleProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
    50   : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader)
    50   : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success)
    51 {
    51 {
    52     const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader;
    52   LEReferenceTo<NonContextualGlyphSubstitutionHeader> header(morphSubtableHeader, success);
    53 
    53   segmentSingleLookupTable = LEReferenceTo<SegmentSingleLookupTable>(morphSubtableHeader, success, (const SegmentSingleLookupTable*)&header->table);
    54     segmentSingleLookupTable = (const SegmentSingleLookupTable *) &header->table;
       
    55 }
    54 }
    56 
    55 
    57 SegmentSingleProcessor::~SegmentSingleProcessor()
    56 SegmentSingleProcessor::~SegmentSingleProcessor()
    58 {
    57 {
    59 }
    58 }
    60 
    59 
    61 void SegmentSingleProcessor::process(LEGlyphStorage &glyphStorage)
    60 void SegmentSingleProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success)
    62 {
    61 {
    63     const LookupSegment *segments = segmentSingleLookupTable->segments;
    62     const LookupSegment *segments = segmentSingleLookupTable->segments;
    64     le_int32 glyphCount = glyphStorage.getGlyphCount();
    63     le_int32 glyphCount = glyphStorage.getGlyphCount();
    65     le_int32 glyph;
    64     le_int32 glyph;
    66 
    65 
    67     for (glyph = 0; glyph < glyphCount; glyph += 1) {
    66     for (glyph = 0; glyph < glyphCount && LE_SUCCESS(success); glyph += 1) {
    68         LEGlyphID thisGlyph = glyphStorage[glyph];
    67         LEGlyphID thisGlyph = glyphStorage[glyph];
    69         const LookupSegment *lookupSegment = segmentSingleLookupTable->lookupSegment(segments, thisGlyph);
    68         const LookupSegment *lookupSegment = segmentSingleLookupTable->lookupSegment(segmentSingleLookupTable, segments, thisGlyph, success);
    70 
    69 
    71         if (lookupSegment != NULL) {
    70         if (lookupSegment != NULL && LE_SUCCESS(success)) {
    72             TTGlyphID   newGlyph  = (TTGlyphID) LE_GET_GLYPH(thisGlyph) + SWAPW(lookupSegment->value);
    71             TTGlyphID   newGlyph  = (TTGlyphID) LE_GET_GLYPH(thisGlyph) + SWAPW(lookupSegment->value);
    73 
    72 
    74             glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
    73             glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
    75         }
    74         }
    76     }
    75     }