use of com.android.gallery3d.glrenderer.RawTexture in project android_packages_apps_Gallery2 by LineageOS.
the class PhotoView method buildFallbackEffect.
public PhotoFallbackEffect buildFallbackEffect(GLView root, GLCanvas canvas) {
Rect location = new Rect();
Utils.assertTrue(root.getBoundsOf(this, location));
Rect fullRect = bounds();
PhotoFallbackEffect effect = new PhotoFallbackEffect();
for (int i = -SCREEN_NAIL_MAX; i <= SCREEN_NAIL_MAX; ++i) {
MediaItem item = mModel.getMediaItem(i);
if (item == null)
continue;
ScreenNail sc = mModel.getScreenNail(i);
if (!(sc instanceof TiledScreenNail) || ((TiledScreenNail) sc).isShowingPlaceholder())
continue;
// Now, sc is BitmapScreenNail and is not showing placeholder
Rect rect = new Rect(getPhotoRect(i));
if (!Rect.intersects(fullRect, rect))
continue;
rect.offset(location.left, location.top);
int width = sc.getWidth();
int height = sc.getHeight();
int rotation = mModel.getImageRotation(i);
RawTexture texture;
if ((rotation % 180) == 0) {
texture = new RawTexture(width, height, true);
canvas.beginRenderTarget(texture);
canvas.translate(width / 2f, height / 2f);
} else {
texture = new RawTexture(height, width, true);
canvas.beginRenderTarget(texture);
canvas.translate(height / 2f, width / 2f);
}
canvas.rotate(rotation, 0, 0, 1);
canvas.translate(-width / 2f, -height / 2f);
sc.draw(canvas, 0, 0, width, height);
canvas.endRenderTarget();
effect.addEntry(item.getPath(), rect, texture);
}
return effect;
}
use of com.android.gallery3d.glrenderer.RawTexture in project android_packages_apps_Gallery2 by LineageOS.
the class PreparePageFadeoutTexture method prepareFadeOutTexture.
public static void prepareFadeOutTexture(AbstractGalleryActivity activity, GLView rootPane) {
PreparePageFadeoutTexture task = new PreparePageFadeoutTexture(rootPane);
if (task.isCancelled())
return;
GLRoot root = activity.getGLRoot();
RawTexture texture = null;
root.lockRenderThread();
try {
root.addOnGLIdleListener(task);
texture = task.get();
} finally {
root.unlockRenderThread();
}
if (texture == null) {
return;
}
activity.getTransitionStore().put(KEY_FADE_TEXTURE, texture);
}
use of com.android.gallery3d.glrenderer.RawTexture in project android_packages_apps_Gallery2 by LineageOS.
the class ActivityState method onResume.
// a subclass of ActivityState should override the method to resume itself
protected void onResume() {
RawTexture fade = mActivity.getTransitionStore().get(PreparePageFadeoutTexture.KEY_FADE_TEXTURE);
mNextTransition = mActivity.getTransitionStore().get(KEY_TRANSITION_IN, StateTransitionAnimation.Transition.None);
if (mNextTransition != StateTransitionAnimation.Transition.None) {
mIntroAnimation = new StateTransitionAnimation(mNextTransition, fade);
mNextTransition = StateTransitionAnimation.Transition.None;
}
}
Aggregations