summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-05-23 15:07:59 -0700
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-05-24 19:58:24 +0300
commit45890ff674b7d2184192a820db79cf7c2be20d94 (patch)
tree24fc447de5339b421a31950f0fc54fa7df597d1d
parent64064088afd3d7e08d39f04bb5469dd8f9f4d9dc (diff)
downloadqtlocation-mapboxgl-45890ff674b7d2184192a820db79cf7c2be20d94.tar.gz
[osx] Added stencil buffer option
Added an option to display the stencil buffer instead of the color buffer in osxapp.
-rw-r--r--platform/osx/CHANGELOG.md2
-rw-r--r--platform/osx/app/Base.lproj/MainMenu.xib13
-rw-r--r--platform/osx/app/MapDocument.m18
-rw-r--r--platform/osx/src/MGLMapView.h3
-rw-r--r--platform/osx/src/MGLMapView.mm6
5 files changed, 41 insertions, 1 deletions
diff --git a/platform/osx/CHANGELOG.md b/platform/osx/CHANGELOG.md
index 6dd7b5bb31..df26619bac 100644
--- a/platform/osx/CHANGELOG.md
+++ b/platform/osx/CHANGELOG.md
@@ -4,7 +4,7 @@
* Fixed an issue in which Mapbox.framework was nested inside another folder named Mapbox.framework. ([#4998](https://github.com/mapbox/mapbox-gl-native/pull/4998))
* Fixed a crash passing a mixture of point and shape annotations into `-[MGLMapView addAnnotations:]`. ([#5097](https://github.com/mapbox/mapbox-gl-native/pull/5097))
-* Added a new option to `MGLMapDebugMaskOptions`, `MGLMapDebugWireframesMask`, that shows wireframes instead of the usual rendered output. ([#4359](https://github.com/mapbox/mapbox-gl-native/pull/4359))
+* Added new options to `MGLMapDebugMaskOptions` that show wireframes and the stencil buffer instead of the color buffer. ([#4359](https://github.com/mapbox/mapbox-gl-native/pull/4359))
## 0.1.0
diff --git a/platform/osx/app/Base.lproj/MainMenu.xib b/platform/osx/app/Base.lproj/MainMenu.xib
index b37d1e154f..4afb3b244e 100644
--- a/platform/osx/app/Base.lproj/MainMenu.xib
+++ b/platform/osx/app/Base.lproj/MainMenu.xib
@@ -467,6 +467,19 @@
<action selector="toggleWireframes:" target="-1" id="usj-ug-upt"/>
</connections>
</menuItem>
+ <menuItem isSeparatorItem="YES" id="2EG-Hp-4FA"/>
+ <menuItem title="Show Color Buffer" id="Eao-WE-BWz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="showColorBuffer:" target="-1" id="Nuq-Qs-98g"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Show Stencil Buffer" id="LlS-Yh-RkN">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="showStencilBuffer:" target="-1" id="WkN-t9-Mpv"/>
+ </connections>
+ </menuItem>
<menuItem isSeparatorItem="YES" id="dYw-bb-tr1"/>
<menuItem title="Show Tooltips on Dropped Pins" id="uir-Rx-zmw">
<modifierMask key="keyEquivalentModifierMask"/>
diff --git a/platform/osx/app/MapDocument.m b/platform/osx/app/MapDocument.m
index df6aa98c33..9bff4603e4 100644
--- a/platform/osx/app/MapDocument.m
+++ b/platform/osx/app/MapDocument.m
@@ -248,6 +248,14 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
self.mapView.debugMask ^= MGLMapDebugWireframesMask;
}
+- (IBAction)showColorBuffer:(id)sender {
+ self.mapView.debugMask &= ~MGLMapDebugStencilBufferMask;
+}
+
+- (IBAction)showStencilBuffer:(id)sender {
+ self.mapView.debugMask |= MGLMapDebugStencilBufferMask;
+}
+
- (IBAction)toggleShowsToolTipsOnDroppedPins:(id)sender {
_showsToolTipsOnDroppedPins = !_showsToolTipsOnDroppedPins;
}
@@ -529,6 +537,16 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
menuItem.title = isShown ? @"Hide Wireframes" : @"Show Wireframes";
return YES;
}
+ if (menuItem.action == @selector(showColorBuffer:)) {
+ BOOL enabled = self.mapView.debugMask & MGLMapDebugStencilBufferMask;
+ menuItem.state = enabled ? NSOffState : NSOnState;
+ return YES;
+ }
+ if (menuItem.action == @selector(showStencilBuffer:)) {
+ BOOL enabled = self.mapView.debugMask & MGLMapDebugStencilBufferMask;
+ menuItem.state = enabled ? NSOnState : NSOffState;
+ return YES;
+ }
if (menuItem.action == @selector(toggleShowsToolTipsOnDroppedPins:)) {
BOOL isShown = _showsToolTipsOnDroppedPins;
menuItem.title = isShown ? @"Hide Tooltips on Dropped Pins" : @"Show Tooltips on Dropped Pins";
diff --git a/platform/osx/src/MGLMapView.h b/platform/osx/src/MGLMapView.h
index a98853f6c2..749b3561d2 100644
--- a/platform/osx/src/MGLMapView.h
+++ b/platform/osx/src/MGLMapView.h
@@ -24,6 +24,9 @@ typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
/** Line widths, backgrounds, and fill colors are ignored to create a
wireframe effect. */
MGLMapDebugWireframesMask = 1 << 5,
+
+ /** The stencil buffer is shown instead of the color buffer. */
+ MGLMapDebugStencilBufferMask = 1 << 6,
};
@class MGLAnnotationImage;
diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm
index cdac60dd8e..5b85ff7ec2 100644
--- a/platform/osx/src/MGLMapView.mm
+++ b/platform/osx/src/MGLMapView.mm
@@ -2369,6 +2369,9 @@ public:
if (options & mbgl::MapDebugOptions::Wireframe) {
mask |= MGLMapDebugWireframesMask;
}
+ if (options & mbgl::MapDebugOptions::StencilClip) {
+ mask |= MGLMapDebugStencilBufferMask;
+ }
return mask;
}
@@ -2389,6 +2392,9 @@ public:
if (debugMask & MGLMapDebugWireframesMask) {
options |= mbgl::MapDebugOptions::Wireframe;
}
+ if (debugMask & MGLMapDebugStencilBufferMask) {
+ options |= mbgl::MapDebugOptions::StencilClip;
+ }
_mbglMap->setDebug(options);
}