Skip to content

Commit

Permalink
Remove Viewport.identity
Browse files Browse the repository at this point in the history
  • Loading branch information
John Lombardo authored and John Lombardo committed Mar 16, 2013
1 parent e819a6c commit 9750513
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions library/src/com/sigseg/android/view/Scene.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ public void draw(Canvas c){
private class Viewport {
/** The bitmap of the current viewport */
Bitmap bitmap = null;
/** A Rect that can be used for drawing. Same size as bitmap */
final Rect identity = new Rect(0,0,0,0);
/** A Rect that defines where the Viewport is within the scene */
final Rect window = new Rect(0,0,0,0);

Expand Down Expand Up @@ -225,7 +223,6 @@ void setSize( int w, int h ){
bitmap = null;
}
bitmap = Bitmap.createBitmap(w, h, Config.RGB_565);
identity.set(0, 0, w, h);
window.set(
window.left,
window.top,
Expand All @@ -240,8 +237,8 @@ void getOrigin(Point p){
}
void getSize(Point p){
synchronized (this) {
p.x = identity.right;
p.y = identity.bottom;
p.x = window.width();
p.y = window.height();
}
}
void zoom(float factor, float focusX, float focusY){
Expand All @@ -255,7 +252,7 @@ void draw(Canvas c){
cache.update(this);
synchronized (this){
if (c!=null && bitmap!=null){
c.drawBitmap( bitmap, null, identity, null );
c.drawBitmap( bitmap, 0F, 0F, null);
drawComplete(c);
}
}
Expand Down Expand Up @@ -369,13 +366,13 @@ void loadBitmapIntoViewport(Bitmap bitmap, Viewport viewport){
int right = left + viewport.window.width();
int bottom = top + viewport.window.height();
srcRect.set( left, top, right, bottom );
dstRect.set( 0, 0, srcRect.width(), srcRect.height());
Canvas c = new Canvas(viewport.bitmap);
c.drawBitmap(
bitmap,
srcRect,
viewport.identity,
dstRect,
null);

// try {
// FileOutputStream fos = new FileOutputStream("/sdcard/viewport.png");
// viewport.bitmap.compress(Bitmap.CompressFormat.PNG, 99, fos);
Expand All @@ -387,6 +384,7 @@ void loadBitmapIntoViewport(Bitmap bitmap, Viewport viewport){
}
}
final Rect srcRect = new Rect(0,0,0,0);
final Rect dstRect = new Rect(0,0,0,0);

void loadSampleIntoViewport(Viewport viewport){
if (getState()!=CacheState.UNINITIALIZED){
Expand Down

0 comments on commit 9750513

Please sign in to comment.