diff options
author | Chris Craik <ccraik@google.com> | 2014-05-09 18:02:53 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-09 18:02:53 +0000 |
commit | e1f788b3e216329c570929eb4526332ae0db14d1 (patch) | |
tree | 20ebf8e839e813db8085fe4412206c1861075ba4 /libs/hwui | |
parent | 809146690d03b3ec3404c37c1fb467f7b7234692 (diff) | |
parent | e10e827ed68b0a9487cf8dd1fc545f9a09517ae9 (diff) | |
download | frameworks_base-e1f788b3e216329c570929eb4526332ae0db14d1.zip frameworks_base-e1f788b3e216329c570929eb4526332ae0db14d1.tar.gz frameworks_base-e1f788b3e216329c570929eb4526332ae0db14d1.tar.bz2 |
Merge "Rename matrices for consistency"
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/DisplayListRenderer.cpp | 2 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 23 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.h | 14 |
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 5a977c8..20b038d 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -171,7 +171,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); } @@ -628,7 +628,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) { @@ -854,7 +854,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); @@ -884,8 +884,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; } @@ -1689,17 +1688,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); } } @@ -1724,11 +1723,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; |