package org.osmdroid.views.drawing;

import org.osmdroid.views.MapView;

import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Matrix;

public class OsmBitmapShader extends BitmapShader {
	private final Matrix mMatrix = new Matrix();
	private int mBitmapWidth;
	private int mBitmapHeight;

	public OsmBitmapShader(Bitmap bitmap, TileMode tileX, TileMode tileY) {
		super(bitmap, tileX, tileY);
		mBitmapWidth = bitmap.getWidth();
		mBitmapHeight = bitmap.getHeight();
	}

	public void onDrawCycle(MapView mapView) {
		mMatrix.setTranslate(-mapView.getScrollX() % mBitmapWidth, -mapView.getScrollY()
				% mBitmapHeight);
		setLocalMatrix(mMatrix);
	}
}

@@ -56,23 +56,26 @@
 d.views.
-MapView
+Projection
 ;%0A%0Aimpor
@@ -170,16 +170,47 @@
 .Matrix;
+%0Aimport android.graphics.Point;
 %0A%0Apublic
@@ -255,16 +255,67 @@
 hader %7B%0A
+%09private static final Point sPoint = new Point();%0A%0A
 %09private
@@ -619,114 +619,137 @@
 cle(
-MapView mapView) %7B%0A%09%09mMatrix.setTranslate(-mapView.getScrollX() %25 mBitmapWidth, -mapView.getScrollY()%0A%09%09%09%09
+Projection projection) %7B%0A%09%09projection.toMercatorPixels(0, 0, sPoint);%0A%09%09mMatrix.setTranslate(-sPoint.x %25 mBitmapWidth, -sPoint.y 
 %25 mB

Use Projection to obtain a reference point in OsmBitmapShader.