From efabe00e4a51bb792366c459d6acc46832e61fdc Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Fri, 28 Aug 2009 09:38:18 -0700 Subject: [PATCH] The icons are 3d --- res/raw/rollo.c | 167 ++++++++++--------- src/com/android/launcher2/AllAppsView.java | 2 +- src/com/android/launcher2/LauncherModel.java | 7 +- src/com/android/launcher2/Utilities.java | 8 +- 4 files changed, 97 insertions(+), 87 deletions(-) diff --git a/res/raw/rollo.c b/res/raw/rollo.c index b8f3341aa1..c109d2984c 100644 --- a/res/raw/rollo.c +++ b/res/raw/rollo.c @@ -30,11 +30,10 @@ #define SCRATCH_ADJUSTED_DECELERATION 0 // Drawing constants, should be parameters ====== -#define SCREEN_WIDTH 480 +#define SCREEN_WIDTH_PX 480 #define SCREEN_HEIGHT 854 #define COLUMNS_PER_PAGE 4 #define ROWS_PER_PAGE 4 -#define DIAMETER 8.0f #define PAGE_PADDING_TOP_PX 80 #define CELL_PADDING_TOP_PX 5 @@ -48,8 +47,9 @@ #define CELL_WIDTH_PX 105 #define ICON_WIDTH_PX 64 #define ICON_TEXTURE_WIDTH_PX 128 -#define COLUMN_GUTTER_PX 5 -#define LABEL_WIDTH_PX 105 + +#define VIEW_ANGLE 1.28700222f +#define RADIUS 4.0f int count_pages(int iconCount) @@ -62,17 +62,70 @@ count_pages(int iconCount) return pages; } -int current_page(float scrollXPx) -{ - return -scrollXPx / SCREEN_WIDTH; -} - float modf(float x, float y) { return x-(y*floorf(x/y)); } +void +draw_page(int icon, int lastIcon, float centerAngle) +{ + int row; + int col; + + float iconTextureWidth = ICON_WIDTH_PX / (float)ICON_TEXTURE_WIDTH_PX; + float iconTextureHeight = ICON_HEIGHT_PX / (float)ICON_TEXTURE_HEIGHT_PX; + + float iconWidthAngle = VIEW_ANGLE * ICON_WIDTH_PX / SCREEN_WIDTH_PX; + float columnGutterAngle = iconWidthAngle * 0.5f; + + float normalizedIconSize = 2 * ICON_WIDTH_PX / (float)SCREEN_WIDTH_PX; + float farIconSize = normalizedIconSize * (RADIUS+2) / 2; // -2 is the camera z=(z-camZ)/z + + for (row=0; row= (SCREEN_WIDTH/2)) { + if (scrollOnPage >= (SCREEN_WIDTH_PX/2)) { // adjust the deceleration so we align on the page boundary - endPos = -endPage * SCREEN_WIDTH; + endPos = -endPage * SCREEN_WIDTH_PX; debugI32("endPos case 3", endPos); } else { // TODO: bounce - endPos = -endPage * SCREEN_WIDTH; + endPos = -endPage * SCREEN_WIDTH_PX; debugI32("endPos case 4", endPos); } } @@ -229,60 +273,23 @@ main(int launchID) storeF(ALLOC_STATE, STATE_ADJUSTED_DECELERATION, 0); } - // don't draw everything, just the page before and after what we're viewing. - int currentPage = current_page(scrollXPx); - float screenWidth = SCREEN_WIDTH * densityScale; + bindProgramFragment(NAMED_PF); + bindProgramFragmentStore(NAMED_PFS); + + // Bug makes 1.0f alpha fail. + color(1.0f, 1.0f, 1.0f, 0.99f); + + int lastIcon = iconCount-1; + + float currentPage = -scrollXPx / (float)SCREEN_WIDTH_PX; + int page = currentPage; + float currentPagePosition = currentPage - page; int iconsPerPage = COLUMNS_PER_PAGE * ROWS_PER_PAGE; - int icon = 0; - int lastIcon = iconCount-1; - float pageLeft = -1 + (scrollXPx * densityScale); - while (icon <= lastIcon) { - // Bug makes 1.0f alpha fail. - color(1.0f, 1.0f, 1.0f, 0.99f); - - float cellTop = pagePaddingTop; - int row; - for (row=0; row 0) { added = mAllAppsList.added; - added = new ArrayList(); + mAllAppsList.added = new ArrayList(); } if (mAllAppsList.removed.size() > 0) { removed = mAllAppsList.removed; - removed = new ArrayList(); + mAllAppsList.removed = new ArrayList(); for (ApplicationInfo info: removed) { AppInfoCache.remove(info.intent.getComponent()); } } if (mAllAppsList.modified.size() > 0) { modified = mAllAppsList.modified; - modified = new ArrayList(); + mAllAppsList.modified = new ArrayList(); } final Callbacks callbacks = mCallbacks.get(); @@ -438,6 +438,7 @@ public class LauncherModel { while (!done) { try { mWaitThread.join(); + done = true; } catch (InterruptedException ex) { } } diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java index 53e42e3cf6..0c5dbbdf04 100644 --- a/src/com/android/launcher2/Utilities.java +++ b/src/com/android/launcher2/Utilities.java @@ -264,12 +264,14 @@ final class Utilities { mTextWidth = bubbleWidth - mBubblePadding - mBubblePadding; Paint rectPaint = mRectPaint = new Paint(); - rectPaint.setColor(0xaa000000); + rectPaint.setColor(0xff000000); rectPaint.setAntiAlias(true); + Log.d(Launcher.LOG_TAG, "scale=" + scale + " textSize=" + (13*scale)); + TextPaint textPaint = mTextPaint = new TextPaint(); - textPaint.setTypeface(Typeface.DEFAULT_BOLD); - textPaint.setTextSize(20); + textPaint.setTypeface(Typeface.DEFAULT); + textPaint.setTextSize(13*scale); textPaint.setColor(0xffffffff); textPaint.setAntiAlias(true);