Loading core/java/android/content/res/Resources.java +1 −2 Original line number Diff line number Diff line Loading @@ -1889,8 +1889,7 @@ public class Resources { if (cs != null) { dr = cs.newDrawable(this); } else { if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT && value.type <= TypedValue.TYPE_LAST_COLOR_INT) { if (isColorDrawable) { dr = new ColorDrawable(value.data); } Loading libs/hwui/Caches.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ void Caches::init() { mTexCoordsArrayEnabled = false; mScissorX = mScissorY = mScissorWidth = mScissorHeight = 0; glActiveTexture(gTextureUnits[0]); mTextureUnit = 0; Loading Loading @@ -312,6 +314,17 @@ void Caches::activeTexture(GLuint textureUnit) { } } void Caches::setScissor(GLint x, GLint y, GLint width, GLint height) { if (x != mScissorX || y != mScissorY || width != mScissorWidth || height != mScissorHeight) { glScissor(x, y, width, height); mScissorX = x; mScissorY = y; mScissorWidth = width; mScissorHeight = height; } } TextureVertex* Caches::getRegionMesh() { // Create the mesh, 2 triangles and 4 vertices per rectangle in the region if (!mRegionMesh) { Loading libs/hwui/Caches.h +10 −0 Original line number Diff line number Diff line Loading @@ -187,6 +187,11 @@ public: */ void activeTexture(GLuint textureUnit); /** * Sets the scissor for the current surface. */ void setScissor(GLint x, GLint y, GLint width, GLint height); /** * Returns the mesh used to draw regions. Calling this method will * bind a VBO of type GL_ELEMENT_ARRAY_BUFFER that contains the Loading Loading @@ -240,6 +245,11 @@ private: GLuint mTextureUnit; GLint mScissorX; GLint mScissorY; GLint mScissorWidth; GLint mScissorHeight; // Used to render layers TextureVertex* mRegionMesh; GLuint mRegionMeshIndices; Loading libs/hwui/OpenGLRenderer.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ void OpenGLRenderer::prepareDirty(float left, float top, float right, float bott mSaveCount = 1; glViewport(0, 0, mWidth, mHeight); glScissor(left, mSnapshot->height - bottom, right - left, bottom - top); mCaches.setScissor(left, mSnapshot->height - bottom, right - left, bottom - top); mSnapshot->setClip(left, top, right, bottom); mDirtyClip = false; Loading Loading @@ -550,7 +550,7 @@ bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, sp<Snapshot> sna #endif // Clear the FBO, expand the clear region by 1 to get nice bilinear filtering glScissor(clip.left - 1.0f, bounds.getHeight() - clip.bottom - 1.0f, mCaches.setScissor(clip.left - 1.0f, bounds.getHeight() - clip.bottom - 1.0f, clip.getWidth() + 2.0f, clip.getHeight() + 2.0f); glClear(GL_COLOR_BUFFER_BIT); Loading Loading @@ -965,7 +965,10 @@ void OpenGLRenderer::concatMatrix(SkMatrix* matrix) { void OpenGLRenderer::setScissorFromClip() { Rect clip(*mSnapshot->clipRect); clip.snapToPixelBoundaries(); glScissor(clip.left, mSnapshot->height - clip.bottom, clip.getWidth(), clip.getHeight()); mCaches.setScissor(clip.left, mSnapshot->height - clip.bottom, clip.getWidth(), clip.getHeight()); mDirtyClip = false; } Loading libs/hwui/Rect.h +9 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,8 @@ public: } bool intersect(float l, float t, float r, float b) { Rect tmp(intersectWith(l, t, r, b)); Rect tmp(l, t, r, b); intersectWith(tmp); if (!tmp.isEmpty()) { set(tmp); return true; Loading Loading @@ -173,6 +174,13 @@ private: static inline float min(float a, float b) { return (a < b) ? a : b; } static inline float max(float a, float b) { return (a > b) ? a : b; } void intersectWith(Rect& tmp) const { tmp.left = max(left, tmp.left); tmp.top = max(top, tmp.top); tmp.right = min(right, tmp.right); tmp.bottom = min(bottom, tmp.bottom); } Rect intersectWith(float l, float t, float r, float b) const { Rect tmp; tmp.left = max(left, l); Loading Loading
core/java/android/content/res/Resources.java +1 −2 Original line number Diff line number Diff line Loading @@ -1889,8 +1889,7 @@ public class Resources { if (cs != null) { dr = cs.newDrawable(this); } else { if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT && value.type <= TypedValue.TYPE_LAST_COLOR_INT) { if (isColorDrawable) { dr = new ColorDrawable(value.data); } Loading
libs/hwui/Caches.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ void Caches::init() { mTexCoordsArrayEnabled = false; mScissorX = mScissorY = mScissorWidth = mScissorHeight = 0; glActiveTexture(gTextureUnits[0]); mTextureUnit = 0; Loading Loading @@ -312,6 +314,17 @@ void Caches::activeTexture(GLuint textureUnit) { } } void Caches::setScissor(GLint x, GLint y, GLint width, GLint height) { if (x != mScissorX || y != mScissorY || width != mScissorWidth || height != mScissorHeight) { glScissor(x, y, width, height); mScissorX = x; mScissorY = y; mScissorWidth = width; mScissorHeight = height; } } TextureVertex* Caches::getRegionMesh() { // Create the mesh, 2 triangles and 4 vertices per rectangle in the region if (!mRegionMesh) { Loading
libs/hwui/Caches.h +10 −0 Original line number Diff line number Diff line Loading @@ -187,6 +187,11 @@ public: */ void activeTexture(GLuint textureUnit); /** * Sets the scissor for the current surface. */ void setScissor(GLint x, GLint y, GLint width, GLint height); /** * Returns the mesh used to draw regions. Calling this method will * bind a VBO of type GL_ELEMENT_ARRAY_BUFFER that contains the Loading Loading @@ -240,6 +245,11 @@ private: GLuint mTextureUnit; GLint mScissorX; GLint mScissorY; GLint mScissorWidth; GLint mScissorHeight; // Used to render layers TextureVertex* mRegionMesh; GLuint mRegionMeshIndices; Loading
libs/hwui/OpenGLRenderer.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ void OpenGLRenderer::prepareDirty(float left, float top, float right, float bott mSaveCount = 1; glViewport(0, 0, mWidth, mHeight); glScissor(left, mSnapshot->height - bottom, right - left, bottom - top); mCaches.setScissor(left, mSnapshot->height - bottom, right - left, bottom - top); mSnapshot->setClip(left, top, right, bottom); mDirtyClip = false; Loading Loading @@ -550,7 +550,7 @@ bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, sp<Snapshot> sna #endif // Clear the FBO, expand the clear region by 1 to get nice bilinear filtering glScissor(clip.left - 1.0f, bounds.getHeight() - clip.bottom - 1.0f, mCaches.setScissor(clip.left - 1.0f, bounds.getHeight() - clip.bottom - 1.0f, clip.getWidth() + 2.0f, clip.getHeight() + 2.0f); glClear(GL_COLOR_BUFFER_BIT); Loading Loading @@ -965,7 +965,10 @@ void OpenGLRenderer::concatMatrix(SkMatrix* matrix) { void OpenGLRenderer::setScissorFromClip() { Rect clip(*mSnapshot->clipRect); clip.snapToPixelBoundaries(); glScissor(clip.left, mSnapshot->height - clip.bottom, clip.getWidth(), clip.getHeight()); mCaches.setScissor(clip.left, mSnapshot->height - clip.bottom, clip.getWidth(), clip.getHeight()); mDirtyClip = false; } Loading
libs/hwui/Rect.h +9 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,8 @@ public: } bool intersect(float l, float t, float r, float b) { Rect tmp(intersectWith(l, t, r, b)); Rect tmp(l, t, r, b); intersectWith(tmp); if (!tmp.isEmpty()) { set(tmp); return true; Loading Loading @@ -173,6 +174,13 @@ private: static inline float min(float a, float b) { return (a < b) ? a : b; } static inline float max(float a, float b) { return (a > b) ? a : b; } void intersectWith(Rect& tmp) const { tmp.left = max(left, tmp.left); tmp.top = max(top, tmp.top); tmp.right = min(right, tmp.right); tmp.bottom = min(bottom, tmp.bottom); } Rect intersectWith(float l, float t, float r, float b) const { Rect tmp; tmp.left = max(left, l); Loading