Bug 731603 - Propagate the resolution of the painted content into syncViewportInfo as well. r=Cwiiis

This commit is contained in:
Kartikaya Gupta 2012-03-20 00:05:45 -04:00
Родитель 31076e0bed
Коммит a9fe2cdfa1
7 изменённых файлов: 18 добавлений и 35 удалений

Просмотреть файл

@ -286,7 +286,15 @@ CompositorParent::TransformShadowTree()
// We synchronise the viewport information with Java after sending the above
// notifications, so that Java can take these into account in its response.
SyncViewportInfo();
if (metrics) {
// Calculate the absolute display port to send to Java
nsIntRect displayPort = metrics->mDisplayPort;
nsIntPoint scrollOffset = metrics->mViewportScrollOffset;
displayPort.x += scrollOffset.x;
displayPort.y += scrollOffset.y;
mozilla::AndroidBridge::Bridge()->SyncViewportInfo(displayPort, 1/rootScaleX, mScrollOffset, mXScale, mYScale);
}
// Handle transformations for asynchronous panning and zooming. We determine the
// zoom used by Gecko from the transformation set on the root layer, and we
@ -312,25 +320,6 @@ CompositorParent::TransformShadowTree()
#endif
}
#ifdef MOZ_WIDGET_ANDROID
void
CompositorParent::SyncViewportInfo()
{
ContainerLayer* container = GetPrimaryScrollableLayer()->AsContainerLayer();
const FrameMetrics* metrics = &container->GetFrameMetrics();
if (metrics) {
// Calculate the absolute display port to send to Java
nsIntRect displayPort = container->GetFrameMetrics().mDisplayPort;
nsIntPoint scrollOffset = metrics->mViewportScrollOffset;
displayPort.x += scrollOffset.x;
displayPort.y += scrollOffset.y;
mozilla::AndroidBridge::Bridge()->SyncViewportInfo(displayPort, mScrollOffset, mXScale, mYScale);
}
}
#endif
void
CompositorParent::ShadowLayersUpdated(bool isFirstPaint)
{

Просмотреть файл

@ -122,13 +122,6 @@ private:
// Platform specific functions
#ifdef MOZ_WIDGET_ANDROID
/**
* Informs Java of the current display port, and asks Java for its viewport
* position and zoom, to use in updating the world transform in
* TransformShadowTree.
*/
void SyncViewportInfo();
/**
* Does a breadth-first search to find the first layer in the tree with a
* displayport set.

Просмотреть файл

@ -392,7 +392,7 @@ public class GeckoLayerClient implements GeckoEventResponder,
* everytime we're called. NOTE: we might be able to return a ImmutableViewportMetrics
* which would avoid the copy into mCurrentViewTransform.
*/
public ViewTransform syncViewportInfo(int x, int y, int width, int height) {
public ViewTransform syncViewportInfo(int x, int y, int width, int height, float resolution) {
// getViewportMetrics is thread safe so we don't need to synchronize
// on mLayerController.
// We save the viewport metrics here, so we later use it later in

Просмотреть файл

@ -1910,13 +1910,13 @@ AndroidBridge::SetPageSize(float aZoom, float aPageWidth, float aPageHeight)
}
void
AndroidBridge::SyncViewportInfo(const nsIntRect& aDisplayPort, nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
AndroidBridge::SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
{
AndroidGeckoLayerClient *client = mLayerClient;
if (!client)
return;
client->SyncViewportInfo(aDisplayPort, aScrollOffset, aScaleX, aScaleY);
client->SyncViewportInfo(aDisplayPort, aDisplayResolution, aScrollOffset, aScaleX, aScaleY);
}
AndroidBridge::AndroidBridge()

Просмотреть файл

@ -409,7 +409,7 @@ public:
base::Thread* aCompositorThread);
void SetFirstPaintViewport(float aOffsetX, float aOffsetY, float aZoom, float aPageWidth, float aPageHeight);
void SetPageSize(float aZoom, float aPageWidth, float aPageHeight);
void SyncViewportInfo(const nsIntRect& aDisplayPort, nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
jobject CreateSurface();
void DestroySurface(jobject surface);

Просмотреть файл

@ -275,7 +275,7 @@ AndroidGeckoLayerClient::InitGeckoLayerClientClass(JNIEnv *jEnv)
jSetFirstPaintViewport = getMethod("setFirstPaintViewport", "(FFFFF)V");
jSetPageSize = getMethod("setPageSize", "(FFF)V");
jSyncViewportInfoMethod = getMethod("syncViewportInfo",
"(IIII)Lorg/mozilla/gecko/gfx/ViewTransform;");
"(IIIIF)Lorg/mozilla/gecko/gfx/ViewTransform;");
jCreateFrameMethod = getMethod("createFrame", "()Lorg/mozilla/gecko/gfx/LayerRenderer$Frame;");
jActivateProgramMethod = getMethod("activateProgram", "()V");
jDeactivateProgramMethod = getMethod("deactivateProgram", "()V");
@ -707,7 +707,7 @@ AndroidGeckoLayerClient::SetPageSize(float aZoom, float aPageWidth, float aPageH
}
void
AndroidGeckoLayerClient::SyncViewportInfo(const nsIntRect& aDisplayPort, nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
AndroidGeckoLayerClient::SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
{
NS_ASSERTION(!isNull(), "SyncViewportInfo called on null layer client!");
JNIEnv *env = GetJNIForThread(); // this is called on the compositor thread
@ -719,7 +719,8 @@ AndroidGeckoLayerClient::SyncViewportInfo(const nsIntRect& aDisplayPort, nsIntPo
jobject viewTransformJObj = env->CallObjectMethod(wrapped_obj, jSyncViewportInfoMethod,
aDisplayPort.x, aDisplayPort.y,
aDisplayPort.width, aDisplayPort.height);
aDisplayPort.width, aDisplayPort.height,
aDisplayResolution);
NS_ABORT_IF_FALSE(viewTransformJObj, "No view transform object!");
viewTransform.Init(viewTransformJObj);

Просмотреть файл

@ -206,7 +206,7 @@ public:
void EndDrawing();
void SetFirstPaintViewport(float aOffsetX, float aOffsetY, float aZoom, float aPageWidth, float aPageHeight);
void SetPageSize(float aZoom, float aPageWidth, float aPageHeight);
void SyncViewportInfo(const nsIntRect& aDisplayPort, nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
void CreateFrame(AndroidLayerRendererFrame& aFrame);
void ActivateProgram();
void DeactivateProgram();