Methods Summary |
---|
public void | destroy()
if (!IS_SUPPORTED) {
return;
}
if (USE_TEXTURE_VIEW) {
mTextureView.destroy();
} else {
mGLSurfaceView.queueEvent(mFreeTextures);
}
|
protected void | dispatchDraw(android.graphics.Canvas canvas)
if (!IS_SUPPORTED) {
return;
}
if (USE_TEXTURE_VIEW) {
mTextureView.render();
}
super.dispatchDraw(canvas);
|
private void | invalOnVsync()
if (!mInvalPending) {
mInvalPending = true;
if (mFrameCallback == null) {
mFrameCallback = new FrameCallback() {
@Override
public void doFrame(long frameTimeNanos) {
mInvalPending = false;
mGLSurfaceView.requestRender();
}
};
}
Choreographer.getInstance().postFrameCallback(mFrameCallback);
}
|
public void | invalidate()
if (!IS_SUPPORTED) {
return;
}
if (USE_TEXTURE_VIEW) {
super.invalidate();
mTextureView.invalidate();
} else {
if (USE_CHOREOGRAPHER) {
invalOnVsync();
} else {
mGLSurfaceView.requestRender();
}
}
|
public static boolean | isTilingSupported()
return IS_SUPPORTED;
|
protected void | onLayout(boolean changed, int left, int top, int right, int bottom)
super.onLayout(changed, left, top, right, bottom);
if (!IS_SUPPORTED) {
return;
}
synchronized (mLock) {
updateScaleIfNecessaryLocked(mRenderer);
}
|
public void | onPause()
if (!IS_SUPPORTED) {
return;
}
if (!USE_TEXTURE_VIEW) {
mGLSurfaceView.onPause();
}
|
public void | onResume()
if (!IS_SUPPORTED) {
return;
}
if (!USE_TEXTURE_VIEW) {
mGLSurfaceView.onResume();
}
|
public void | positionFromMatrix(android.graphics.Matrix matrix)
if (!IS_SUPPORTED) {
return;
}
if (mRenderer.source != null) {
final int rotation = mRenderer.source.getRotation();
final boolean swap = !(rotation % 180 == 0);
final int width = swap ? mRenderer.source.getImageHeight()
: mRenderer.source.getImageWidth();
final int height = swap ? mRenderer.source.getImageWidth()
: mRenderer.source.getImageHeight();
mTempRectF.set(0, 0, width, height);
matrix.mapRect(mTempRectF);
matrix.getValues(mValues);
int cx = width / 2;
int cy = height / 2;
float scale = mValues[Matrix.MSCALE_X];
int xoffset = Math.round((getWidth() - mTempRectF.width()) / 2 / scale);
int yoffset = Math.round((getHeight() - mTempRectF.height()) / 2 / scale);
if (rotation == 90 || rotation == 180) {
cx += (mTempRectF.left / scale) - xoffset;
} else {
cx -= (mTempRectF.left / scale) - xoffset;
}
if (rotation == 180 || rotation == 270) {
cy += (mTempRectF.top / scale) - yoffset;
} else {
cy -= (mTempRectF.top / scale) - yoffset;
}
mRenderer.scale = scale;
mRenderer.centerX = swap ? cy : cx;
mRenderer.centerY = swap ? cx : cy;
invalidate();
}
|
public void | setTileSource(com.android.photos.views.TiledImageRenderer.TileSource source, java.lang.Runnable isReadyCallback)
if (!IS_SUPPORTED) {
return;
}
synchronized (mLock) {
mRenderer.source = source;
mRenderer.isReadyCallback = isReadyCallback;
mRenderer.centerX = source != null ? source.getImageWidth() / 2 : 0;
mRenderer.centerY = source != null ? source.getImageHeight() / 2 : 0;
mRenderer.rotation = source != null ? source.getRotation() : 0;
mRenderer.scale = 0;
updateScaleIfNecessaryLocked(mRenderer);
}
invalidate();
|
public void | setTranslationX(float translationX)
if (!IS_SUPPORTED) {
return;
}
super.setTranslationX(translationX);
|
private void | updateScaleIfNecessaryLocked(com.android.photos.views.TiledImageView$ImageRendererWrapper renderer)
if (renderer == null || renderer.source == null
|| renderer.scale > 0 || getWidth() == 0) {
return;
}
renderer.scale = Math.min(
(float) getWidth() / (float) renderer.source.getImageWidth(),
(float) getHeight() / (float) renderer.source.getImageHeight());
|