Skip to content

Commit

Permalink
Merge branch 'eclair' of git://github.com/cyanogen/android_packages_w…
Browse files Browse the repository at this point in the history
…allpapers_Basic into HEAD

Conflicts:
	res/drawable-mdpi/dark_pyramid_background.png
	res/values/arrays.xml
  • Loading branch information
Wes Garner committed Apr 7, 2010
2 parents 07fcc3d + 1e2bfc9 commit 20a19e3
Show file tree
Hide file tree
Showing 13 changed files with 162 additions and 120 deletions.
Binary file modified res/drawable-hdpi/cyanogenmod_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable-hdpi/dark_pyramid_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/droid_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable-hdpi/nexus_thumb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable-mdpi/cyanogenmod_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/droid_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable-mdpi/lookingglass_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable-mdpi/nexus_thumb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 2 additions & 10 deletions res/raw/nexus.rs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -110,21 +110,13 @@ void initPulses() {


void drawBackground(int width, int height) { void drawBackground(int width, int height) {
bindProgramFragment(NAMED_PFTexture565); bindProgramFragment(NAMED_PFTexture565);
if (State->background == 0) { bindTexture(NAMED_PFTexture565, 0, NAMED_TBackground);
bindTexture(NAMED_PFTexture565, 0, NAMED_TBackground);
} else if (State->background == 1) {
bindTexture(NAMED_PFTexture565, 0, NAMED_TBackgroundDark);
} else if (State->background == 2) { //changed from a else to a else if
bindTexture(NAMED_PFTexture565, 0, NAMED_TBackgroundLookingGlass);
} else if (State->background == 3) { //added a else if for if set to 3 (cyanogenmod bg)
bindTexture(NAMED_PFTexture565, 0, NAMED_TBackgroundCyanogenMod); //added cyanogenmod state
}
color(1.0f, 1.0f, 1.0f, 1.0f); color(1.0f, 1.0f, 1.0f, 1.0f);
if (State->rotate) { if (State->rotate) {
drawRect(0.0f, 0.0f, height*2, width, 0.0f); drawRect(0.0f, 0.0f, height*2, width, 0.0f);
} else { } else {
drawRect(0.0f, 0.0f, width*2, height, 0.0f); drawRect(0.0f, 0.0f, width*2, height, 0.0f);
} }
} }




Expand Down
16 changes: 13 additions & 3 deletions res/values/arrays.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<item>Zion</item> <item>Zion</item>
<item>Sholes Red</item> <item>Sholes Red</item>
<item>Wes Garner</item> <item>Wes Garner</item>
<item>Soft Blues</item>
</string-array> </string-array>
<string-array name="nexus_colorscheme_ids" translatable="false"> <string-array name="nexus_colorscheme_ids" translatable="false">
<item>0</item> <item>0</item>
Expand All @@ -58,6 +59,7 @@
<item>5</item> <item>5</item>
<item>6</item> <item>6</item>
<item>7</item> <item>7</item>
<item>8</item>
</string-array> </string-array>


<string-array name="nexus_colorscheme_0" translatable="false"> <string-array name="nexus_colorscheme_0" translatable="false">
Expand Down Expand Up @@ -116,19 +118,27 @@
<item>#1B4B7D</item> <item>#1B4B7D</item>
</string-array> </string-array>


<string-array name="nexus_colorscheme_8" translatable="false">
<item>#66CCDD</item>
<item>#3366AA</item>
<item>#6699AA</item>
<item>#AABBBB</item>
</string-array>

<string-array name="nexus_background_names" translatable="false"> <string-array name="nexus_background_names" translatable="false">
<item>Normal</item> <item>Normal</item>
<item>Dark</item> <item>Dark</item>
<item>Looking Glass</item> <item>Looking Glass</item>
<item>Cyanogenmod</item> //added option for cyanogenmod <item>Cyanogenmod</item> //added option for cyanogenmod

<item>Blue Droid</item>// added jegoss's droid background
</string-array> </string-array>


<string-array name="nexus_background_ids" translatable="false"> <string-array name="nexus_background_ids" translatable="false">
<item>normal</item> <item>pyramid</item>
<item>dark</item> <item>dark_pyramid</item>
<item>lookingglass</item> <item>lookingglass</item>
<item>cyanogenmod</item> //added option for cyanogenmod <item>cyanogenmod</item> //added option for cyanogenmod
<item>droid</item>//added jeagoss's droid background
</string-array> </string-array>


</resources> </resources>
15 changes: 14 additions & 1 deletion src/com/android/wallpaper/RenderScriptScene.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public abstract class RenderScriptScene {
protected Resources mResources; protected Resources mResources;
protected RenderScript mRS; protected RenderScript mRS;
protected ScriptC mScript; protected ScriptC mScript;

protected boolean dirty = false;

public RenderScriptScene(int width, int height) { public RenderScriptScene(int width, int height) {
mWidth = width; mWidth = width;
mHeight = height; mHeight = height;
Expand Down Expand Up @@ -72,6 +73,10 @@ public void stop() {
mRS.contextBindRootScript(null); mRS.contextBindRootScript(null);
} }


public void destroyScript() {
mScript.destroy();
}

public void start() { public void start() {
mRS.contextBindRootScript(mScript); mRS.contextBindRootScript(mScript);
} }
Expand All @@ -81,6 +86,14 @@ public void resize(int width, int height) {
mHeight = height; mHeight = height;
} }


public boolean isDirty() {
return dirty;
}

public void setDirty(boolean isDirty) {
this.dirty = isDirty;
}

@SuppressWarnings({"UnusedDeclaration"}) @SuppressWarnings({"UnusedDeclaration"})
public void setOffset(float xOffset, float yOffset, int xPixels, int yPixels) { public void setOffset(float xOffset, float yOffset, int xPixels, int yPixels) {
} }
Expand Down
24 changes: 19 additions & 5 deletions src/com/android/wallpaper/RenderScriptWallpaper.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@


package com.android.wallpaper; package com.android.wallpaper;


import android.service.wallpaper.WallpaperService;
import android.os.Bundle; import android.os.Bundle;
import android.renderscript.RenderScript; import android.renderscript.RenderScript;
import android.view.SurfaceHolder; import android.service.wallpaper.WallpaperService;
import android.view.Surface; import android.view.Surface;
import android.view.SurfaceHolder;


public abstract class RenderScriptWallpaper<T extends RenderScriptScene> extends WallpaperService { public abstract class RenderScriptWallpaper<T extends RenderScriptScene> extends WallpaperService {
public Engine onCreateEngine() { public Engine onCreateEngine() {
Expand Down Expand Up @@ -62,6 +62,7 @@ public void onVisibilityChanged(boolean visible) {
super.onVisibilityChanged(visible); super.onVisibilityChanged(visible);
if (mRenderer != null) { if (mRenderer != null) {
if (visible) { if (visible) {
initRendererIfDirty();
mRenderer.start(); mRenderer.start();
} else { } else {
mRenderer.stop(); mRenderer.stop();
Expand All @@ -75,15 +76,28 @@ public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int he
if (mRs != null) { if (mRs != null) {
mRs.contextSetSurface(width, height, holder.getSurface()); mRs.contextSetSurface(width, height, holder.getSurface());
} }
if (mRenderer == null) { if (mRenderer == null || mRenderer.isDirty()) {
mRenderer = createScene(width, height); if (mRenderer == null) {
mRenderer.init(mRs, getResources(), isPreview()); mRenderer = createScene(width, height);
mRenderer.init(mRs, getResources(), isPreview());
} else {
initRendererIfDirty();
}
mRenderer.start(); mRenderer.start();
} else { } else {
mRenderer.resize(width, height); mRenderer.resize(width, height);
} }
} }


private synchronized void initRendererIfDirty() {
if (mRenderer != null && mRenderer.isDirty()) {
mRenderer.stop();
mRenderer.destroyScript();
mRenderer.setDirty(false);
mRenderer.init(mRs, getResources(), isPreview());
}
}

@Override @Override
public void onOffsetsChanged(float xOffset, float yOffset, public void onOffsetsChanged(float xOffset, float yOffset,
float xStep, float yStep, int xPixels, int yPixels) { float xStep, float yStep, int xPixels, int yPixels) {
Expand Down
Loading

0 comments on commit 20a19e3

Please sign in to comment.