summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/androidfw/InputDevice.cpp9
-rw-r--r--libs/androidfw/KeyLayoutMap.cpp47
-rw-r--r--libs/hwui/DisplayListRenderer.cpp5
-rw-r--r--libs/hwui/OpenGLRenderer.cpp5
-rw-r--r--libs/hwui/OpenGLRenderer.h1
5 files changed, 48 insertions, 19 deletions
diff --git a/libs/androidfw/InputDevice.cpp b/libs/androidfw/InputDevice.cpp
index 698feb6..6bb06a9 100644
--- a/libs/androidfw/InputDevice.cpp
+++ b/libs/androidfw/InputDevice.cpp
@@ -127,11 +127,12 @@ String8 getInputDeviceConfigurationFilePathByName(
// --- InputDeviceInfo ---
InputDeviceInfo::InputDeviceInfo() {
- initialize(-1, String8("uninitialized device info"), String8("unknown"));
+ initialize(-1, -1, String8("uninitialized device info"), String8("unknown"));
}
InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other) :
- mId(other.mId), mName(other.mName), mDescriptor(other.mDescriptor),
+ mId(other.mId), mGeneration(other.mGeneration),
+ mName(other.mName), mDescriptor(other.mDescriptor),
mSources(other.mSources),
mKeyboardType(other.mKeyboardType),
mKeyCharacterMap(other.mKeyCharacterMap),
@@ -141,8 +142,10 @@ InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other) :
InputDeviceInfo::~InputDeviceInfo() {
}
-void InputDeviceInfo::initialize(int32_t id, const String8& name, const String8& descriptor) {
+void InputDeviceInfo::initialize(int32_t id, int32_t generation,
+ const String8& name, const String8& descriptor) {
mId = id;
+ mGeneration = generation;
mName = name;
mDescriptor = descriptor;
mSources = 0;
diff --git a/libs/androidfw/KeyLayoutMap.cpp b/libs/androidfw/KeyLayoutMap.cpp
index 1809412..a7c2199 100644
--- a/libs/androidfw/KeyLayoutMap.cpp
+++ b/libs/androidfw/KeyLayoutMap.cpp
@@ -80,32 +80,49 @@ status_t KeyLayoutMap::load(const String8& filename, sp<KeyLayoutMap>* outMap) {
return status;
}
-status_t KeyLayoutMap::mapKey(int32_t scanCode, int32_t* keyCode, uint32_t* flags) const {
- ssize_t index = mKeys.indexOfKey(scanCode);
- if (index < 0) {
+status_t KeyLayoutMap::mapKey(int32_t scanCode, int32_t usageCode,
+ int32_t* outKeyCode, uint32_t* outFlags) const {
+ const Key* key = getKey(scanCode, usageCode);
+ if (!key) {
#if DEBUG_MAPPING
- ALOGD("mapKey: scanCode=%d ~ Failed.", scanCode);
+ ALOGD("mapKey: scanCode=%d, usageCode=0x%08x ~ Failed.", scanCode, usageCode);
#endif
- *keyCode = AKEYCODE_UNKNOWN;
- *flags = 0;
+ *outKeyCode = AKEYCODE_UNKNOWN;
+ *outFlags = 0;
return NAME_NOT_FOUND;
}
- const Key& k = mKeys.valueAt(index);
- *keyCode = k.keyCode;
- *flags = k.flags;
+ *outKeyCode = key->keyCode;
+ *outFlags = key->flags;
#if DEBUG_MAPPING
- ALOGD("mapKey: scanCode=%d ~ Result keyCode=%d, flags=0x%08x.", scanCode, *keyCode, *flags);
+ ALOGD("mapKey: scanCode=%d, usageCode=0x%08x ~ Result keyCode=%d, outFlags=0x%08x.",
+ scanCode, usageCode, *outKeyCode, *outFlags);
#endif
return NO_ERROR;
}
+const KeyLayoutMap::Key* KeyLayoutMap::getKey(int32_t scanCode, int32_t usageCode) const {
+ if (usageCode) {
+ ssize_t index = mKeysByUsageCode.indexOfKey(usageCode);
+ if (index >= 0) {
+ return &mKeysByUsageCode.valueAt(index);
+ }
+ }
+ if (scanCode) {
+ ssize_t index = mKeysByScanCode.indexOfKey(scanCode);
+ if (index >= 0) {
+ return &mKeysByScanCode.valueAt(index);
+ }
+ }
+ return NULL;
+}
+
status_t KeyLayoutMap::findScanCodesForKey(int32_t keyCode, Vector<int32_t>* outScanCodes) const {
- const size_t N = mKeys.size();
+ const size_t N = mKeysByScanCode.size();
for (size_t i=0; i<N; i++) {
- if (mKeys.valueAt(i).keyCode == keyCode) {
- outScanCodes->add(mKeys.keyAt(i));
+ if (mKeysByScanCode.valueAt(i).keyCode == keyCode) {
+ outScanCodes->add(mKeysByScanCode.keyAt(i));
}
}
return NO_ERROR;
@@ -190,7 +207,7 @@ status_t KeyLayoutMap::Parser::parseKey() {
scanCodeToken.string());
return BAD_VALUE;
}
- if (mMap->mKeys.indexOfKey(scanCode) >= 0) {
+ if (mMap->mKeysByScanCode.indexOfKey(scanCode) >= 0) {
ALOGE("%s: Duplicate entry for key scan code '%s'.", mTokenizer->getLocation().string(),
scanCodeToken.string());
return BAD_VALUE;
@@ -231,7 +248,7 @@ status_t KeyLayoutMap::Parser::parseKey() {
Key key;
key.keyCode = keyCode;
key.flags = flags;
- mMap->mKeys.add(scanCode, key);
+ mMap->mKeysByScanCode.add(scanCode, key);
return NO_ERROR;
}
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 9f2bacd..3910739 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -818,7 +818,10 @@ status_t DisplayList::replay(OpenGLRenderer& renderer, uint32_t width,
indent[i] = ' ';
}
indent[count] = '\0';
- DISPLAY_LIST_LOGD("%sStart display list (%p, %s)", (char*) indent + 2, this, mName.string());
+ Rect* clipRect = renderer.getClipRect();
+ DISPLAY_LIST_LOGD("%sStart display list (%p, %s), clipRect: %.0f, %.f, %.0f, %.0f",
+ (char*) indent + 2, this, mName.string(), clipRect->left, clipRect->top,
+ clipRect->right, clipRect->bottom);
#endif
renderer.startMark(mName.string());
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 06928df..ebb8eb7 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -520,6 +520,7 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top,
layer->texCoords.set(0.0f, bounds.getHeight() / float(layer->getHeight()),
bounds.getWidth() / float(layer->getWidth()), 0.0f);
layer->setColorFilter(mColorFilter);
+ layer->setBlend(true);
// Save the layer in the snapshot
snapshot->flags |= Snapshot::kFlagIsLayer;
@@ -1058,6 +1059,10 @@ bool OpenGLRenderer::clipRect(float left, float top, float right, float bottom,
return !mSnapshot->clipRect->isEmpty();
}
+Rect* OpenGLRenderer::getClipRect() {
+ return mSnapshot->clipRect;
+}
+
///////////////////////////////////////////////////////////////////////////////
// Drawing commands
///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index b52d2b0..47927bb 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -101,6 +101,7 @@ public:
ANDROID_API const Rect& getClipBounds();
ANDROID_API bool quickReject(float left, float top, float right, float bottom);
virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
+ virtual Rect* getClipRect();
virtual status_t drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
Rect& dirty, int32_t flags, uint32_t level = 0);