diff options
-rw-r--r-- | core/java/android/accounts/AccountManager.java | 3 | ||||
-rw-r--r-- | core/java/android/pim/vcard/VCardComposer.java | 91 | ||||
-rw-r--r-- | core/java/android/provider/Browser.java | 34 | ||||
-rw-r--r-- | core/java/android/provider/ContactsContract.java | 7 | ||||
-rw-r--r-- | core/java/android/webkit/WebViewCore.java | 4 | ||||
-rw-r--r-- | core/java/com/android/internal/view/menu/MenuBuilder.java | 94 | ||||
-rw-r--r-- | libs/rs/java/Fountain/AndroidManifest.xml | 3 | ||||
-rw-r--r-- | libs/rs/rsContext.cpp | 2 | ||||
-rw-r--r-- | libs/rs/rsLocklessFifo.cpp | 4 | ||||
-rw-r--r-- | libs/rs/rsScript.cpp | 1 | ||||
-rw-r--r-- | libs/rs/rsScript.h | 1 | ||||
-rw-r--r-- | libs/rs/rsScriptC.cpp | 16 | ||||
-rw-r--r-- | libs/rs/rsScriptC.h | 1 | ||||
-rw-r--r-- | libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp | 16 | ||||
-rw-r--r-- | libs/surfaceflinger/DisplayHardware/DisplayHardware.h | 2 | ||||
-rw-r--r-- | libs/surfaceflinger/Layer.cpp | 2 | ||||
-rw-r--r-- | libs/surfaceflinger/LayerBase.cpp | 120 | ||||
-rw-r--r-- | libs/surfaceflinger/SurfaceFlinger.cpp | 6 | ||||
-rw-r--r-- | opengl/libagl/array.cpp | 4 |
19 files changed, 223 insertions, 188 deletions
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java index 1ee7f60..2979072 100644 --- a/core/java/android/accounts/AccountManager.java +++ b/core/java/android/accounts/AccountManager.java @@ -859,9 +859,10 @@ public class AccountManager { throw new IllegalArgumentException("the listener is null"); } synchronized (mAccountsUpdatedListeners) { - if (mAccountsUpdatedListeners.remove(listener) == null) { + if (!mAccountsUpdatedListeners.containsKey(listener)) { throw new IllegalStateException("this listener was not previously added"); } + mAccountsUpdatedListeners.remove(listener); if (mAccountsUpdatedListeners.isEmpty()) { mContext.unregisterReceiver(mAccountsChangedBroadcastReceiver); } diff --git a/core/java/android/pim/vcard/VCardComposer.java b/core/java/android/pim/vcard/VCardComposer.java index d386de5..cef971d 100644 --- a/core/java/android/pim/vcard/VCardComposer.java +++ b/core/java/android/pim/vcard/VCardComposer.java @@ -219,6 +219,9 @@ public class VCardComposer { // Property for call log entry private static final String VCARD_PROPERTY_X_TIMESTAMP = "X-IRMC-CALL-DATETIME"; + private static final String VCARD_PROPERTY_CALLTYPE_INCOMING = "INCOMING"; + private static final String VCARD_PROPERTY_CALLTYPE_OUTGOING = "OUTGOING"; + private static final String VCARD_PROPERTY_CALLTYPE_MISSED = "MISSED"; // Properties for DoCoMo vCard. private static final String VCARD_PROPERTY_X_CLASS = "X-CLASS"; @@ -505,9 +508,9 @@ public class VCardComposer { /** * Format according to RFC 2445 DATETIME type. - * The format is: ("%Y%m%dT%H%M%S"). + * The format is: ("%Y%m%dT%H%M%SZ"). */ - private final String formatDate(final long millSecs) { + private final String toRfc2455Format(final long millSecs) { Time startDate = new Time(); startDate.set(millSecs); String date = startDate.format2445(); @@ -515,38 +518,46 @@ public class VCardComposer { } /** - * Create call history time stamp field. - * - * @param type call type + * Try to append the property line for a call history time stamp field if possible. + * Do nothing if the call log type gotton from the database is invalid. */ - private String createCallHistoryTimeStampField(int type) { + private void tryAppendCallHistoryTimeStampField(final StringBuilder builder) { // Extension for call history as defined in // in the Specification for Ic Mobile Communcation - ver 1.1, // Oct 2000. This is used to send the details of the call // history - missed, incoming, outgoing along with date and time // to the requesting device (For example, transferring phone book // when connected over bluetooth) - // X-IRMC-CALL-DATETIME;MISSED:20050320T100000 - final StringBuilder builder = new StringBuilder(); - builder.append(VCARD_PROPERTY_X_TIMESTAMP); - builder.append(VCARD_ATTR_SEPARATOR); - - if (mIsV30) { - builder.append(Constants.ATTR_TYPE).append(VCARD_ATTR_EQUAL); - } - - if (type == Calls.INCOMING_TYPE) { - builder.append("INCOMING"); - } else if (type == Calls.OUTGOING_TYPE) { - builder.append("OUTGOING"); - } else if (type == Calls.MISSED_TYPE) { - builder.append("MISSED"); - } else { - Log.w(LOG_TAG, "Call log type not correct."); - return null; + // + // e.g. "X-IRMC-CALL-DATETIME;MISSED:20050320T100000Z" + final int callLogType = mCursor.getInt(CALL_TYPE_COLUMN_INDEX); + final String callLogTypeStr; + switch (callLogType) { + case Calls.INCOMING_TYPE: { + callLogTypeStr = VCARD_PROPERTY_CALLTYPE_INCOMING; + break; + } + case Calls.OUTGOING_TYPE: { + callLogTypeStr = VCARD_PROPERTY_CALLTYPE_OUTGOING; + break; + } + case Calls.MISSED_TYPE: { + callLogTypeStr = VCARD_PROPERTY_CALLTYPE_MISSED; + break; + } + default: { + Log.w(LOG_TAG, "Call log type not correct."); + return; + } } - return builder.toString(); + final long dateAsLong = mCursor.getLong(DATE_COLUMN_INDEX); + builder.append(VCARD_PROPERTY_X_TIMESTAMP); + builder.append(VCARD_ATTR_SEPARATOR); + appendType(builder, callLogTypeStr); + builder.append(VCARD_DATA_SEPARATOR); + builder.append(toRfc2455Format(dateAsLong)); + builder.append(VCARD_COL_SEPARATOR); } private String createOneCallLogEntryInternal() { @@ -561,7 +572,7 @@ public class VCardComposer { if (TextUtils.isEmpty(name)) { name = mCursor.getString(NUMBER_COLUMN_INDEX); } - boolean needCharset = !(VCardUtils.containsOnlyAscii(name)); + final boolean needCharset = !(VCardUtils.containsOnlyAscii(name)); appendVCardLine(builder, VCARD_PROPERTY_FULL_NAME, name, needCharset, false); appendVCardLine(builder, VCARD_PROPERTY_NAME, name, needCharset, false); @@ -572,17 +583,8 @@ public class VCardComposer { label = Integer.toString(type); } appendVCardTelephoneLine(builder, type, label, number); - - long date = mCursor.getLong(DATE_COLUMN_INDEX); - String dateClause = formatDate(date); - int callLogType = mCursor.getInt(CALL_TYPE_COLUMN_INDEX); - String timestampFeldString = createCallHistoryTimeStampField(callLogType); - if (timestampFeldString != null) { - appendVCardLine(builder, timestampFeldString, dateClause); - } - + tryAppendCallHistoryTimeStampField(builder); appendVCardLine(builder, VCARD_PROPERTY_END, VCARD_DATA_VCARD); - return builder.toString(); } @@ -1266,8 +1268,7 @@ public class VCardComposer { tmpBuilder.append(VCARD_ATTR_ENCODING_BASE64_V21); } tmpBuilder.append(VCARD_ATTR_SEPARATOR); - tmpBuilder.append("TYPE="); - tmpBuilder.append(type); + appendType(tmpBuilder, type); tmpBuilder.append(VCARD_DATA_SEPARATOR); tmpBuilder.append(encodedData); @@ -1544,12 +1545,16 @@ public class VCardComposer { } else { builder.append(VCARD_ATTR_SEPARATOR); } - if (mIsV30) { - builder.append(Constants.ATTR_TYPE); - builder.append('='); - } - builder.append(type); + appendType(builder, type); + } + } + + private void appendType(final StringBuilder builder, final String type) { + // Note: In vCard 3.0, Type strings also can be like this: "TYPE=HOME,PREF" + if (mIsV30) { + builder.append(Constants.ATTR_TYPE).append(VCARD_ATTR_EQUAL); } + builder.append(type); } private String encodeQuotedPrintable(String str) { diff --git a/core/java/android/provider/Browser.java b/core/java/android/provider/Browser.java index 4600b49..c8b7f99 100644 --- a/core/java/android/provider/Browser.java +++ b/core/java/android/provider/Browser.java @@ -280,23 +280,23 @@ public class Browser { * @hide pending API council approval */ public static final String[] getVisitedHistory(ContentResolver cr) { - try { - String[] projection = new String[] { "url" }; - Cursor c = cr.query(BOOKMARKS_URI, - projection, - "visits > 0", - null, null); - String[] str = new String[c.getCount()]; - int i = 0; - while (c.moveToNext()) { - str[i] = c.getString(0); - i++; - } - c.deactivate(); - return str; - } catch (IllegalStateException e) { - return new String[0]; - } + try { + String[] projection = new String[] { + "url" + }; + Cursor c = cr.query(BOOKMARKS_URI, projection, "visits > 0", null, + null); + String[] str = new String[c.getCount()]; + int i = 0; + while (c.moveToNext()) { + str[i] = c.getString(0); + i++; + } + c.deactivate(); + return str; + } catch (IllegalStateException e) { + return new String[0]; + } } /** diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index ed2a78e..8140d82 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -1655,13 +1655,6 @@ public final class ContactsContract { * <P>Type: TEXT</P> */ public static final String BIRTHDAY = DATA1; - - /** - * The nickname as the user entered it. - * <P>Type: TEXT</P> - *@hide - */ - public static final String NICKNAME = DATA2; } /** diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index f617401..8b9ca57 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -312,7 +312,9 @@ final class WebViewCore { } protected String[] populateVisitedLinks() { - return Browser.getVisitedHistory(mContext.getContentResolver()); + // FIXME: getVisitedHistory needs permission and host may not have. +// return Browser.getVisitedHistory(mContext.getContentResolver()); + return new String[0]; } /** diff --git a/core/java/com/android/internal/view/menu/MenuBuilder.java b/core/java/com/android/internal/view/menu/MenuBuilder.java index cbc4e9f..228d5d0 100644 --- a/core/java/com/android/internal/view/menu/MenuBuilder.java +++ b/core/java/com/android/internal/view/menu/MenuBuilder.java @@ -44,6 +44,7 @@ import android.widget.BaseAdapter; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; +import java.util.Vector; /** * Implementation of the {@link android.view.Menu} interface for creating a @@ -752,7 +753,13 @@ public class MenuBuilder implements Menu { return handled; } - MenuItemImpl findItemWithShortcutForKey(int keyCode, KeyEvent event) { + /* + * This function will return all the menu and sub-menu items that can + * be directly (the shortcut directly corresponds) and indirectly + * (the ALT-enabled char corresponds to the shortcut) associated + * with the keyCode. + */ + List<MenuItemImpl> findItemsWithShortcutForKey(int keyCode, KeyEvent event) { final boolean qwerty = isQwertyMode(); final int metaState = event.getMetaState(); final KeyCharacterMap.KeyData possibleChars = new KeyCharacterMap.KeyData(); @@ -763,41 +770,76 @@ public class MenuBuilder implements Menu { return null; } + Vector<MenuItemImpl> items = new Vector(); // Look for an item whose shortcut is this key. final int N = mItems.size(); for (int i = 0; i < N; i++) { MenuItemImpl item = mItems.get(i); if (item.hasSubMenu()) { - MenuItemImpl subMenuItem = ((MenuBuilder)item.getSubMenu()) - .findItemWithShortcutForKey(keyCode, event); - if (subMenuItem != null) { - return subMenuItem; - } + List<MenuItemImpl> subMenuItems = ((MenuBuilder)item.getSubMenu()) + .findItemsWithShortcutForKey(keyCode, event); + items.addAll(subMenuItems); } - if (qwerty) { - final char shortcutAlphaChar = item.getAlphabeticShortcut(); - if (((metaState & (KeyEvent.META_SHIFT_ON | KeyEvent.META_SYM_ON)) == 0) && - (shortcutAlphaChar != 0) && - (shortcutAlphaChar == possibleChars.meta[0] - || shortcutAlphaChar == possibleChars.meta[2] - || (shortcutAlphaChar == '\b' && keyCode == KeyEvent.KEYCODE_DEL)) && - item.isEnabled()) { - return item; - } - } else { - final char shortcutNumericChar = item.getNumericShortcut(); - if (((metaState & (KeyEvent.META_SHIFT_ON | KeyEvent.META_SYM_ON)) == 0) && - (shortcutNumericChar != 0) && - (shortcutNumericChar == possibleChars.meta[0] - || shortcutNumericChar == possibleChars.meta[2]) && - item.isEnabled()) { - return item; - } + final char shortcutChar = qwerty ? item.getAlphabeticShortcut() : item.getNumericShortcut(); + if (((metaState & (KeyEvent.META_SHIFT_ON | KeyEvent.META_SYM_ON)) == 0) && + (shortcutChar != 0) && + (shortcutChar == possibleChars.meta[0] + || shortcutChar == possibleChars.meta[2] + || (qwerty && shortcutChar == '\b' && + keyCode == KeyEvent.KEYCODE_DEL)) && + item.isEnabled()) { + items.add(item); + } + } + return items; + } + + /* + * We want to return the menu item associated with the key, but if there is no + * ambiguity (i.e. there is only one menu item corresponding to the key) we want + * to return it even if it's not an exact match; this allow the user to + * _not_ use the ALT key for example, making the use of shortcuts slightly more + * user-friendly. An example is on the G1, '!' and '1' are on the same key, and + * in Gmail, Menu+1 will trigger Menu+! (the actual shortcut). + * + * On the other hand, if two (or more) shortcuts corresponds to the same key, + * we have to only return the exact match. + */ + MenuItemImpl findItemWithShortcutForKey(int keyCode, KeyEvent event) { + // Get all items that can be associated directly or indirectly with the keyCode + List<MenuItemImpl> items = findItemsWithShortcutForKey(keyCode, event); + + if (items == null) { + return null; + } + + final int metaState = event.getMetaState(); + final KeyCharacterMap.KeyData possibleChars = new KeyCharacterMap.KeyData(); + // Get the chars associated with the keyCode (i.e using any chording combo) + event.getKeyData(possibleChars); + + // If we have only one element, we can safely returns it + if (items.size() == 1) { + return items.get(0); + } + + final boolean qwerty = isQwertyMode(); + // If we found more than one item associated with the key, + // we have to return the exact match + for (MenuItemImpl item : items) { + final char shortcutChar = qwerty ? item.getAlphabeticShortcut() : item.getNumericShortcut(); + if ((shortcutChar == possibleChars.meta[0] && + (metaState & KeyEvent.META_ALT_ON) == 0) + || (shortcutChar == possibleChars.meta[2] && + (metaState & KeyEvent.META_ALT_ON) != 0) + || (qwerty && shortcutChar == '\b' && + keyCode == KeyEvent.KEYCODE_DEL)) { + return item; } } return null; } - + public boolean performIdentifierAction(int id, int flags) { // Look for an item whose identifier is the id. return performItemAction(findItem(id), flags); diff --git a/libs/rs/java/Fountain/AndroidManifest.xml b/libs/rs/java/Fountain/AndroidManifest.xml index dd0e428..1185930 100644 --- a/libs/rs/java/Fountain/AndroidManifest.xml +++ b/libs/rs/java/Fountain/AndroidManifest.xml @@ -2,8 +2,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.fountain"> <application android:label="Fountain"> - <activity android:name="Fountain" - android:theme="@android:style/Theme.Translucent"> + <activity android:name="Fountain"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index cc11ab2..0ac8320 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -317,7 +317,7 @@ Context::Context(Device *dev, Surface *sur, bool useDepth) } while(!mRunning) { - sleep(1); + usleep(100); } pthread_attr_destroy(&threadAttr); diff --git a/libs/rs/rsLocklessFifo.cpp b/libs/rs/rsLocklessFifo.cpp index 0c40389..f4f5d40 100644 --- a/libs/rs/rsLocklessFifo.cpp +++ b/libs/rs/rsLocklessFifo.cpp @@ -159,7 +159,7 @@ void LocklessCommandFifo::makeSpace(uint32_t bytes) if ((mPut+bytes) > mEnd) { // Need to loop regardless of where get is. while((mGet > mPut) && (mBuffer+4 >= mGet)) { - sleep(1); + usleep(100); } // Toss in a reset then the normal wait for space will do the rest. @@ -170,7 +170,7 @@ void LocklessCommandFifo::makeSpace(uint32_t bytes) // it will fit here so we just need to wait for space. while(getFreeSpace() < bytes) { - sleep(1); + usleep(100); } } diff --git a/libs/rs/rsScript.cpp b/libs/rs/rsScript.cpp index 99a085d..76fed3b 100644 --- a/libs/rs/rsScript.cpp +++ b/libs/rs/rsScript.cpp @@ -94,6 +94,7 @@ void rsi_ScriptSetInvoke(Context *rsc, const char *name, uint32_t slot) void rsi_ScriptInvoke(Context *rsc, RsScript vs, uint32_t slot) { Script *s = static_cast<Script *>(vs); + s->setupScript(); s->mEnviroment.mInvokables[slot](); } diff --git a/libs/rs/rsScript.h b/libs/rs/rsScript.h index e40531e..97cb67a 100644 --- a/libs/rs/rsScript.h +++ b/libs/rs/rsScript.h @@ -69,6 +69,7 @@ public: + virtual void setupScript() = 0; virtual bool run(Context *, uint32_t launchID) = 0; }; diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index 108ae5a..bff337c 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/rsScriptC.cpp @@ -46,6 +46,15 @@ ScriptC::~ScriptC() } } +void ScriptC::setupScript() +{ + for (int ct=0; ct < MAX_SCRIPT_BANKS; ct++) { + if (mProgram.mSlotPointers[ct]) { + *mProgram.mSlotPointers[ct] = mSlots[ct]->getPtr(); + } + } +} + bool ScriptC::run(Context *rsc, uint32_t launchIndex) { @@ -66,12 +75,7 @@ bool ScriptC::run(Context *rsc, uint32_t launchIndex) mEnviroment.mStartTimeMillis = nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC)); } - - for (int ct=0; ct < MAX_SCRIPT_BANKS; ct++) { - if (mProgram.mSlotPointers[ct]) { - *mProgram.mSlotPointers[ct] = mSlots[ct]->getPtr(); - } - } + setupScript(); bool ret = false; tls->mScript = this; diff --git a/libs/rs/rsScriptC.h b/libs/rs/rsScriptC.h index 355f0c3..16eb8de 100644 --- a/libs/rs/rsScriptC.h +++ b/libs/rs/rsScriptC.h @@ -58,6 +58,7 @@ public: ACCscript* mAccScript; + virtual void setupScript(); virtual bool run(Context *, uint32_t launchID); }; diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp index 7bdf885..8a7abec 100644 --- a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp +++ b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp @@ -160,7 +160,7 @@ void DisplayHardware::init(uint32_t dpy) if (mNativeWindow->isUpdateOnDemand()) { - mFlags |= UPDATE_ON_DEMAND; + mFlags |= PARTIAL_UPDATES; } if (eglGetConfigAttrib(display, config, EGL_CONFIG_CAVEAT, &dummy) == EGL_TRUE) { @@ -174,9 +174,9 @@ void DisplayHardware::init(uint32_t dpy) surface = eglCreateWindowSurface(display, config, mNativeWindow.get(), NULL); - if (mFlags & UPDATE_ON_DEMAND) { - // if we have update on demand, we definitely don't need to - // preserve the backbuffer, which is usually costly. + if (mFlags & PARTIAL_UPDATES) { + // if we have partial updates, we definitely don't need to + // preserve the backbuffer, which may be costly. eglSurfaceAttrib(display, surface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); } @@ -199,9 +199,9 @@ void DisplayHardware::init(uint32_t dpy) mFlags |= SWAP_RECTANGLE; } } - // when we have the choice between UPDATE_ON_DEMAND and SWAP_RECTANGLE - // choose UPDATE_ON_DEMAND, which is more efficient - if (mFlags & UPDATE_ON_DEMAND) + // when we have the choice between PARTIAL_UPDATES and SWAP_RECTANGLE + // choose PARTIAL_UPDATES, which should be more efficient + if (mFlags & PARTIAL_UPDATES) mFlags &= ~SWAP_RECTANGLE; #endif @@ -317,7 +317,7 @@ void DisplayHardware::flip(const Region& dirty) const } #endif - if (mFlags & UPDATE_ON_DEMAND) { + if (mFlags & PARTIAL_UPDATES) { mNativeWindow->setUpdateRectangle(dirty.getBounds()); } diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardware.h b/libs/surfaceflinger/DisplayHardware/DisplayHardware.h index b7f1cdb..cb688b7 100644 --- a/libs/surfaceflinger/DisplayHardware/DisplayHardware.h +++ b/libs/surfaceflinger/DisplayHardware/DisplayHardware.h @@ -48,7 +48,7 @@ public: NPOT_EXTENSION = 0x00000100, DRAW_TEXTURE_EXTENSION = 0x00000200, BUFFER_PRESERVED = 0x00010000, - UPDATE_ON_DEMAND = 0x00020000, // video driver feature + PARTIAL_UPDATES = 0x00020000, // video driver feature SLOW_CONFIG = 0x00040000, // software SWAP_RECTANGLE = 0x00080000, }; diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp index 67ddcf9..2894bf0 100644 --- a/libs/surfaceflinger/Layer.cpp +++ b/libs/surfaceflinger/Layer.cpp @@ -223,14 +223,12 @@ void Layer::onDraw(const Region& clip) const mFrontBufferIndex : 0; GLuint textureName = mTextures[index].name; if (UNLIKELY(textureName == -1LU)) { - //LOGW("Layer %p doesn't have a texture", this); // the texture has not been created yet, this Layer has // in fact never been drawn into. this happens frequently with // SurfaceView. clearWithOpenGL(clip); return; } - drawWithOpenGL(clip, mTextures[index]); } diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp index 5a93b2d..a351253 100644 --- a/libs/surfaceflinger/LayerBase.cpp +++ b/libs/surfaceflinger/LayerBase.cpp @@ -363,15 +363,13 @@ void LayerBase::clearWithOpenGL(const Region& clip, GLclampx red, Region::const_iterator it = clip.begin(); Region::const_iterator const end = clip.end(); - if (it != end) { - glEnable(GL_SCISSOR_TEST); - glVertexPointer(2, GL_FIXED, 0, mVertices); - while (it != end) { - const Rect& r = *it++; - const GLint sy = fbHeight - (r.top + r.height()); - glScissor(r.left, sy, r.width(), r.height()); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - } + glEnable(GL_SCISSOR_TEST); + glVertexPointer(2, GL_FIXED, 0, mVertices); + while (it != end) { + const Rect& r = *it++; + const GLint sy = fbHeight - (r.top + r.height()); + glScissor(r.left, sy, r.width(), r.height()); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } } @@ -427,71 +425,63 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const } } + Region::const_iterator it = clip.begin(); + Region::const_iterator const end = clip.end(); if (UNLIKELY(transformed() || !(mFlags & DisplayHardware::DRAW_TEXTURE_EXTENSION) )) { //StopWatch watch("GL transformed"); - Region::const_iterator it = clip.begin(); - Region::const_iterator const end = clip.end(); - if (it != end) { - const GLfixed texCoords[4][2] = { - { 0, 0 }, - { 0, 0x10000 }, - { 0x10000, 0x10000 }, - { 0x10000, 0 } - }; - - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - - // the texture's source is rotated - if (texture.transform == HAL_TRANSFORM_ROT_90) { - // TODO: handle the other orientations - glTranslatef(0, 1, 0); - glRotatef(-90, 0, 0, 1); - } + const GLfixed texCoords[4][2] = { + { 0, 0 }, + { 0, 0x10000 }, + { 0x10000, 0x10000 }, + { 0x10000, 0 } + }; + + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + + // the texture's source is rotated + if (texture.transform == HAL_TRANSFORM_ROT_90) { + // TODO: handle the other orientations + glTranslatef(0, 1, 0); + glRotatef(-90, 0, 0, 1); + } - if (!(mFlags & (DisplayHardware::NPOT_EXTENSION | - DisplayHardware::DIRECT_TEXTURE))) { - // find the smallest power-of-two that will accommodate our surface - GLuint tw = 1 << (31 - clz(width)); - GLuint th = 1 << (31 - clz(height)); - if (tw < width) tw <<= 1; - if (th < height) th <<= 1; - // this divide should be relatively fast because it's - // a power-of-two (optimized path in libgcc) - GLfloat ws = GLfloat(width) /tw; - GLfloat hs = GLfloat(height)/th; - glScalef(ws, hs, 1.0f); - } + if (!(mFlags & (DisplayHardware::NPOT_EXTENSION | + DisplayHardware::DIRECT_TEXTURE))) { + // find the smallest power-of-two that will accommodate our surface + GLuint tw = 1 << (31 - clz(width)); + GLuint th = 1 << (31 - clz(height)); + if (tw < width) tw <<= 1; + if (th < height) th <<= 1; + GLfloat ws = GLfloat(width) /tw; + GLfloat hs = GLfloat(height)/th; + glScalef(ws, hs, 1.0f); + } - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glVertexPointer(2, GL_FIXED, 0, mVertices); - glTexCoordPointer(2, GL_FIXED, 0, texCoords); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glVertexPointer(2, GL_FIXED, 0, mVertices); + glTexCoordPointer(2, GL_FIXED, 0, texCoords); - while (it != end) { - const Rect& r = *it++; - const GLint sy = fbHeight - (r.top + r.height()); - glScissor(r.left, sy, r.width(), r.height()); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - } - glDisableClientState(GL_TEXTURE_COORD_ARRAY); + while (it != end) { + const Rect& r = *it++; + const GLint sy = fbHeight - (r.top + r.height()); + glScissor(r.left, sy, r.width(), r.height()); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } + glDisableClientState(GL_TEXTURE_COORD_ARRAY); } else { - Region::const_iterator it = clip.begin(); - Region::const_iterator const end = clip.end(); - if (it != end) { - GLint crop[4] = { 0, height, width, -height }; - glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop); - int x = tx(); - int y = ty(); - y = fbHeight - (y + height); - while (it != end) { - const Rect& r = *it++; - const GLint sy = fbHeight - (r.top + r.height()); - glScissor(r.left, sy, r.width(), r.height()); - glDrawTexiOES(x, y, 0, width, height); - } + GLint crop[4] = { 0, height, width, -height }; + glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop); + int x = tx(); + int y = ty(); + y = fbHeight - (y + height); + while (it != end) { + const Rect& r = *it++; + const GLint sy = fbHeight - (r.top + r.height()); + glScissor(r.left, sy, r.width(), r.height()); + glDrawTexiOES(x, y, 0, width, height); } } } diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp index a0b48d4..065425d 100644 --- a/libs/surfaceflinger/SurfaceFlinger.cpp +++ b/libs/surfaceflinger/SurfaceFlinger.cpp @@ -859,10 +859,10 @@ void SurfaceFlinger::handleRepaint() // is costly and usually involves copying the whole update back. } } else { - if (flags & DisplayHardware::UPDATE_ON_DEMAND) { + if (flags & DisplayHardware::PARTIAL_UPDATES) { // We need to redraw the rectangle that will be updated // (pushed to the framebuffer). - // This is needed because UPDATE_ON_DEMAND only takes one + // This is needed because PARTIAL_UPDATES only takes one // rectangle instead of a region (see DisplayHardware::flip()) mDirtyRegion.set(mInvalidRegion.bounds()); } else { @@ -920,7 +920,7 @@ void SurfaceFlinger::debugFlashRegions() if (!((flags & DisplayHardware::SWAP_RECTANGLE) || (flags & DisplayHardware::BUFFER_PRESERVED))) { - const Region repaint((flags & DisplayHardware::UPDATE_ON_DEMAND) ? + const Region repaint((flags & DisplayHardware::PARTIAL_UPDATES) ? mDirtyRegion.bounds() : hw.bounds()); composeSurfaces(repaint); } diff --git a/opengl/libagl/array.cpp b/opengl/libagl/array.cpp index f414ee5..4878722 100644 --- a/opengl/libagl/array.cpp +++ b/opengl/libagl/array.cpp @@ -1266,9 +1266,7 @@ void glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { ogles_context_t* c = ogles_context_t::get(); - // in theory ogles doesn't allow color arrays of size 3 - // but it is very useful to 'visualize' the normal array. - if (size<3 || size>4 || stride<0) { + if (size!=4 || stride<0) { ogles_error(c, GL_INVALID_VALUE); return; } |