OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.ui.resources.dynamics; | 5 package org.chromium.ui.resources.dynamics; |
6 | 6 |
7 import android.graphics.Bitmap; | 7 import android.graphics.Bitmap; |
8 import android.graphics.Rect; | 8 import android.graphics.Rect; |
9 | 9 |
| 10 import org.chromium.ui.resources.ResourceFactory; |
| 11 import org.chromium.ui.resources.statics.NinePatchData; |
| 12 |
10 /** | 13 /** |
11 * A basic implementation of {@link DynamicResource} to handle updatable bitmaps
. | 14 * A basic implementation of {@link DynamicResource} to handle updatable bitmaps
. |
12 */ | 15 */ |
13 public class BitmapDynamicResource implements DynamicResource { | 16 public class BitmapDynamicResource implements DynamicResource { |
14 private static final Rect EMPTY_RECT = new Rect(); | 17 private static final Rect EMPTY_RECT = new Rect(); |
15 | 18 |
16 private final int mResId; | 19 private final int mResId; |
17 private Bitmap mBitmap; | 20 private Bitmap mBitmap; |
18 private final Rect mSize = new Rect(); | 21 private final Rect mSize = new Rect(); |
19 private boolean mIsDirty = true; | 22 private boolean mIsDirty = true; |
(...skipping 27 matching lines...) Expand all Loading... |
47 mIsDirty = false; | 50 mIsDirty = false; |
48 return mBitmap; | 51 return mBitmap; |
49 } | 52 } |
50 | 53 |
51 @Override | 54 @Override |
52 public Rect getBitmapSize() { | 55 public Rect getBitmapSize() { |
53 return mSize; | 56 return mSize; |
54 } | 57 } |
55 | 58 |
56 @Override | 59 @Override |
57 public Rect getPadding() { | 60 public long createNativeResource() { |
58 return EMPTY_RECT; | 61 return ResourceFactory.createBitmapResource(null); |
59 } | 62 } |
60 | 63 |
61 @Override | 64 @Override |
62 public Rect getAperture() { | 65 public NinePatchData getNinePatchData() { |
63 return EMPTY_RECT; | 66 return null; |
64 } | 67 } |
65 | 68 |
66 @Override | 69 @Override |
67 public boolean isDirty() { | 70 public boolean isDirty() { |
68 return mIsDirty; | 71 return mIsDirty; |
69 } | 72 } |
70 } | 73 } |
OLD | NEW |