Skip to content

Commit

Permalink
CurlMesh.setTextureRect usage changed to CurlMesh.setFlipTexture.
Browse files Browse the repository at this point in the history
  • Loading branch information
harism committed May 9, 2011
1 parent e307e4c commit 5e96a17
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/fi/harism/curl/CurlView.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ public class CurlView extends GLSurfaceView implements View.OnTouchListener,
private BitmapProvider mBitmapProvider;
private SizeChangedObserver mSizeChangedObserver;

// Texture coordinates. For flipping a page we do not alter its rectangle
// but flip texture instead.
private static final RectF TEXTURE_RECT_FRONT = new RectF(0, 0, 1, 1);
private static final RectF TEXTURE_RECT_BACK = new RectF(1, 0, 0, 1);

/**
* Default constructor.
*/
Expand Down Expand Up @@ -115,7 +110,7 @@ public void onDrawFrame() {
CurlMesh right = mPageCurl;
CurlMesh curl = mPageRight;
right.setRect(mRenderer.getPageRect(CurlRenderer.PAGE_RIGHT));
right.setTexRect(TEXTURE_RECT_FRONT);
right.setFlipTexture(false);
right.reset();
mRenderer.removeCurlMesh(curl);
mPageCurl = curl;
Expand All @@ -129,7 +124,7 @@ public void onDrawFrame() {
CurlMesh left = mPageCurl;
CurlMesh curl = mPageLeft;
left.setRect(mRenderer.getPageRect(CurlRenderer.PAGE_LEFT));
left.setTexRect(TEXTURE_RECT_BACK);
left.setFlipTexture(true);
left.reset();
mRenderer.removeCurlMesh(curl);
if (!mRenderLeftPage) {
Expand Down Expand Up @@ -409,8 +404,8 @@ private void init(Context ctx) {
mPageLeft = new CurlMesh(10);
mPageRight = new CurlMesh(10);
mPageCurl = new CurlMesh(10);
mPageLeft.setTexRect(TEXTURE_RECT_BACK);
mPageRight.setTexRect(TEXTURE_RECT_FRONT);
mPageLeft.setFlipTexture(true);
mPageRight.setFlipTexture(false);
}

/**
Expand Down Expand Up @@ -505,14 +500,14 @@ private void startCurl(int page) {
mPageRight.setBitmap(bitmap);
mPageRight.setRect(mRenderer
.getPageRect(CurlRenderer.PAGE_RIGHT));
mPageRight.setTexRect(TEXTURE_RECT_FRONT);
mPageRight.setFlipTexture(false);
mPageRight.reset();
mRenderer.addCurlMesh(mPageRight);
}

// Add curled page to renderer.
mPageCurl.setRect(mRenderer.getPageRect(CurlRenderer.PAGE_RIGHT));
mPageCurl.setTexRect(TEXTURE_RECT_FRONT);
mPageCurl.setFlipTexture(false);
mPageCurl.reset();
mRenderer.addCurlMesh(mPageCurl);

Expand Down Expand Up @@ -541,7 +536,7 @@ private void startCurl(int page) {
mPageLeft.setBitmap(bitmap);
mPageLeft
.setRect(mRenderer.getPageRect(CurlRenderer.PAGE_LEFT));
mPageLeft.setTexRect(TEXTURE_RECT_BACK);
mPageLeft.setFlipTexture(true);
mPageLeft.reset();
if (mRenderLeftPage) {
mRenderer.addCurlMesh(mPageLeft);
Expand All @@ -560,11 +555,11 @@ private void startCurl(int page) {
if (mViewMode == SHOW_ONE_PAGE) {
mPageCurl.setRect(mRenderer
.getPageRect(CurlRenderer.PAGE_RIGHT));
mPageCurl.setTexRect(TEXTURE_RECT_FRONT);
mPageCurl.setFlipTexture(false);
} else {
mPageCurl
.setRect(mRenderer.getPageRect(CurlRenderer.PAGE_LEFT));
mPageCurl.setTexRect(TEXTURE_RECT_BACK);
mPageCurl.setFlipTexture(true);
}
mPageCurl.reset();
mRenderer.addCurlMesh(mPageCurl);
Expand Down

0 comments on commit 5e96a17

Please sign in to comment.