summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp34
-rw-r--r--libs/hwui/Rect.h8
-rw-r--r--libs/rs/Android.mk10
-rw-r--r--libs/rs/rsScriptC.cpp6
-rw-r--r--libs/rs/rslib.bcbin0 -> 716 bytes
5 files changed, 36 insertions, 22 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index faad297..7495a06 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -353,19 +353,22 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top,
// Window coordinates of the layer
Rect bounds(left, top, right, bottom);
- if (!fboLayer) {
+ if (fboLayer) {
+ // Clear the previous layer regions before we change the viewport
+ clearLayerRegions();
+ } else {
mSnapshot->transform->mapRect(bounds);
// Layers only make sense if they are in the framebuffer's bounds
bounds.intersect(*snapshot->clipRect);
+ // We cannot work with sub-pixels in this case
+ bounds.snapToPixelBoundaries();
+
// When the layer is not an FBO, we may use glCopyTexImage so we
// need to make sure the layer does not extend outside the bounds
// of the framebuffer
bounds.intersect(snapshot->previous->viewport);
-
- // We cannot work with sub-pixels in this case
- bounds.snapToPixelBoundaries();
}
if (bounds.isEmpty() || bounds.getWidth() > mMaxTextureSize ||
@@ -454,14 +457,14 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top,
// Copy the framebuffer into the layer
glBindTexture(GL_TEXTURE_2D, layer->texture);
- if (layer->empty) {
- glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom,
- layer->width, layer->height, 0);
- layer->empty = false;
- } else {
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, mHeight - bounds.bottom,
- bounds.getWidth(), bounds.getHeight());
- }
+ if (layer->empty) {
+ glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left,
+ snapshot->height - bounds.bottom, layer->width, layer->height, 0);
+ layer->empty = false;
+ } else {
+ glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left,
+ snapshot->height - bounds.bottom, bounds.getWidth(), bounds.getHeight());
+ }
// Enqueue the buffer coordinates to clear the corresponding region later
mLayers.push(new Rect(bounds));
@@ -487,7 +490,8 @@ void OpenGLRenderer::composeLayer(sp<Snapshot> current, sp<Snapshot> previous) {
}
// Restore the clip from the previous snapshot
- const Rect& clip = *previous->clipRect;
+ Rect& clip(*previous->clipRect);
+ clip.snapToPixelBoundaries();
glScissor(clip.left, previous->height - clip.bottom, clip.getWidth(), clip.getHeight());
Layer* layer = current->layer;
@@ -795,7 +799,8 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {
}
void OpenGLRenderer::drawColor(int color, SkXfermode::Mode mode) {
- const Rect& clip = *mSnapshot->clipRect;
+ Rect& clip(*mSnapshot->clipRect);
+ clip.snapToPixelBoundaries();
drawColorRect(clip.left, clip.top, clip.right, clip.bottom, color, mode, true);
}
@@ -863,6 +868,7 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
paint->getTextSize());
Rect clipRect(*mSnapshot->clipRect);
+ clipRect.snapToPixelBoundaries();
glScissor(clipRect.left, mSnapshot->height - clipRect.bottom,
clipRect.getWidth(), clipRect.getHeight());
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h
index c571ea1..8f3655c 100644
--- a/libs/hwui/Rect.h
+++ b/libs/hwui/Rect.h
@@ -149,10 +149,10 @@ struct Rect {
}
void snapToPixelBoundaries() {
- left = floorf(left);
- top = floorf(top);
- right = ceilf(right);
- bottom = ceilf(bottom);
+ left = floorf(left + 0.5f);
+ top = floorf(top + 0.5f);
+ right = floorf(right + 0.5f);
+ bottom = floorf(bottom + 0.5f);
}
void dump() const {
diff --git a/libs/rs/Android.mk b/libs/rs/Android.mk
index 05c1a48..2ec003f 100644
--- a/libs/rs/Android.mk
+++ b/libs/rs/Android.mk
@@ -23,7 +23,13 @@ include $(BUILD_HOST_EXECUTABLE)
# TODO: This should go into build/core/config.mk
RSG_GENERATOR:=$(LOCAL_BUILT_MODULE)
-
+include $(CLEAR_VARS)
+input_data_file := $(LOCAL_PATH)/rslib.bc
+slangdata_output_var_name := rs_runtime_lib_bc
+LOCAL_MODULE := librslib_rt
+LOCAL_MODULE_TAGS := optional
+include frameworks/compile/slang/SlangData.mk
+include $(BUILD_STATIC_LIBRARY)
# Build render script lib ====================
@@ -109,7 +115,7 @@ LOCAL_SRC_FILES:= \
LOCAL_SHARED_LIBRARIES += libcutils libutils libEGL libGLESv1_CM libGLESv2 libui libbcc
-LOCAL_STATIC_LIBRARIES := libft2
+LOCAL_STATIC_LIBRARIES := libft2 librslib_rt
LOCAL_C_INCLUDES += external/freetype/include
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index 165fa71..9dce158 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -390,6 +390,9 @@ static BCCvoid* symbolLookup(BCCvoid* pContext, const BCCchar* name)
return NULL;
}
+extern const char rs_runtime_lib_bc[];
+extern unsigned rs_runtime_lib_bc_size;
+
void ScriptCState::runCompiler(Context *rsc, ScriptC *s)
{
LOGV("%p ScriptCState::runCompiler ", rsc);
@@ -398,6 +401,7 @@ void ScriptCState::runCompiler(Context *rsc, ScriptC *s)
s->mBccScript = bccCreateScript();
s->mEnviroment.mIsThreadable = true;
bccScriptBitcode(s->mBccScript, s->mEnviroment.mScriptText, s->mEnviroment.mScriptTextLength);
+ //bccLinkBitcode(s->mBccScript, rs_runtime_lib_bc, rs_runtime_lib_bc_size);
bccRegisterSymbolCallback(s->mBccScript, symbolLookup, s);
bccCompileScript(s->mBccScript);
bccGetScriptLabel(s->mBccScript, "root", (BCCvoid**) &s->mProgram.mRoot);
@@ -533,5 +537,3 @@ RsScript rsi_ScriptCCreate(Context * rsc)
}
}
-
-
diff --git a/libs/rs/rslib.bc b/libs/rs/rslib.bc
new file mode 100644
index 0000000..1897c3b
--- /dev/null
+++ b/libs/rs/rslib.bc
Binary files differ