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.ResourceManager; |
| 11 |
10 /** | 12 /** |
11 * A basic implementation of {@link DynamicResource} to handle updatable bitmaps
. | 13 * A basic implementation of {@link DynamicResource} to handle updatable bitmaps
. |
12 */ | 14 */ |
13 public class BitmapDynamicResource implements DynamicResource { | 15 public class BitmapDynamicResource implements DynamicResource { |
14 private static final Rect EMPTY_RECT = new Rect(); | 16 private static final Rect EMPTY_RECT = new Rect(); |
15 | 17 |
16 private final int mResId; | 18 private final int mResId; |
17 private Bitmap mBitmap; | 19 private Bitmap mBitmap; |
18 private final Rect mSize = new Rect(); | 20 private final Rect mSize = new Rect(); |
19 private boolean mIsDirty = true; | 21 private boolean mIsDirty = true; |
(...skipping 27 matching lines...) Expand all Loading... |
47 mIsDirty = false; | 49 mIsDirty = false; |
48 return mBitmap; | 50 return mBitmap; |
49 } | 51 } |
50 | 52 |
51 @Override | 53 @Override |
52 public Rect getBitmapSize() { | 54 public Rect getBitmapSize() { |
53 return mSize; | 55 return mSize; |
54 } | 56 } |
55 | 57 |
56 @Override | 58 @Override |
57 public Rect getPadding() { | 59 public long createNativeResource() { |
58 return EMPTY_RECT; | 60 return ResourceManager.createBitmapResource(); |
59 } | 61 } |
60 | 62 |
61 @Override | 63 @Override |
62 public Rect getAperture() { | |
63 return EMPTY_RECT; | |
64 } | |
65 | |
66 @Override | |
67 public boolean isDirty() { | 64 public boolean isDirty() { |
68 return mIsDirty; | 65 return mIsDirty; |
69 } | 66 } |
70 } | 67 } |
OLD | NEW |