summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt5
-rw-r--r--libs/hwui/DisplayListOp.h6
-rw-r--r--libs/hwui/DisplayListRenderer.cpp2
-rwxr-xr-xlibs/hwui/OpenGLRenderer.cpp26
-rw-r--r--libs/hwui/Renderer.h12
-rw-r--r--media/java/android/media/tv/TvView.java32
6 files changed, 47 insertions, 36 deletions
diff --git a/api/current.txt b/api/current.txt
index e3f641eacc6b..368dcef05d0b 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -17108,8 +17108,6 @@ package android.media.tv {
method public void setStreamVolume(float);
method public void setTvInputListener(android.media.tv.TvView.TvInputListener);
method public void tune(java.lang.String, android.net.Uri);
- field public static final int ERROR_INPUT_DISCONNECTED = 1; // 0x1
- field public static final int ERROR_INPUT_NOT_CONNECTED = 0; // 0x0
}
public static abstract interface TvView.OnUnhandledInputEventListener {
@@ -17119,9 +17117,10 @@ package android.media.tv {
public static abstract class TvView.TvInputListener {
ctor public TvView.TvInputListener();
method public void onChannelRetuned(java.lang.String, android.net.Uri);
+ method public void onConnectionFailed(java.lang.String);
method public void onContentAllowed(java.lang.String);
method public void onContentBlocked(java.lang.String, android.media.tv.TvContentRating);
- method public void onError(java.lang.String, int);
+ method public void onDisconnected(java.lang.String);
method public void onTrackSelected(java.lang.String, int, java.lang.String);
method public void onTracksChanged(java.lang.String, java.util.List<android.media.tv.TvTrackInfo>);
method public void onVideoAvailable(java.lang.String);
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index 1032a7560bd0..5f533a731155 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -1001,6 +1001,8 @@ class DrawStrokableOp : public DrawBoundedOp {
public:
DrawStrokableOp(float left, float top, float right, float bottom, const SkPaint* paint)
: DrawBoundedOp(left, top, right, bottom, paint) {};
+ DrawStrokableOp(const Rect& localBounds, const SkPaint* paint)
+ : DrawBoundedOp(localBounds, paint) {};
virtual bool getLocalBounds(Rect& localBounds) {
localBounds.set(mLocalBounds);
@@ -1339,11 +1341,11 @@ private:
const float* mPositions;
};
-class DrawTextOp : public DrawBoundedOp {
+class DrawTextOp : public DrawStrokableOp {
public:
DrawTextOp(const char* text, int bytesCount, int count, float x, float y,
const float* positions, const SkPaint* paint, float totalAdvance, const Rect& bounds)
- : DrawBoundedOp(bounds, paint), mText(text), mBytesCount(bytesCount), mCount(count),
+ : DrawStrokableOp(bounds, paint), mText(text), mBytesCount(bytesCount), mCount(count),
mX(x), mY(y), mPositions(positions), mTotalAdvance(totalAdvance) {
mPrecacheTransform = SkMatrix::InvalidMatrix();
}
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 94162fcc8118..9a9c5441a6fb 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -376,7 +376,7 @@ status_t DisplayListRenderer::drawText(const char* text, int bytesCount, int cou
float x, float y, const float* positions, const SkPaint* paint,
float totalAdvance, const Rect& bounds, DrawOpMode drawOpMode) {
- if (!text || count <= 0) return DrawGlInfo::kStatusDone;
+ if (!text || count <= 0 || paintWillNotDrawText(*paint)) return DrawGlInfo::kStatusDone;
text = refText(text, bytesCount);
positions = refBuffer<float>(positions, count * 2);
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 721ab3df84fd..bbf055116752 100755
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -2518,8 +2518,9 @@ status_t OpenGLRenderer::drawShape(float left, float top, const PathTexture* tex
status_t OpenGLRenderer::drawRoundRect(float left, float top, float right, float bottom,
float rx, float ry, const SkPaint* p) {
- if (currentSnapshot()->isIgnored() || quickRejectSetupScissor(left, top, right, bottom, p) ||
- (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
+ if (currentSnapshot()->isIgnored()
+ || quickRejectSetupScissor(left, top, right, bottom, p)
+ || paintWillNotDraw(*p)) {
return DrawGlInfo::kStatusDone;
}
@@ -2536,9 +2537,9 @@ status_t OpenGLRenderer::drawRoundRect(float left, float top, float right, float
}
status_t OpenGLRenderer::drawCircle(float x, float y, float radius, const SkPaint* p) {
- if (currentSnapshot()->isIgnored() || quickRejectSetupScissor(x - radius, y - radius,
- x + radius, y + radius, p) ||
- (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
+ if (currentSnapshot()->isIgnored()
+ || quickRejectSetupScissor(x - radius, y - radius, x + radius, y + radius, p)
+ || paintWillNotDraw(*p)) {
return DrawGlInfo::kStatusDone;
}
if (p->getPathEffect() != 0) {
@@ -2558,8 +2559,9 @@ status_t OpenGLRenderer::drawCircle(float x, float y, float radius, const SkPain
status_t OpenGLRenderer::drawOval(float left, float top, float right, float bottom,
const SkPaint* p) {
- if (currentSnapshot()->isIgnored() || quickRejectSetupScissor(left, top, right, bottom, p) ||
- (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
+ if (currentSnapshot()->isIgnored()
+ || quickRejectSetupScissor(left, top, right, bottom, p)
+ || paintWillNotDraw(*p)) {
return DrawGlInfo::kStatusDone;
}
@@ -2580,8 +2582,9 @@ status_t OpenGLRenderer::drawOval(float left, float top, float right, float bott
status_t OpenGLRenderer::drawArc(float left, float top, float right, float bottom,
float startAngle, float sweepAngle, bool useCenter, const SkPaint* p) {
- if (currentSnapshot()->isIgnored() || quickRejectSetupScissor(left, top, right, bottom, p) ||
- (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
+ if (currentSnapshot()->isIgnored()
+ || quickRejectSetupScissor(left, top, right, bottom, p)
+ || paintWillNotDraw(*p)) {
return DrawGlInfo::kStatusDone;
}
@@ -2614,8 +2617,9 @@ status_t OpenGLRenderer::drawArc(float left, float top, float right, float botto
status_t OpenGLRenderer::drawRect(float left, float top, float right, float bottom,
const SkPaint* p) {
- if (currentSnapshot()->isIgnored() || quickRejectSetupScissor(left, top, right, bottom, p) ||
- (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
+ if (currentSnapshot()->isIgnored()
+ || quickRejectSetupScissor(left, top, right, bottom, p)
+ || paintWillNotDraw(*p)) {
return DrawGlInfo::kStatusDone;
}
diff --git a/libs/hwui/Renderer.h b/libs/hwui/Renderer.h
index f5cd2668e19e..6d4bb4ab50f2 100644
--- a/libs/hwui/Renderer.h
+++ b/libs/hwui/Renderer.h
@@ -67,6 +67,18 @@ public:
return resultMode;
}
+ // TODO: move to a method on android:Paint
+ static inline bool paintWillNotDraw(const SkPaint& paint) {
+ return paint.getAlpha() == 0
+ && getXfermode(paint.getXfermode()) != SkXfermode::kClear_Mode;
+ }
+
+ // TODO: move to a method on android:Paint
+ static inline bool paintWillNotDrawText(const SkPaint& paint) {
+ return paint.getAlpha() == 0
+ && paint.getLooper() == NULL
+ && getXfermode(paint.getXfermode()) == SkXfermode::kSrcOver_Mode;
+ }
// ----------------------------------------------------------------------------
// Frame state operations
// ----------------------------------------------------------------------------
diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java
index 445194e2037f..f348b9be3049 100644
--- a/media/java/android/media/tv/TvView.java
+++ b/media/java/android/media/tv/TvView.java
@@ -59,19 +59,6 @@ public class TvView extends ViewGroup {
// STOPSHIP: Turn debugging off.
private static final boolean DEBUG = true;
- /**
- * Passed with {@link TvInputListener#onError(String, int)}. Indicates that the connection to
- * the requested TV input was not established thus the view is unable to handle the further
- * operations.
- */
- public static final int ERROR_INPUT_NOT_CONNECTED = 0;
-
- /**
- * Passed with {@link TvInputListener#onError(String, int)}. Indicates that the underlying TV
- * input has been disconnected.
- */
- public static final int ERROR_INPUT_DISCONNECTED = 1;
-
private static final int VIDEO_SIZE_VALUE_UNKNOWN = 0;
private static final int ZORDER_MEDIA = 0;
@@ -686,13 +673,20 @@ public class TvView extends ViewGroup {
public abstract static class TvInputListener {
/**
- * This is invoked when an error occurred while handling requested operation.
+ * This is invoked when an error occurred while establishing a connection to the underlying
+ * TV input.
+ *
+ * @param inputId The ID of the TV input bound to this view.
+ */
+ public void onConnectionFailed(String inputId) {
+ }
+
+ /**
+ * This is invoked when the existing connection to the underlying TV input is lost.
*
* @param inputId The ID of the TV input bound to this view.
- * @param errorCode The error code. For the details of error code, please see
- * {@link TvView}.
*/
- public void onError(String inputId, int errorCode) {
+ public void onDisconnected(String inputId) {
}
/**
@@ -857,7 +851,7 @@ public class TvView extends ViewGroup {
}
} else {
if (mListener != null) {
- mListener.onError(mInputId, ERROR_INPUT_NOT_CONNECTED);
+ mListener.onConnectionFailed(mInputId);
}
}
}
@@ -870,7 +864,7 @@ public class TvView extends ViewGroup {
mSessionCallback = null;
mSession = null;
if (mListener != null) {
- mListener.onError(mInputId, ERROR_INPUT_DISCONNECTED);
+ mListener.onDisconnected(mInputId);
}
}