Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 | |
| 6 package org.chromium.ui.autofill; | |
| 7 | |
| 8 import android.graphics.Canvas; | |
| 9 import android.graphics.ColorFilter; | |
| 10 import android.graphics.Paint; | |
| 11 import android.graphics.RectF; | |
| 12 import android.graphics.drawable.Drawable; | |
| 13 | |
| 14 public class AutofillDividerDrawable extends Drawable { | |
| 15 | |
| 16 private Paint paint; | |
|
newt (away)
2013/09/09 20:20:42
mPaint
keishi
2013/09/19 11:53:05
Done.
| |
| 17 | |
| 18 public AutofillDividerDrawable() { | |
| 19 paint = new Paint(); | |
| 20 } | |
| 21 | |
| 22 @Override | |
| 23 public void draw(Canvas canvas) { | |
| 24 int width = getBounds().width(); | |
| 25 RectF rect = new RectF(0, 0, width, 1); | |
|
newt (away)
2013/09/09 20:20:42
avoid allocating memory while drawing: store this
keishi
2013/09/19 11:53:05
Done.
| |
| 26 canvas.drawRect(rect, paint); | |
| 27 } | |
| 28 | |
| 29 public void setColor(int color) { | |
| 30 paint.setColor(color); | |
| 31 } | |
| 32 | |
| 33 @Override | |
| 34 public void setAlpha(int alpha) { | |
| 35 } | |
| 36 | |
| 37 @Override | |
| 38 public void setColorFilter(ColorFilter cf) { | |
| 39 } | |
| 40 | |
| 41 @Override | |
| 42 public int getOpacity() { | |
| 43 return 255; | |
| 44 } | |
| 45 | |
| 46 } | |
| OLD | NEW |