Loading core/java/android/view/View.java +8 −32 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package android.view; import android.content.ClipData; import android.content.ClipDescription; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; Loading Loading @@ -55,7 +54,6 @@ import android.util.PoolableManager; import android.util.Pools; import android.util.SparseArray; import android.view.ContextMenu.ContextMenuInfo; import android.view.DragEvent; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityEventSource; import android.view.accessibility.AccessibilityManager; Loading Loading @@ -2038,7 +2036,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility * */ boolean mCanAcceptDrop; private boolean mIsCurrentDropTarget; private int mThumbnailWidth; private int mThumbnailHeight; Loading Loading @@ -9800,11 +9797,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility + " surface=" + surface); if (token != null) { Canvas canvas = surface.lockCanvas(null); try { onDrawDragThumbnail(canvas); } finally { surface.unlockCanvasAndPost(canvas); } okay = mAttachInfo.mSession.performDrag(mAttachInfo.mWindow, token, touchX, touchY, thumbnailTouchX, thumbnailTouchX, data); touchX, touchY, thumbnailTouchX, thumbnailTouchY, data); if (DEBUG_DRAG) Log.d(VIEW_LOG_TAG, "performDrag returned " + okay); } } catch (Exception e) { Loading Loading @@ -9837,8 +9837,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility * The View must call this method from onMeasureDragThumbnail() in order to * specify the dimensions of the drag thumbnail image. * * @param width * @param height * @param width The desired thumbnail width. * @param height The desired thumbnail height. */ protected final void setDragThumbnailDimension(int width, int height) { mPrivateFlags |= MEASURED_DIMENSION_SET; Loading Loading @@ -9973,30 +9973,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility ViewConfiguration.getLongPressTimeout() - delayOffset); } private static int[] stateSetUnion(final int[] stateSet1, final int[] stateSet2) { final int stateSet1Length = stateSet1.length; final int stateSet2Length = stateSet2.length; final int[] newSet = new int[stateSet1Length + stateSet2Length]; int k = 0; int i = 0; int j = 0; // This is a merge of the two input state sets and assumes that the // input sets are sorted by the order imposed by ViewDrawableStates. for (int viewState : R.styleable.ViewDrawableStates) { if (i < stateSet1Length && stateSet1[i] == viewState) { newSet[k++] = viewState; i++; } else if (j < stateSet2Length && stateSet2[j] == viewState) { newSet[k++] = viewState; j++; } if (k > 1) { assert(newSet[k - 1] > newSet[k - 2]); } } return newSet; } /** * Inflate a view from an XML resource. This convenience method wraps the {@link * LayoutInflater} class, which provides a full range of options for view inflation. Loading libs/hwui/Layer.h +3 −3 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ struct LayerSize { uint32_t id; bool operator<(const LayerSize& rhs) const { if (id != 0 && rhs.id != 0) { if (id != 0 && rhs.id != 0 && id != rhs.id) { return id < rhs.id; } if (width == rhs.width) { Loading @@ -54,7 +54,7 @@ struct LayerSize { } bool operator==(const LayerSize& rhs) const { return width == rhs.width && height == rhs.height; return id == rhs.id && width == rhs.width && height == rhs.height; } }; // struct LayerSize Loading Loading @@ -83,7 +83,7 @@ struct Layer { */ bool blend; /** * Indicates that this layer has never been used before. * Indicates whether this layer has been used already. */ bool empty; }; // struct Layer Loading libs/hwui/LayerCache.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,8 @@ Layer* LayerCache::get(LayerSize& size) { glGenTextures(1, &layer->texture); glBindTexture(GL_TEXTURE_2D, layer->texture); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); Loading libs/hwui/OpenGLRenderer.cpp +18 −11 Original line number Diff line number Diff line Loading @@ -366,6 +366,8 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top, return false; } glActiveTexture(GL_TEXTURE0); LayerSize size(bounds.getWidth(), bounds.getHeight()); Layer* layer = mCaches.layerCache.get(size); if (!layer) { Loading @@ -383,17 +385,22 @@ 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) { // TODO: Workaround for b/3054204 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom, bounds.getWidth(), bounds.getHeight(), 0); layer->empty = false; } else { glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, mHeight - bounds.bottom, bounds.getWidth(), bounds.getHeight()); } if (flags & SkCanvas::kClipToLayer_SaveFlag) { if (mSnapshot->clipTransformed(bounds)) setScissorFromClip(); // TODO: Waiting for b/3054204 to be fixed // if (layer->empty) { // glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom, // bounds.getWidth(), bounds.getHeight(), 0); // layer->empty = false; // } else { // glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, mHeight - bounds.bottom, // bounds.getWidth(), bounds.getHeight()); // } if (flags & SkCanvas::kClipToLayer_SaveFlag && mSnapshot->clipTransformed(bounds)) { setScissorFromClip(); } // Enqueue the buffer coordinates to clear the corresponding region later Loading tests/HwAccelerationTest/AndroidManifest.xml +9 −0 Original line number Diff line number Diff line Loading @@ -165,6 +165,15 @@ </intent-filter> </activity> <activity android:name="GradientsActivity" android:label="_Gradients"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="ShadersActivity" android:label="_Shaders"> Loading Loading
core/java/android/view/View.java +8 −32 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package android.view; import android.content.ClipData; import android.content.ClipDescription; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; Loading Loading @@ -55,7 +54,6 @@ import android.util.PoolableManager; import android.util.Pools; import android.util.SparseArray; import android.view.ContextMenu.ContextMenuInfo; import android.view.DragEvent; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityEventSource; import android.view.accessibility.AccessibilityManager; Loading Loading @@ -2038,7 +2036,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility * */ boolean mCanAcceptDrop; private boolean mIsCurrentDropTarget; private int mThumbnailWidth; private int mThumbnailHeight; Loading Loading @@ -9800,11 +9797,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility + " surface=" + surface); if (token != null) { Canvas canvas = surface.lockCanvas(null); try { onDrawDragThumbnail(canvas); } finally { surface.unlockCanvasAndPost(canvas); } okay = mAttachInfo.mSession.performDrag(mAttachInfo.mWindow, token, touchX, touchY, thumbnailTouchX, thumbnailTouchX, data); touchX, touchY, thumbnailTouchX, thumbnailTouchY, data); if (DEBUG_DRAG) Log.d(VIEW_LOG_TAG, "performDrag returned " + okay); } } catch (Exception e) { Loading Loading @@ -9837,8 +9837,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility * The View must call this method from onMeasureDragThumbnail() in order to * specify the dimensions of the drag thumbnail image. * * @param width * @param height * @param width The desired thumbnail width. * @param height The desired thumbnail height. */ protected final void setDragThumbnailDimension(int width, int height) { mPrivateFlags |= MEASURED_DIMENSION_SET; Loading Loading @@ -9973,30 +9973,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility ViewConfiguration.getLongPressTimeout() - delayOffset); } private static int[] stateSetUnion(final int[] stateSet1, final int[] stateSet2) { final int stateSet1Length = stateSet1.length; final int stateSet2Length = stateSet2.length; final int[] newSet = new int[stateSet1Length + stateSet2Length]; int k = 0; int i = 0; int j = 0; // This is a merge of the two input state sets and assumes that the // input sets are sorted by the order imposed by ViewDrawableStates. for (int viewState : R.styleable.ViewDrawableStates) { if (i < stateSet1Length && stateSet1[i] == viewState) { newSet[k++] = viewState; i++; } else if (j < stateSet2Length && stateSet2[j] == viewState) { newSet[k++] = viewState; j++; } if (k > 1) { assert(newSet[k - 1] > newSet[k - 2]); } } return newSet; } /** * Inflate a view from an XML resource. This convenience method wraps the {@link * LayoutInflater} class, which provides a full range of options for view inflation. Loading
libs/hwui/Layer.h +3 −3 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ struct LayerSize { uint32_t id; bool operator<(const LayerSize& rhs) const { if (id != 0 && rhs.id != 0) { if (id != 0 && rhs.id != 0 && id != rhs.id) { return id < rhs.id; } if (width == rhs.width) { Loading @@ -54,7 +54,7 @@ struct LayerSize { } bool operator==(const LayerSize& rhs) const { return width == rhs.width && height == rhs.height; return id == rhs.id && width == rhs.width && height == rhs.height; } }; // struct LayerSize Loading Loading @@ -83,7 +83,7 @@ struct Layer { */ bool blend; /** * Indicates that this layer has never been used before. * Indicates whether this layer has been used already. */ bool empty; }; // struct Layer Loading
libs/hwui/LayerCache.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,8 @@ Layer* LayerCache::get(LayerSize& size) { glGenTextures(1, &layer->texture); glBindTexture(GL_TEXTURE_2D, layer->texture); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); Loading
libs/hwui/OpenGLRenderer.cpp +18 −11 Original line number Diff line number Diff line Loading @@ -366,6 +366,8 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top, return false; } glActiveTexture(GL_TEXTURE0); LayerSize size(bounds.getWidth(), bounds.getHeight()); Layer* layer = mCaches.layerCache.get(size); if (!layer) { Loading @@ -383,17 +385,22 @@ 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) { // TODO: Workaround for b/3054204 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom, bounds.getWidth(), bounds.getHeight(), 0); layer->empty = false; } else { glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, mHeight - bounds.bottom, bounds.getWidth(), bounds.getHeight()); } if (flags & SkCanvas::kClipToLayer_SaveFlag) { if (mSnapshot->clipTransformed(bounds)) setScissorFromClip(); // TODO: Waiting for b/3054204 to be fixed // if (layer->empty) { // glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom, // bounds.getWidth(), bounds.getHeight(), 0); // layer->empty = false; // } else { // glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, mHeight - bounds.bottom, // bounds.getWidth(), bounds.getHeight()); // } if (flags & SkCanvas::kClipToLayer_SaveFlag && mSnapshot->clipTransformed(bounds)) { setScissorFromClip(); } // Enqueue the buffer coordinates to clear the corresponding region later Loading
tests/HwAccelerationTest/AndroidManifest.xml +9 −0 Original line number Diff line number Diff line Loading @@ -165,6 +165,15 @@ </intent-filter> </activity> <activity android:name="GradientsActivity" android:label="_Gradients"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="ShadersActivity" android:label="_Shaders"> Loading