diff options
Diffstat (limited to 'eclipse')
12 files changed, 181 insertions, 29 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/plugin.xml b/eclipse/plugins/com.android.ide.eclipse.gldebugger/plugin.xml index 66f7fa6..ff2799f 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/plugin.xml +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/plugin.xml @@ -33,7 +33,7 @@ </view>
<view
category="com.android.ide.eclipse.gltrace"
- class="com.android.ide.eclipse.gltrace.views.DetailsView"
+ class="com.android.ide.eclipse.gltrace.views.detail.DetailsView"
icon="icons/opengl.png"
id="com.android.ide.eclipse.gltrace.views.Details"
name="Details"
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTracePerspective.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTracePerspective.java index bc41e33..30bb1d5 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTracePerspective.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTracePerspective.java @@ -16,9 +16,9 @@ package com.android.ide.eclipse.gltrace; -import com.android.ide.eclipse.gltrace.views.DetailsView; import com.android.ide.eclipse.gltrace.views.FrameSummaryView; import com.android.ide.eclipse.gltrace.views.StateView; +import com.android.ide.eclipse.gltrace.views.detail.DetailsView; import org.eclipse.ui.IFolderLayout; import org.eclipse.ui.IPageLayout; diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java index ece4723..4d1da1f 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java @@ -24,8 +24,8 @@ import com.android.ide.eclipse.gltrace.editors.GLCallGroups.GLCallNode; import com.android.ide.eclipse.gltrace.model.GLCall; import com.android.ide.eclipse.gltrace.model.GLFrame; import com.android.ide.eclipse.gltrace.model.GLTrace; -import com.android.ide.eclipse.gltrace.views.DetailsPage; import com.android.ide.eclipse.gltrace.views.FrameSummaryViewPage; +import com.android.ide.eclipse.gltrace.views.detail.DetailsPage; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.MessageDialog; diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/DetailsPage.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/DetailsPage.java index 88e7b05..6d6f00d 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/DetailsPage.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/DetailsPage.java @@ -14,13 +14,14 @@ * limitations under the License. */ -package com.android.ide.eclipse.gltrace.views; +package com.android.ide.eclipse.gltrace.views.detail; import com.android.ide.eclipse.gltrace.editors.GLCallGroups.GLCallNode; import com.android.ide.eclipse.gltrace.editors.GLFunctionTraceViewer; import com.android.ide.eclipse.gltrace.model.GLCall; import com.android.ide.eclipse.gltrace.model.GLTrace; import com.android.ide.eclipse.gltrace.state.IGLProperty; +import com.android.ide.eclipse.gltrace.views.StateView; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.IToolBarManager; @@ -48,10 +49,11 @@ public class DetailsPage extends Page implements ISelectionListener { private StackLayout mStackLayout; private Composite mBlankComposite; - private List<IStateDetailsProvider> mStateDetailProviders = Arrays.asList( + private List<IDetailProvider> mDetailProviders = Arrays.asList( new ShaderSourceDetailsProvider(), new ShaderUniformDetailsProvider(), - new TextureImageDetailsProvider()); + new TextureImageDetailsProvider(), + new GlDrawCallDetailProvider()); public DetailsPage(GLTrace trace) { mTrace = trace; @@ -68,7 +70,7 @@ public class DetailsPage extends Page implements ISelectionListener { mToolBarManager = getSite().getActionBars().getToolBarManager(); - for (IStateDetailsProvider provider : mStateDetailProviders) { + for (IDetailProvider provider : mDetailProviders) { provider.createControl(mTopComposite); for (IContributionItem item: provider.getToolBarItems()) { @@ -79,7 +81,7 @@ public class DetailsPage extends Page implements ISelectionListener { setDetailsProvider(null); } - private void setDetailsProvider(IStateDetailsProvider provider) { + private void setDetailsProvider(IDetailProvider provider) { for (IContributionItem item: mToolBarManager.getItems()) { item.setVisible(false); } @@ -117,7 +119,7 @@ public class DetailsPage extends Page implements ISelectionListener { public void dispose() { getSite().getPage().removeSelectionListener(this); - for (IStateDetailsProvider provider : mStateDetailProviders) { + for (IDetailProvider provider : mDetailProviders) { provider.disposeControl(); } @@ -152,10 +154,15 @@ public class DetailsPage extends Page implements ISelectionListener { } private void stateVariableSelected(IGLProperty property) { - for (IStateDetailsProvider p : mStateDetailProviders) { - if (p.isApplicable(property)) { - p.updateControl(property); - setDetailsProvider(p); + for (IDetailProvider p : mDetailProviders) { + if (!(p instanceof IStateDetailProvider)) { + continue; + } + + IStateDetailProvider sp = (IStateDetailProvider) p; + if (sp.isApplicable(property)) { + sp.updateControl(property); + setDetailsProvider(sp); return; } } @@ -165,6 +172,21 @@ public class DetailsPage extends Page implements ISelectionListener { } private void callSelected(GLCall selectedCall) { + for (IDetailProvider p : mDetailProviders) { + if (!(p instanceof ICallDetailProvider)) { + continue; + } + + ICallDetailProvider cp = (ICallDetailProvider) p; + if (cp.isApplicable(selectedCall)) { + cp.updateControl(mTrace, selectedCall); + setDetailsProvider(cp); + return; + } + } + + setDetailsProvider(null); + return; } private GLCall getSelectedCall(GLFunctionTraceViewer part, ISelection selection) { diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/DetailsView.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/DetailsView.java index 015cf61..0a2d88e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/DetailsView.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/DetailsView.java @@ -14,9 +14,10 @@ * limitations under the License. */ -package com.android.ide.eclipse.gltrace.views; +package com.android.ide.eclipse.gltrace.views.detail; import com.android.ide.eclipse.gltrace.editors.GLFunctionTraceViewer; +import com.android.ide.eclipse.gltrace.views.GLPageBookView; import org.eclipse.ui.IWorkbenchPart; diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/GlDrawCallDetailProvider.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/GlDrawCallDetailProvider.java new file mode 100644 index 0000000..c3cabb0 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/GlDrawCallDetailProvider.java @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.ide.eclipse.gltrace.views.detail; + +import com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.Function; +import com.android.ide.eclipse.gltrace.model.GLCall; +import com.android.ide.eclipse.gltrace.model.GLTrace; +import com.android.ide.eclipse.gltrace.views.FitToCanvasAction; +import com.android.ide.eclipse.gltrace.widgets.ImageCanvas; + +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +import java.util.Collections; +import java.util.List; + +public class GlDrawCallDetailProvider implements ICallDetailProvider { + private ImageCanvas mImageCanvas; + private FitToCanvasAction mFitToCanvasAction; + private List<IContributionItem> mToolBarItems; + + @Override + public boolean isApplicable(GLCall call) { + return (call.getFunction() == Function.glDrawArrays + || call.getFunction() == Function.glDrawElements) && call.hasFb(); + } + + @Override + public void createControl(Composite parent) { + mImageCanvas = new ImageCanvas(parent); + mImageCanvas.setFitToCanvas(false); + + mFitToCanvasAction = new FitToCanvasAction(false, mImageCanvas); + mToolBarItems = Collections.singletonList( + (IContributionItem) new ActionContributionItem(mFitToCanvasAction)); + } + + @Override + public void disposeControl() { + if (mImageCanvas != null) { + mImageCanvas.dispose(); + mImageCanvas = null; + } + } + + @Override + public Control getControl() { + return mImageCanvas; + } + + @Override + public void updateControl(GLTrace trace, GLCall call) { + mImageCanvas.setImage(trace.getImage(call)); + mImageCanvas.setFitToCanvas(true); + } + + @Override + public List<IContributionItem> getToolBarItems() { + return mToolBarItems; + } +} diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/ICallDetailProvider.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/ICallDetailProvider.java new file mode 100644 index 0000000..51770f3 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/ICallDetailProvider.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.ide.eclipse.gltrace.views.detail; + +import com.android.ide.eclipse.gltrace.model.GLCall; +import com.android.ide.eclipse.gltrace.model.GLTrace; + +public interface ICallDetailProvider extends IDetailProvider { + /** Is this provider applicable for given {@link GLCall}? */ + boolean isApplicable(GLCall call); + + /** + * Update the detail view for given {@link GLCall} that is part of the given + * {@link GLTrace}. + */ + void updateControl(GLTrace trace, GLCall call); +} diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/IStateDetailsProvider.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/IDetailProvider.java index 7fe7c56..1fc5174 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/IStateDetailsProvider.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/IDetailProvider.java @@ -14,9 +14,7 @@ * limitations under the License. */ -package com.android.ide.eclipse.gltrace.views; - -import com.android.ide.eclipse.gltrace.state.IGLProperty; +package com.android.ide.eclipse.gltrace.views.detail; import org.eclipse.jface.action.IContributionItem; import org.eclipse.swt.widgets.Composite; @@ -24,10 +22,7 @@ import org.eclipse.swt.widgets.Control; import java.util.List; -public interface IStateDetailsProvider { - /** Is this provider applicable for given GL state property? */ - boolean isApplicable(IGLProperty state); - +public interface IDetailProvider { /** Create the controls to display the details. */ void createControl(Composite parent); @@ -37,8 +32,6 @@ public interface IStateDetailsProvider { /** Obtain the top level control used by this detail provider. */ Control getControl(); - /** Update the detail view for given GL state property. */ - void updateControl(IGLProperty state); /** Obtain a list of tool bar items to be displayed when this provider is active. */ List<IContributionItem> getToolBarItems(); diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/IStateDetailProvider.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/IStateDetailProvider.java new file mode 100644 index 0000000..4ad06be --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/IStateDetailProvider.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.ide.eclipse.gltrace.views.detail; + +import com.android.ide.eclipse.gltrace.state.IGLProperty; + +public interface IStateDetailProvider extends IDetailProvider { + /** Is this provider applicable for given GL state property? */ + boolean isApplicable(IGLProperty state); + + /** Update the detail view for given GL state property. */ + void updateControl(IGLProperty state); +} diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/ShaderSourceDetailsProvider.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/ShaderSourceDetailsProvider.java index bad3042..a3ee578 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/ShaderSourceDetailsProvider.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/ShaderSourceDetailsProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.ide.eclipse.gltrace.views; +package com.android.ide.eclipse.gltrace.views.detail; import com.android.ide.eclipse.gltrace.state.GLCompositeProperty; import com.android.ide.eclipse.gltrace.state.GLStateType; @@ -30,7 +30,7 @@ import org.eclipse.swt.widgets.Text; import java.util.Collections; import java.util.List; -public class ShaderSourceDetailsProvider implements IStateDetailsProvider { +public class ShaderSourceDetailsProvider implements IStateDetailProvider { private Text mTextControl; @Override diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/ShaderUniformDetailsProvider.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/ShaderUniformDetailsProvider.java index 4111b77..f156c00 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/ShaderUniformDetailsProvider.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/ShaderUniformDetailsProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.ide.eclipse.gltrace.views; +package com.android.ide.eclipse.gltrace.views.detail; import com.android.ide.eclipse.gldebugger.GLEnum; import com.android.ide.eclipse.gltrace.state.GLCompositeProperty; @@ -31,7 +31,7 @@ import org.eclipse.swt.widgets.Text; import java.util.Collections; import java.util.List; -public class ShaderUniformDetailsProvider implements IStateDetailsProvider { +public class ShaderUniformDetailsProvider implements IStateDetailProvider { private Text mTextControl; private static final Joiner JOINER = Joiner.on(", "); diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/TextureImageDetailsProvider.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/TextureImageDetailsProvider.java index 2b0034b..0c17d4c 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/TextureImageDetailsProvider.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/detail/TextureImageDetailsProvider.java @@ -14,12 +14,13 @@ * limitations under the License. */ -package com.android.ide.eclipse.gltrace.views; +package com.android.ide.eclipse.gltrace.views.detail; import com.android.ide.eclipse.gltrace.state.GLCompositeProperty; import com.android.ide.eclipse.gltrace.state.GLStateType; import com.android.ide.eclipse.gltrace.state.GLStringProperty; import com.android.ide.eclipse.gltrace.state.IGLProperty; +import com.android.ide.eclipse.gltrace.views.FitToCanvasAction; import com.android.ide.eclipse.gltrace.widgets.ImageCanvas; import org.eclipse.jface.action.ActionContributionItem; @@ -32,7 +33,7 @@ import org.eclipse.swt.widgets.Display; import java.util.Collections; import java.util.List; -public class TextureImageDetailsProvider implements IStateDetailsProvider { +public class TextureImageDetailsProvider implements IStateDetailProvider { private ImageCanvas mImageCanvas; private FitToCanvasAction mFitToCanvasAction; private List<IContributionItem> mToolBarItems; |