summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2013-11-08 14:26:17 -0800
committerJohn Reck <jreck@google.com>2013-11-08 16:39:13 -0800
commit02a2aab57c71f1058348cec0fc3a6aaa07250bc9 (patch)
tree0293f392dcc26ef7d31e8b502883bca9ef82b7b9 /graphics
parentfe2737282fe3eac6b7e7b3863f82f6a6cc191af8 (diff)
downloadframeworks_base-02a2aab57c71f1058348cec0fc3a6aaa07250bc9.zip
frameworks_base-02a2aab57c71f1058348cec0fc3a6aaa07250bc9.tar.gz
frameworks_base-02a2aab57c71f1058348cec0fc3a6aaa07250bc9.tar.bz2
Always do simple path detection
HardwareRenderer.isAvailable() only returns false under an emulator As such eliminate Path's dependency on the HardwareRenderer by always doing simple path detection. The only drawback is a bit of wasted work in the emulator. Change-Id: I89d452bd24a6c6751ed8017c13a9e97f8a1a940d
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/Path.java35
1 files changed, 12 insertions, 23 deletions
diff --git a/graphics/java/android/graphics/Path.java b/graphics/java/android/graphics/Path.java
index 5b04a91..09481d4 100644
--- a/graphics/java/android/graphics/Path.java
+++ b/graphics/java/android/graphics/Path.java
@@ -16,8 +16,6 @@
package android.graphics;
-import android.view.HardwareRenderer;
-
/**
* The Path class encapsulates compound (multiple contour) geometric paths
* consisting of straight line segments, quadratic curves, and cubic curves.
@@ -39,7 +37,6 @@ public class Path {
* @hide
*/
public Region rects;
- private boolean mDetectSimplePaths;
private Direction mLastDirection = null;
/**
@@ -47,7 +44,6 @@ public class Path {
*/
public Path() {
mNativePath = init1();
- mDetectSimplePaths = HardwareRenderer.isAvailable();
}
/**
@@ -65,7 +61,6 @@ public class Path {
}
}
mNativePath = init2(valNative);
- mDetectSimplePaths = HardwareRenderer.isAvailable();
}
/**
@@ -74,10 +69,8 @@ public class Path {
*/
public void reset() {
isSimplePath = true;
- if (mDetectSimplePaths) {
- mLastDirection = null;
- if (rects != null) rects.setEmpty();
- }
+ mLastDirection = null;
+ if (rects != null) rects.setEmpty();
// We promised not to change this, so preserve it around the native
// call, which does now reset fill type.
final FillType fillType = getFillType();
@@ -91,10 +84,8 @@ public class Path {
*/
public void rewind() {
isSimplePath = true;
- if (mDetectSimplePaths) {
- mLastDirection = null;
- if (rects != null) rects.setEmpty();
- }
+ mLastDirection = null;
+ if (rects != null) rects.setEmpty();
native_rewind(mNativePath);
}
@@ -475,16 +466,14 @@ public class Path {
}
private void detectSimplePath(float left, float top, float right, float bottom, Direction dir) {
- if (mDetectSimplePaths) {
- if (mLastDirection == null) {
- mLastDirection = dir;
- }
- if (mLastDirection != dir) {
- isSimplePath = false;
- } else {
- if (rects == null) rects = new Region();
- rects.op((int) left, (int) top, (int) right, (int) bottom, Region.Op.UNION);
- }
+ if (mLastDirection == null) {
+ mLastDirection = dir;
+ }
+ if (mLastDirection != dir) {
+ isSimplePath = false;
+ } else {
+ if (rects == null) rects = new Region();
+ rects.op((int) left, (int) top, (int) right, (int) bottom, Region.Op.UNION);
}
}