diff options
author | Julien Chaffraix <julienc@quicinc.com> | 2010-07-31 23:48:39 -0700 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2010-08-14 10:57:29 -0400 |
commit | fae7c2cc854191bec74a15fcc698aeb49a4b724b (patch) | |
tree | 4af22c6f52ae6a0e926fe3a6dfaf679da37b23be | |
parent | 27f870c901852006612b8d7dedf774005e6fd335 (diff) | |
download | frameworks_base-fae7c2cc854191bec74a15fcc698aeb49a4b724b.zip frameworks_base-fae7c2cc854191bec74a15fcc698aeb49a4b724b.tar.gz frameworks_base-fae7c2cc854191bec74a15fcc698aeb49a4b724b.tar.bz2 |
Add a color inversion algorithm to Android.
This flips the colors in the page (not including images) to use OLED's
lower power when displaying dark colors.
frameworks/base part of the change.
Change-Id: I250083c9c60cf68f906991252d81f0bbec32bc6e
-rw-r--r-- | core/java/android/webkit/WebSettings.java | 18 | ||||
-rw-r--r-- | core/java/android/webkit/WebViewCore.java | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index cfb6b92..1f1a088 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -178,6 +178,7 @@ public class WebSettings { private boolean mUseWideViewport = false; private boolean mSupportMultipleWindows = false; private boolean mShrinksStandaloneImagesToFit = false; + private boolean mInvertColor = false; // HTML5 API flags private boolean mAppCacheEnabled = false; private boolean mDatabaseEnabled = false; @@ -1387,6 +1388,23 @@ public class WebSettings { } } + /** + * @hide + */ + public synchronized void setInvertColor(boolean invert) { + if (mInvertColor != invert) { + mInvertColor = invert; + postSync(); + } + } + + /** + * @hide + */ + public synchronized boolean getInvertColor() { + return mInvertColor; + } + int getDoubleTapToastCount() { return mDoubleTapToastCount; } diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 68c0fb8..c39f867 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -525,6 +525,8 @@ final class WebViewCore { private native void nativeSetBackgroundColor(int color); + private native void nativeSetColorInversion(boolean invert); + private native void nativeDumpDomTree(boolean useFile); private native void nativeDumpRenderTree(boolean useFile); @@ -1792,6 +1794,7 @@ final class WebViewCore { df = mScrollFilter; } canvas.setDrawFilter(df); + nativeSetColorInversion(mSettings.getInvertColor()); boolean tookTooLong = nativeDrawContent(canvas, color); canvas.setDrawFilter(null); if (tookTooLong && mSplitPictureIsScheduled == false) { |