Pull out tile dimensions being passed around uselessly

This commit is contained in:
Kartikaya Gupta 2012-02-24 10:51:41 -05:00
Родитель 32d2d9d9a7
Коммит d1065efeb5
5 изменённых файлов: 12 добавлений и 22 удалений

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

@ -365,12 +365,11 @@ public class GeckoEvent {
return event;
}
public static GeckoEvent createSizeChangedEvent(int w, int h, int screenw, int screenh, int tilew, int tileh) {
public static GeckoEvent createSizeChangedEvent(int w, int h, int screenw, int screenh) {
GeckoEvent event = new GeckoEvent(SIZE_CHANGED);
event.mPoints = new Point[3];
event.mPoints = new Point[2];
event.mPoints[0] = new Point(w, h);
event.mPoints[1] = new Point(screenw, screenh);
event.mPoints[2] = new Point(tilew, tileh);
return event;
}

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

@ -126,9 +126,8 @@ public class GeckoLayerClient implements GeckoEventListener,
}
/** This function is invoked by Gecko via JNI; be careful when modifying signature. */
public Rect beginDrawing(int width, int height, int tileWidth, int tileHeight,
String metadata) {
Log.e(LOGTAG, "### beginDrawing " + width + " " + height + " " + tileWidth + " " + tileHeight);
public Rect beginDrawing(int width, int height, String metadata) {
Log.e(LOGTAG, "### beginDrawing " + width + " " + height);
// If the viewport has changed but we still don't have the latest viewport
// from Gecko, ignore the viewport passed to us from Gecko since that is going
@ -281,9 +280,8 @@ public class GeckoLayerClient implements GeckoEventListener,
}
IntSize bufferSize = getBufferSize();
GeckoEvent event = GeckoEvent.createSizeChangedEvent(mWindowSize.width, mWindowSize.height, // Window (buffer) size
mScreenSize.width, mScreenSize.height, // Screen size
0, 0); // Tile-size (unused)
GeckoEvent event = GeckoEvent.createSizeChangedEvent(mWindowSize.width, mWindowSize.height, // Window (buffer) size
mScreenSize.width, mScreenSize.height); // Screen size
GeckoAppShell.sendEventToGecko(event);
}

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

@ -347,7 +347,7 @@ AndroidGeckoLayerClient::InitGeckoLayerClientClass(JNIEnv *jEnv)
jGeckoLayerClientClass = getClassGlobalRef("org/mozilla/gecko/gfx/GeckoLayerClient");
jBeginDrawingMethod = getMethod("beginDrawing", "(IIIILjava/lang/String;)Landroid/graphics/Rect;");
jBeginDrawingMethod = getMethod("beginDrawing", "(IILjava/lang/String;)Landroid/graphics/Rect;");
jEndDrawingMethod = getMethod("endDrawing", "(IIII)V");
jGetViewTransformMethod = getMethod("getViewTransform",
"()Lorg/mozilla/gecko/gfx/ViewTransform;");
@ -511,7 +511,7 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
switch (mType) {
case SIZE_CHANGED:
ReadPointArray(mPoints, jenv, jPoints, 3);
ReadPointArray(mPoints, jenv, jPoints, 2);
break;
case KEY_EVENT:
@ -764,8 +764,7 @@ AndroidGeckoSurfaceView::Draw2D(jobject buffer, int stride)
}
bool
AndroidGeckoLayerClient::BeginDrawing(int aWidth, int aHeight, int aTileWidth, int aTileHeight,
nsIntRect &aDirtyRect, const nsAString &aMetadata)
AndroidGeckoLayerClient::BeginDrawing(int aWidth, int aHeight, nsIntRect &aDirtyRect, const nsAString &aMetadata)
{
NS_ASSERTION(!isNull(), "BeginDrawing() called on null layer client!");
JNIEnv *env = AndroidBridge::GetJNIEnv();
@ -776,7 +775,7 @@ AndroidGeckoLayerClient::BeginDrawing(int aWidth, int aHeight, int aTileWidth, i
jstring jMetadata = env->NewString(nsPromiseFlatString(aMetadata).get(), aMetadata.Length());
jobject rectObject = env->CallObjectMethod(wrapped_obj, jBeginDrawingMethod,
aWidth, aHeight, aTileWidth, aTileHeight,
aWidth, aHeight,
jMetadata);
if (rectObject == nsnull)

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

@ -224,8 +224,7 @@ public:
AndroidGeckoLayerClient(jobject jobj)
: mViewTransformGetter(*this) { Init(jobj); }
bool BeginDrawing(int aWidth, int aHeight, int aTileWidth, int aTileHeight,
nsIntRect &aDirtyRect, const nsAString &aMetadata);
bool BeginDrawing(int aWidth, int aHeight, nsIntRect &aDirtyRect, const nsAString &aMetadata);
void EndDrawing(const nsIntRect &aRect);
void GetViewTransform(AndroidViewTransform& aViewTransform);
void CreateFrame(AndroidLayerRendererFrame& aFrame);

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

@ -88,7 +88,6 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget)
// The dimensions of the current android view
static gfxIntSize gAndroidBounds = gfxIntSize(0, 0);
static gfxIntSize gAndroidTileSize = gfxIntSize(0, 0);
static gfxIntSize gAndroidScreenBounds;
#ifdef ACCESSIBILITY
@ -857,7 +856,7 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
}
case AndroidGeckoEvent::SIZE_CHANGED: {
nsTArray<nsIntPoint> points = ae->Points();
NS_ASSERTION(points.Length() == 3, "Size changed does not have enough coordinates");
NS_ASSERTION(points.Length() == 2, "Size changed does not have enough coordinates");
int nw = points[0].x;
int nh = points[0].y;
@ -877,9 +876,6 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
}
}
gAndroidTileSize.width = points[2].x;
gAndroidTileSize.height = points[2].y;
int newScreenWidth = points[1].x;
int newScreenHeight = points[1].y;
@ -1216,7 +1212,6 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae)
AndroidGeckoLayerClient &client = AndroidBridge::Bridge()->GetLayerClient();
if (!client.BeginDrawing(gAndroidBounds.width, gAndroidBounds.height,
gAndroidTileSize.width, gAndroidTileSize.height,
dirtyRect, metadata)) {
__android_log_print(ANDROID_LOG_ERROR, "Gecko", "### BeginDrawing returned false!");
return;