summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-05-08 14:28:26 -0700
committerChris Craik <ccraik@google.com>2014-05-08 14:28:26 -0700
commite10e827ed68b0a9487cf8dd1fc545f9a09517ae9 (patch)
tree9efe760385a3a85206aaf8b7d558d29a30fc39fb /libs
parenta2604b738e7298fd926482ec5d94356b37a0d807 (diff)
downloadframeworks_base-e10e827ed68b0a9487cf8dd1fc545f9a09517ae9.zip
frameworks_base-e10e827ed68b0a9487cf8dd1fc545f9a09517ae9.tar.gz
frameworks_base-e10e827ed68b0a9487cf8dd1fc545f9a09517ae9.tar.bz2
Rename matrices for consistency
The projection matrix no longer contains viewing transformation, and has thus been renamed. Change-Id: I4f85ccdac97f4cb4f987bb05c389816680f1c94f
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/DisplayListRenderer.cpp2
-rw-r--r--libs/hwui/OpenGLRenderer.cpp23
-rw-r--r--libs/hwui/OpenGLRenderer.h14
3 files changed, 19 insertions, 20 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index c2ce6ed..2391e80 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -58,7 +58,7 @@ DisplayListData* DisplayListRenderer::finishRecording() {
void DisplayListRenderer::setViewport(int width, int height) {
// TODO: DisplayListRenderer shouldn't have a projection matrix, as it should never be used
- mViewProjMatrix.loadOrtho(0, width, height, 0, -1, 1);
+ mProjectionMatrix.loadOrtho(0, width, height, 0, -1, 1);
initializeViewport(width, height);
}
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 87b07b3..77d2680 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -170,7 +170,7 @@ void OpenGLRenderer::setViewport(int width, int height) {
}
void OpenGLRenderer::initViewport(int width, int height) {
- mViewProjMatrix.loadOrtho(0, width, height, 0, -1, 1);
+ mProjectionMatrix.loadOrtho(0, width, height, 0, -1, 1);
initializeViewport(width, height);
}
@@ -644,7 +644,7 @@ void OpenGLRenderer::onSnapshotRestored(const Snapshot& removed, const Snapshot&
if (restoreOrtho) {
const Rect& r = restored.viewport;
glViewport(r.left, r.top, r.right, r.bottom);
- mViewProjMatrix.load(removed.orthoMatrix); // TODO: should ortho be stored in 'restored'?
+ mProjectionMatrix.load(removed.orthoMatrix); // TODO: should ortho be stored in 'restored'?
}
if (restoreClip) {
@@ -870,7 +870,7 @@ bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, Rect& clip) {
mSnapshot->resetClip(clip.left, clip.top, clip.right, clip.bottom);
mSnapshot->viewport.set(0.0f, 0.0f, bounds.getWidth(), bounds.getHeight());
mSnapshot->height = bounds.getHeight();
- mSnapshot->orthoMatrix.load(mViewProjMatrix);
+ mSnapshot->orthoMatrix.load(mProjectionMatrix);
endTiling();
debugOverdraw(false, false);
@@ -900,8 +900,7 @@ bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, Rect& clip) {
// Change the ortho projection
glViewport(0, 0, bounds.getWidth(), bounds.getHeight());
- // TODO: determine best way to support 3d drawing within HW layers
- mViewProjMatrix.loadOrtho(0.0f, bounds.getWidth(), bounds.getHeight(), 0.0f, -1.0f, 1.0f);
+ mProjectionMatrix.loadOrtho(0.0f, bounds.getWidth(), bounds.getHeight(), 0.0f, -1.0f, 1.0f);
return true;
}
@@ -1705,17 +1704,17 @@ void OpenGLRenderer::setupDrawDirtyRegionsDisabled() {
void OpenGLRenderer::setupDrawModelView(ModelViewMode mode, bool offset,
float left, float top, float right, float bottom, bool ignoreTransform) {
- mModelView.loadTranslate(left, top, 0.0f);
+ mModelViewMatrix.loadTranslate(left, top, 0.0f);
if (mode == kModelViewMode_TranslateAndScale) {
- mModelView.scale(right - left, bottom - top, 1.0f);
+ mModelViewMatrix.scale(right - left, bottom - top, 1.0f);
}
bool dirty = right - left > 0.0f && bottom - top > 0.0f;
if (!ignoreTransform) {
- mCaches.currentProgram->set(mViewProjMatrix, mModelView, *currentTransform(), offset);
+ mCaches.currentProgram->set(mProjectionMatrix, mModelViewMatrix, *currentTransform(), offset);
if (dirty && mTrackDirtyRegions) dirtyLayer(left, top, right, bottom, *currentTransform());
} else {
- mCaches.currentProgram->set(mViewProjMatrix, mModelView, mat4::identity(), offset);
+ mCaches.currentProgram->set(mProjectionMatrix, mModelViewMatrix, mat4::identity(), offset);
if (dirty && mTrackDirtyRegions) dirtyLayer(left, top, right, bottom);
}
}
@@ -1740,11 +1739,11 @@ void OpenGLRenderer::setupDrawShaderUniforms(bool ignoreTransform) {
// compensate.
mat4 modelViewWithoutTransform;
modelViewWithoutTransform.loadInverse(*currentTransform());
- modelViewWithoutTransform.multiply(mModelView);
- mModelView.load(modelViewWithoutTransform);
+ modelViewWithoutTransform.multiply(mModelViewMatrix);
+ mModelViewMatrix.load(modelViewWithoutTransform);
}
mDrawModifiers.mShader->setupProgram(mCaches.currentProgram,
- mModelView, *mSnapshot, &mTextureUnit);
+ mModelViewMatrix, *mSnapshot, &mTextureUnit);
}
}
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 1d46945..4f7f01e 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -930,8 +930,8 @@ private:
*/
Texture* getTexture(const SkBitmap* bitmap);
- // Matrix used for view/projection in shaders
- mat4 mViewProjMatrix;
+ // Ortho matrix used for projection in shaders
+ mat4 mProjectionMatrix;
/**
* Model-view matrix used to position/size objects
@@ -939,15 +939,15 @@ private:
* Stores operation-local modifications to the draw matrix that aren't incorporated into the
* currentTransform().
*
- * If generated with kModelViewMode_Translate, the mModelView will reflect an x/y offset,
+ * If generated with kModelViewMode_Translate, mModelViewMatrix will reflect an x/y offset,
* e.g. the offset in drawLayer(). If generated with kModelViewMode_TranslateAndScale,
- * mModelView will reflect a translation and scale, e.g. the translation and scale required to
- * make VBO 0 (a rect of (0,0,1,1)) scaled to match the x,y offset, and width/height of a
- * bitmap.
+ * mModelViewMatrix will reflect a translation and scale, e.g. the translation and scale
+ * required to make VBO 0 (a rect of (0,0,1,1)) scaled to match the x,y offset, and width/height
+ * of a bitmap.
*
* Used as input to SkiaShader transformation.
*/
- mat4 mModelView;
+ mat4 mModelViewMatrix;
// State used to define the clipping region
Rect mTilingClip;