のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

CharWrapper

CharWrapper.drawTextを呼ぶ人がみつからない。
どこで使うのだろうか?

   8933 
   8934     private static class CharWrapper implements CharSequence, GetChars, GraphicsOperations {
   8935         private char[] mChars;
   8936         private int mStart, mLength;
   8937 
   8938         public CharWrapper(char[] chars, int start, int len) {
   8939             mChars = chars;
   8940             mStart = start;
   8941             mLength = len;
   8942         }
   8943 
   8944         /* package */ void set(char[] chars, int start, int len) {
   8945             mChars = chars;
   8946             mStart = start;
   8947             mLength = len;
   8948         }
   8949 
   8950         public int length() {
   8951             return mLength;
   8952         }
   8953 
   8954         public char charAt(int off) {
   8955             return mChars[off + mStart];
   8956         }
   8957 
   8958         @Override
   8959         public String toString() {
   8960             return new String(mChars, mStart, mLength);
   8961         }
   8962 
   8963         public CharSequence subSequence(int start, int end) {
   8964             if (start < 0 || end < 0 || start > mLength || end > mLength) {
   8965                 throw new IndexOutOfBoundsException(start + ", " + end);
   8966             }
   8967 
   8968             return new String(mChars, start + mStart, end - start);
   8969         }
   8970 
   8971         public void getChars(int start, int end, char[] buf, int off) {
   8972             if (start < 0 || end < 0 || start > mLength || end > mLength) {
   8973                 throw new IndexOutOfBoundsException(start + ", " + end);
   8974             }
   8975 
   8976             System.arraycopy(mChars, start + mStart, buf, off, end - start);
   8977         }
   8978 
   8979         public void drawText(Canvas c, int start, int end,
   8980                              float x, float y, Paint p) {
   8981             c.drawText(mChars, start + mStart, end - start, x, y, p);
   8982         }
   8983 
   8984         public void drawTextRun(Canvas c, int start, int end,
   8985                 int contextStart, int contextEnd, float x, float y, int flags, Paint p) {
   8986             int count = end - start;
   8987             int contextCount = contextEnd - contextStart;
   8988             c.drawTextRun(mChars, start + mStart, count, contextStart + mStart,
   8989                     contextCount, x, y, flags, p);
   8990         }
   8991 
   8992         public float measureText(int start, int end, Paint p) {
   8993             return p.measureText(mChars, start + mStart, end - start);
   8994         }
   8995 
   8996         public int getTextWidths(int start, int end, float[] widths, Paint p) {
   8997             return p.getTextWidths(mChars, start + mStart, end - start, widths);
   8998         }
   8999 
   9000         public float getTextRunAdvances(int start, int end, int contextStart,
   9001                 int contextEnd, int flags, float[] advances, int advancesIndex,
   9002                 Paint p) {
   9003             int count = end - start;
   9004             int contextCount = contextEnd - contextStart;
   9005             return p.getTextRunAdvances(mChars, start + mStart, count,
   9006                     contextStart + mStart, contextCount, flags, advances,
   9007                     advancesIndex);
   9008         }
   9009 
   9010         public int getTextRunCursor(int contextStart, int contextEnd, int flags,
   9011                 int offset, int cursorOpt, Paint p) {
   9012             int contextCount = contextEnd - contextStart;
   9013             return p.getTextRunCursor(mChars, contextStart + mStart,
   9014                     contextCount, flags, offset + mStart, cursorOpt);
   9015         }
   9016     }