[osx] Added stencil buffer option

Added an option to display the stencil buffer instead of the color buffer in osxapp.
This commit is contained in:
Minh Nguyễn
2016-05-23 15:07:59 -07:00
committed by Bruno de Oliveira Abinader
parent 64064088af
commit 45890ff674
5 changed files with 41 additions and 1 deletions

View File

@@ -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

View File

@@ -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"/>

View File

@@ -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";

View File

@@ -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;

View File

@@ -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);
}