Loading libs/hwui/DisplayListRenderer.cpp +0 −3 Original line number Diff line number Diff line Loading @@ -57,9 +57,6 @@ DisplayListData* DisplayListRenderer::finishRecording() { } void DisplayListRenderer::setViewport(int width, int height) { // TODO: DisplayListRenderer shouldn't have a projection matrix, as it should never be used mProjectionMatrix.loadOrtho(0, width, height, 0, -1, 1); initializeViewport(width, height); } Loading libs/hwui/Layer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ void Layer::defer() { DeferStateStruct deferredState(*deferredList, *renderer, RenderNode::kReplayFlag_ClipChildren); renderer->initViewport(width, height); renderer->initializeViewport(width, height); renderer->setupFrameState(dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom, !isBlend()); Loading libs/hwui/LayerRenderer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ LayerRenderer::~LayerRenderer() { } void LayerRenderer::setViewport(int width, int height) { initViewport(width, height); initializeViewport(width, height); } status_t LayerRenderer::prepareDirty(float left, float top, float right, float bottom, Loading libs/hwui/OpenGLRenderer.cpp +28 −38 Original line number Diff line number Diff line Loading @@ -162,7 +162,7 @@ void OpenGLRenderer::initProperties() { /////////////////////////////////////////////////////////////////////////////// void OpenGLRenderer::setViewport(int width, int height) { initViewport(width, height); initializeViewport(width, height); glDisable(GL_DITHER); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); Loading @@ -170,12 +170,6 @@ void OpenGLRenderer::setViewport(int width, int height) { glEnableVertexAttribArray(Program::kBindingPosition); } void OpenGLRenderer::initViewport(int width, int height) { mProjectionMatrix.loadOrtho(0, width, height, 0, -1, 1); initializeViewport(width, height); } void OpenGLRenderer::setupFrameState(float left, float top, float right, float bottom, bool opaque) { mCaches.clearGarbage(); Loading Loading @@ -244,7 +238,7 @@ void OpenGLRenderer::discardFramebuffer(float left, float top, float right, floa status_t OpenGLRenderer::clear(float left, float top, float right, float bottom, bool opaque) { if (!opaque || mCountOverdraw) { mCaches.enableScissor(); mCaches.setScissor(left, currentSnapshot()->height - bottom, right - left, bottom - top); mCaches.setScissor(left, getViewportHeight() - bottom, right - left, bottom - top); glClear(GL_COLOR_BUFFER_BIT); return DrawGlInfo::kStatusDrew; } Loading @@ -270,7 +264,7 @@ void OpenGLRenderer::startTilingCurrentClip(bool opaque) { clip = &(snapshot->layer->clipRect); } startTiling(*clip, snapshot->height, opaque); startTiling(*clip, getViewportHeight(), opaque); } } Loading Loading @@ -333,7 +327,7 @@ void OpenGLRenderer::interrupt() { void OpenGLRenderer::resume() { const Snapshot* snapshot = currentSnapshot(); glViewport(0, 0, snapshot->viewport.getWidth(), snapshot->viewport.getHeight()); glViewport(0, 0, getViewportWidth(), getViewportHeight()); glBindFramebuffer(GL_FRAMEBUFFER, snapshot->fbo); debugOverdraw(true, false); Loading @@ -354,9 +348,8 @@ void OpenGLRenderer::resume() { } void OpenGLRenderer::resumeAfterLayer() { const Snapshot* snapshot = currentSnapshot(); glViewport(0, 0, snapshot->viewport.getWidth(), snapshot->viewport.getHeight()); glBindFramebuffer(GL_FRAMEBUFFER, snapshot->fbo); glViewport(0, 0, getViewportWidth(), getViewportHeight()); glBindFramebuffer(GL_FRAMEBUFFER, currentSnapshot()->fbo); debugOverdraw(true, false); mCaches.resetScissor(); Loading @@ -381,8 +374,8 @@ status_t OpenGLRenderer::callDrawGLFunction(Functor* functor, Rect& dirty) { info.clipRight = clip.right; info.clipBottom = clip.bottom; info.isLayer = hasLayer(); info.width = currentSnapshot()->viewport.getWidth(); info.height = currentSnapshot()->height; info.width = getViewportWidth(); info.height = getViewportHeight(); currentTransform()->copyTo(&info.transform[0]); bool dirtyClip = mDirtyClip; Loading Loading @@ -437,7 +430,7 @@ void OpenGLRenderer::renderOverdraw() { const Rect* clip = &mTilingClip; mCaches.enableScissor(); mCaches.setScissor(clip->left, firstSnapshot()->height - clip->bottom, mCaches.setScissor(clip->left, firstSnapshot()->getViewportHeight() - clip->bottom, clip->right - clip->left, clip->bottom - clip->top); // 1x overdraw Loading Loading @@ -621,14 +614,12 @@ void OpenGLRenderer::flushLayerUpdates() { /////////////////////////////////////////////////////////////////////////////// void OpenGLRenderer::onSnapshotRestored(const Snapshot& removed, const Snapshot& restored) { bool restoreOrtho = removed.flags & Snapshot::kFlagDirtyOrtho; bool restoreViewport = removed.flags & Snapshot::kFlagIsFboLayer; bool restoreClip = removed.flags & Snapshot::kFlagClipSet; bool restoreLayer = removed.flags & Snapshot::kFlagIsLayer; if (restoreOrtho) { const Rect& r = restored.viewport; glViewport(r.left, r.top, r.right, r.bottom); mProjectionMatrix.load(removed.orthoMatrix); // TODO: should ortho be stored in 'restored'? if (restoreViewport) { glViewport(0, 0, getViewportWidth(), getViewportHeight()); } if (restoreClip) { Loading Loading @@ -671,7 +662,7 @@ void OpenGLRenderer::calculateLayerBoundsAndClip(Rect& bounds, Rect& clip, bool // When the layer is not an FBO, we may use glCopyTexImage so we // need to make sure the layer does not extend outside the bounds // of the framebuffer if (!bounds.intersect(currentSnapshot()->previous->viewport)) { if (!bounds.intersect(Rect(0, 0, getViewportWidth(), getViewportHeight()))) { bounds.setEmpty(); } else if (fboLayer) { clip.set(bounds); Loading Loading @@ -719,7 +710,7 @@ int OpenGLRenderer::saveLayerDeferred(float left, float top, float right, float if (!currentSnapshot()->isIgnored()) { mSnapshot->resetTransform(-bounds.left, -bounds.top, 0.0f); mSnapshot->resetClip(clip.left, clip.top, clip.right, clip.bottom); mSnapshot->viewport.set(0.0f, 0.0f, bounds.getWidth(), bounds.getHeight()); mSnapshot->initializeViewport(bounds.getWidth(), bounds.getHeight()); } } Loading Loading @@ -831,8 +822,9 @@ bool OpenGLRenderer::createLayer(float left, float top, float right, float botto layer->setEmpty(false); } glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, mSnapshot->height - bounds.bottom, bounds.getWidth(), bounds.getHeight()); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, getViewportHeight() - bounds.bottom, bounds.getWidth(), bounds.getHeight()); // Enqueue the buffer coordinates to clear the corresponding region later mLayers.push(new Rect(bounds)); Loading @@ -847,14 +839,11 @@ bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, Rect& clip) { layer->setFbo(mCaches.fboCache.get()); mSnapshot->region = &mSnapshot->layer->region; mSnapshot->flags |= Snapshot::kFlagFboTarget | Snapshot::kFlagIsFboLayer | Snapshot::kFlagDirtyOrtho; mSnapshot->flags |= Snapshot::kFlagFboTarget | Snapshot::kFlagIsFboLayer; mSnapshot->fbo = layer->getFbo(); mSnapshot->resetTransform(-bounds.left, -bounds.top, 0.0f); 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(mProjectionMatrix); mSnapshot->initializeViewport(bounds.getWidth(), bounds.getHeight()); endTiling(); debugOverdraw(false, false); Loading Loading @@ -884,7 +873,6 @@ bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, Rect& clip) { // Change the ortho projection glViewport(0, 0, bounds.getWidth(), bounds.getHeight()); mProjectionMatrix.loadOrtho(0.0f, bounds.getWidth(), bounds.getHeight(), 0.0f, -1.0f, 1.0f); return true; } Loading Loading @@ -1419,7 +1407,7 @@ void OpenGLRenderer::setScissorFromClip() { Rect clip(*currentClipRect()); clip.snapToPixelBoundaries(); if (mCaches.setScissor(clip.left, currentSnapshot()->height - clip.bottom, if (mCaches.setScissor(clip.left, getViewportHeight() - clip.bottom, clip.getWidth(), clip.getHeight())) { mDirtyClip = false; } Loading Loading @@ -1694,12 +1682,14 @@ void OpenGLRenderer::setupDrawModelView(ModelViewMode mode, bool offset, } bool dirty = right - left > 0.0f && bottom - top > 0.0f; const Matrix4& transformMatrix = ignoreTransform ? Matrix4::identity() : *currentTransform(); mCaches.currentProgram->set(mSnapshot->getOrthoMatrix(), mModelViewMatrix, transformMatrix, offset); if (dirty && mTrackDirtyRegions) { if (!ignoreTransform) { mCaches.currentProgram->set(mProjectionMatrix, mModelViewMatrix, *currentTransform(), offset); if (dirty && mTrackDirtyRegions) dirtyLayer(left, top, right, bottom, *currentTransform()); dirtyLayer(left, top, right, bottom, *currentTransform()); } else { mCaches.currentProgram->set(mProjectionMatrix, mModelViewMatrix, mat4::identity(), offset); if (dirty && mTrackDirtyRegions) dirtyLayer(left, top, right, bottom); dirtyLayer(left, top, right, bottom); } } } Loading libs/hwui/OpenGLRenderer.h +2 −11 Original line number Diff line number Diff line Loading @@ -254,8 +254,8 @@ public: return mSnapshot->clipRegion->isEmpty(); } int getViewportWidth() { return currentSnapshot()->viewport.getWidth(); } int getViewportHeight() { return currentSnapshot()->viewport.getHeight(); } int getViewportWidth() { return currentSnapshot()->getViewportWidth(); } int getViewportHeight() { return currentSnapshot()->getViewportHeight(); } /** * Scales the alpha on the current snapshot. This alpha value will be modulated Loading Loading @@ -353,12 +353,6 @@ public: #endif protected: /** * Computes the projection matrix, initialize the first snapshot * and stores the dimensions of the render target. */ void initViewport(int width, int height); /** * Perform the setup specific to a frame. This method does not * issue any OpenGL commands. Loading Loading @@ -930,9 +924,6 @@ private: */ Texture* getTexture(const SkBitmap* bitmap); // Ortho matrix used for projection in shaders mat4 mProjectionMatrix; /** * Model-view matrix used to position/size objects * Loading Loading
libs/hwui/DisplayListRenderer.cpp +0 −3 Original line number Diff line number Diff line Loading @@ -57,9 +57,6 @@ DisplayListData* DisplayListRenderer::finishRecording() { } void DisplayListRenderer::setViewport(int width, int height) { // TODO: DisplayListRenderer shouldn't have a projection matrix, as it should never be used mProjectionMatrix.loadOrtho(0, width, height, 0, -1, 1); initializeViewport(width, height); } Loading
libs/hwui/Layer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ void Layer::defer() { DeferStateStruct deferredState(*deferredList, *renderer, RenderNode::kReplayFlag_ClipChildren); renderer->initViewport(width, height); renderer->initializeViewport(width, height); renderer->setupFrameState(dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom, !isBlend()); Loading
libs/hwui/LayerRenderer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ LayerRenderer::~LayerRenderer() { } void LayerRenderer::setViewport(int width, int height) { initViewport(width, height); initializeViewport(width, height); } status_t LayerRenderer::prepareDirty(float left, float top, float right, float bottom, Loading
libs/hwui/OpenGLRenderer.cpp +28 −38 Original line number Diff line number Diff line Loading @@ -162,7 +162,7 @@ void OpenGLRenderer::initProperties() { /////////////////////////////////////////////////////////////////////////////// void OpenGLRenderer::setViewport(int width, int height) { initViewport(width, height); initializeViewport(width, height); glDisable(GL_DITHER); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); Loading @@ -170,12 +170,6 @@ void OpenGLRenderer::setViewport(int width, int height) { glEnableVertexAttribArray(Program::kBindingPosition); } void OpenGLRenderer::initViewport(int width, int height) { mProjectionMatrix.loadOrtho(0, width, height, 0, -1, 1); initializeViewport(width, height); } void OpenGLRenderer::setupFrameState(float left, float top, float right, float bottom, bool opaque) { mCaches.clearGarbage(); Loading Loading @@ -244,7 +238,7 @@ void OpenGLRenderer::discardFramebuffer(float left, float top, float right, floa status_t OpenGLRenderer::clear(float left, float top, float right, float bottom, bool opaque) { if (!opaque || mCountOverdraw) { mCaches.enableScissor(); mCaches.setScissor(left, currentSnapshot()->height - bottom, right - left, bottom - top); mCaches.setScissor(left, getViewportHeight() - bottom, right - left, bottom - top); glClear(GL_COLOR_BUFFER_BIT); return DrawGlInfo::kStatusDrew; } Loading @@ -270,7 +264,7 @@ void OpenGLRenderer::startTilingCurrentClip(bool opaque) { clip = &(snapshot->layer->clipRect); } startTiling(*clip, snapshot->height, opaque); startTiling(*clip, getViewportHeight(), opaque); } } Loading Loading @@ -333,7 +327,7 @@ void OpenGLRenderer::interrupt() { void OpenGLRenderer::resume() { const Snapshot* snapshot = currentSnapshot(); glViewport(0, 0, snapshot->viewport.getWidth(), snapshot->viewport.getHeight()); glViewport(0, 0, getViewportWidth(), getViewportHeight()); glBindFramebuffer(GL_FRAMEBUFFER, snapshot->fbo); debugOverdraw(true, false); Loading @@ -354,9 +348,8 @@ void OpenGLRenderer::resume() { } void OpenGLRenderer::resumeAfterLayer() { const Snapshot* snapshot = currentSnapshot(); glViewport(0, 0, snapshot->viewport.getWidth(), snapshot->viewport.getHeight()); glBindFramebuffer(GL_FRAMEBUFFER, snapshot->fbo); glViewport(0, 0, getViewportWidth(), getViewportHeight()); glBindFramebuffer(GL_FRAMEBUFFER, currentSnapshot()->fbo); debugOverdraw(true, false); mCaches.resetScissor(); Loading @@ -381,8 +374,8 @@ status_t OpenGLRenderer::callDrawGLFunction(Functor* functor, Rect& dirty) { info.clipRight = clip.right; info.clipBottom = clip.bottom; info.isLayer = hasLayer(); info.width = currentSnapshot()->viewport.getWidth(); info.height = currentSnapshot()->height; info.width = getViewportWidth(); info.height = getViewportHeight(); currentTransform()->copyTo(&info.transform[0]); bool dirtyClip = mDirtyClip; Loading Loading @@ -437,7 +430,7 @@ void OpenGLRenderer::renderOverdraw() { const Rect* clip = &mTilingClip; mCaches.enableScissor(); mCaches.setScissor(clip->left, firstSnapshot()->height - clip->bottom, mCaches.setScissor(clip->left, firstSnapshot()->getViewportHeight() - clip->bottom, clip->right - clip->left, clip->bottom - clip->top); // 1x overdraw Loading Loading @@ -621,14 +614,12 @@ void OpenGLRenderer::flushLayerUpdates() { /////////////////////////////////////////////////////////////////////////////// void OpenGLRenderer::onSnapshotRestored(const Snapshot& removed, const Snapshot& restored) { bool restoreOrtho = removed.flags & Snapshot::kFlagDirtyOrtho; bool restoreViewport = removed.flags & Snapshot::kFlagIsFboLayer; bool restoreClip = removed.flags & Snapshot::kFlagClipSet; bool restoreLayer = removed.flags & Snapshot::kFlagIsLayer; if (restoreOrtho) { const Rect& r = restored.viewport; glViewport(r.left, r.top, r.right, r.bottom); mProjectionMatrix.load(removed.orthoMatrix); // TODO: should ortho be stored in 'restored'? if (restoreViewport) { glViewport(0, 0, getViewportWidth(), getViewportHeight()); } if (restoreClip) { Loading Loading @@ -671,7 +662,7 @@ void OpenGLRenderer::calculateLayerBoundsAndClip(Rect& bounds, Rect& clip, bool // When the layer is not an FBO, we may use glCopyTexImage so we // need to make sure the layer does not extend outside the bounds // of the framebuffer if (!bounds.intersect(currentSnapshot()->previous->viewport)) { if (!bounds.intersect(Rect(0, 0, getViewportWidth(), getViewportHeight()))) { bounds.setEmpty(); } else if (fboLayer) { clip.set(bounds); Loading Loading @@ -719,7 +710,7 @@ int OpenGLRenderer::saveLayerDeferred(float left, float top, float right, float if (!currentSnapshot()->isIgnored()) { mSnapshot->resetTransform(-bounds.left, -bounds.top, 0.0f); mSnapshot->resetClip(clip.left, clip.top, clip.right, clip.bottom); mSnapshot->viewport.set(0.0f, 0.0f, bounds.getWidth(), bounds.getHeight()); mSnapshot->initializeViewport(bounds.getWidth(), bounds.getHeight()); } } Loading Loading @@ -831,8 +822,9 @@ bool OpenGLRenderer::createLayer(float left, float top, float right, float botto layer->setEmpty(false); } glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, mSnapshot->height - bounds.bottom, bounds.getWidth(), bounds.getHeight()); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, getViewportHeight() - bounds.bottom, bounds.getWidth(), bounds.getHeight()); // Enqueue the buffer coordinates to clear the corresponding region later mLayers.push(new Rect(bounds)); Loading @@ -847,14 +839,11 @@ bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, Rect& clip) { layer->setFbo(mCaches.fboCache.get()); mSnapshot->region = &mSnapshot->layer->region; mSnapshot->flags |= Snapshot::kFlagFboTarget | Snapshot::kFlagIsFboLayer | Snapshot::kFlagDirtyOrtho; mSnapshot->flags |= Snapshot::kFlagFboTarget | Snapshot::kFlagIsFboLayer; mSnapshot->fbo = layer->getFbo(); mSnapshot->resetTransform(-bounds.left, -bounds.top, 0.0f); 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(mProjectionMatrix); mSnapshot->initializeViewport(bounds.getWidth(), bounds.getHeight()); endTiling(); debugOverdraw(false, false); Loading Loading @@ -884,7 +873,6 @@ bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, Rect& clip) { // Change the ortho projection glViewport(0, 0, bounds.getWidth(), bounds.getHeight()); mProjectionMatrix.loadOrtho(0.0f, bounds.getWidth(), bounds.getHeight(), 0.0f, -1.0f, 1.0f); return true; } Loading Loading @@ -1419,7 +1407,7 @@ void OpenGLRenderer::setScissorFromClip() { Rect clip(*currentClipRect()); clip.snapToPixelBoundaries(); if (mCaches.setScissor(clip.left, currentSnapshot()->height - clip.bottom, if (mCaches.setScissor(clip.left, getViewportHeight() - clip.bottom, clip.getWidth(), clip.getHeight())) { mDirtyClip = false; } Loading Loading @@ -1694,12 +1682,14 @@ void OpenGLRenderer::setupDrawModelView(ModelViewMode mode, bool offset, } bool dirty = right - left > 0.0f && bottom - top > 0.0f; const Matrix4& transformMatrix = ignoreTransform ? Matrix4::identity() : *currentTransform(); mCaches.currentProgram->set(mSnapshot->getOrthoMatrix(), mModelViewMatrix, transformMatrix, offset); if (dirty && mTrackDirtyRegions) { if (!ignoreTransform) { mCaches.currentProgram->set(mProjectionMatrix, mModelViewMatrix, *currentTransform(), offset); if (dirty && mTrackDirtyRegions) dirtyLayer(left, top, right, bottom, *currentTransform()); dirtyLayer(left, top, right, bottom, *currentTransform()); } else { mCaches.currentProgram->set(mProjectionMatrix, mModelViewMatrix, mat4::identity(), offset); if (dirty && mTrackDirtyRegions) dirtyLayer(left, top, right, bottom); dirtyLayer(left, top, right, bottom); } } } Loading
libs/hwui/OpenGLRenderer.h +2 −11 Original line number Diff line number Diff line Loading @@ -254,8 +254,8 @@ public: return mSnapshot->clipRegion->isEmpty(); } int getViewportWidth() { return currentSnapshot()->viewport.getWidth(); } int getViewportHeight() { return currentSnapshot()->viewport.getHeight(); } int getViewportWidth() { return currentSnapshot()->getViewportWidth(); } int getViewportHeight() { return currentSnapshot()->getViewportHeight(); } /** * Scales the alpha on the current snapshot. This alpha value will be modulated Loading Loading @@ -353,12 +353,6 @@ public: #endif protected: /** * Computes the projection matrix, initialize the first snapshot * and stores the dimensions of the render target. */ void initViewport(int width, int height); /** * Perform the setup specific to a frame. This method does not * issue any OpenGL commands. Loading Loading @@ -930,9 +924,6 @@ private: */ Texture* getTexture(const SkBitmap* bitmap); // Ortho matrix used for projection in shaders mat4 mProjectionMatrix; /** * Model-view matrix used to position/size objects * Loading