summaryrefslogtreecommitdiffstats
path: root/libs/hwui
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui')
-rw-r--r--libs/hwui/DisplayListRenderer.cpp81
-rw-r--r--libs/hwui/DisplayListRenderer.h10
-rw-r--r--libs/hwui/FontRenderer.cpp4
-rw-r--r--libs/hwui/OpenGLRenderer.cpp23
-rw-r--r--libs/hwui/OpenGLRenderer.h4
5 files changed, 41 insertions, 81 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 118608d..3a3f8a5 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -18,6 +18,8 @@
#include <SkCamera.h>
+#include <private/hwui/DrawGlInfo.h>
+
#include "DisplayListLogBuffer.h"
#include "DisplayListRenderer.h"
#include "Caches.h"
@@ -104,7 +106,7 @@ DisplayList::~DisplayList() {
void DisplayList::initProperties() {
mLeft = 0;
mTop = 0;
- mTop = 0;
+ mRight = 0;
mBottom = 0;
mApplicationScale = -1;
mClipChildren = true;
@@ -119,6 +121,7 @@ void DisplayList::initProperties() {
mScaleY = 1;
mPivotX = 0;
mPivotY = 0;
+ mCameraDistance = 0;
mMatrixDirty = false;
mMatrixFlags = 0;
mPrevWidth = -1;
@@ -684,7 +687,7 @@ void DisplayList::outputViewProperties(OpenGLRenderer& renderer, char* indent) {
mTransformMatrix->get(8));
}
}
- if (mAlpha < 1) {
+ if (mAlpha < 1 && !mCaching) {
// TODO: should be able to store the size of a DL at record time and not
// have to pass it into this call. In fact, this information might be in the
// location/size info that we store with the new native transform data.
@@ -763,42 +766,14 @@ void DisplayList::setViewProperties(OpenGLRenderer& renderer, uint32_t width, ui
}
}
-void DisplayList::transformRect(float left, float top, float right, float bottom, Rect& result) {
- result.left = left + mLeft;
- result.top = top + mTop;
- result.right = right + mLeft;
- result.bottom = bottom + mTop;
- if (mMatrixFlags != 0) {
- if (mMatrixFlags == TRANSLATION) {
- result.left += mTranslationX;
- result.top += mTranslationY;
- result.right += mTranslationX;
- result.bottom += mTranslationY;
- } else {
- updateMatrix();
- SkRect r;
- r.fLeft = result.left;
- r.fTop = result.top;
- r.fRight = result.right;
- r.fBottom = result.bottom;
- mTransformMatrix->mapRect(&r);
- result.left = r.fLeft;
- result.top = r.fTop;
- result.right = r.fRight;
- result.bottom = r.fBottom;
- }
- }
-}
-
-
/**
* Changes to replay(), specifically those involving opcode or parameter changes, should be mimicked
* in the output() function, since that function processes the same list of opcodes for the
* purposes of logging display list info for a given view.
*/
-bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t width,
+status_t DisplayList::replay(OpenGLRenderer& renderer, uint32_t width,
uint32_t height, Rect& dirty, int32_t flags, uint32_t level) {
- bool needsInvalidate = false;
+ status_t drawGlStatus = 0;
TextContainer text;
mReader.rewind();
@@ -820,6 +795,12 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t width,
restoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
}
setViewProperties(renderer, width, height, level);
+ if (USE_DISPLAY_LIST_PROPERTIES && renderer.quickReject(0, 0, width, height)) {
+ DISPLAY_LIST_LOGD("%s%s %d", (char*) indent, "RestoreToCount", restoreTo);
+ renderer.restoreToCount(restoreTo);
+ renderer.endMark();
+ return false;
+ }
DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance();
int saveCount = renderer.getSaveCount() - 1;
@@ -843,7 +824,7 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t width,
Functor *functor = (Functor *) getInt();
DISPLAY_LIST_LOGD("%s%s %p", (char*) indent, OP_NAMES[op], functor);
renderer.startMark("GL functor");
- needsInvalidate |= renderer.callDrawGLFunction(functor, dirty);
+ drawGlStatus |= renderer.callDrawGLFunction(functor, dirty);
renderer.endMark();
}
break;
@@ -950,7 +931,7 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t width,
int32_t flags = getInt();
DISPLAY_LIST_LOGD("%s%s %p, %dx%d, 0x%x %d", (char*) indent, OP_NAMES[op],
displayList, width, height, flags, level + 1);
- needsInvalidate |= renderer.drawDisplayList(displayList, width,
+ drawGlStatus |= renderer.drawDisplayList(displayList, width,
height, dirty, flags, level + 1);
}
break;
@@ -972,6 +953,9 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t width,
float x = getFloat();
float y = getFloat();
SkPaint* paint = getPaint(renderer);
+ if (mCaching && mMultipliedAlpha < 255) {
+ paint->setAlpha(mMultipliedAlpha);
+ }
DISPLAY_LIST_LOGD("%s%s %p, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
bitmap, x, y, paint);
renderer.drawBitmap(bitmap, x, y, paint);
@@ -1233,8 +1217,8 @@ bool DisplayList::replay(OpenGLRenderer& renderer, uint32_t width,
renderer.endMark();
DISPLAY_LIST_LOGD("%sDone (%p, %s), returning %d", (char*) indent + 2, this, mName.string(),
- needsInvalidate);
- return needsInvalidate;
+ drawGlStatus);
+ return drawGlStatus;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1321,11 +1305,11 @@ void DisplayListRenderer::interrupt() {
void DisplayListRenderer::resume() {
}
-bool DisplayListRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) {
+status_t DisplayListRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) {
// Ignore dirty during recording, it matters only when we replay
addOp(DisplayList::DrawGLFunction);
addInt((int) functor);
- return false; // No invalidate needed at record-time
+ return DrawGlInfo::kStatusDone; // No invalidate needed at record-time
}
int DisplayListRenderer::save(int flags) {
@@ -1415,29 +1399,16 @@ bool DisplayListRenderer::clipRect(float left, float top, float right, float bot
return OpenGLRenderer::clipRect(left, top, right, bottom, op);
}
-bool DisplayListRenderer::drawDisplayList(DisplayList* displayList,
+status_t DisplayListRenderer::drawDisplayList(DisplayList* displayList,
uint32_t width, uint32_t height, Rect& dirty, int32_t flags, uint32_t level) {
// dirty is an out parameter and should not be recorded,
// it matters only when replaying the display list
- float top = 0;
- float left = 0;
- float right = width;
- float bottom = height;
- if (USE_DISPLAY_LIST_PROPERTIES) {
- Rect transformedRect;
- displayList->transformRect(left, top, right, bottom, transformedRect);
- left = transformedRect.left;
- top = transformedRect.top;
- right = transformedRect.right;
- bottom = transformedRect.bottom;
- }
- const bool reject = quickReject(left, top, right, bottom);
- uint32_t* location = addOp(DisplayList::DrawDisplayList, reject);
+
+ addOp(DisplayList::DrawDisplayList);
addDisplayList(displayList);
addSize(width, height);
addInt(flags);
- addSkip(location);
- return false;
+ return DrawGlInfo::kStatusDone;
}
void DisplayListRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* paint) {
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 4bbb04f..4a9886b 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -51,7 +51,7 @@ namespace uirenderer {
// Set to 1 to enable native processing of View properties. 0 by default. Eventually this
// will go away and we will always use this approach for accelerated apps.
-#define USE_DISPLAY_LIST_PROPERTIES 0
+#define USE_DISPLAY_LIST_PROPERTIES 1
#define TRANSLATION 0x0001
#define ROTATION 0x0002
@@ -137,7 +137,7 @@ public:
void initFromDisplayListRenderer(const DisplayListRenderer& recorder, bool reusing = false);
- bool replay(OpenGLRenderer& renderer, uint32_t width, uint32_t height,
+ status_t replay(OpenGLRenderer& renderer, uint32_t width, uint32_t height,
Rect& dirty, int32_t flags, uint32_t level = 0);
void output(OpenGLRenderer& renderer, uint32_t level = 0);
@@ -379,8 +379,6 @@ public:
mCaching = caching;
}
- void transformRect(float left, float top, float right, float bottom, Rect& result);
-
private:
void init();
@@ -525,7 +523,7 @@ public:
virtual void prepareDirty(float left, float top, float right, float bottom, bool opaque);
virtual void finish();
- virtual bool callDrawGLFunction(Functor *functor, Rect& dirty);
+ virtual status_t callDrawGLFunction(Functor *functor, Rect& dirty);
virtual void interrupt();
virtual void resume();
@@ -549,7 +547,7 @@ public:
virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
- virtual bool drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
+ virtual status_t drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
Rect& dirty, int32_t flags, uint32_t level = 0);
virtual void drawLayer(Layer* layer, float x, float y, SkPaint* paint);
virtual void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index d7937c7..9e7fbb5 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -518,6 +518,8 @@ FontRenderer::~FontRenderer() {
mCacheLines.clear();
if (mInitialized) {
+ // Unbinding the buffer shouldn't be necessary but it crashes with some drivers
+ Caches::getInstance().unbindIndicesBuffer();
glDeleteBuffers(1, &mIndexBufferID);
delete[] mTextMeshPtr;
@@ -777,7 +779,7 @@ void FontRenderer::checkInit() {
// We store a string with letters in a rough frequency of occurrence
mLatinPrecache = String16("eisarntolcdugpmhbyfvkwzxjq ");
mLatinPrecache += String16("EISARNTOLCDUGPMHBYFVKWZXJQ");
- mLatinPrecache += String16(",.?!()-+@;:`'");
+ mLatinPrecache += String16(",.?!()-+@;:'");
mLatinPrecache += String16("0123456789");
mInitialized = true;
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 685fddc..eb4b83b 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -236,7 +236,7 @@ void OpenGLRenderer::resume() {
glBlendEquation(GL_FUNC_ADD);
}
-bool OpenGLRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) {
+status_t OpenGLRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) {
interrupt();
if (mDirtyClip) {
setScissorFromClip();
@@ -269,7 +269,7 @@ bool OpenGLRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) {
}
resume();
- return result != 0;
+ return result;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1321,21 +1321,10 @@ void OpenGLRenderer::finishDrawTexture() {
// Drawing
///////////////////////////////////////////////////////////////////////////////
-bool OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
+status_t OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
Rect& dirty, int32_t flags, uint32_t level) {
- float top = 0;
- float left = 0;
- float right = width;
- float bottom = height;
- if (USE_DISPLAY_LIST_PROPERTIES) {
- Rect transformedRect;
- displayList->transformRect(left, top, right, bottom, transformedRect);
- left = transformedRect.left;
- top = transformedRect.top;
- right = transformedRect.right;
- bottom = transformedRect.bottom;
- }
- if (quickReject(left, top, right, bottom)) {
+
+ if (!USE_DISPLAY_LIST_PROPERTIES && quickReject(0, 0, width, height)) {
return false;
}
@@ -1345,7 +1334,7 @@ bool OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t width, u
return displayList->replay(*this, width, height, dirty, flags, level);
}
- return false;
+ return DrawGlInfo::kStatusDone;
}
void OpenGLRenderer::outputDisplayList(DisplayList* displayList, uint32_t level) {
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 4d7a491..3ba6202 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -72,7 +72,7 @@ public:
virtual void interrupt();
virtual void resume();
- virtual bool callDrawGLFunction(Functor *functor, Rect& dirty);
+ virtual status_t callDrawGLFunction(Functor *functor, Rect& dirty);
ANDROID_API int getSaveCount() const;
virtual int save(int flags);
@@ -97,7 +97,7 @@ public:
ANDROID_API bool quickReject(float left, float top, float right, float bottom);
virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
- virtual bool drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
+ virtual status_t drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
Rect& dirty, int32_t flags, uint32_t level = 0);
virtual void outputDisplayList(DisplayList* displayList, uint32_t level = 0);
virtual void drawLayer(Layer* layer, float x, float y, SkPaint* paint);