FileDocCategorySizeDatePackage
DisplayModifier.javaAPI DocAndroid 5.1 API22981Thu Mar 12 22:22:42 GMT 2015com.android.test.hwuicompare

DisplayModifier

public abstract class DisplayModifier extends Object

Fields Summary
protected static final int
TOTAL_MASK
protected static final int
SWEEP_STROKE_WIDTH_BIT
protected static final int
SWEEP_STROKE_CAP_BIT
protected static final int
SWEEP_STROKE_JOIN_BIT
protected static final int
SWEEP_SHADER_BIT
protected static final int
SWEEP_TRANSFORM_BIT
private static final android.graphics.RectF
gRect
private static final float[]
gPts
private static final int
NUM_PARALLEL_LINES
private static final float[]
gTriPts
private static final float[]
gLinePts
private static final LinkedHashMap
gMaps
private static final int[]
mIndices
private static final String[]
mLastAppliedModifications
Constructors Summary
Methods Summary
public static voidapply(android.graphics.Paint paint, android.graphics.Canvas canvas)

        int mapIndex = 0;
        for (LinkedHashMap<String, DisplayModifier> map : gMaps.values()) {
            int displayModifierIndex = mIndices[mapIndex];
            for (Entry<String, DisplayModifier> modifierEntry : map.entrySet()) {
                if (displayModifierIndex == 0) {
                    mLastAppliedModifications[mapIndex] = modifierEntry.getKey();
                    modifierEntry.getValue().modifyDrawing(paint, canvas);
                    break;
                }
                displayModifierIndex--;
            }
            mapIndex++;
        }
    
private static booleancheckModificationStateMask()

        int operatorMask = 0x0;
        int mapIndex = 0;
        for (LinkedHashMap<String, DisplayModifier> map : gMaps.values()) {
            int displayModifierIndex = mIndices[mapIndex];
            for (Entry<String, DisplayModifier> modifierEntry : map.entrySet()) {
                if (displayModifierIndex == 0) {
                    mLastAppliedModifications[mapIndex] = modifierEntry.getKey();
                    operatorMask |= modifierEntry.getValue().mask();
                    break;
                }
                displayModifierIndex--;
            }
            mapIndex++;
        }
        return operatorMask == TOTAL_MASK;
    
public static int[]getIndices()

        return mIndices;
    
public static java.lang.String[]getLastAppliedModifications()

        return mLastAppliedModifications.clone();
    
private static java.util.LinkedHashMapgetMapAtIndex(int index)


          
        for (LinkedHashMap<String, DisplayModifier> map : gMaps.values()) {
            if (index == 0) {
                return map;
            }
            index--;
        }
        return null;
    
public static java.lang.String[][]getStrings()

        String[][] keys = new String[gMaps.size()][];

        int i = 0;
        for (LinkedHashMap<String, DisplayModifier> map : gMaps.values()) {
            keys[i] = new String[map.size()];
            int j = 0;
            for (String key : map.keySet()) {
                keys[i][j++] = key;
            }
            i++;
        }

        return keys;
    
protected intmask()

 // only sweep over specified transforms

          
        return 0x0; 
public abstract voidmodifyDrawing(android.graphics.Paint paint, android.graphics.Canvas canvas)

public static voidsetIndex(int mapIndex, int newIndexValue)

        mIndices[mapIndex] = newIndexValue;
    
public static booleanstep()

        boolean ret = false;
        do {
            ret |= stepInternal(true);
        } while (!checkModificationStateMask());
        return ret;
    
public static booleanstepBack()

        boolean ret = false;
        do {
            ret |= stepInternal(false);
        } while (!checkModificationStateMask());
        return ret;
    
private static booleanstepInternal(boolean forward)


         
        int modifierMapIndex = gMaps.size() - 1;
        while (modifierMapIndex >= 0) {
            LinkedHashMap<String, DisplayModifier> map = getMapAtIndex(modifierMapIndex);
            mIndices[modifierMapIndex] += (forward ? 1 : -1);

            if (mIndices[modifierMapIndex] >= 0 && mIndices[modifierMapIndex] < map.size()) {
                break;
            }

            mIndices[modifierMapIndex] = (forward ? 0 : map.size() - 1);
            modifierMapIndex--;
        }
        return modifierMapIndex < 0; // true if resetting