Merge inbound to m-c.

This commit is contained in:
Ryan VanderMeulen 2013-07-22 21:47:13 -04:00
commit b14d9d9372
196 changed files with 2362 additions and 1566 deletions

View File

@ -1265,7 +1265,7 @@ DocAccessible::GetAccessibleByUniqueIDInSubtree(void* aUniqueID)
}
Accessible*
DocAccessible::GetAccessibleOrContainer(nsINode* aNode)
DocAccessible::GetAccessibleOrContainer(nsINode* aNode) const
{
if (!aNode || !aNode->IsInDoc())
return nullptr;
@ -1278,6 +1278,30 @@ DocAccessible::GetAccessibleOrContainer(nsINode* aNode)
return accessible;
}
Accessible*
DocAccessible::GetAccessibleOrDescendant(nsINode* aNode) const
{
Accessible* acc = GetAccessible(aNode);
if (acc)
return acc;
acc = GetContainerAccessible(aNode);
if (acc) {
uint32_t childCnt = acc->ChildCount();
for (uint32_t idx = 0; idx < childCnt; idx++) {
Accessible* child = acc->GetChildAt(idx);
for (nsIContent* elm = child->GetContent();
elm && elm != acc->GetContent();
elm = elm->GetFlattenedTreeParent()) {
if (elm == aNode)
return child;
}
}
}
return nullptr;
}
bool
DocAccessible::BindToDocument(Accessible* aAccessible,
nsRoleMapEntry* aRoleMapEntry)

View File

@ -242,16 +242,21 @@ public:
* Return an accessible for the given DOM node or container accessible if
* the node is not accessible.
*/
Accessible* GetAccessibleOrContainer(nsINode* aNode);
Accessible* GetAccessibleOrContainer(nsINode* aNode) const;
/**
* Return a container accessible for the given DOM node.
*/
Accessible* GetContainerAccessible(nsINode* aNode)
Accessible* GetContainerAccessible(nsINode* aNode) const
{
return aNode ? GetAccessibleOrContainer(aNode->GetParentNode()) : nullptr;
}
/**
* Return an accessible for the given node or its first accessible descendant.
*/
Accessible* GetAccessibleOrDescendant(nsINode* aNode) const;
/**
* Return true if the given ID is referred by relation attribute.
*

View File

@ -1826,24 +1826,22 @@ AccessibleWrap::GetXPAccessibleFor(const VARIANT& aVarChild)
// Convert child ID to unique ID.
void* uniqueID = reinterpret_cast<void*>(-aVarChild.lVal);
// Document.
DocAccessible* document = Document();
Accessible* child =
document->GetAccessibleByUniqueIDInSubtree(uniqueID);
// If it is a document then just return an accessible.
if (IsDoc())
return AsDoc()->GetAccessibleByUniqueIDInSubtree(uniqueID);
return child;
// ARIA document and menu popups.
if (ARIARole() == roles::DOCUMENT || IsMenuPopup()) {
DocAccessible* document = Document();
Accessible* child =
document->GetAccessibleByUniqueIDInSubtree(uniqueID);
// Otherwise check whether the accessible is a child (this path works for
// ARIA documents and popups).
Accessible* parent = child;
while (parent && parent != document) {
if (parent == this)
return child;
// Check whether the accessible for the given ID is a child.
Accessible* parent = child ? child->Parent() : nullptr;
while (parent && parent != document) {
if (parent == this)
return child;
parent = parent->Parent();
}
parent = parent->Parent();
}
return nullptr;

View File

@ -34,7 +34,7 @@ sdnTextAccessible::get_domText(BSTR __RPC_FAR* aText)
if (!aText)
return E_INVALIDARG;
*aText = NULL;
*aText = nullptr;
if (mAccessible->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -170,7 +170,7 @@ sdnTextAccessible::get_fontFamily(BSTR __RPC_FAR* aFontFamily)
if (!aFontFamily)
return E_INVALIDARG;
*aFontFamily = NULL;
*aFontFamily = nullptr;
if (mAccessible->IsDefunct())
return CO_E_OBJNOTCONNECTED;

View File

@ -345,8 +345,8 @@ var gPluginHandler = {
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
let permissionString = pluginHost.getPermissionStringForType(objLoadingContent.actualType);
let browser = gBrowser.getBrowserForDocument(objLoadingContent.ownerDocument.defaultView.top.document);
let pluginPermission = Services.perms.testPermission(browser.currentURI, permissionString);
let principal = objLoadingContent.ownerDocument.defaultView.top.document.nodePrincipal;
let pluginPermission = Services.perms.testPermissionFromPrincipal(principal, permissionString);
let isFallbackTypeValid =
objLoadingContent.pluginFallbackType >= Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY &&
@ -511,7 +511,8 @@ var gPluginHandler = {
if (!gPluginHandler.isKnownPlugin(objLoadingContent))
return;
let permissionString = pluginHost.getPermissionStringForType(objLoadingContent.actualType);
let pluginPermission = Services.perms.testPermission(browser.currentURI, permissionString);
let principal = doc.defaultView.top.document.nodePrincipal;
let pluginPermission = Services.perms.testPermissionFromPrincipal(principal, permissionString);
let overlay = doc.getAnonymousElementByAttribute(aPlugin, "class", "mainBox");
@ -630,13 +631,28 @@ var gPluginHandler = {
}
},
// Match the behaviour of nsPermissionManager
_getHostFromPrincipal: function PH_getHostFromPrincipal(principal) {
if (!principal.URI || principal.URI.schemeIs("moz-nullprincipal")) {
return "(null)";
}
try {
if (principal.URI.host)
return principal.URI.host;
} catch (e) {}
return principal.origin;
},
_makeCenterActions: function PH_makeCenterActions(notification) {
let browser = notification.browser;
let contentWindow = browser.contentWindow;
let contentWindow = notification.browser.contentWindow;
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(browser.currentURI);
let principal = contentWindow.document.nodePrincipal;
// This matches the behavior of nsPermssionManager, used for display purposes only
let principalHost = this._getHostFromPrincipal(principal);
let centerActions = [];
let pluginsFound = new Set();
@ -666,7 +682,7 @@ var gPluginHandler = {
pluginInfo.pluginPermissionType = permissionObj.expireType;
}
else {
pluginInfo.pluginPermissionHost = browser.currentURI.host;
pluginInfo.pluginPermissionHost = principalHost;
pluginInfo.pluginPermissionType = undefined;
}
@ -729,9 +745,11 @@ var gPluginHandler = {
}
let browser = aNotification.browser;
let contentWindow = browser.contentWindow;
if (aNewState != "continue") {
Services.perms.add(browser.currentURI, aPluginInfo.permissionString,
permission, expireType, expireTime);
let principal = contentWindow.document.nodePrincipal;
Services.perms.addFromPrincipal(principal, aPluginInfo.permissionString,
permission, expireType, expireTime);
if (aNewState == "block") {
return;
@ -740,7 +758,6 @@ var gPluginHandler = {
// Manually activate the plugins that would have been automatically
// activated.
let contentWindow = browser.contentWindow;
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let plugins = cwu.plugins;

View File

@ -192,6 +192,7 @@ MOCHITEST_BROWSER_FILES = \
browser_contentAreaClick.js \
browser_contextSearchTabPosition.js \
browser_CTP_drag_drop.js \
browser_CTP_data_urls.js \
browser_ctrlTab.js \
browser_customize_popupNotification.js \
browser_customize.js \
@ -317,6 +318,7 @@ MOCHITEST_BROWSER_FILES = \
plugin_test2.html \
plugin_test3.html \
plugin_two_types.html \
plugin_data_url.html \
plugin_unknown.html \
pluginCrashCommentAndURL.html \
POSTSearchEngine.xml \

View File

@ -0,0 +1,239 @@
var rootDir = getRootDirectory(gTestPath);
const gTestRoot = rootDir;
const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
var gTestBrowser = null;
var gNextTest = null;
var gPluginHost = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
Components.utils.import("resource://gre/modules/Services.jsm");
// This listens for the next opened tab and checks it is of the right url.
// opencallback is called when the new tab is fully loaded
// closecallback is called when the tab is closed
function TabOpenListener(url, opencallback, closecallback) {
this.url = url;
this.opencallback = opencallback;
this.closecallback = closecallback;
gBrowser.tabContainer.addEventListener("TabOpen", this, false);
}
TabOpenListener.prototype = {
url: null,
opencallback: null,
closecallback: null,
tab: null,
browser: null,
handleEvent: function(event) {
if (event.type == "TabOpen") {
gBrowser.tabContainer.removeEventListener("TabOpen", this, false);
this.tab = event.originalTarget;
this.browser = this.tab.linkedBrowser;
gBrowser.addEventListener("pageshow", this, false);
} else if (event.type == "pageshow") {
if (event.target.location.href != this.url)
return;
gBrowser.removeEventListener("pageshow", this, false);
this.tab.addEventListener("TabClose", this, false);
var url = this.browser.contentDocument.location.href;
is(url, this.url, "Should have opened the correct tab");
this.opencallback(this.tab, this.browser.contentWindow);
} else if (event.type == "TabClose") {
if (event.originalTarget != this.tab)
return;
this.tab.removeEventListener("TabClose", this, false);
this.opencallback = null;
this.tab = null;
this.browser = null;
// Let the window close complete
executeSoon(this.closecallback);
this.closecallback = null;
}
}
};
function test() {
waitForExplicitFinish();
registerCleanupFunction(function() {
clearAllPluginPermissions();
Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_ENABLED;
});
Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
var newTab = gBrowser.addTab();
gBrowser.selectedTab = newTab;
gTestBrowser = gBrowser.selectedBrowser;
gTestBrowser.addEventListener("load", pageLoad, true);
Services.prefs.setBoolPref("plugins.click_to_play", true);
getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
prepareTest(test1a, gHttpTestRoot + "plugin_data_url.html");
}
function finishTest() {
clearAllPluginPermissions();
gTestBrowser.removeEventListener("load", pageLoad, true);
gBrowser.removeCurrentTab();
window.focus();
finish();
}
function pageLoad() {
// The plugin events are async dispatched and can come after the load event
// This just allows the events to fire before we then go on to test the states
executeSoon(gNextTest);
}
function prepareTest(nextTest, url) {
gNextTest = nextTest;
gTestBrowser.contentWindow.location = url;
}
// Test that the click-to-play doorhanger still works when navigating to data URLs
function test1a() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(popupNotification, "Test 1a, Should have a click-to-play notification");
let plugin = gTestBrowser.contentDocument.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 1a, Plugin should not be activated");
gNextTest = test1b;
gTestBrowser.contentDocument.getElementById("data-link-1").click();
}
function test1b() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(popupNotification, "Test 1b, Should have a click-to-play notification");
let plugin = gTestBrowser.contentDocument.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 1b, Plugin should not be activated");
// Simulate clicking the "Allow Always" button.
popupNotification.reshow();
PopupNotifications.panel.firstChild._primaryButton.click();
let condition = function() objLoadingContent.activated;
waitForCondition(condition, test1c, "Test 1b, Waited too long for plugin to activate");
}
function test1c() {
clearAllPluginPermissions();
prepareTest(test2a, gHttpTestRoot + "plugin_data_url.html");
}
// Test that the click-to-play notification doesn't break when navigating to data URLs with multiple plugins
function test2a() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(popupNotification, "Test 2a, Should have a click-to-play notification");
let plugin = gTestBrowser.contentDocument.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 2a, Plugin should not be activated");
gNextTest = test2b;
gTestBrowser.contentDocument.getElementById("data-link-2").click();
}
function test2b() {
let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(notification, "Test 2b, Should have a click-to-play notification");
// Simulate choosing "Allow now" for the test plugin
notification.reshow();
is(notification.options.centerActions.length, 2, "Test 2b, Should have two types of plugin in the notification");
var centerAction = null;
for (var action of notification.options.centerActions) {
if (action.pluginName == "Test") {
centerAction = action;
break;
}
}
ok(centerAction, "Test 2b, found center action for the Test plugin");
var centerItem = null;
for (var item of PopupNotifications.panel.firstChild.childNodes) {
is(item.value, "block", "Test 2b, all plugins should start out blocked");
if (item.action == centerAction) {
centerItem = item;
break;
}
}
ok(centerItem, "Test 2b, found center item for the Test plugin");
// "click" the button to activate the Test plugin
centerItem.value = "allownow";
PopupNotifications.panel.firstChild._primaryButton.click();
let plugin = gTestBrowser.contentDocument.getElementById("test1");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
let condition = function() objLoadingContent.activated;
waitForCondition(condition, test2c, "Test 2b, Waited too long for plugin to activate");
}
function test2c() {
let plugin = gTestBrowser.contentDocument.getElementById("test1");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(objLoadingContent.activated, "Test 2c, Plugin should be activated");
clearAllPluginPermissions();
prepareTest(test3a, gHttpTestRoot + "plugin_data_url.html");
}
// Test that when navigating to a data url, the plugin permission is inherited
function test3a() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(popupNotification, "Test 3a, Should have a click-to-play notification");
let plugin = gTestBrowser.contentDocument.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 3a, Plugin should not be activated");
// Simulate clicking the "Allow Always" button.
popupNotification.reshow();
PopupNotifications.panel.firstChild._primaryButton.click();
let condition = function() objLoadingContent.activated;
waitForCondition(condition, test3b, "Test 3a, Waited too long for plugin to activate");
}
function test3b() {
gNextTest = test3c;
gTestBrowser.contentDocument.getElementById("data-link-1").click();
}
function test3c() {
let plugin = gTestBrowser.contentDocument.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(objLoadingContent.activated, "Test 3c, Plugin should be activated");
clearAllPluginPermissions();
prepareTest(test4b, 'data:text/html,<embed id="test" style="width: 200px; height: 200px" type="application/x-test"/>');
}
// Test that the click-to-play doorhanger still works when directly navigating to data URLs
function test4a() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(popupNotification, "Test 4a, Should have a click-to-play notification");
let plugin = gTestBrowser.contentDocument.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 4a, Plugin should not be activated");
// Simulate clicking the "Allow Always" button.
popupNotification.reshow();
PopupNotifications.panel.firstChild._primaryButton.click();
let condition = function() objLoadingContent.activated;
waitForCondition(condition, test4b, "Test 4a, Waited too long for plugin to activate");
}
function test4b() {
clearAllPluginPermissions();
finishTest();
}

View File

@ -0,0 +1,11 @@
<html>
<body>
<a id="data-link-1" href='data:text/html,<embed id="test" style="width: 200px; height: 200px" type="application/x-test"/>'>
data: with one plugin
</a><br />
<a id="data-link-2" href='data:text/html,<embed id="test1" style="width: 200px; height: 200px" type="application/x-test"/><embed id="test2" style="width: 200px; height: 200px" type="application/x-second-test"/>'>
data: with two plugins
</a><br />
<object id="test" style="width: 200px; height: 200px" type="application/x-test"></object>
</body>
</html>

View File

@ -1600,7 +1600,8 @@
return;
}
this._setupDescription("pluginActivateMultiple.message");
let host = gPluginHandler._getHostFromPrincipal(this.notification.browser.contentWindow.document.nodePrincipal);
this._setupDescription("pluginActivateMultiple.message", null, host);
var showBox = document.getAnonymousElementByAttribute(this, "anonid", "plugin-notification-showbox");
@ -1763,9 +1764,6 @@
span.removeChild(span.lastChild);
}
if (!host) {
host = this.notification.browser.currentURI.host;
}
var args = ["__host__", this._brandShortName];
if (pluginName) {
args.unshift(pluginName);

View File

@ -131,9 +131,8 @@ let RemoteTabsPanelView = {
init: function init() {
//decks are fragile, don't hide the tab panel(bad things happen), hide link in menu.
let menuEntry = document.getElementById("menuitem-remotetabs");
let snappedEntry = document.getElementById("snappedRemoteTabsLabel");
let uiList = [menuEntry, snappedEntry];
let uiList = [snappedEntry];
this._view = new RemoteTabsView(this._grid, uiList);
},

View File

@ -1211,7 +1211,6 @@ var StartUI = {
var PanelUI = {
get _panels() { return document.getElementById("panel-items"); },
get _switcher() { return document.getElementById("panel-view-switcher"); },
get isVisible() {
return !Elements.panelUI.hidden;
@ -1259,7 +1258,6 @@ var PanelUI = {
if (oldPanel != panel) {
this._panels.selectedPanel = panel;
this._switcher.value = panel.id;
this._fire("ToolPanelHidden", oldPanel);
}

View File

@ -302,15 +302,6 @@
<vbox id="panel-container" hidden="true" class="window-width window-height meta" observes="bcast_windowState">
<hbox id="panel-header">
<toolbarbutton id="panel-close-button" command="cmd_panel"/>
<menulist id="panel-view-switcher" oncommand="PanelUI.switchPane(this.value);">
<menupopup>
<menuitem label="&bookmarksHeader.label;" value="bookmarks-container" id="menuitem-bookmarks"/>
<menuitem label="&startHistoryHeader.label;" value="history-container" id="menuitem-history"/>
<menuitem label="&startRemoteTabsHeader.label;" value="remotetabs-container" id="menuitem-remotetabs"/>
<menuitem label="&consoleHeader.label;" value="console-container" id="menuitem-console"/>
</menupopup>
</menulist>
</hbox>
<deck id="panel-items" selectedIndex="0" flex="1" >

View File

@ -33,7 +33,6 @@ let ConsolePanelView = {
} catch(ex) {
// likely don't have an old pref
}
this.updateVisibility();
Services.prefs.addObserver(this._enabledPref, this, false);
},
@ -68,14 +67,10 @@ let ConsolePanelView = {
return Services.prefs.getBoolPref(this._enabledPref);
},
updateVisibility: function ec_updateVisibility(aVal, aPref) {
let button = document.getElementById("menuitem-console");
button.hidden = !this.enabled;
},
observe: function(aSubject, aTopic, aData) {
if (aTopic == "nsPref:changed")
this.updateVisibility();
if (aTopic == "nsPref:changed") {
// We may choose to create a new menu in v2
}
else
this.appendItem(aSubject);
},

View File

@ -30,10 +30,6 @@ gTests.push({
let vbox = document.getElementById("start-remotetabs");
ok(vbox.hidden, "remote tabs in the start page should be hidden when sync is not enabled");
// check container link is hidden
let menulink = document.getElementById("menuitem-remotetabs");
ok(menulink.hidden, "link to container should be hidden when sync is not enabled");
RemoteTabsStartView._view.setUIAccessVisible(true);
// start page grid should be visible
@ -43,6 +39,5 @@ gTests.push({
RemoteTabsStartView._view.setUIAccessVisible(false);
ok(vbox.hidden, "remote tabs in the start page should be hidden when sync is not enabled");
ok(menulink.hidden, "link to container should be hidden when sync is not enabled");
}
});

View File

@ -826,20 +826,6 @@ setting[type="radio"] > vbox {
opacity: .5;
}
#panel-view-switcher {
border: 0 none !important;
color: #000 !important;
background: transparent;
padding: 0;
font-size: @metro_font_xlarge@;
font-weight: 100;
margin: 0;
}
#panel-container[viewstate="snapped"] #panel-view-switcher {
font-size: @metro_font_large@;
}
#panel-items {
padding-top: 20px;
-moz-padding-start: 88px;

View File

@ -30,6 +30,8 @@ WebGLContext::BindVertexArray(WebGLVertexArray *array)
return;
}
InvalidateCachedMinInUseAttribArrayLength();
MakeContextCurrent();
if (array) {

View File

@ -44,12 +44,6 @@ void WebGLExtensionVertexArray::BindVertexArrayOES(WebGLVertexArray* array)
bool WebGLExtensionVertexArray::IsSupported(const WebGLContext* context)
{
/*
* Security leak with using Vertex Array Objects found while implementing
* WebGL 2.0 => Temporally disabled for fixing.
*/
return false;
/*
gl::GLContext* gl = context->GL();
if (gl->IsGLES2()) {
@ -58,7 +52,6 @@ bool WebGLExtensionVertexArray::IsSupported(const WebGLContext* context)
return gl->IsExtensionSupported(gl::GLContext::ARB_vertex_array_object) ||
gl->IsExtensionSupported(gl::GLContext::APPLE_vertex_array_object);
*/
}
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionVertexArray)

View File

@ -1,6 +1,7 @@
oes-standard-derivatives.html
ext-texture-filter-anisotropic.html
oes-texture-float.html
oes-vertex-array-object.html
webgl-debug-renderer-info.html
webgl-debug-shaders.html
--min-version 1.0.2 webgl-compressed-texture-s3tc.html

View File

@ -115,6 +115,7 @@ MOCHITEST_FILES = \
test_volume.html \
test_video_to_canvas.html \
test_audiowrite.html \
test_mediarecorder_creation.html \
test_mozHasAudio.html \
test_source_media.html \
test_autoplay_contentEditable.html \

View File

@ -78,6 +78,12 @@ var gTrackTests = [
{ name:"bogus.duh", type:"bogus/duh" }
];
// Used by any media recorder test. Need one test file per decoder backend
// currently supported by the media encoder.
var gMediaRecorderTests = [
{ name:"detodos.opus", type:"audio/ogg; codecs=opus", duration:2.9135 }
];
// These are files that we want to make sure we can play through. We can
// also check metadata. Put files of the same type together in this list so if
// something crashes we have some idea of which backend is responsible.

View File

@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test MediaRecorder Creation</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var manager = new MediaTestManager;
/**
* Starts a test on every media recorder file included to check that
* a media recorder object created with a stream derived from a media
* element with that file produces the correct starting attribute values.
*/
function startTest(test, token) {
var element = document.createElement('audio');
element.token = token;
manager.started(token);
element.src = test.name;
element.test = test;
element.stream = element.mozCaptureStreamUntilEnded();
var mediaRecorder = new MediaRecorder(element.stream);
is(mediaRecorder.stream, element.stream,
'Stream should be provided stream on creation');
is(mediaRecorder.mimeType, '',
'mimeType should be an empty string on creation');
is(mediaRecorder.state, 'inactive',
'state should be inactive on creation');
manager.finished(token);
}
manager.runTests(gMediaRecorderTests, startTest);
</script>
</pre>
</body>
</html>

View File

@ -608,16 +608,28 @@ DataChannelTest.prototype = Object.create(PeerConnectionTest.prototype, {
}
}
// Register handlers for the remote peer
this.pcRemote.registerDataChannelOpenEvents(function (channel) {
remoteChannel = channel;
check_next_test();
});
if (!options.negotiated) {
// Register handlers for the remote peer
this.pcRemote.registerDataChannelOpenEvents(function (channel) {
remoteChannel = channel;
check_next_test();
});
}
// Creat the datachannel and handle the local 'onopen' event
// Create the datachannel and handle the local 'onopen' event
this.pcLocal.createDataChannel(options, function (channel) {
localChannel = channel;
check_next_test();
if (options.negotiated) {
// externally negotiated - we need to open from both ends
options.id = options.id || channel.id; // allow for no id to let the impl choose
self.pcRemote.createDataChannel(options, function (channel) {
remoteChannel = channel;
check_next_test();
});
} else {
check_next_test();
}
});
}
},
@ -825,6 +837,35 @@ DataChannelWrapper.prototype = {
return this._channel.label;
},
/**
* Returns the protocol of the underlying data channel
*
* @returns {String} The protocol
*/
get protocol() {
return this._channel.protocol;
},
/**
* Returns the id of the underlying data channel
*
* @returns {number} The stream id
*/
get id() {
return this._channel.id;
},
/**
* Returns the reliable state of the underlying data channel
*
* @returns {bool} The stream's reliable state
*/
get reliable() {
return this._channel.reliable;
},
// ordered, maxRetransmits and maxRetransmitTime not exposed yet
/**
* Returns the readyState bit of the data channel
*

View File

@ -337,6 +337,77 @@ var commandsDataChannel = [
}, options);
}
],
[
'CREATE_NEGOTIATED_DATA_CHANNEL',
function (test) {
var options = {negotiated:true, id: 5, protocol:"foo/bar", ordered:false,
maxRetransmits:500};
test.createDataChannel(options, function (sourceChannel2, targetChannel2) {
is(sourceChannel2.readyState, "open", sourceChannel2 + " is in state: 'open'");
is(targetChannel2.readyState, "open", targetChannel2 + " is in state: 'open'");
is(targetChannel2.binaryType, "blob", targetChannel2 + " is of binary type 'blob'");
is(targetChannel2.readyState, "open", targetChannel2 + " is in state: 'open'");
if (options.id != undefined) {
is(sourceChannel2.id, options.id, sourceChannel2 + " id is:" + sourceChannel2.id);
} else {
options.id = sourceChannel2.id;
}
var reliable = !options.ordered ? false : (options.maxRetransmits || options.maxRetransmitTime);
is(sourceChannel2.protocol, options.protocol, sourceChannel2 + " protocol is:" + sourceChannel2.protocol);
is(sourceChannel2.reliable, reliable, sourceChannel2 + " reliable is:" + sourceChannel2.reliable);
/*
These aren't exposed by IDL yet
is(sourceChannel2.ordered, options.ordered, sourceChannel2 + " ordered is:" + sourceChannel2.ordered);
is(sourceChannel2.maxRetransmits, options.maxRetransmits, sourceChannel2 + " maxRetransmits is:" +
sourceChannel2.maxRetransmits);
is(sourceChannel2.maxRetransmitTime, options.maxRetransmitTime, sourceChannel2 + " maxRetransmitTime is:" +
sourceChannel2.maxRetransmitTime);
*/
is(targetChannel2.id, options.id, targetChannel2 + " id is:" + targetChannel2.id);
is(targetChannel2.protocol, options.protocol, targetChannel2 + " protocol is:" + targetChannel2.protocol);
is(targetChannel2.reliable, reliable, targetChannel2 + " reliable is:" + targetChannel2.reliable);
/*
These aren't exposed by IDL yet
is(targetChannel2.ordered, options.ordered, targetChannel2 + " ordered is:" + targetChannel2.ordered);
is(targetChannel2.maxRetransmits, options.maxRetransmits, targetChannel2 + " maxRetransmits is:" +
targetChannel2.maxRetransmits);
is(targetChannel2.maxRetransmitTime, options.maxRetransmitTime, targetChannel2 + " maxRetransmitTime is:" +
targetChannel2.maxRetransmitTime);
*/
test.next();
});
}
],
[
'SEND_MESSAGE_THROUGH_LAST_OPENED_CHANNEL2',
function (test) {
var channels = test.pcRemote.dataChannels;
var message = "Lorem ipsum dolor sit amet";
test.send(message, function (channel, data) {
is(channels.indexOf(channel), channels.length - 1, "Last channel used");
is(data, message, "Received message has the correct content.");
test.next();
});
}
],
[
'CLOSE_LAST_OPENED_DATA_CHANNEL2',
function (test) {
var channels = test.pcRemote.dataChannels;
test.closeDataChannel(channels.length - 1, function (channel) {
is(channel.readyState, "closed", "Channel is in state: 'closed'");
test.next();
});
}
],
[
'CLOSE_LAST_OPENED_DATA_CHANNEL',
function (test) {

View File

@ -46,10 +46,14 @@ public:
DesktopNotificationCenter(nsPIDOMWindow *aWindow)
{
MOZ_ASSERT(aWindow);
mOwner = aWindow;
// Grab the uri of the document
mPrincipal = mOwner->GetDoc()->NodePrincipal();
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(aWindow);
MOZ_ASSERT(sop);
mPrincipal = sop->GetPrincipal();
MOZ_ASSERT(mPrincipal);
SetIsDOMBinding();
}

View File

@ -704,7 +704,7 @@ public:
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
const DrawOptions &aOptions = DrawOptions(),
const GlyphRenderingOptions *aRenderingOptions = NULL) = 0;
const GlyphRenderingOptions *aRenderingOptions = nullptr) = 0;
/*
* This takes a source pattern and a mask, and composites the source pattern
@ -839,7 +839,7 @@ public:
/* Tries to get a native surface for a DrawTarget, this may fail if the
* draw target cannot convert to this surface type.
*/
virtual void *GetNativeSurface(NativeSurfaceType aType) { return NULL; }
virtual void *GetNativeSurface(NativeSurfaceType aType) { return nullptr; }
virtual bool IsDualDrawTarget() { return false; }

View File

@ -29,7 +29,7 @@ DrawEventRecorderPrivate::RecordEvent(const RecordedEvent &aEvent)
}
DrawEventRecorderFile::DrawEventRecorderFile(const char *aFilename)
: DrawEventRecorderPrivate(NULL)
: DrawEventRecorderPrivate(nullptr)
, mOutputFile(aFilename, ofstream::binary)
{
mOutputStream = &mOutputFile;

View File

@ -1813,10 +1813,10 @@ DrawTargetD2D::GetClippedGeometry(IntRect *aClipBounds)
pathGeom = newGeom.forget();
}
// For now we need mCurrentClippedGeometry to always be non-NULL. This method
// might seem a little strange but it is just fine, if pathGeom is NULL
// pathRect will always still contain 1 clip unaccounted for regardless of
// mCurrentClipBounds.
// For now we need mCurrentClippedGeometry to always be non-nullptr. This
// method might seem a little strange but it is just fine, if pathGeom is
// nullptr pathRect will always still contain 1 clip unaccounted for
// regardless of mCurrentClipBounds.
if (!pathGeom) {
pathGeom = ConvertRectToGeometry(pathRect);
}

View File

@ -207,7 +207,7 @@ private:
void SetupStateForRendering();
// Set the scissor rect to a certain IntRects, resets the scissor rect to
// surface bounds when NULL is specified.
// surface bounds when nullptr is specified.
void SetScissorToRect(IntRect *aRect);
void PushD2DLayer(ID2D1RenderTarget *aRT, ID2D1Geometry *aGeometry, ID2D1Layer *aLayer, const D2D1_MATRIX_3X2_F &aTransform);
@ -242,7 +242,7 @@ private:
RefPtr<ID2D1Layer> mLayer;
D2D1_RECT_F mBounds;
union {
// If mPath is non-NULL, the mTransform member will be used, otherwise
// If mPath is non-nullptr, the mTransform member will be used, otherwise
// the mIsPixelAligned member is valid.
D2D1_MATRIX_3X2_F mTransform;
bool mIsPixelAligned;

View File

@ -77,7 +77,7 @@ GetGradientStops(GradientStops *aStops)
struct AdjustedPattern
{
AdjustedPattern(const Pattern &aPattern)
: mPattern(NULL)
: mPattern(nullptr)
{
mOrigPattern = const_cast<Pattern*>(&aPattern);
}
@ -186,7 +186,7 @@ Path*
DrawTargetRecording::GetPathForPathRecording(const Path *aPath) const
{
if (aPath->GetBackendType() != BACKEND_RECORDING) {
return NULL;
return nullptr;
}
return static_cast<const PathRecording*>(aPath)->mPath;

View File

@ -157,7 +157,7 @@ public:
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
const DrawOptions &aOptions = DrawOptions(),
const GlyphRenderingOptions *aRenderingOptions = NULL);
const GlyphRenderingOptions *aRenderingOptions = nullptr);
/*
* This takes a source pattern and a mask, and composites the source pattern

View File

@ -60,7 +60,7 @@ RecordedEvent::LoadEventFromStream(std::istream &aStream, EventType aType)
LOAD_EVENT_TYPE(SCALEDFONTDESTRUCTION, RecordedScaledFontDestruction);
LOAD_EVENT_TYPE(MASKSURFACE, RecordedMaskSurface);
default:
return NULL;
return nullptr;
}
}
@ -342,7 +342,7 @@ RecordedDrawTargetDestruction::OutputSimpleEventInfo(stringstream &aStringStream
struct GenericPattern
{
GenericPattern(const PatternStorage &aStorage, Translator *aTranslator)
: mPattern(NULL), mTranslator(aTranslator)
: mPattern(nullptr), mTranslator(aTranslator)
{
mStorage = const_cast<PatternStorage*>(&aStorage);
}

View File

@ -815,7 +815,7 @@ public:
}
RecordedScaledFontCreation(ReferencePtr aRefPtr, ScaledFont *aScaledFont)
: RecordedEvent(SCALEDFONTCREATION), mRefPtr(aRefPtr), mData(NULL)
: RecordedEvent(SCALEDFONTCREATION), mRefPtr(aRefPtr), mData(nullptr)
{
aScaledFont->GetFontFileData(&FontDataProc, this);
}

View File

@ -14,16 +14,20 @@
namespace mozilla {
namespace gfx {
struct Margin :
public BaseMargin<Float, Margin> {
typedef BaseMargin<Float, Margin> Super;
template<class units>
struct MarginTyped:
public BaseMargin<Float, MarginTyped<units> >,
public units {
typedef BaseMargin<Float, MarginTyped<units> > Super;
// Constructors
Margin() : Super(0, 0, 0, 0) {}
Margin(const Margin& aMargin) : Super(aMargin) {}
Margin(Float aTop, Float aRight, Float aBottom, Float aLeft)
: Super(aTop, aRight, aBottom, aLeft) {}
MarginTyped() : Super(0, 0, 0, 0) {}
MarginTyped(const MarginTyped<units>& aMargin) :
Super(float(aMargin.top), float(aMargin.right),
float(aMargin.bottom), float(aMargin.left)) {}
MarginTyped(Float aTop, Float aRight, Float aBottom, Float aLeft) :
Super(aTop, aRight, aBottom, aLeft) {}
};
typedef MarginTyped<UnknownUnits> Margin;
template<class units>
struct IntRectTyped :

View File

@ -213,7 +213,7 @@ DoGrayscale(IDWriteFontFace *aDWFace, Float ppem)
return true;
}
IDWriteFontFileLoader* DWriteFontFileLoader::mInstance = NULL;
IDWriteFontFileLoader* DWriteFontFileLoader::mInstance = nullptr;
HRESULT STDMETHODCALLTYPE
DWriteFontFileLoader::CreateStreamFromKey(const void *fontFileReferenceKey,
@ -275,7 +275,7 @@ DWriteFontFileStream::ReadFileFragment(const void **fragmentStart,
// We should be alive for the duration of this.
*fragmentStart = &mData[index];
*fragmentContext = NULL;
*fragmentContext = nullptr;
return S_OK;
}

View File

@ -141,147 +141,147 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
mWorkAroundDriverBugs = gfxPlatform::GetPlatform()->WorkAroundDriverBugs();
SymLoadStruct symbols[] = {
{ (PRFuncPtr*) &mSymbols.fActiveTexture, { "ActiveTexture", "ActiveTextureARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fAttachShader, { "AttachShader", "AttachShaderARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fBindAttribLocation, { "BindAttribLocation", "BindAttribLocationARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fBindBuffer, { "BindBuffer", "BindBufferARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fBindTexture, { "BindTexture", "BindTextureARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fBlendColor, { "BlendColor", NULL } },
{ (PRFuncPtr*) &mSymbols.fBlendEquation, { "BlendEquation", NULL } },
{ (PRFuncPtr*) &mSymbols.fBlendEquationSeparate, { "BlendEquationSeparate", "BlendEquationSeparateEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fBlendFunc, { "BlendFunc", NULL } },
{ (PRFuncPtr*) &mSymbols.fBlendFuncSeparate, { "BlendFuncSeparate", "BlendFuncSeparateEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fBufferData, { "BufferData", NULL } },
{ (PRFuncPtr*) &mSymbols.fBufferSubData, { "BufferSubData", NULL } },
{ (PRFuncPtr*) &mSymbols.fClear, { "Clear", NULL } },
{ (PRFuncPtr*) &mSymbols.fClearColor, { "ClearColor", NULL } },
{ (PRFuncPtr*) &mSymbols.fClearStencil, { "ClearStencil", NULL } },
{ (PRFuncPtr*) &mSymbols.fColorMask, { "ColorMask", NULL } },
{ (PRFuncPtr*) &mSymbols.fCompressedTexImage2D, {"CompressedTexImage2D", NULL} },
{ (PRFuncPtr*) &mSymbols.fCompressedTexSubImage2D, {"CompressedTexSubImage2D", NULL} },
{ (PRFuncPtr*) &mSymbols.fCullFace, { "CullFace", NULL } },
{ (PRFuncPtr*) &mSymbols.fDetachShader, { "DetachShader", "DetachShaderARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fDepthFunc, { "DepthFunc", NULL } },
{ (PRFuncPtr*) &mSymbols.fDepthMask, { "DepthMask", NULL } },
{ (PRFuncPtr*) &mSymbols.fDisable, { "Disable", NULL } },
{ (PRFuncPtr*) &mSymbols.fDisableVertexAttribArray, { "DisableVertexAttribArray", "DisableVertexAttribArrayARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fDrawArrays, { "DrawArrays", NULL } },
{ (PRFuncPtr*) &mSymbols.fDrawElements, { "DrawElements", NULL } },
{ (PRFuncPtr*) &mSymbols.fEnable, { "Enable", NULL } },
{ (PRFuncPtr*) &mSymbols.fEnableVertexAttribArray, { "EnableVertexAttribArray", "EnableVertexAttribArrayARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fFinish, { "Finish", NULL } },
{ (PRFuncPtr*) &mSymbols.fFlush, { "Flush", NULL } },
{ (PRFuncPtr*) &mSymbols.fFrontFace, { "FrontFace", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetActiveAttrib, { "GetActiveAttrib", "GetActiveAttribARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetActiveUniform, { "GetActiveUniform", "GetActiveUniformARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetAttachedShaders, { "GetAttachedShaders", "GetAttachedShadersARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetAttribLocation, { "GetAttribLocation", "GetAttribLocationARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetIntegerv, { "GetIntegerv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetFloatv, { "GetFloatv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetBooleanv, { "GetBooleanv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetBufferParameteriv, { "GetBufferParameteriv", "GetBufferParameterivARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetError, { "GetError", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetProgramiv, { "GetProgramiv", "GetProgramivARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetProgramInfoLog, { "GetProgramInfoLog", "GetProgramInfoLogARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fTexParameteri, { "TexParameteri", NULL } },
{ (PRFuncPtr*) &mSymbols.fTexParameteriv, { "TexParameteriv", NULL } },
{ (PRFuncPtr*) &mSymbols.fTexParameterf, { "TexParameterf", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetString, { "GetString", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetTexParameterfv, { "GetTexParameterfv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetTexParameteriv, { "GetTexParameteriv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetUniformfv, { "GetUniformfv", "GetUniformfvARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetUniformiv, { "GetUniformiv", "GetUniformivARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetUniformLocation, { "GetUniformLocation", "GetUniformLocationARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetVertexAttribfv, { "GetVertexAttribfv", "GetVertexAttribfvARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetVertexAttribiv, { "GetVertexAttribiv", "GetVertexAttribivARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetVertexAttribPointerv, { "GetVertexAttribPointerv", NULL } },
{ (PRFuncPtr*) &mSymbols.fHint, { "Hint", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsBuffer, { "IsBuffer", "IsBufferARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsEnabled, { "IsEnabled", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsProgram, { "IsProgram", "IsProgramARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsShader, { "IsShader", "IsShaderARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsTexture, { "IsTexture", "IsTextureARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fLineWidth, { "LineWidth", NULL } },
{ (PRFuncPtr*) &mSymbols.fLinkProgram, { "LinkProgram", "LinkProgramARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fPixelStorei, { "PixelStorei", NULL } },
{ (PRFuncPtr*) &mSymbols.fPolygonOffset, { "PolygonOffset", NULL } },
{ (PRFuncPtr*) &mSymbols.fReadPixels, { "ReadPixels", NULL } },
{ (PRFuncPtr*) &mSymbols.fSampleCoverage, { "SampleCoverage", NULL } },
{ (PRFuncPtr*) &mSymbols.fScissor, { "Scissor", NULL } },
{ (PRFuncPtr*) &mSymbols.fStencilFunc, { "StencilFunc", NULL } },
{ (PRFuncPtr*) &mSymbols.fStencilFuncSeparate, { "StencilFuncSeparate", "StencilFuncSeparateEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fStencilMask, { "StencilMask", NULL } },
{ (PRFuncPtr*) &mSymbols.fStencilMaskSeparate, { "StencilMaskSeparate", "StencilMaskSeparateEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fStencilOp, { "StencilOp", NULL } },
{ (PRFuncPtr*) &mSymbols.fStencilOpSeparate, { "StencilOpSeparate", "StencilOpSeparateEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fTexImage2D, { "TexImage2D", NULL } },
{ (PRFuncPtr*) &mSymbols.fTexSubImage2D, { "TexSubImage2D", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform1f, { "Uniform1f", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform1fv, { "Uniform1fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform1i, { "Uniform1i", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform1iv, { "Uniform1iv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform2f, { "Uniform2f", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform2fv, { "Uniform2fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform2i, { "Uniform2i", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform2iv, { "Uniform2iv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform3f, { "Uniform3f", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform3fv, { "Uniform3fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform3i, { "Uniform3i", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform3iv, { "Uniform3iv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform4f, { "Uniform4f", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform4fv, { "Uniform4fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform4i, { "Uniform4i", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform4iv, { "Uniform4iv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniformMatrix2fv, { "UniformMatrix2fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniformMatrix3fv, { "UniformMatrix3fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniformMatrix4fv, { "UniformMatrix4fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUseProgram, { "UseProgram", NULL } },
{ (PRFuncPtr*) &mSymbols.fValidateProgram, { "ValidateProgram", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttribPointer, { "VertexAttribPointer", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib1f, { "VertexAttrib1f", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib2f, { "VertexAttrib2f", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib3f, { "VertexAttrib3f", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib4f, { "VertexAttrib4f", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib1fv, { "VertexAttrib1fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib2fv, { "VertexAttrib2fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib3fv, { "VertexAttrib3fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib4fv, { "VertexAttrib4fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fViewport, { "Viewport", NULL } },
{ (PRFuncPtr*) &mSymbols.fCompileShader, { "CompileShader", NULL } },
{ (PRFuncPtr*) &mSymbols.fCopyTexImage2D, { "CopyTexImage2D", NULL } },
{ (PRFuncPtr*) &mSymbols.fCopyTexSubImage2D, { "CopyTexSubImage2D", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetShaderiv, { "GetShaderiv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetShaderInfoLog, { "GetShaderInfoLog", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetShaderSource, { "GetShaderSource", NULL } },
{ (PRFuncPtr*) &mSymbols.fShaderSource, { "ShaderSource", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttribPointer, { "VertexAttribPointer", NULL } },
{ (PRFuncPtr*) &mSymbols.fBindFramebuffer, { "BindFramebuffer", "BindFramebufferEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fBindRenderbuffer, { "BindRenderbuffer", "BindRenderbufferEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fCheckFramebufferStatus, { "CheckFramebufferStatus", "CheckFramebufferStatusEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fFramebufferRenderbuffer, { "FramebufferRenderbuffer", "FramebufferRenderbufferEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fFramebufferTexture2D, { "FramebufferTexture2D", "FramebufferTexture2DEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fGenerateMipmap, { "GenerateMipmap", "GenerateMipmapEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetFramebufferAttachmentParameteriv, { "GetFramebufferAttachmentParameteriv", "GetFramebufferAttachmentParameterivEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetRenderbufferParameteriv, { "GetRenderbufferParameteriv", "GetRenderbufferParameterivEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsFramebuffer, { "IsFramebuffer", "IsFramebufferEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsRenderbuffer, { "IsRenderbuffer", "IsRenderbufferEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fRenderbufferStorage, { "RenderbufferStorage", "RenderbufferStorageEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fActiveTexture, { "ActiveTexture", "ActiveTextureARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fAttachShader, { "AttachShader", "AttachShaderARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBindAttribLocation, { "BindAttribLocation", "BindAttribLocationARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBindBuffer, { "BindBuffer", "BindBufferARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBindTexture, { "BindTexture", "BindTextureARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBlendColor, { "BlendColor", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBlendEquation, { "BlendEquation", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBlendEquationSeparate, { "BlendEquationSeparate", "BlendEquationSeparateEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBlendFunc, { "BlendFunc", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBlendFuncSeparate, { "BlendFuncSeparate", "BlendFuncSeparateEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBufferData, { "BufferData", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBufferSubData, { "BufferSubData", nullptr } },
{ (PRFuncPtr*) &mSymbols.fClear, { "Clear", nullptr } },
{ (PRFuncPtr*) &mSymbols.fClearColor, { "ClearColor", nullptr } },
{ (PRFuncPtr*) &mSymbols.fClearStencil, { "ClearStencil", nullptr } },
{ (PRFuncPtr*) &mSymbols.fColorMask, { "ColorMask", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCompressedTexImage2D, {"CompressedTexImage2D", nullptr} },
{ (PRFuncPtr*) &mSymbols.fCompressedTexSubImage2D, {"CompressedTexSubImage2D", nullptr} },
{ (PRFuncPtr*) &mSymbols.fCullFace, { "CullFace", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDetachShader, { "DetachShader", "DetachShaderARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDepthFunc, { "DepthFunc", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDepthMask, { "DepthMask", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDisable, { "Disable", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDisableVertexAttribArray, { "DisableVertexAttribArray", "DisableVertexAttribArrayARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDrawArrays, { "DrawArrays", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDrawElements, { "DrawElements", nullptr } },
{ (PRFuncPtr*) &mSymbols.fEnable, { "Enable", nullptr } },
{ (PRFuncPtr*) &mSymbols.fEnableVertexAttribArray, { "EnableVertexAttribArray", "EnableVertexAttribArrayARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fFinish, { "Finish", nullptr } },
{ (PRFuncPtr*) &mSymbols.fFlush, { "Flush", nullptr } },
{ (PRFuncPtr*) &mSymbols.fFrontFace, { "FrontFace", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetActiveAttrib, { "GetActiveAttrib", "GetActiveAttribARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetActiveUniform, { "GetActiveUniform", "GetActiveUniformARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetAttachedShaders, { "GetAttachedShaders", "GetAttachedShadersARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetAttribLocation, { "GetAttribLocation", "GetAttribLocationARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetIntegerv, { "GetIntegerv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetFloatv, { "GetFloatv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetBooleanv, { "GetBooleanv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetBufferParameteriv, { "GetBufferParameteriv", "GetBufferParameterivARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetError, { "GetError", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetProgramiv, { "GetProgramiv", "GetProgramivARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetProgramInfoLog, { "GetProgramInfoLog", "GetProgramInfoLogARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexParameteri, { "TexParameteri", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexParameteriv, { "TexParameteriv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexParameterf, { "TexParameterf", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetString, { "GetString", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetTexParameterfv, { "GetTexParameterfv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetTexParameteriv, { "GetTexParameteriv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetUniformfv, { "GetUniformfv", "GetUniformfvARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetUniformiv, { "GetUniformiv", "GetUniformivARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetUniformLocation, { "GetUniformLocation", "GetUniformLocationARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetVertexAttribfv, { "GetVertexAttribfv", "GetVertexAttribfvARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetVertexAttribiv, { "GetVertexAttribiv", "GetVertexAttribivARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetVertexAttribPointerv, { "GetVertexAttribPointerv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fHint, { "Hint", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsBuffer, { "IsBuffer", "IsBufferARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsEnabled, { "IsEnabled", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsProgram, { "IsProgram", "IsProgramARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsShader, { "IsShader", "IsShaderARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsTexture, { "IsTexture", "IsTextureARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fLineWidth, { "LineWidth", nullptr } },
{ (PRFuncPtr*) &mSymbols.fLinkProgram, { "LinkProgram", "LinkProgramARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fPixelStorei, { "PixelStorei", nullptr } },
{ (PRFuncPtr*) &mSymbols.fPolygonOffset, { "PolygonOffset", nullptr } },
{ (PRFuncPtr*) &mSymbols.fReadPixels, { "ReadPixels", nullptr } },
{ (PRFuncPtr*) &mSymbols.fSampleCoverage, { "SampleCoverage", nullptr } },
{ (PRFuncPtr*) &mSymbols.fScissor, { "Scissor", nullptr } },
{ (PRFuncPtr*) &mSymbols.fStencilFunc, { "StencilFunc", nullptr } },
{ (PRFuncPtr*) &mSymbols.fStencilFuncSeparate, { "StencilFuncSeparate", "StencilFuncSeparateEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fStencilMask, { "StencilMask", nullptr } },
{ (PRFuncPtr*) &mSymbols.fStencilMaskSeparate, { "StencilMaskSeparate", "StencilMaskSeparateEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fStencilOp, { "StencilOp", nullptr } },
{ (PRFuncPtr*) &mSymbols.fStencilOpSeparate, { "StencilOpSeparate", "StencilOpSeparateEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexImage2D, { "TexImage2D", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexSubImage2D, { "TexSubImage2D", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform1f, { "Uniform1f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform1fv, { "Uniform1fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform1i, { "Uniform1i", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform1iv, { "Uniform1iv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform2f, { "Uniform2f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform2fv, { "Uniform2fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform2i, { "Uniform2i", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform2iv, { "Uniform2iv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform3f, { "Uniform3f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform3fv, { "Uniform3fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform3i, { "Uniform3i", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform3iv, { "Uniform3iv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform4f, { "Uniform4f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform4fv, { "Uniform4fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform4i, { "Uniform4i", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform4iv, { "Uniform4iv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniformMatrix2fv, { "UniformMatrix2fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniformMatrix3fv, { "UniformMatrix3fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniformMatrix4fv, { "UniformMatrix4fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUseProgram, { "UseProgram", nullptr } },
{ (PRFuncPtr*) &mSymbols.fValidateProgram, { "ValidateProgram", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttribPointer, { "VertexAttribPointer", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib1f, { "VertexAttrib1f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib2f, { "VertexAttrib2f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib3f, { "VertexAttrib3f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib4f, { "VertexAttrib4f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib1fv, { "VertexAttrib1fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib2fv, { "VertexAttrib2fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib3fv, { "VertexAttrib3fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib4fv, { "VertexAttrib4fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fViewport, { "Viewport", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCompileShader, { "CompileShader", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCopyTexImage2D, { "CopyTexImage2D", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCopyTexSubImage2D, { "CopyTexSubImage2D", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetShaderiv, { "GetShaderiv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetShaderInfoLog, { "GetShaderInfoLog", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetShaderSource, { "GetShaderSource", nullptr } },
{ (PRFuncPtr*) &mSymbols.fShaderSource, { "ShaderSource", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttribPointer, { "VertexAttribPointer", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBindFramebuffer, { "BindFramebuffer", "BindFramebufferEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBindRenderbuffer, { "BindRenderbuffer", "BindRenderbufferEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCheckFramebufferStatus, { "CheckFramebufferStatus", "CheckFramebufferStatusEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fFramebufferRenderbuffer, { "FramebufferRenderbuffer", "FramebufferRenderbufferEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fFramebufferTexture2D, { "FramebufferTexture2D", "FramebufferTexture2DEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenerateMipmap, { "GenerateMipmap", "GenerateMipmapEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetFramebufferAttachmentParameteriv, { "GetFramebufferAttachmentParameteriv", "GetFramebufferAttachmentParameterivEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetRenderbufferParameteriv, { "GetRenderbufferParameteriv", "GetRenderbufferParameterivEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsFramebuffer, { "IsFramebuffer", "IsFramebufferEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsRenderbuffer, { "IsRenderbuffer", "IsRenderbufferEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fRenderbufferStorage, { "RenderbufferStorage", "RenderbufferStorageEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenBuffers, { "GenBuffers", "GenBuffersARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGenTextures, { "GenTextures", NULL } },
{ (PRFuncPtr*) &mSymbols.fCreateProgram, { "CreateProgram", "CreateProgramARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fCreateShader, { "CreateShader", "CreateShaderARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGenFramebuffers, { "GenFramebuffers", "GenFramebuffersEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fGenRenderbuffers, { "GenRenderbuffers", "GenRenderbuffersEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fGenBuffers, { "GenBuffers", "GenBuffersARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenTextures, { "GenTextures", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCreateProgram, { "CreateProgram", "CreateProgramARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCreateShader, { "CreateShader", "CreateShaderARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenFramebuffers, { "GenFramebuffers", "GenFramebuffersEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenRenderbuffers, { "GenRenderbuffers", "GenRenderbuffersEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteBuffers, { "DeleteBuffers", "DeleteBuffersARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteTextures, { "DeleteTextures", "DeleteTexturesARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteProgram, { "DeleteProgram", "DeleteProgramARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteShader, { "DeleteShader", "DeleteShaderARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteFramebuffers, { "DeleteFramebuffers", "DeleteFramebuffersEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteRenderbuffers, { "DeleteRenderbuffers", "DeleteRenderbuffersEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteBuffers, { "DeleteBuffers", "DeleteBuffersARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteTextures, { "DeleteTextures", "DeleteTexturesARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteProgram, { "DeleteProgram", "DeleteProgramARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteShader, { "DeleteShader", "DeleteShaderARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteFramebuffers, { "DeleteFramebuffers", "DeleteFramebuffersEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteRenderbuffers, { "DeleteRenderbuffers", "DeleteRenderbuffersEXT", nullptr } },
{ NULL, { NULL } },
{ nullptr, { nullptr } },
};
@ -291,10 +291,10 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (mInitialized) {
if (mIsGLES2) {
SymLoadStruct symbols_ES2[] = {
{ (PRFuncPtr*) &mSymbols.fGetShaderPrecisionFormat, { "GetShaderPrecisionFormat", NULL } },
{ (PRFuncPtr*) &mSymbols.fClearDepthf, { "ClearDepthf", NULL } },
{ (PRFuncPtr*) &mSymbols.fDepthRangef, { "DepthRangef", NULL } },
{ NULL, { NULL } },
{ (PRFuncPtr*) &mSymbols.fGetShaderPrecisionFormat, { "GetShaderPrecisionFormat", nullptr } },
{ (PRFuncPtr*) &mSymbols.fClearDepthf, { "ClearDepthf", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDepthRangef, { "DepthRangef", nullptr } },
{ nullptr, { nullptr } },
};
if (!LoadSymbols(&symbols_ES2[0], trygl, prefix)) {
@ -303,22 +303,22 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
}
} else {
SymLoadStruct symbols_desktop[] = {
{ (PRFuncPtr*) &mSymbols.fClearDepth, { "ClearDepth", NULL } },
{ (PRFuncPtr*) &mSymbols.fDepthRange, { "DepthRange", NULL } },
{ (PRFuncPtr*) &mSymbols.fReadBuffer, { "ReadBuffer", NULL } },
{ (PRFuncPtr*) &mSymbols.fMapBuffer, { "MapBuffer", NULL } },
{ (PRFuncPtr*) &mSymbols.fUnmapBuffer, { "UnmapBuffer", NULL } },
{ (PRFuncPtr*) &mSymbols.fPointParameterf, { "PointParameterf", NULL } },
{ (PRFuncPtr*) &mSymbols.fBeginQuery, { "BeginQuery", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetQueryObjectuiv, { "GetQueryObjectuiv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGenQueries, { "GenQueries", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteQueries, { "DeleteQueries", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetQueryiv, { "GetQueryiv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetQueryObjectiv, { "GetQueryObjectiv", NULL } },
{ (PRFuncPtr*) &mSymbols.fEndQuery, { "EndQuery", NULL } },
{ (PRFuncPtr*) &mSymbols.fDrawBuffer, { "DrawBuffer", NULL } },
{ (PRFuncPtr*) &mSymbols.fDrawBuffers, { "DrawBuffers", NULL } },
{ NULL, { NULL } },
{ (PRFuncPtr*) &mSymbols.fClearDepth, { "ClearDepth", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDepthRange, { "DepthRange", nullptr } },
{ (PRFuncPtr*) &mSymbols.fReadBuffer, { "ReadBuffer", nullptr } },
{ (PRFuncPtr*) &mSymbols.fMapBuffer, { "MapBuffer", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUnmapBuffer, { "UnmapBuffer", nullptr } },
{ (PRFuncPtr*) &mSymbols.fPointParameterf, { "PointParameterf", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBeginQuery, { "BeginQuery", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetQueryObjectuiv, { "GetQueryObjectuiv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenQueries, { "GenQueries", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteQueries, { "DeleteQueries", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetQueryiv, { "GetQueryiv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetQueryObjectiv, { "GetQueryObjectiv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fEndQuery, { "EndQuery", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDrawBuffer, { "DrawBuffer", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDrawBuffers, { "DrawBuffers", nullptr } },
{ nullptr, { nullptr } },
};
if (!LoadSymbols(&symbols_desktop[0], trygl, prefix)) {
@ -1581,8 +1581,8 @@ GLContext::ReadTextureImage(GLuint aTexture,
vs = fCreateShader(LOCAL_GL_VERTEX_SHADER);
fs = fCreateShader(LOCAL_GL_FRAGMENT_SHADER);
fShaderSource(vs, 1, (const GLchar**) &vShader, NULL);
fShaderSource(fs, 1, (const GLchar**) &fShader, NULL);
fShaderSource(vs, 1, (const GLchar**) &vShader, nullptr);
fShaderSource(fs, 1, (const GLchar**) &fShader, nullptr);
fCompileShader(vs);
fCompileShader(fs);
prog = fCreateProgram();
@ -2012,8 +2012,8 @@ GLContext::BlitTextureImage(TextureImage *aSrc, const nsIntRect& aSrcRect,
} while (aSrc->NextTile());
} while (aDst->NextTile());
fVertexAttribPointer(0, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, NULL);
fVertexAttribPointer(1, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, NULL);
fVertexAttribPointer(0, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, nullptr);
fVertexAttribPointer(1, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, nullptr);
// unbind the previous texture from the framebuffer
SetBlitFramebufferForDestTexture(0);
@ -2186,7 +2186,7 @@ GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
{
nsRefPtr<gfxImageSurface> imageSurface = aSurface->GetAsImageSurface();
unsigned char* data = NULL;
unsigned char* data = nullptr;
if (!imageSurface ||
(imageSurface->Format() != gfxASurface::ImageFormatARGB32 &&
@ -2254,7 +2254,7 @@ GLContext::UploadSurfaceToTexture(gfx::DataSourceSurface *aSurface,
GLenum aTextureUnit,
GLenum aTextureTarget)
{
unsigned char* data = aPixelBuffer ? NULL : aSurface->GetData();
unsigned char* data = aPixelBuffer ? nullptr : aSurface->GetData();
int32_t stride = aSurface->Stride();
gfxASurface::gfxImageFormat format =
ImageFormatForSurfaceFormat(aSurface->GetFormat());
@ -2349,7 +2349,7 @@ GLContext::TexImage2D(GLenum target, GLint level, GLint internalformat,
border,
format,
type,
NULL);
nullptr);
TexSubImage2D(target,
level,
0,
@ -2736,8 +2736,8 @@ GLContext::UseBlitProgram()
" gl_FragColor = texture2D(uSrcTexture, vTexCoord);"
"}";
fShaderSource(shaders[0], 1, (const GLchar**) &blitVSSrc, NULL);
fShaderSource(shaders[1], 1, (const GLchar**) &blitFSSrc, NULL);
fShaderSource(shaders[0], 1, (const GLchar**) &blitVSSrc, nullptr);
fShaderSource(shaders[1], 1, (const GLchar**) &blitFSSrc, nullptr);
for (int i = 0; i < 2; ++i) {
GLint success, len = 0;
@ -2958,7 +2958,7 @@ ReportArrayContents(const char *title, const nsTArray<GLContext::NamedResource>&
nsTArray<GLContext::NamedResource> copy(aArray);
copy.Sort();
GLContext *lastContext = NULL;
GLContext *lastContext = nullptr;
for (uint32_t i = 0; i < copy.Length(); ++i) {
if (lastContext != copy[i].origin) {
if (lastContext)

View File

@ -173,7 +173,7 @@ public:
#ifdef DEBUG
static void StaticInit() {
PR_NewThreadPrivateIndex(&sCurrentGLContextTLS, NULL);
PR_NewThreadPrivateIndex(&sCurrentGLContextTLS, nullptr);
}
#endif
@ -213,7 +213,7 @@ public:
mUserData.Put(aKey, aValue);
}
// Mark this context as destroyed. This will NULL out all
// Mark this context as destroyed. This will nullptr out all
// the GL function pointers!
void MarkDestroyed();
@ -229,7 +229,7 @@ public:
NativeDataTypeMax
};
virtual void *GetNativeData(NativeDataType aType) { return NULL; }
virtual void *GetNativeData(NativeDataType aType) { return nullptr; }
GLContext *GetSharedContext() { return mSharedContext; }
bool IsGlobalSharedContext() { return mIsGlobalSharedContext; }
@ -786,7 +786,7 @@ public:
* default, GL_LINEAR filtering. Specify
* |aFlags=UseNearestFilter| for GL_NEAREST filtering. Specify
* |aFlags=NeedsYFlip| if the image is flipped. Return
* NULL if creating the TextureImage fails.
* nullptr if creating the TextureImage fails.
*
* The returned TextureImage may only be used with this GLContext.
* Attempting to use the returned TextureImage after this
@ -982,7 +982,7 @@ public:
/**
* these return a float pointer to the start of each array respectively.
* Use it for glVertexAttribPointer calls.
* We can return NULL if we choose to use Vertex Buffer Objects here.
* We can return nullptr if we choose to use Vertex Buffer Objects here.
*/
float* vertexPointer() {
return &vertexCoords[0].x;
@ -1500,7 +1500,7 @@ public:
void BeforeGLCall(const char* glFunction) {
MOZ_ASSERT(IsCurrent());
if (DebugMode()) {
GLContext *currentGLContext = NULL;
GLContext *currentGLContext = nullptr;
currentGLContext = (GLContext*)PR_GetThreadPrivate(sCurrentGLContextTLS);

View File

@ -67,7 +67,7 @@ using namespace android;
// a little helper
class AutoDestroyHWND {
public:
AutoDestroyHWND(HWND aWnd = NULL)
AutoDestroyHWND(HWND aWnd = nullptr)
: mWnd(aWnd)
{
}
@ -84,7 +84,7 @@ public:
HWND forget() {
HWND w = mWnd;
mWnd = NULL;
mWnd = nullptr;
return w;
}
@ -555,7 +555,7 @@ public:
#else
EGLConfig config;
CreateConfig(&config);
mSurface = CreateSurfaceForWindow(NULL, config);
mSurface = CreateSurfaceForWindow(nullptr, config);
#endif
}
return sEGLLibrary.fMakeCurrent(EGL_DISPLAY(),
@ -570,7 +570,7 @@ public:
sEGLLibrary.fMakeCurrent(EGL_DISPLAY(), EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);
sEGLLibrary.fDestroySurface(EGL_DISPLAY(), mSurface);
mSurface = NULL;
mSurface = nullptr;
}
}
@ -1191,7 +1191,7 @@ public:
//printf_stderr("BeginUpdate with updateRect [%d %d %d %d]\n", mUpdateRect.x, mUpdateRect.y, mUpdateRect.width, mUpdateRect.height);
if (!nsIntRect(nsIntPoint(0, 0), mSize).Contains(mUpdateRect)) {
NS_ERROR("update outside of image");
return NULL;
return nullptr;
}
if (mBackingSurface) {
@ -1357,7 +1357,7 @@ public:
0,
GLFormatForImage(mUpdateFormat),
GLTypeForImage(mUpdateFormat),
NULL);
nullptr);
}
mTextureState = Allocated;

View File

@ -125,68 +125,68 @@ GLXLibrary::EnsureInitialized(LibType libType)
GLLibraryLoader::SymLoadStruct symbols[] = {
/* functions that were in GLX 1.0 */
{ (PRFuncPtr*) &xDestroyContextInternal, { "glXDestroyContext", NULL } },
{ (PRFuncPtr*) &xMakeCurrentInternal, { "glXMakeCurrent", NULL } },
{ (PRFuncPtr*) &xSwapBuffersInternal, { "glXSwapBuffers", NULL } },
{ (PRFuncPtr*) &xQueryVersionInternal, { "glXQueryVersion", NULL } },
{ (PRFuncPtr*) &xGetCurrentContextInternal, { "glXGetCurrentContext", NULL } },
{ (PRFuncPtr*) &xWaitGLInternal, { "glXWaitGL", NULL } },
{ (PRFuncPtr*) &xWaitXInternal, { "glXWaitX", NULL } },
{ (PRFuncPtr*) &xDestroyContextInternal, { "glXDestroyContext", nullptr } },
{ (PRFuncPtr*) &xMakeCurrentInternal, { "glXMakeCurrent", nullptr } },
{ (PRFuncPtr*) &xSwapBuffersInternal, { "glXSwapBuffers", nullptr } },
{ (PRFuncPtr*) &xQueryVersionInternal, { "glXQueryVersion", nullptr } },
{ (PRFuncPtr*) &xGetCurrentContextInternal, { "glXGetCurrentContext", nullptr } },
{ (PRFuncPtr*) &xWaitGLInternal, { "glXWaitGL", nullptr } },
{ (PRFuncPtr*) &xWaitXInternal, { "glXWaitX", nullptr } },
/* functions introduced in GLX 1.1 */
{ (PRFuncPtr*) &xQueryExtensionsStringInternal, { "glXQueryExtensionsString", NULL } },
{ (PRFuncPtr*) &xGetClientStringInternal, { "glXGetClientString", NULL } },
{ (PRFuncPtr*) &xQueryServerStringInternal, { "glXQueryServerString", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xQueryExtensionsStringInternal, { "glXQueryExtensionsString", nullptr } },
{ (PRFuncPtr*) &xGetClientStringInternal, { "glXGetClientString", nullptr } },
{ (PRFuncPtr*) &xQueryServerStringInternal, { "glXQueryServerString", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct symbols13[] = {
/* functions introduced in GLX 1.3 */
{ (PRFuncPtr*) &xChooseFBConfigInternal, { "glXChooseFBConfig", NULL } },
{ (PRFuncPtr*) &xGetFBConfigAttribInternal, { "glXGetFBConfigAttrib", NULL } },
{ (PRFuncPtr*) &xChooseFBConfigInternal, { "glXChooseFBConfig", nullptr } },
{ (PRFuncPtr*) &xGetFBConfigAttribInternal, { "glXGetFBConfigAttrib", nullptr } },
// WARNING: xGetFBConfigs not set in symbols13_ext
{ (PRFuncPtr*) &xGetFBConfigsInternal, { "glXGetFBConfigs", NULL } },
{ (PRFuncPtr*) &xGetFBConfigsInternal, { "glXGetFBConfigs", nullptr } },
// WARNING: symbols13_ext sets xCreateGLXPixmapWithConfig instead
{ (PRFuncPtr*) &xCreatePixmapInternal, { "glXCreatePixmap", NULL } },
{ (PRFuncPtr*) &xDestroyPixmapInternal, { "glXDestroyPixmap", NULL } },
{ (PRFuncPtr*) &xCreateNewContextInternal, { "glXCreateNewContext", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xCreatePixmapInternal, { "glXCreatePixmap", nullptr } },
{ (PRFuncPtr*) &xDestroyPixmapInternal, { "glXDestroyPixmap", nullptr } },
{ (PRFuncPtr*) &xCreateNewContextInternal, { "glXCreateNewContext", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct symbols13_ext[] = {
/* extension equivalents for functions introduced in GLX 1.3 */
// GLX_SGIX_fbconfig extension
{ (PRFuncPtr*) &xChooseFBConfigInternal, { "glXChooseFBConfigSGIX", NULL } },
{ (PRFuncPtr*) &xGetFBConfigAttribInternal, { "glXGetFBConfigAttribSGIX", NULL } },
{ (PRFuncPtr*) &xChooseFBConfigInternal, { "glXChooseFBConfigSGIX", nullptr } },
{ (PRFuncPtr*) &xGetFBConfigAttribInternal, { "glXGetFBConfigAttribSGIX", nullptr } },
// WARNING: no xGetFBConfigs equivalent in extensions
// WARNING: different from symbols13:
{ (PRFuncPtr*) &xCreateGLXPixmapWithConfigInternal, { "glXCreateGLXPixmapWithConfigSGIX", NULL } },
{ (PRFuncPtr*) &xDestroyPixmapInternal, { "glXDestroyGLXPixmap", NULL } }, // not from ext
{ (PRFuncPtr*) &xCreateNewContextInternal, { "glXCreateContextWithConfigSGIX", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xCreateGLXPixmapWithConfigInternal, { "glXCreateGLXPixmapWithConfigSGIX", nullptr } },
{ (PRFuncPtr*) &xDestroyPixmapInternal, { "glXDestroyGLXPixmap", nullptr } }, // not from ext
{ (PRFuncPtr*) &xCreateNewContextInternal, { "glXCreateContextWithConfigSGIX", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct symbols14[] = {
/* functions introduced in GLX 1.4 */
{ (PRFuncPtr*) &xGetProcAddressInternal, { "glXGetProcAddress", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xGetProcAddressInternal, { "glXGetProcAddress", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct symbols14_ext[] = {
/* extension equivalents for functions introduced in GLX 1.4 */
// GLX_ARB_get_proc_address extension
{ (PRFuncPtr*) &xGetProcAddressInternal, { "glXGetProcAddressARB", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xGetProcAddressInternal, { "glXGetProcAddressARB", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct symbols_texturefrompixmap[] = {
{ (PRFuncPtr*) &xBindTexImageInternal, { "glXBindTexImageEXT", NULL } },
{ (PRFuncPtr*) &xReleaseTexImageInternal, { "glXReleaseTexImageEXT", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xBindTexImageInternal, { "glXBindTexImageEXT", nullptr } },
{ (PRFuncPtr*) &xReleaseTexImageInternal, { "glXReleaseTexImageEXT", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct symbols_robustness[] = {
{ (PRFuncPtr*) &xCreateContextAttribsInternal, { "glXCreateContextAttribsARB", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xCreateContextAttribsInternal, { "glXCreateContextAttribsARB", nullptr } },
{ nullptr, { nullptr } }
};
if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, &symbols[0])) {
@ -448,7 +448,7 @@ GLXLibrary::BindTexImage(GLXPixmap aPixmap)
} else {
xWaitX();
}
xBindTexImage(display, aPixmap, GLX_FRONT_LEFT_EXT, NULL);
xBindTexImage(display, aPixmap, GLX_FRONT_LEFT_EXT, nullptr);
}
void
@ -777,7 +777,7 @@ TRY_AGAIN_NO_SHARING:
error = false;
GLXContext glxContext = shareContext ? shareContext->mContext : NULL;
GLXContext glxContext = shareContext ? shareContext->mContext : nullptr;
if (glx.HasRobustness()) {
int attrib_list[] = {
LOCAL_GL_CONTEXT_FLAGS_ARB, LOCAL_GL_CONTEXT_ROBUST_ACCESS_BIT_ARB,
@ -1354,7 +1354,7 @@ CreateOffscreenPixmapContext(const gfxIntSize& size, LibType libToUse)
glxpixmap = glx.xCreatePixmap(display,
cfgs[chosenIndex],
xsurface->XDrawable(),
NULL);
nullptr);
} else {
glxpixmap = glx.xCreateGLXPixmapWithConfig(display,
cfgs[chosenIndex],

View File

@ -41,26 +41,27 @@ HWND
WGLLibrary::CreateDummyWindow(HDC *aWindowDC)
{
WNDCLASSW wc;
if (!GetClassInfoW(GetModuleHandle(NULL), L"GLContextWGLClass", &wc)) {
if (!GetClassInfoW(GetModuleHandle(nullptr), L"GLContextWGLClass", &wc)) {
ZeroMemory(&wc, sizeof(WNDCLASSW));
wc.style = CS_OWNDC;
wc.hInstance = GetModuleHandle(NULL);
wc.hInstance = GetModuleHandle(nullptr);
wc.lpfnWndProc = DefWindowProc;
wc.lpszClassName = L"GLContextWGLClass";
if (!RegisterClassW(&wc)) {
NS_WARNING("Failed to register GLContextWGLClass?!");
// er. failed to register our class?
return NULL;
return nullptr;
}
}
HWND win = CreateWindowW(L"GLContextWGLClass", L"GLContextWGL", 0,
0, 0, 16, 16,
NULL, NULL, GetModuleHandle(NULL), NULL);
NS_ENSURE_TRUE(win, NULL);
nullptr, nullptr, GetModuleHandle(nullptr),
nullptr);
NS_ENSURE_TRUE(win, nullptr);
HDC dc = GetDC(win);
NS_ENSURE_TRUE(dc, NULL);
NS_ENSURE_TRUE(dc, nullptr);
if (mWindowPixelFormat == 0) {
PIXELFORMATDESCRIPTOR pfd;
@ -83,11 +84,11 @@ WGLLibrary::CreateDummyWindow(HDC *aWindowDC)
}
if (!mWindowPixelFormat ||
!SetPixelFormat(dc, mWindowPixelFormat, NULL))
!SetPixelFormat(dc, mWindowPixelFormat, nullptr))
{
NS_WARNING("SetPixelFormat failed!");
DestroyWindow(win);
return NULL;
return nullptr;
}
if (aWindowDC) {
@ -126,14 +127,14 @@ WGLLibrary::EnsureInitialized(bool aUseMesaLlvmPipe)
mUseDoubleBufferedWindows = PR_GetEnv("MOZ_WGL_DB") != nullptr;
GLLibraryLoader::SymLoadStruct earlySymbols[] = {
{ (PRFuncPtr*) &fCreateContext, { "wglCreateContext", NULL } },
{ (PRFuncPtr*) &fMakeCurrent, { "wglMakeCurrent", NULL } },
{ (PRFuncPtr*) &fGetProcAddress, { "wglGetProcAddress", NULL } },
{ (PRFuncPtr*) &fDeleteContext, { "wglDeleteContext", NULL } },
{ (PRFuncPtr*) &fGetCurrentContext, { "wglGetCurrentContext", NULL } },
{ (PRFuncPtr*) &fGetCurrentDC, { "wglGetCurrentDC", NULL } },
{ (PRFuncPtr*) &fShareLists, { "wglShareLists", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &fCreateContext, { "wglCreateContext", nullptr } },
{ (PRFuncPtr*) &fMakeCurrent, { "wglMakeCurrent", nullptr } },
{ (PRFuncPtr*) &fGetProcAddress, { "wglGetProcAddress", nullptr } },
{ (PRFuncPtr*) &fDeleteContext, { "wglDeleteContext", nullptr } },
{ (PRFuncPtr*) &fGetCurrentContext, { "wglGetCurrentContext", nullptr } },
{ (PRFuncPtr*) &fGetCurrentDC, { "wglGetCurrentDC", nullptr } },
{ (PRFuncPtr*) &fShareLists, { "wglShareLists", nullptr } },
{ nullptr, { nullptr } }
};
if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, &earlySymbols[0])) {
@ -162,18 +163,18 @@ WGLLibrary::EnsureInitialized(bool aUseMesaLlvmPipe)
// a context current.
GLLibraryLoader::SymLoadStruct pbufferSymbols[] = {
{ (PRFuncPtr*) &fCreatePbuffer, { "wglCreatePbufferARB", "wglCreatePbufferEXT", NULL } },
{ (PRFuncPtr*) &fDestroyPbuffer, { "wglDestroyPbufferARB", "wglDestroyPbufferEXT", NULL } },
{ (PRFuncPtr*) &fGetPbufferDC, { "wglGetPbufferDCARB", "wglGetPbufferDCEXT", NULL } },
{ (PRFuncPtr*) &fBindTexImage, { "wglBindTexImageARB", "wglBindTexImageEXT", NULL } },
{ (PRFuncPtr*) &fReleaseTexImage, { "wglReleaseTexImageARB", "wglReleaseTexImageEXT", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &fCreatePbuffer, { "wglCreatePbufferARB", "wglCreatePbufferEXT", nullptr } },
{ (PRFuncPtr*) &fDestroyPbuffer, { "wglDestroyPbufferARB", "wglDestroyPbufferEXT", nullptr } },
{ (PRFuncPtr*) &fGetPbufferDC, { "wglGetPbufferDCARB", "wglGetPbufferDCEXT", nullptr } },
{ (PRFuncPtr*) &fBindTexImage, { "wglBindTexImageARB", "wglBindTexImageEXT", nullptr } },
{ (PRFuncPtr*) &fReleaseTexImage, { "wglReleaseTexImageARB", "wglReleaseTexImageEXT", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct pixFmtSymbols[] = {
{ (PRFuncPtr*) &fChoosePixelFormat, { "wglChoosePixelFormatARB", "wglChoosePixelFormatEXT", NULL } },
{ (PRFuncPtr*) &fGetPixelFormatAttribiv, { "wglGetPixelFormatAttribivARB", "wglGetPixelFormatAttribivEXT", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &fChoosePixelFormat, { "wglChoosePixelFormatARB", "wglChoosePixelFormatEXT", nullptr } },
{ (PRFuncPtr*) &fGetPixelFormatAttribiv, { "wglGetPixelFormatAttribivARB", "wglGetPixelFormatAttribivEXT", nullptr } },
{ nullptr, { nullptr } }
};
if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, &pbufferSymbols[0],
@ -191,13 +192,13 @@ WGLLibrary::EnsureInitialized(bool aUseMesaLlvmPipe)
}
GLLibraryLoader::SymLoadStruct extensionsSymbols[] = {
{ (PRFuncPtr *) &fGetExtensionsString, { "wglGetExtensionsStringARB", NULL} },
{ NULL, { NULL } }
{ (PRFuncPtr *) &fGetExtensionsString, { "wglGetExtensionsStringARB", nullptr} },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct robustnessSymbols[] = {
{ (PRFuncPtr *) &fCreateContextAttribs, { "wglCreateContextAttribsARB", NULL} },
{ NULL, { NULL } }
{ (PRFuncPtr *) &fCreateContextAttribs, { "wglCreateContextAttribsARB", nullptr} },
{ nullptr, { nullptr } }
};
if (GLLibraryLoader::LoadSymbols(mOGLLibrary, &extensionsSymbols[0],
@ -224,7 +225,7 @@ WGLLibrary::EnsureInitialized(bool aUseMesaLlvmPipe)
0
};
mWindowGLContext = fCreateContextAttribs(mWindowDC, NULL, attribs);
mWindowGLContext = fCreateContextAttribs(mWindowDC, nullptr, attribs);
if (!mWindowGLContext) {
mHasRobustness = false;
mWindowGLContext = fCreateContext(mWindowDC);
@ -266,7 +267,7 @@ public:
mDC(aDC),
mContext(aContext),
mWnd(aWindow),
mPBuffer(NULL),
mPBuffer(nullptr),
mPixelFormat(0),
mLibType(aLibUsed),
mIsDoubleBuffered(false)
@ -285,7 +286,7 @@ public:
: GLContext(caps, sharedContext, isOffscreen),
mDC(aDC),
mContext(aContext),
mWnd(NULL),
mWnd(nullptr),
mPBuffer(aPbuffer),
mPixelFormat(aPixelFormat),
mLibType(aLibUsed),
@ -456,7 +457,7 @@ GLContextProviderWGL::CreateForWindow(nsIWidget *aWidget)
HDC dc = (HDC)aWidget->GetNativeData(NS_NATIVE_GRAPHIC);
SetPixelFormat(dc, sWGLLib[libToUse].GetWindowPixelFormat(), NULL);
SetPixelFormat(dc, sWGLLib[libToUse].GetWindowPixelFormat(), nullptr);
HGLRC context;
GLContextWGL *shareContext = GetGlobalContextWGL();
@ -545,7 +546,7 @@ CreatePBufferOffscreenContext(const gfxIntSize& aSize,
int formats[1];
HDC windowDC = wgl.GetWindowDC();
if (!wgl.fChoosePixelFormat(windowDC,
attrs.Elements(), NULL,
attrs.Elements(), nullptr,
numFormats, formats, &numFormats)
|| numFormats == 0)
{

View File

@ -32,7 +32,7 @@ static const char *sExtensionNames[] = {
static PRLibrary* LoadApitraceLibrary()
{
static PRLibrary* sApitraceLibrary = NULL;
static PRLibrary* sApitraceLibrary = nullptr;
if (sApitraceLibrary)
return sApitraceLibrary;
@ -145,7 +145,7 @@ GLLibraryEGL::EnsureInitialized()
#endif // !Windows
#define SYMBOL(name) \
{ (PRFuncPtr*) &mSymbols.f##name, { "egl" #name, NULL } }
{ (PRFuncPtr*) &mSymbols.f##name, { "egl" #name, nullptr } }
GLLibraryLoader::SymLoadStruct earlySymbols[] = {
SYMBOL(GetDisplay),
@ -173,7 +173,7 @@ GLLibraryEGL::EnsureInitialized()
SYMBOL(BindTexImage),
SYMBOL(ReleaseTexImage),
SYMBOL(QuerySurface),
{ NULL, { NULL } }
{ nullptr, { nullptr } }
};
if (!GLLibraryLoader::LoadSymbols(mEGLLibrary, &earlySymbols[0])) {
@ -182,7 +182,7 @@ GLLibraryEGL::EnsureInitialized()
}
mEGLDisplay = fGetDisplay(EGL_DEFAULT_DISPLAY);
if (!fInitialize(mEGLDisplay, NULL, NULL))
if (!fInitialize(mEGLDisplay, nullptr, nullptr))
return false;
const char *vendor = (const char*) fQueryString(mEGLDisplay, LOCAL_EGL_VENDOR);
@ -372,7 +372,7 @@ void
GLLibraryEGL::DumpEGLConfigs()
{
int nc = 0;
fGetConfigs(mEGLDisplay, NULL, 0, &nc);
fGetConfigs(mEGLDisplay, nullptr, 0, &nc);
EGLConfig *ec = new EGLConfig[nc];
fGetConfigs(mEGLDisplay, ec, nc, &nc);

View File

@ -56,7 +56,7 @@ BasicTextureImage::BeginUpdate(nsIntRegion& aRegion)
nsIntRect rgnSize = mUpdateRegion.GetBounds();
if (!nsIntRect(nsIntPoint(0, 0), mSize).Contains(rgnSize)) {
NS_ERROR("update outside of image");
return NULL;
return nullptr;
}
ImageFormat format =
@ -66,8 +66,8 @@ BasicTextureImage::BeginUpdate(nsIntRegion& aRegion)
GetSurfaceForUpdate(gfxIntSize(rgnSize.width, rgnSize.height), format);
if (!mUpdateSurface || mUpdateSurface->CairoStatus()) {
mUpdateSurface = NULL;
return NULL;
mUpdateSurface = nullptr;
return nullptr;
}
mUpdateSurface->SetDeviceOffset(gfxPoint(-rgnSize.x, -rgnSize.y));
@ -182,7 +182,7 @@ BasicTextureImage::Resize(const nsIntSize& aSize)
0,
LOCAL_GL_RGBA,
LOCAL_GL_UNSIGNED_BYTE,
NULL);
nullptr);
mTextureState = Allocated;
mSize = aSize;

View File

@ -66,10 +66,10 @@ public:
/**
* Returns a gfxASurface for updating |aRegion| of the client's
* image if successul, NULL if not. |aRegion|'s bounds must fit
* image if successul, nullptr if not. |aRegion|'s bounds must fit
* within Size(); its coordinate space (if any) is ignored. If
* the update begins successfully, the returned gfxASurface is
* owned by this. Otherwise, NULL is returned.
* owned by this. Otherwise, nullptr is returned.
*
* |aRegion| is an inout param: the returned region is what the
* client must repaint. Category (1) regions above can

View File

@ -50,7 +50,7 @@ SharedDIBSurface::InitSurface(uint32_t aWidth, uint32_t aHeight,
gfxImageSurface::InitWithData(data, gfxIntSize(aWidth, aHeight),
stride, format);
cairo_surface_set_user_data(mSurface, &SHAREDDIB_KEY, this, NULL);
cairo_surface_set_user_data(mSurface, &SHAREDDIB_KEY, this, nullptr);
}
bool

View File

@ -40,8 +40,8 @@ SharedDIBWin::Close()
if (mSharedBmp)
::DeleteObject(mSharedBmp);
mSharedHdc = NULL;
mOldObj = mSharedBmp = NULL;
mSharedHdc = nullptr;
mOldObj = mSharedBmp = nullptr;
SharedDIB::Close();
@ -83,7 +83,7 @@ SharedDIBWin::Attach(Handle aHandle, uint32_t aWidth, uint32_t aHeight,
if (NS_FAILED(rv))
return rv;
if (NS_FAILED(SetupSurface(NULL, &bmih))) {
if (NS_FAILED(SetupSurface(nullptr, &bmih))) {
Close();
return NS_ERROR_FAILURE;
}

View File

@ -39,7 +39,7 @@ D3D9SurfaceImage::SetData(const Data& aData)
// device.
const nsIntRect& region = aData.mRegion;
RefPtr<IDirect3DTexture9> texture;
HANDLE shareHandle = NULL;
HANDLE shareHandle = nullptr;
hr = device->CreateTexture(region.width,
region.height,
1,
@ -59,7 +59,7 @@ D3D9SurfaceImage::SetData(const Data& aData)
textureSurface->GetDesc(&mDesc);
RECT src = { region.x, region.y, region.x+region.width, region.y+region.height };
hr = device->StretchRect(surface, &src, textureSurface, NULL, D3DTEXF_NONE);
hr = device->StretchRect(surface, &src, textureSurface, nullptr, D3DTEXF_NONE);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
// Flush the draw command now, so that by the time we come to draw this
@ -87,7 +87,7 @@ D3D9SurfaceImage::EnsureSynchronized()
return;
}
int iterations = 0;
while (iterations < 10 && S_FALSE == mQuery->GetData(NULL, 0, D3DGETDATA_FLUSH)) {
while (iterations < 10 && S_FALSE == mQuery->GetData(nullptr, 0, D3DGETDATA_FLUSH)) {
Sleep(1);
iterations++;
}
@ -155,7 +155,7 @@ D3D9SurfaceImage::GetAsSurface()
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
D3DLOCKED_RECT rect;
hr = systemMemorySurface->LockRect(&rect, NULL, 0);
hr = systemMemorySurface->LockRect(&rect, nullptr, 0);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
const unsigned char* src = (const unsigned char*)(rect.pBits);

View File

@ -28,7 +28,7 @@ public:
nsIntRect mRegion;
};
D3D9SurfaceImage() : Image(NULL, D3D9_RGB32_TEXTURE), mSize(0, 0) {}
D3D9SurfaceImage() : Image(nullptr, D3D9_RGB32_TEXTURE), mSize(0, 0) {}
virtual ~D3D9SurfaceImage() {}
// Copies the surface into a sharable texture's surface, and initializes

View File

@ -55,7 +55,7 @@ public:
gfxIntSize mPicSize;
};
GonkIOSurfaceImage()
: Image(NULL, GONK_IO_SURFACE)
: Image(nullptr, GONK_IO_SURFACE)
, mSize(0, 0)
{}

View File

@ -538,7 +538,7 @@ protected:
nsRefPtr<BufferRecycleBin> mRecycleBin;
// This contains the remote image data for this container, if this is NULL
// This contains the remote image data for this container, if this is nullptr
// that means the container has no other process that may control its active
// image.
RemoteImageData *mRemoteData;
@ -782,7 +782,7 @@ public:
gfxIntSize GetSize() { return mSize; }
CairoImage() : Image(NULL, CAIRO_SURFACE) {}
CairoImage() : Image(nullptr, CAIRO_SURFACE) {}
nsCountedRef<nsMainThreadSurfaceRef> mSurface;
gfxIntSize mSize;
@ -790,7 +790,7 @@ public:
class RemoteBitmapImage : public Image {
public:
RemoteBitmapImage() : Image(NULL, REMOTE_IMAGE_BITMAP) {}
RemoteBitmapImage() : Image(nullptr, REMOTE_IMAGE_BITMAP) {}
already_AddRefed<gfxASurface> GetAsSurface();

View File

@ -1142,7 +1142,7 @@ Layer::PrintInfo(nsACString& aTo, const char* aPrefix)
aTo += " [componentAlpha]";
}
if (GetIsFixedPosition()) {
aTo += " [isFixedPosition]";
aTo.AppendPrintf(" [isFixedPosition anchor=%f,%f]", mAnchor.x, mAnchor.y);
}
return aTo;

View File

@ -491,12 +491,12 @@ public:
* Dump information about this layer manager and its managed tree to
* aFile, which defaults to stderr.
*/
void Dump(FILE* aFile=NULL, const char* aPrefix="", bool aDumpHtml=false);
void Dump(FILE* aFile=nullptr, const char* aPrefix="", bool aDumpHtml=false);
/**
* Dump information about just this layer manager itself to aFile,
* which defaults to stderr.
*/
void DumpSelf(FILE* aFile=NULL, const char* aPrefix="");
void DumpSelf(FILE* aFile=nullptr, const char* aPrefix="");
/**
* Log information about this layer manager and its managed tree to
@ -859,7 +859,7 @@ public:
* same position when compositing the layer tree with a transformation
* (such as when asynchronously scrolling and zooming).
*/
void SetFixedPositionAnchor(const gfxPoint& aAnchor)
void SetFixedPositionAnchor(const LayerPoint& aAnchor)
{
if (mAnchor != aAnchor) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) FixedPositionAnchor", this));
@ -879,7 +879,7 @@ public:
* layer represents are auto-positioned, and so fixed position margins should
* not have an effect on the corresponding axis.
*/
void SetFixedPositionMargins(const gfx::Margin& aMargins)
void SetFixedPositionMargins(const LayerMargin& aMargins)
{
if (mMargins != aMargins) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) FixedPositionMargins", this));
@ -905,8 +905,8 @@ public:
float GetPostXScale() const { return mPostXScale; }
float GetPostYScale() const { return mPostYScale; }
bool GetIsFixedPosition() { return mIsFixedPosition; }
gfxPoint GetFixedPositionAnchor() { return mAnchor; }
const gfx::Margin& GetFixedPositionMargins() { return mMargins; }
LayerPoint GetFixedPositionAnchor() { return mAnchor; }
const LayerMargin& GetFixedPositionMargins() { return mMargins; }
Layer* GetMaskLayer() const { return mMaskLayer; }
// Note that all lengths in animation data are either in CSS pixels or app
@ -1118,12 +1118,12 @@ public:
* Dump information about this layer manager and its managed tree to
* aFile, which defaults to stderr.
*/
void Dump(FILE* aFile=NULL, const char* aPrefix="", bool aDumpHtml=false);
void Dump(FILE* aFile=nullptr, const char* aPrefix="", bool aDumpHtml=false);
/**
* Dump information about just this layer manager itself to aFile,
* which defaults to stderr.
*/
void DumpSelf(FILE* aFile=NULL, const char* aPrefix="");
void DumpSelf(FILE* aFile=nullptr, const char* aPrefix="");
/**
* Log information about this layer manager and its managed tree to
@ -1260,8 +1260,8 @@ protected:
bool mUseClipRect;
bool mUseTileSourceRect;
bool mIsFixedPosition;
gfxPoint mAnchor;
gfx::Margin mMargins;
LayerPoint mAnchor;
LayerMargin mMargins;
DebugOnly<uint32_t> mDebugColorIndex;
// If this layer is used for OMTA, then this counter is used to ensure we
// stay in sync with the animation manager

View File

@ -18,7 +18,7 @@ static int colorId = 0;
static gfx3DMatrix GetRootTransform(Layer *aLayer) {
gfx3DMatrix layerTrans = aLayer->GetTransform();
layerTrans.ProjectTo2D();
if (aLayer->GetParent() != NULL) {
if (aLayer->GetParent() != nullptr) {
return GetRootTransform(aLayer->GetParent()) * layerTrans;
}
return layerTrans;

View File

@ -35,7 +35,7 @@ public:
return gl::GLContextProvider::GetSharedHandleAsSurface(mData.mShareType, mData.mHandle);
}
SharedTextureImage() : Image(NULL, SHARED_TEXTURE) {}
SharedTextureImage() : Image(nullptr, SHARED_TEXTURE) {}
private:
Data mData;

View File

@ -109,86 +109,174 @@ AsyncCompositionManager::ComputeRotation()
}
}
// Do a breadth-first search to find the first layer in the tree that is
// scrollable.
static void
Translate2D(gfx3DMatrix& aTransform, const gfxPoint& aOffset)
static bool
GetBaseTransform2D(Layer* aLayer, gfxMatrix* aTransform)
{
aTransform._41 += aOffset.x;
aTransform._42 += aOffset.y;
// Start with the animated transform if there is one
return (aLayer->AsLayerComposite()->GetShadowTransformSetByAnimation() ?
aLayer->GetLocalTransform() : aLayer->GetTransform()).Is2D(aTransform);
}
static void
TranslateShadowLayer2D(Layer* aLayer,
const gfxPoint& aTranslation)
{
gfxMatrix layerTransform;
if (!GetBaseTransform2D(aLayer, &layerTransform)) {
return;
}
// Apply the 2D translation to the layer transform.
layerTransform.x0 += aTranslation.x;
layerTransform.y0 += aTranslation.y;
// The transform already takes the resolution scale into account. Since we
// will apply the resolution scale again when computing the effective
// transform, we must apply the inverse resolution scale here.
gfx3DMatrix layerTransform3D = gfx3DMatrix::From2D(layerTransform);
if (ContainerLayer* c = aLayer->AsContainerLayer()) {
layerTransform3D.Scale(1.0f/c->GetPreXScale(),
1.0f/c->GetPreYScale(),
1);
}
layerTransform3D.ScalePost(1.0f/aLayer->GetPostXScale(),
1.0f/aLayer->GetPostYScale(),
1);
LayerComposite* layerComposite = aLayer->AsLayerComposite();
layerComposite->SetShadowTransform(layerTransform3D);
layerComposite->SetShadowTransformSetByAnimation(false);
const nsIntRect* clipRect = aLayer->GetClipRect();
if (clipRect) {
nsIntRect transformedClipRect(*clipRect);
transformedClipRect.MoveBy(aTranslation.x, aTranslation.y);
layerComposite->SetShadowClipRect(&transformedClipRect);
}
}
static bool
AccumulateLayerTransforms2D(Layer* aLayer,
Layer* aAncestor,
gfxMatrix& aMatrix)
{
// Accumulate the transforms between this layer and the subtree root layer.
for (Layer* l = aLayer; l && l != aAncestor; l = l->GetParent()) {
gfxMatrix l2D;
if (!GetBaseTransform2D(l, &l2D)) {
return false;
}
aMatrix.Multiply(l2D);
}
return true;
}
static LayerPoint
GetLayerFixedMarginsOffset(Layer* aLayer,
const LayerMargin& aFixedLayerMargins)
{
// Work out the necessary translation, in root scrollable layer space.
// Because fixed layer margins are stored relative to the root scrollable
// layer, we can just take the difference between these values.
LayerPoint translation;
const LayerPoint& anchor = aLayer->GetFixedPositionAnchor();
const LayerMargin& fixedMargins = aLayer->GetFixedPositionMargins();
if (fixedMargins.left >= 0) {
if (anchor.x > 0) {
translation.x -= aFixedLayerMargins.right - fixedMargins.right;
} else {
translation.x += aFixedLayerMargins.left - fixedMargins.left;
}
}
if (fixedMargins.top >= 0) {
if (anchor.y > 0) {
translation.y -= aFixedLayerMargins.bottom - fixedMargins.bottom;
} else {
translation.y += aFixedLayerMargins.top - fixedMargins.top;
}
}
return translation;
}
void
AsyncCompositionManager::TransformFixedLayers(Layer* aLayer,
const gfxPoint& aTranslation,
const gfxSize& aScaleDiff,
const gfx::Margin& aFixedLayerMargins)
AsyncCompositionManager::AlignFixedLayersForAnchorPoint(Layer* aLayer,
Layer* aTransformedSubtreeRoot,
const gfx3DMatrix& aPreviousTransformForRoot,
const LayerMargin& aFixedLayerMargins)
{
if (aLayer->GetIsFixedPosition() &&
if (aLayer != aTransformedSubtreeRoot && aLayer->GetIsFixedPosition() &&
!aLayer->GetParent()->GetIsFixedPosition()) {
// When a scale has been applied to a layer, it focuses around (0,0).
// The anchor position is used here as a scale focus point (assuming that
// aScaleDiff has already been applied) to re-focus the scale.
const gfxPoint& anchor = aLayer->GetFixedPositionAnchor();
gfxPoint translation(aTranslation - (anchor - anchor / aScaleDiff));
// Insert a translation so that the position of the anchor point is the same
// before and after the change to the transform of aTransformedSubtreeRoot.
// This currently only works for fixed layers with 2D transforms.
// Offset this translation by the fixed layer margins, depending on what
// side of the viewport the layer is anchored to, reconciling the
// difference between the current fixed layer margins and the Gecko-side
// fixed layer margins.
// aFixedLayerMargins are the margins we expect to be at at the current
// time, obtained via SyncViewportInfo, and fixedMargins are the margins
// that were used during layout.
// If top/left of fixedMargins are negative, that indicates that this layer
// represents auto-positioned elements, and should not be affected by
// fixed margins at all.
const gfx::Margin& fixedMargins = aLayer->GetFixedPositionMargins();
if (fixedMargins.left >= 0) {
if (anchor.x > 0) {
translation.x -= aFixedLayerMargins.right - fixedMargins.right;
} else {
translation.x += aFixedLayerMargins.left - fixedMargins.left;
}
// Accumulate the transforms between this layer and the subtree root layer.
gfxMatrix ancestorTransform;
if (!AccumulateLayerTransforms2D(aLayer->GetParent(), aTransformedSubtreeRoot,
ancestorTransform)) {
return;
}
if (fixedMargins.top >= 0) {
if (anchor.y > 0) {
translation.y -= aFixedLayerMargins.bottom - fixedMargins.bottom;
} else {
translation.y += aFixedLayerMargins.top - fixedMargins.top;
}
gfxMatrix oldRootTransform;
gfxMatrix newRootTransform;
if (!aPreviousTransformForRoot.Is2D(&oldRootTransform) ||
!aTransformedSubtreeRoot->GetLocalTransform().Is2D(&newRootTransform)) {
return;
}
// The transform already takes the resolution scale into account. Since we
// will apply the resolution scale again when computing the effective
// transform, we must apply the inverse resolution scale here.
LayerComposite* layerComposite = aLayer->AsLayerComposite();
gfx3DMatrix layerTransform;
if (layerComposite->GetShadowTransformSetByAnimation()) {
// Start with the animated transform
layerTransform = aLayer->GetLocalTransform();
} else {
layerTransform = aLayer->GetTransform();
// Calculate the cumulative transforms between the subtree root with the
// old transform and the current transform.
gfxMatrix oldCumulativeTransform = ancestorTransform * oldRootTransform;
gfxMatrix newCumulativeTransform = ancestorTransform * newRootTransform;
if (newCumulativeTransform.IsSingular()) {
return;
}
Translate2D(layerTransform, translation);
if (ContainerLayer* c = aLayer->AsContainerLayer()) {
layerTransform.Scale(1.0f/c->GetPreXScale(),
1.0f/c->GetPreYScale(),
1);
}
layerTransform.ScalePost(1.0f/aLayer->GetPostXScale(),
1.0f/aLayer->GetPostYScale(),
1);
layerComposite->SetShadowTransform(layerTransform);
layerComposite->SetShadowTransformSetByAnimation(false);
gfxMatrix newCumulativeTransformInverse = newCumulativeTransform;
newCumulativeTransformInverse.Invert();
const nsIntRect* clipRect = aLayer->GetClipRect();
if (clipRect) {
nsIntRect transformedClipRect(*clipRect);
transformedClipRect.MoveBy(translation.x, translation.y);
layerComposite->SetShadowClipRect(&transformedClipRect);
// Now work out the translation necessary to make sure the layer doesn't
// move given the new sub-tree root transform.
gfxMatrix layerTransform;
if (!GetBaseTransform2D(aLayer, &layerTransform)) {
return;
}
// Calculate any offset necessary, in previous transform sub-tree root
// space. This is used to make sure fixed position content respects
// content document fixed position margins.
LayerPoint offsetInOldSubtreeLayerSpace = GetLayerFixedMarginsOffset(aLayer, aFixedLayerMargins);
// Add the above offset to the anchor point so we can offset the layer by
// and amount that's specified in old subtree layer space.
const LayerPoint& anchorInOldSubtreeLayerSpace = aLayer->GetFixedPositionAnchor();
LayerPoint offsetAnchorInOldSubtreeLayerSpace = anchorInOldSubtreeLayerSpace + offsetInOldSubtreeLayerSpace;
// Add the local layer transform to the two points to make the equation
// below this section more convenient.
gfxPoint anchor(anchorInOldSubtreeLayerSpace.x, anchorInOldSubtreeLayerSpace.y);
gfxPoint offsetAnchor(offsetAnchorInOldSubtreeLayerSpace.x, offsetAnchorInOldSubtreeLayerSpace.y);
gfxPoint locallyTransformedAnchor = layerTransform.Transform(anchor);
gfxPoint locallyTransformedOffsetAnchor = layerTransform.Transform(offsetAnchor);
// Transforming the locallyTransformedAnchor by oldCumulativeTransform
// returns the layer's anchor point relative to the parent of
// aTransformedSubtreeRoot, before the new transform was applied.
// Then, applying newCumulativeTransformInverse maps that point relative
// to the layer's parent, which is the same coordinate space as
// locallyTransformedAnchor again, allowing us to subtract them and find
// out the offset necessary to make sure the layer stays stationary.
gfxPoint oldAnchorPositionInNewSpace =
newCumulativeTransformInverse.Transform(
oldCumulativeTransform.Transform(locallyTransformedOffsetAnchor));
gfxPoint translation = oldAnchorPositionInNewSpace - locallyTransformedAnchor;
// Finally, apply the 2D translation to the layer transform.
TranslateShadowLayer2D(aLayer, translation);
// The transform has now been applied, so there's no need to iterate over
// child layers.
return;
@ -196,7 +284,8 @@ AsyncCompositionManager::TransformFixedLayers(Layer* aLayer,
for (Layer* child = aLayer->GetFirstChild();
child; child = child->GetNextSibling()) {
TransformFixedLayers(child, aTranslation, aScaleDiff, aFixedLayerMargins);
AlignFixedLayersForAnchorPoint(child, aTransformedSubtreeRoot,
aPreviousTransformForRoot, aFixedLayerMargins);
}
}
@ -342,6 +431,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFram
if (AsyncPanZoomController* controller = container->GetAsyncPanZoomController()) {
LayerComposite* layerComposite = aLayer->AsLayerComposite();
gfx3DMatrix oldTransform = aLayer->GetTransform();
ViewTransform treeTransform;
ScreenPoint scrollOffset;
@ -361,7 +451,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFram
/ LayerToLayoutDeviceScale(rootTransform.GetXScale(), rootTransform.GetYScale());
CSSRect displayPort(metrics.mCriticalDisplayPort.IsEmpty() ?
metrics.mDisplayPort : metrics.mCriticalDisplayPort);
gfx::Margin fixedLayerMargins(0, 0, 0, 0);
LayerMargin fixedLayerMargins(0, 0, 0, 0);
ScreenPoint offset(0, 0);
SyncFrameMetrics(scrollOffset, treeTransform.mScale.scale, metrics.mScrollableRect,
mLayersUpdated, displayPort, paintScale,
@ -387,11 +477,20 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFram
NS_ASSERTION(!layerComposite->GetShadowTransformSetByAnimation(),
"overwriting animated transform!");
TransformFixedLayers(
aLayer,
gfxPoint(-treeTransform.mTranslation.x, -treeTransform.mTranslation.y),
gfxSize(treeTransform.mScale.scale, treeTransform.mScale.scale),
fixedLayerMargins);
// Apply resolution scaling to the old transform - the layer tree as it is
// doesn't have the necessary transform to display correctly.
#ifdef MOZ_WIDGET_ANDROID
// XXX We use rootTransform instead of the resolution on the individual layer's
// FrameMetrics on Fennec because the resolution is set on the root layer rather
// than the scrollable layer. See bug 732971. On non-Fennec we do the right thing.
LayoutDeviceToLayerScale resolution(1.0 / rootTransform.GetXScale(),
1.0 / rootTransform.GetYScale());
#else
LayoutDeviceToLayerScale resolution = metrics.mResolution;
#endif
oldTransform.Scale(resolution.scale, resolution.scale, 1);
AlignFixedLayersForAnchorPoint(aLayer, aLayer, oldTransform, fixedLayerMargins);
appliedTransform = true;
}
@ -409,6 +508,7 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer, const LayoutDev
// We must apply the resolution scale before a pan/zoom transform, so we call
// GetTransform here.
const gfx3DMatrix& currentTransform = aLayer->GetTransform();
gfx3DMatrix oldTransform = currentTransform;
gfx3DMatrix treeTransform;
@ -437,7 +537,7 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer, const LayoutDev
) * geckoZoom);
displayPort += scrollOffsetLayerPixels;
gfx::Margin fixedLayerMargins(0, 0, 0, 0);
LayerMargin fixedLayerMargins(0, 0, 0, 0);
ScreenPoint offset(0, 0);
// Ideally we would initialize userZoom to AsyncPanZoomController::CalculateResolution(metrics)
@ -471,33 +571,6 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer, const LayoutDev
LayerPoint translation = (userScroll / zoomAdjust) - geckoScroll;
treeTransform = gfx3DMatrix(ViewTransform(-translation, userZoom / metrics.mDevPixelsPerCSSPixel));
// Translate fixed position layers so that they stay in the correct position
// when userScroll and geckoScroll differ.
gfxPoint fixedOffset;
gfxSize scaleDiff;
LayerRect content = mContentRect * geckoZoom;
// If the contents can fit entirely within the widget area on a particular
// dimension, we need to translate and scale so that the fixed layers remain
// within the page boundaries.
if (mContentRect.width * userZoom.scale < metrics.mCompositionBounds.width) {
fixedOffset.x = -geckoScroll.x;
scaleDiff.width = std::min(1.0f, metrics.mCompositionBounds.width / content.width);
} else {
fixedOffset.x = clamped(userScroll.x / zoomAdjust.scale, content.x,
content.XMost() - metrics.mCompositionBounds.width / zoomAdjust.scale) - geckoScroll.x;
scaleDiff.width = zoomAdjust.scale;
}
if (mContentRect.height * userZoom.scale < metrics.mCompositionBounds.height) {
fixedOffset.y = -geckoScroll.y;
scaleDiff.height = std::min(1.0f, metrics.mCompositionBounds.height / content.height);
} else {
fixedOffset.y = clamped(userScroll.y / zoomAdjust.scale, content.y,
content.YMost() - metrics.mCompositionBounds.height / zoomAdjust.scale) - geckoScroll.y;
scaleDiff.height = zoomAdjust.scale;
}
// The transform already takes the resolution scale into account. Since we
// will apply the resolution scale again when computing the effective
// transform, we must apply the inverse resolution scale here.
@ -511,7 +584,46 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer, const LayoutDev
layerComposite->SetShadowTransform(computedTransform);
NS_ASSERTION(!layerComposite->GetShadowTransformSetByAnimation(),
"overwriting animated transform!");
TransformFixedLayers(aLayer, fixedOffset, scaleDiff, fixedLayerMargins);
// Apply resolution scaling to the old transform - the layer tree as it is
// doesn't have the necessary transform to display correctly.
oldTransform.Scale(aResolution.scale, aResolution.scale, 1);
// Make sure that overscroll and under-zoom are represented in the old
// transform so that fixed position content moves and scales accordingly.
// These calculations will effectively scale and offset fixed position layers
// in screen space when the compensatory transform is performed in
// AlignFixedLayersForAnchorPoint.
ScreenRect contentScreenRect = mContentRect * userZoom;
gfxPoint3D overscrollTranslation;
if (userScroll.x < contentScreenRect.x) {
overscrollTranslation.x = contentScreenRect.x - userScroll.x;
} else if (userScroll.x + metrics.mCompositionBounds.width > contentScreenRect.XMost()) {
overscrollTranslation.x = contentScreenRect.XMost() -
(userScroll.x + metrics.mCompositionBounds.width);
}
if (userScroll.y < contentScreenRect.y) {
overscrollTranslation.y = contentScreenRect.y - userScroll.y;
} else if (userScroll.y + metrics.mCompositionBounds.height > contentScreenRect.YMost()) {
overscrollTranslation.y = contentScreenRect.YMost() -
(userScroll.y + metrics.mCompositionBounds.height);
}
oldTransform.Translate(overscrollTranslation);
gfxSize underZoomScale(1.0f, 1.0f);
if (mContentRect.width * userZoom.scale < metrics.mCompositionBounds.width) {
underZoomScale.width = (mContentRect.width * userZoom.scale) /
metrics.mCompositionBounds.width;
}
if (mContentRect.height * userZoom.scale < metrics.mCompositionBounds.height) {
underZoomScale.height = (mContentRect.height * userZoom.scale) /
metrics.mCompositionBounds.height;
}
oldTransform.Scale(underZoomScale.width, underZoomScale.height, 1);
// Make sure fixed position layers don't move away from their anchor points
// when we're asynchronously panning or zooming
AlignFixedLayersForAnchorPoint(aLayer, aLayer, oldTransform, fixedLayerMargins);
}
bool
@ -587,7 +699,7 @@ AsyncCompositionManager::SyncViewportInfo(const LayerIntRect& aDisplayPort,
bool aLayersUpdated,
ScreenPoint& aScrollOffset,
CSSToScreenScale& aScale,
gfx::Margin& aFixedLayerMargins,
LayerMargin& aFixedLayerMargins,
ScreenPoint& aOffset)
{
#ifdef MOZ_WIDGET_ANDROID
@ -609,7 +721,7 @@ AsyncCompositionManager::SyncFrameMetrics(const ScreenPoint& aScrollOffset,
const CSSRect& aDisplayPort,
const CSSToLayerScale& aDisplayResolution,
bool aIsFirstPaint,
gfx::Margin& aFixedLayerMargins,
LayerMargin& aFixedLayerMargins,
ScreenPoint& aOffset)
{
#ifdef MOZ_WIDGET_ANDROID

View File

@ -131,7 +131,7 @@ private:
bool aLayersUpdated,
ScreenPoint& aScrollOffset,
CSSToScreenScale& aScale,
gfx::Margin& aFixedLayerMargins,
LayerMargin& aFixedLayerMargins,
ScreenPoint& aOffset);
void SyncFrameMetrics(const ScreenPoint& aScrollOffset,
float aZoom,
@ -140,20 +140,23 @@ private:
const CSSRect& aDisplayPort,
const CSSToLayerScale& aDisplayResolution,
bool aIsFirstPaint,
gfx::Margin& aFixedLayerMargins,
LayerMargin& aFixedLayerMargins,
ScreenPoint& aOffset);
/**
* Recursively applies the given translation to all top-level fixed position
* layers that are descendants of the given layer.
* aScaleDiff is considered to be the scale transformation applied when
* displaying the layers, and is used to make sure the anchor points of
* fixed position layers remain in the same position.
* Adds a translation to the transform of any fixed-pos layer descendant of
* aTransformedSubtreeRoot whose parent layer is not fixed. The translation is
* chosen so that the layer's anchor point relative to aTransformedSubtreeRoot's
* parent layer is the same as it was when aTransformedSubtreeRoot's
* GetLocalTransform() was aPreviousTransformForRoot.
* This function will also adjust layers so that the given content document
* fixed position margins will be respected during asynchronous panning and
* zooming.
*/
void TransformFixedLayers(Layer* aLayer,
const gfxPoint& aTranslation,
const gfxSize& aScaleDiff,
const gfx::Margin& aFixedLayerMargins);
void AlignFixedLayersForAnchorPoint(Layer* aLayer,
Layer* aTransformedSubtreeRoot,
const gfx3DMatrix& aPreviousTransformForRoot,
const LayerMargin& aFixedLayerMargins);
/**
* DRAWING PHASE ONLY

View File

@ -195,7 +195,7 @@ public:
SetCompositor(nullptr);
}
virtual void Dump(FILE* aFile=NULL,
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",
bool aDumpHtml=false) { }
static void DumpDeprecatedTextureHost(FILE* aFile, DeprecatedTextureHost* aTexture);

View File

@ -97,7 +97,7 @@ public:
}
#endif
virtual void Dump(FILE* aFile=NULL,
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",
bool aDumpHtml=false) MOZ_OVERRIDE;
@ -159,7 +159,7 @@ public:
const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
virtual void DestroyTextures() MOZ_OVERRIDE;
virtual void Dump(FILE* aFile=NULL,
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",
bool aDumpHtml=false) MOZ_OVERRIDE;

View File

@ -86,7 +86,7 @@ public:
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
virtual void Dump(FILE* aFile=NULL,
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",
bool aDumpHtml=false) MOZ_OVERRIDE;

View File

@ -202,7 +202,7 @@ public:
virtual void Attach(Layer* aLayer, Compositor* aCompositor) MOZ_OVERRIDE;
virtual void Dump(FILE* aFile=NULL,
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",
bool aDumpHtml=false) MOZ_OVERRIDE;

View File

@ -68,7 +68,7 @@ CanvasLayerD3D10::Initialize(const Data& aData)
"CanvasLayer can't have both surface and WebGLContext/Surface");
mBounds.SetRect(0, 0, aData.mSize.width, aData.mSize.height);
device()->CreateShaderResourceView(mTexture, NULL, getter_AddRefs(mSRView));
device()->CreateShaderResourceView(mTexture, nullptr, getter_AddRefs(mSRView));
return;
}
@ -86,7 +86,7 @@ CanvasLayerD3D10::Initialize(const Data& aData)
if (data) {
mTexture = static_cast<ID3D10Texture2D*>(data);
mIsD2DTexture = true;
device()->CreateShaderResourceView(mTexture, NULL, getter_AddRefs(mSRView));
device()->CreateShaderResourceView(mTexture, nullptr, getter_AddRefs(mSRView));
mHasAlpha =
mSurface->GetContentType() == gfxASurface::CONTENT_COLOR_ALPHA;
return;
@ -100,13 +100,13 @@ CanvasLayerD3D10::Initialize(const Data& aData)
desc.Usage = D3D10_USAGE_DYNAMIC;
desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
HRESULT hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(mTexture));
HRESULT hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTexture));
if (FAILED(hr)) {
NS_WARNING("Failed to create texture for CanvasLayer!");
return;
}
device()->CreateShaderResourceView(mTexture, NULL, getter_AddRefs(mUploadSRView));
device()->CreateShaderResourceView(mTexture, nullptr, getter_AddRefs(mUploadSRView));
}
void

View File

@ -20,7 +20,7 @@ class CanvasLayerD3D10 : public CanvasLayer,
{
public:
CanvasLayerD3D10(LayerManagerD3D10 *aManager)
: CanvasLayer(aManager, NULL)
: CanvasLayer(aManager, nullptr)
, LayerD3D10(aManager)
, mDataIsPremultiplied(false)
, mNeedsYFlip(false)

View File

@ -11,7 +11,7 @@ namespace mozilla {
namespace layers {
ColorLayerD3D10::ColorLayerD3D10(LayerManagerD3D10 *aManager)
: ColorLayer(aManager, NULL)
: ColorLayer(aManager, nullptr)
, LayerD3D10(aManager)
{
mImplData = static_cast<LayerD3D10*>(this);

View File

@ -16,7 +16,7 @@ namespace mozilla {
namespace layers {
ContainerLayerD3D10::ContainerLayerD3D10(LayerManagerD3D10 *aManager)
: ContainerLayer(aManager, NULL)
: ContainerLayer(aManager, nullptr)
, LayerD3D10(aManager)
{
mImplData = static_cast<LayerD3D10*>(this);
@ -215,7 +215,7 @@ ContainerLayerD3D10::RenderLayer()
gfx3DMatrix oldViewMatrix;
if (useIntermediate) {
device()->OMGetRenderTargets(1, getter_AddRefs(previousRTView), NULL);
device()->OMGetRenderTargets(1, getter_AddRefs(previousRTView), nullptr);
D3D10_TEXTURE2D_DESC desc;
memset(&desc, 0, sizeof(D3D10_TEXTURE2D_DESC));
@ -227,7 +227,7 @@ ContainerLayerD3D10::RenderLayer()
desc.SampleDesc.Count = 1;
desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
HRESULT hr;
hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(renderTexture));
hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(renderTexture));
if (FAILED(hr)) {
LayerManagerD3D10::ReportFailure(NS_LITERAL_CSTRING("Failed to create new texture for ContainerLayerD3D10!"),
@ -235,7 +235,7 @@ ContainerLayerD3D10::RenderLayer()
return;
}
hr = device()->CreateRenderTargetView(renderTexture, NULL, getter_AddRefs(rtView));
hr = device()->CreateRenderTargetView(renderTexture, nullptr, getter_AddRefs(rtView));
NS_ASSERTION(SUCCEEDED(hr), "Failed to create render target view for ContainerLayerD3D10!");
effect()->GetVariableByName("vRenderTargetOffset")->
@ -277,7 +277,7 @@ ContainerLayerD3D10::RenderLayer()
}
ID3D10RenderTargetView *rtViewPtr = rtView;
device()->OMSetRenderTargets(1, &rtViewPtr, NULL);
device()->OMSetRenderTargets(1, &rtViewPtr, nullptr);
renderTargetOffset[0] = (float)visibleRect.x;
renderTargetOffset[1] = (float)visibleRect.y;
@ -332,7 +332,7 @@ ContainerLayerD3D10::RenderLayer()
if (useIntermediate) {
mD3DManager->SetViewport(previousViewportSize);
ID3D10RenderTargetView *rtView = previousRTView;
device()->OMSetRenderTargets(1, &rtView, NULL);
device()->OMSetRenderTargets(1, &rtView, nullptr);
effect()->GetVariableByName("vRenderTargetOffset")->
SetRawValue(previousRenderTargetOffset, 0, 8);
@ -360,7 +360,7 @@ ContainerLayerD3D10::RenderLayer()
technique->GetPassByIndex(0)->Apply(0);
ID3D10ShaderResourceView *view;
device()->CreateShaderResourceView(renderTexture, NULL, &view);
device()->CreateShaderResourceView(renderTexture, nullptr, &view);
device()->PSSetShaderResources(0, 1, &view);
device()->Draw(4, 0);
view->Release();

View File

@ -50,7 +50,7 @@ SurfaceToTexture(ID3D10Device *aDevice,
const gfxIntSize &aSize)
{
if (!aSurface) {
return NULL;
return nullptr;
}
if (aSurface->GetType() == gfxASurface::SurfaceTypeD2D) {
@ -106,7 +106,7 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex
dat->mTexture = DataToTexture(device(), remoteImage->mData, remoteImage->mStride, remoteImage->mSize);
if (dat->mTexture) {
device()->CreateShaderResourceView(dat->mTexture, NULL, getter_AddRefs(dat->mSRView));
device()->CreateShaderResourceView(dat->mTexture, nullptr, getter_AddRefs(dat->mSRView));
aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, dat.forget());
}
}
@ -132,7 +132,7 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex
dat->mTexture = SurfaceToTexture(device(), cairoImage->mSurface, cairoImage->mSize);
if (dat->mTexture) {
device()->CreateShaderResourceView(dat->mTexture, NULL, getter_AddRefs(dat->mSRView));
device()->CreateShaderResourceView(dat->mTexture, nullptr, getter_AddRefs(dat->mSRView));
aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, dat.forget());
}
}
@ -152,7 +152,7 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex
nsAutoPtr<TextureD3D10BackendData> dat(new TextureD3D10BackendData());
dat->mTexture = texture;
hr = device()->CreateShaderResourceView(dat->mTexture, NULL, getter_AddRefs(dat->mSRView));
hr = device()->CreateShaderResourceView(dat->mTexture, nullptr, getter_AddRefs(dat->mSRView));
NS_ENSURE_TRUE(SUCCEEDED(hr) && dat->mSRView, nullptr);
aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, dat.forget());
@ -307,7 +307,7 @@ ImageLayerD3D10::RenderLayer()
if (yuvImage->GetData()->mStereoMode != STEREO_MODE_MONO) {
// Dst resource is optional
GetNv3DVUtils()->SendNv3DVMetaData((unsigned int)yuvImage->GetData()->mYSize.width,
(unsigned int)yuvImage->GetData()->mYSize.height, (HANDLE)(data->mYTexture), (HANDLE)(NULL));
(unsigned int)yuvImage->GetData()->mYSize.height, (HANDLE)(data->mYTexture), (HANDLE)(nullptr));
}
}
@ -385,9 +385,9 @@ void ImageLayerD3D10::AllocateTexturesYCbCr(PlanarYCbCrImage *aImage)
hr);
return;
}
device()->CreateShaderResourceView(backendData->mYTexture, NULL, getter_AddRefs(backendData->mYView));
device()->CreateShaderResourceView(backendData->mCbTexture, NULL, getter_AddRefs(backendData->mCbView));
device()->CreateShaderResourceView(backendData->mCrTexture, NULL, getter_AddRefs(backendData->mCrView));
device()->CreateShaderResourceView(backendData->mYTexture, nullptr, getter_AddRefs(backendData->mYView));
device()->CreateShaderResourceView(backendData->mCbTexture, nullptr, getter_AddRefs(backendData->mCbView));
device()->CreateShaderResourceView(backendData->mCrTexture, nullptr, getter_AddRefs(backendData->mCrView));
aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, backendData.forget());
}
@ -454,7 +454,7 @@ RemoteDXGITextureImage::GetAsSurface()
desc.Usage = D3D10_USAGE_STAGING;
nsRefPtr<ID3D10Texture2D> softTexture;
HRESULT hr = device->CreateTexture2D(&desc, NULL, getter_AddRefs(softTexture));
HRESULT hr = device->CreateTexture2D(&desc, nullptr, getter_AddRefs(softTexture));
if (FAILED(hr)) {
NS_WARNING("Failed to create 2D staging texture.");
@ -514,7 +514,7 @@ RemoteDXGITextureImage::GetD3D10TextureBackendData(ID3D10Device *aDevice)
data->mTexture = texture;
aDevice->CreateShaderResourceView(texture, NULL, getter_AddRefs(data->mSRView));
aDevice->CreateShaderResourceView(texture, nullptr, getter_AddRefs(data->mSRView));
SetBackendData(mozilla::layers::LAYERS_D3D10, data);

View File

@ -19,7 +19,7 @@ class ImageLayerD3D10 : public ImageLayer,
{
public:
ImageLayerD3D10(LayerManagerD3D10 *aManager)
: ImageLayer(aManager, NULL)
: ImageLayer(aManager, nullptr)
, LayerD3D10(aManager)
{
mImplData = static_cast<LayerD3D10*>(this);
@ -56,7 +56,7 @@ struct TextureD3D10BackendData : public ImageBackendData
class RemoteDXGITextureImage : public Image {
public:
RemoteDXGITextureImage() : Image(NULL, REMOTE_IMAGE_DXGI_TEXTURE) {}
RemoteDXGITextureImage() : Image(nullptr, REMOTE_IMAGE_DXGI_TEXTURE) {}
already_AddRefed<gfxASurface> GetAsSurface();

View File

@ -89,7 +89,7 @@ LayerManagerD3D10::~LayerManagerD3D10()
mDevice->GetPrivateData(sDeviceAttachments, &size, &attachments);
// No LayerManagers left for this device. Clear out interfaces stored which
// hold a reference to the device.
mDevice->SetPrivateData(sDeviceAttachments, 0, NULL);
mDevice->SetPrivateData(sDeviceAttachments, 0, nullptr);
delete attachments;
}
@ -136,7 +136,7 @@ LayerManagerD3D10::Initialize(bool force, HRESULT* aHresultPtr)
* Do some post device creation setup
*/
if (mNv3DVUtils) {
IUnknown* devUnknown = NULL;
IUnknown* devUnknown = nullptr;
if (mDevice) {
mDevice->QueryInterface(IID_IUnknown, (void **)&devUnknown);
}
@ -168,7 +168,7 @@ LayerManagerD3D10::Initialize(bool force, HRESULT* aHresultPtr)
sizeof(g_main),
D3D10_EFFECT_SINGLE_THREADED,
mDevice,
NULL,
nullptr,
getter_AddRefs(mEffect));
if (FAILED(hr)) {
@ -463,7 +463,7 @@ LayerManagerD3D10::CreateOptimalSurface(const gfxIntSize &aSize,
desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
desc.MiscFlags = D3D10_RESOURCE_MISC_GDI_COMPATIBLE;
HRESULT hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(texture));
HRESULT hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(texture));
if (FAILED(hr)) {
NS_WARNING("Failed to create new texture for CreateOptimalSurface!");
@ -508,7 +508,7 @@ LayerManagerD3D10::CreateDrawTarget(const IntSize &aSize,
CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aSize.width, aSize.height, 1, 1);
desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
HRESULT hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(texture));
HRESULT hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(texture));
if (FAILED(hr)) {
NS_WARNING("Failed to create new texture for CreateOptimalSurface!");
@ -599,7 +599,7 @@ LayerManagerD3D10::SetupPipeline()
}
ID3D10RenderTargetView *view = mRTView;
mDevice->OMSetRenderTargets(1, &view, NULL);
mDevice->OMSetRenderTargets(1, &view, nullptr);
SetupInputAssembler();
@ -620,7 +620,7 @@ LayerManagerD3D10::UpdateRenderTarget()
if (FAILED(hr)) {
return;
}
mDevice->CreateRenderTargetView(backBuf, NULL, getter_AddRefs(mRTView));
mDevice->CreateRenderTargetView(backBuf, nullptr, getter_AddRefs(mRTView));
}
void
@ -753,7 +753,7 @@ LayerManagerD3D10::PaintToTarget()
nsRefPtr<ID3D10Texture2D> readTexture;
HRESULT hr = device()->CreateTexture2D(&softDesc, NULL, getter_AddRefs(readTexture));
HRESULT hr = device()->CreateTexture2D(&softDesc, nullptr, getter_AddRefs(readTexture));
if (FAILED(hr)) {
ReportFailure(NS_LITERAL_CSTRING("LayerManagerD3D10::PaintToTarget(): Failed to create texture"),
hr);

View File

@ -178,7 +178,7 @@ private:
nsAutoPtr<Nv3DVUtils> mNv3DVUtils;
/*
* Context target, NULL when drawing directly to our swap chain.
* Context target, nullptr when drawing directly to our swap chain.
*/
nsRefPtr<gfxContext> mTarget;

View File

@ -18,7 +18,7 @@ class ReadbackLayerD3D10 :
{
public:
ReadbackLayerD3D10(LayerManagerD3D10 *aManager)
: ReadbackLayer(aManager, NULL),
: ReadbackLayer(aManager, nullptr),
LayerD3D10(aManager)
{
mImplData = static_cast<LayerD3D10*>(this);

View File

@ -108,9 +108,9 @@ ReadbackManagerD3D10::ReadbackManagerD3D10()
: mRefCnt(0)
{
::InitializeCriticalSection(&mTaskMutex);
mShutdownEvent = ::CreateEventA(NULL, FALSE, FALSE, NULL);
mTaskSemaphore = ::CreateSemaphoreA(NULL, 0, 1000000, NULL);
mTaskThread = ::CreateThread(NULL, 0, StartTaskThread, this, 0, 0);
mShutdownEvent = ::CreateEventA(nullptr, FALSE, FALSE, nullptr);
mTaskSemaphore = ::CreateSemaphoreA(nullptr, 0, 1000000, nullptr);
mTaskThread = ::CreateThread(nullptr, 0, StartTaskThread, this, 0, 0);
}
ReadbackManagerD3D10::~ReadbackManagerD3D10()
@ -144,7 +144,7 @@ ReadbackManagerD3D10::PostTask(ID3D10Texture2D *aTexture, void *aUpdate, const g
mPendingReadbackTasks.AppendElement(task);
::LeaveCriticalSection(&mTaskMutex);
::ReleaseSemaphore(mTaskSemaphore, 1, NULL);
::ReleaseSemaphore(mTaskSemaphore, 1, nullptr);
}
HRESULT

View File

@ -32,7 +32,7 @@ namespace mozilla {
namespace layers {
ThebesLayerD3D10::ThebesLayerD3D10(LayerManagerD3D10 *aManager)
: ThebesLayer(aManager, NULL)
: ThebesLayer(aManager, nullptr)
, LayerD3D10(aManager)
, mCurrentSurfaceMode(SURFACE_OPAQUE)
{
@ -250,7 +250,7 @@ ThebesLayerD3D10::Validate(ReadbackProcessor *aReadback)
D3D10_CPU_ACCESS_READ);
nsRefPtr<ID3D10Texture2D> readbackTexture;
HRESULT hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(readbackTexture));
HRESULT hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(readbackTexture));
if (FAILED(hr)) {
LayerManagerD3D10::ReportFailure(NS_LITERAL_CSTRING("ThebesLayerD3D10::Validate(): Failed to create texture"),
hr);
@ -333,12 +333,12 @@ ThebesLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsInt
// and probably not worth the win here as this will often be a single
// rect.
nsRefPtr<ID3D10RenderTargetView> oldRT;
device()->OMGetRenderTargets(1, getter_AddRefs(oldRT), NULL);
device()->OMGetRenderTargets(1, getter_AddRefs(oldRT), nullptr);
nsRefPtr<ID3D10RenderTargetView> viewBlack;
nsRefPtr<ID3D10RenderTargetView> viewWhite;
device()->CreateRenderTargetView(mTexture, NULL, getter_AddRefs(viewBlack));
device()->CreateRenderTargetView(mTextureOnWhite, NULL, getter_AddRefs(viewWhite));
device()->CreateRenderTargetView(mTexture, nullptr, getter_AddRefs(viewBlack));
device()->CreateRenderTargetView(mTextureOnWhite, nullptr, getter_AddRefs(viewWhite));
D3D10_RECT oldScissor;
UINT numRects = 1;
@ -356,7 +356,7 @@ ThebesLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsInt
mD3DManager->SetViewport(nsIntSize(desc.Width, desc.Height));
ID3D10RenderTargetView *views[2] = { viewBlack, viewWhite };
device()->OMSetRenderTargets(2, views, NULL);
device()->OMSetRenderTargets(2, views, nullptr);
gfx3DMatrix transform;
transform.Translate(gfxPoint3D(-aOffset.x, -aOffset.y, 0));
@ -383,7 +383,7 @@ ThebesLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsInt
}
views[0] = oldRT;
device()->OMSetRenderTargets(1, views, NULL);
device()->OMSetRenderTargets(1, views, nullptr);
mD3DManager->SetViewport(oldVP);
device()->RSSetScissorRects(1, &oldScissor);
}
@ -464,14 +464,14 @@ ThebesLayerD3D10::CreateNewTextures(const gfxIntSize &aSize, SurfaceMode aMode)
HRESULT hr;
if (!mTexture) {
hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(mTexture));
hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTexture));
if (FAILED(hr)) {
NS_WARNING("Failed to create new texture for ThebesLayerD3D10!");
return;
}
hr = device()->CreateShaderResourceView(mTexture, NULL, getter_AddRefs(mSRView));
hr = device()->CreateShaderResourceView(mTexture, nullptr, getter_AddRefs(mSRView));
if (FAILED(hr)) {
NS_WARNING("Failed to create shader resource view for ThebesLayerD3D10.");
@ -483,7 +483,7 @@ ThebesLayerD3D10::CreateNewTextures(const gfxIntSize &aSize, SurfaceMode aMode)
if (!mD2DSurface || mD2DSurface->CairoStatus()) {
NS_WARNING("Failed to create surface for ThebesLayerD3D10.");
mD2DSurface = NULL;
mD2DSurface = nullptr;
return;
}
} else {
@ -492,14 +492,14 @@ ThebesLayerD3D10::CreateNewTextures(const gfxIntSize &aSize, SurfaceMode aMode)
}
if (aMode == SURFACE_COMPONENT_ALPHA && !mTextureOnWhite) {
hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(mTextureOnWhite));
hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTextureOnWhite));
if (FAILED(hr)) {
NS_WARNING("Failed to create new texture for ThebesLayerD3D10!");
return;
}
hr = device()->CreateShaderResourceView(mTextureOnWhite, NULL, getter_AddRefs(mSRViewOnWhite));
hr = device()->CreateShaderResourceView(mTextureOnWhite, nullptr, getter_AddRefs(mSRViewOnWhite));
if (FAILED(hr)) {
NS_WARNING("Failed to create shader resource view for ThebesLayerD3D10.");

View File

@ -80,7 +80,7 @@ CompositorD3D11::~CompositorD3D11()
mDevice->GetPrivateData(sDeviceAttachmentsD3D11, &size, &attachments);
// No LayerManagers left for this device. Clear out interfaces stored which
// hold a reference to the device.
mDevice->SetPrivateData(sDeviceAttachmentsD3D11, 0, NULL);
mDevice->SetPrivateData(sDeviceAttachmentsD3D11, 0, nullptr);
delete attachments;
}
@ -338,7 +338,7 @@ CompositorD3D11::CreateRenderTarget(const gfx::IntRect &aRect,
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
RefPtr<ID3D11Texture2D> texture;
mDevice->CreateTexture2D(&desc, NULL, byRef(texture));
mDevice->CreateTexture2D(&desc, nullptr, byRef(texture));
RefPtr<CompositingRenderTargetD3D11> rt = new CompositingRenderTargetD3D11(texture);
rt->SetSize(IntSize(aRect.width, aRect.height));
@ -360,7 +360,7 @@ CompositorD3D11::CreateRenderTargetFromSource(const gfx::IntRect &aRect,
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
RefPtr<ID3D11Texture2D> texture;
mDevice->CreateTexture2D(&desc, NULL, byRef(texture));
mDevice->CreateTexture2D(&desc, nullptr, byRef(texture));
RefPtr<CompositingRenderTargetD3D11> rt = new CompositingRenderTargetD3D11(texture);
rt->SetSize(IntSize(aRect.width, aRect.height));
@ -658,7 +658,7 @@ CompositorD3D11::UpdateRenderTarget()
}
mDefaultRT = new CompositingRenderTargetD3D11(nullptr);
mDevice->CreateRenderTargetView(backBuf, NULL, byRef(mDefaultRT->mRTView));
mDevice->CreateRenderTargetView(backBuf, nullptr, byRef(mDefaultRT->mRTView));
}
bool
@ -759,7 +759,7 @@ CompositorD3D11::PaintToTarget()
nsRefPtr<ID3D11Texture2D> readTexture;
HRESULT hr = mDevice->CreateTexture2D(&softDesc, NULL, getter_AddRefs(readTexture));
HRESULT hr = mDevice->CreateTexture2D(&softDesc, nullptr, getter_AddRefs(readTexture));
mContext->CopyResource(readTexture, backBuf);
D3D11_MAPPED_SUBRESOURCE map;

View File

@ -50,7 +50,7 @@ CompositingRenderTargetD3D11::CompositingRenderTargetD3D11(ID3D11Texture2D *aTex
RefPtr<ID3D11Device> device;
mTextures[0]->GetDevice(byRef(device));
HRESULT hr = device->CreateRenderTargetView(mTextures[0], NULL, byRef(mRTView));
HRESULT hr = device->CreateRenderTargetView(mTextures[0], nullptr, byRef(mRTView));
if (FAILED(hr)) {
LOGD3D11("Failed to create RenderTargetView.");
@ -249,7 +249,7 @@ DeprecatedTextureClientD3D11::ReleaseTexture()
void
DeprecatedTextureClientD3D11::ClearDT()
{
// An Azure DrawTarget needs to be locked when it gets NULL'ed as this is
// An Azure DrawTarget needs to be locked when it gets nullptr'ed as this is
// when it calls EndDraw. This EndDraw should not execute anything so it
// shouldn't -really- need the lock but the debug layer chokes on this.
//

View File

@ -242,13 +242,13 @@ CanvasLayerD3D9::CreateTexture()
if (mD3DManager->deviceManager()->HasDynamicTextures()) {
hr = device()->CreateTexture(mBounds.width, mBounds.height, 1, D3DUSAGE_DYNAMIC,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT,
getter_AddRefs(mTexture), NULL);
getter_AddRefs(mTexture), nullptr);
} else {
// D3DPOOL_MANAGED is fine here since we require Dynamic Textures for D3D9Ex
// devices.
hr = device()->CreateTexture(mBounds.width, mBounds.height, 1, 0,
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
getter_AddRefs(mTexture), NULL);
getter_AddRefs(mTexture), nullptr);
}
if (FAILED(hr)) {
mD3DManager->ReportFailure(NS_LITERAL_CSTRING("CanvasLayerD3D9::CreateTexture() failed"),

View File

@ -20,7 +20,7 @@ class CanvasLayerD3D9 :
{
public:
CanvasLayerD3D9(LayerManagerD3D9 *aManager)
: CanvasLayer(aManager, NULL)
: CanvasLayer(aManager, nullptr)
, LayerD3D9(aManager)
, mDataIsPremultiplied(false)
, mNeedsYFlip(false)

View File

@ -16,7 +16,7 @@ class ColorLayerD3D9 : public ColorLayer,
{
public:
ColorLayerD3D9(LayerManagerD3D9 *aManager)
: ColorLayer(aManager, NULL)
: ColorLayer(aManager, nullptr)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);

View File

@ -191,7 +191,7 @@ ContainerRender(Container* aContainer,
HRESULT hr = aManager->device()->CreateTexture(visibleRect.width, visibleRect.height, 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, getter_AddRefs(renderTexture),
NULL);
nullptr);
if (FAILED(hr)) {
aManager->ReportFailure(NS_LITERAL_CSTRING("ContainerLayerD3D9::ContainerRender(): Failed to create texture"),
hr);
@ -324,7 +324,7 @@ ContainerRender(Container* aContainer,
ContainerLayerD3D9::ContainerLayerD3D9(LayerManagerD3D9 *aManager)
: ContainerLayer(aManager, NULL)
: ContainerLayer(aManager, nullptr)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);

View File

@ -170,9 +170,9 @@ DeviceManagerD3D9::Init()
WNDCLASSW wc;
HRESULT hr;
if (!GetClassInfoW(GetModuleHandle(NULL), kClassName, &wc)) {
if (!GetClassInfoW(GetModuleHandle(nullptr), kClassName, &wc)) {
ZeroMemory(&wc, sizeof(WNDCLASSW));
wc.hInstance = GetModuleHandle(NULL);
wc.hInstance = GetModuleHandle(nullptr);
wc.lpfnWndProc = ::DefWindowProc;
wc.lpszClassName = kClassName;
if (!RegisterClassW(&wc)) {
@ -182,8 +182,8 @@ DeviceManagerD3D9::Init()
}
mFocusWnd = ::CreateWindowW(kClassName, L"D3D9Window", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL,
NULL, GetModuleHandle(NULL), NULL);
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr,
nullptr, GetModuleHandle(nullptr), nullptr);
if (!mFocusWnd) {
NS_WARNING("Failed to create DeviceManagerD3D9 Window.");
@ -262,7 +262,7 @@ DeviceManagerD3D9::Init()
D3DCREATE_MULTITHREADED |
D3DCREATE_MIXED_VERTEXPROCESSING,
&pp,
NULL,
nullptr,
getter_AddRefs(mDeviceEx));
if (SUCCEEDED(hr)) {
mDevice = mDeviceEx;
@ -313,7 +313,7 @@ DeviceManagerD3D9::Init()
* Do some post device creation setup
*/
if (mNv3DVUtils) {
IUnknown* devUnknown = NULL;
IUnknown* devUnknown = nullptr;
if (mDevice) {
mDevice->QueryInterface(IID_IUnknown, (void **)&devUnknown);
}
@ -786,7 +786,7 @@ DeviceManagerD3D9::CreateVertexBuffer()
0,
D3DPOOL_DEFAULT,
getter_AddRefs(mVB),
NULL);
nullptr);
if (FAILED(hr)) {
return false;

View File

@ -51,34 +51,34 @@ DataToTexture(IDirect3DDevice9 *aDevice,
if (FAILED(aDevice->
CreateTexture(aSize.width, aSize.height,
1, 0, aFormat, D3DPOOL_DEFAULT,
getter_AddRefs(texture), NULL)))
getter_AddRefs(texture), nullptr)))
{
return NULL;
return nullptr;
}
nsRefPtr<IDirect3DTexture9> tmpTexture;
if (FAILED(aDevice->
CreateTexture(aSize.width, aSize.height,
1, 0, aFormat, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpTexture), NULL)))
getter_AddRefs(tmpTexture), nullptr)))
{
return NULL;
return nullptr;
}
tmpTexture->GetSurfaceLevel(0, getter_AddRefs(surface));
surface->LockRect(&lockedRect, NULL, 0);
surface->LockRect(&lockedRect, nullptr, 0);
NS_ASSERTION(lockedRect.pBits, "Could not lock surface");
} else {
if (FAILED(aDevice->
CreateTexture(aSize.width, aSize.height,
1, 0, aFormat, D3DPOOL_MANAGED,
getter_AddRefs(texture), NULL)))
getter_AddRefs(texture), nullptr)))
{
return NULL;
return nullptr;
}
/* lock the entire texture */
texture->LockRect(0, &lockedRect, NULL, 0);
texture->LockRect(0, &lockedRect, nullptr, 0);
}
uint32_t width = aSize.width;
@ -95,7 +95,7 @@ DataToTexture(IDirect3DDevice9 *aDevice,
surface->UnlockRect();
nsRefPtr<IDirect3DSurface9> dstSurface;
texture->GetSurfaceLevel(0, getter_AddRefs(dstSurface));
aDevice->UpdateSurface(surface, NULL, dstSurface, NULL);
aDevice->UpdateSurface(surface, nullptr, dstSurface, nullptr);
} else {
texture->UnlockRect(0);
}
@ -185,31 +185,31 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage,
HRESULT hr;
hr = aDevice->CreateTexture(data->mYSize.width, data->mYSize.height,
1, 0, D3DFMT_L8, D3DPOOL_DEFAULT,
getter_AddRefs(backendData->mYTexture), NULL);
getter_AddRefs(backendData->mYTexture), nullptr);
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_DEFAULT,
getter_AddRefs(backendData->mCbTexture), NULL);
getter_AddRefs(backendData->mCbTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_DEFAULT,
getter_AddRefs(backendData->mCrTexture), NULL);
getter_AddRefs(backendData->mCrTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mYSize.width, data->mYSize.height,
1, 0, D3DFMT_L8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpYTexture), NULL);
getter_AddRefs(tmpYTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpCbTexture), NULL);
getter_AddRefs(tmpCbTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpCrTexture), NULL);
getter_AddRefs(tmpCrTexture), nullptr);
}
if (FAILED(hr)) {
@ -221,23 +221,23 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage,
tmpYTexture->GetSurfaceLevel(0, getter_AddRefs(tmpSurfaceY));
tmpCbTexture->GetSurfaceLevel(0, getter_AddRefs(tmpSurfaceCb));
tmpCrTexture->GetSurfaceLevel(0, getter_AddRefs(tmpSurfaceCr));
tmpSurfaceY->LockRect(&lockrectY, NULL, 0);
tmpSurfaceCb->LockRect(&lockrectCb, NULL, 0);
tmpSurfaceCr->LockRect(&lockrectCr, NULL, 0);
tmpSurfaceY->LockRect(&lockrectY, nullptr, 0);
tmpSurfaceCb->LockRect(&lockrectCb, nullptr, 0);
tmpSurfaceCr->LockRect(&lockrectCr, nullptr, 0);
} else {
HRESULT hr;
hr = aDevice->CreateTexture(data->mYSize.width, data->mYSize.height,
1, 0, D3DFMT_L8, D3DPOOL_MANAGED,
getter_AddRefs(backendData->mYTexture), NULL);
getter_AddRefs(backendData->mYTexture), nullptr);
if (!FAILED(hr)) {
aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_MANAGED,
getter_AddRefs(backendData->mCbTexture), NULL);
getter_AddRefs(backendData->mCbTexture), nullptr);
}
if (!FAILED(hr)) {
aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_MANAGED,
getter_AddRefs(backendData->mCrTexture), NULL);
getter_AddRefs(backendData->mCrTexture), nullptr);
}
if (FAILED(hr)) {
@ -247,9 +247,9 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage,
}
/* lock the entire texture */
backendData->mYTexture->LockRect(0, &lockrectY, NULL, 0);
backendData->mCbTexture->LockRect(0, &lockrectCb, NULL, 0);
backendData->mCrTexture->LockRect(0, &lockrectCr, NULL, 0);
backendData->mYTexture->LockRect(0, &lockrectY, nullptr, 0);
backendData->mCbTexture->LockRect(0, &lockrectCb, nullptr, 0);
backendData->mCrTexture->LockRect(0, &lockrectCr, nullptr, 0);
}
src = data->mYChannel;
@ -291,11 +291,11 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage,
tmpSurfaceCr->UnlockRect();
nsRefPtr<IDirect3DSurface9> dstSurface;
backendData->mYTexture->GetSurfaceLevel(0, getter_AddRefs(dstSurface));
aDevice->UpdateSurface(tmpSurfaceY, NULL, dstSurface, NULL);
aDevice->UpdateSurface(tmpSurfaceY, nullptr, dstSurface, nullptr);
backendData->mCbTexture->GetSurfaceLevel(0, getter_AddRefs(dstSurface));
aDevice->UpdateSurface(tmpSurfaceCb, NULL, dstSurface, NULL);
aDevice->UpdateSurface(tmpSurfaceCb, nullptr, dstSurface, nullptr);
backendData->mCrTexture->GetSurfaceLevel(0, getter_AddRefs(dstSurface));
aDevice->UpdateSurface(tmpSurfaceCr, NULL, dstSurface, NULL);
aDevice->UpdateSurface(tmpSurfaceCr, nullptr, dstSurface, nullptr);
} else {
backendData->mYTexture->UnlockRect(0);
backendData->mCbTexture->UnlockRect(0);

View File

@ -19,7 +19,7 @@ class ImageLayerD3D9 : public ImageLayer,
{
public:
ImageLayerD3D9(LayerManagerD3D9 *aManager)
: ImageLayer(aManager, NULL)
: ImageLayer(aManager, nullptr)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);

View File

@ -28,8 +28,8 @@ LayerManagerD3D9::LayerManagerD3D9(nsIWidget *aWidget)
: mWidget(aWidget)
, mDeviceResetCount(0)
{
mCurrentCallbackInfo.Callback = NULL;
mCurrentCallbackInfo.CallbackData = NULL;
mCurrentCallbackInfo.Callback = nullptr;
mCurrentCallbackInfo.CallbackData = nullptr;
}
LayerManagerD3D9::~LayerManagerD3D9()
@ -163,12 +163,12 @@ LayerManagerD3D9::EndTransaction(DrawThebesLayerCallback aCallback,
SetCompositingDisabled(aFlags & END_NO_COMPOSITE);
Render();
/* Clean this out for sanity */
mCurrentCallbackInfo.Callback = NULL;
mCurrentCallbackInfo.CallbackData = NULL;
mCurrentCallbackInfo.Callback = nullptr;
mCurrentCallbackInfo.CallbackData = nullptr;
}
// Clear mTarget, next transaction could have no target
mTarget = NULL;
mTarget = nullptr;
}
void
@ -255,7 +255,7 @@ LayerManagerD3D9::Render()
nsIntRect rect;
mWidget->GetClientBounds(rect);
device()->Clear(0, NULL, D3DCLEAR_TARGET, 0x00000000, 0, 0);
device()->Clear(0, nullptr, D3DCLEAR_TARGET, 0x00000000, 0, 0);
device()->BeginScene();
@ -341,12 +341,12 @@ LayerManagerD3D9::PaintToTarget()
device()->CreateOffscreenPlainSurface(desc.Width, desc.Height,
D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(destSurf), NULL);
getter_AddRefs(destSurf), nullptr);
device()->GetRenderTargetData(backBuff, destSurf);
D3DLOCKED_RECT rect;
destSurf->LockRect(&rect, NULL, D3DLOCK_READONLY);
destSurf->LockRect(&rect, nullptr, D3DLOCK_READONLY);
nsRefPtr<gfxImageSurface> imageSurface =
new gfxImageSurface((unsigned char*)rect.pBits,

View File

@ -152,7 +152,7 @@ public:
/**
* Return pointer to the Nv3DVUtils instance. Re-direct to mDeviceManager.
*/
Nv3DVUtils *GetNv3DVUtils() { return mDeviceManager ? mDeviceManager->GetNv3DVUtils() : NULL; }
Nv3DVUtils *GetNv3DVUtils() { return mDeviceManager ? mDeviceManager->GetNv3DVUtils() : nullptr; }
static void OnDeviceManagerDestroy(DeviceManagerD3D9 *aDeviceManager) {
if(aDeviceManager == mDefaultDeviceManager)
@ -182,7 +182,7 @@ private:
nsIWidget *mWidget;
/*
* Context target, NULL when drawing directly to our swap chain.
* Context target, nullptr when drawing directly to our swap chain.
*/
nsRefPtr<gfxContext> mTarget;
@ -298,7 +298,7 @@ public:
LockTextureRectD3D9(IDirect3DTexture9* aTexture)
: mTexture(aTexture)
{
mLockResult = mTexture->LockRect(0, &mR, NULL, 0);
mLockResult = mTexture->LockRect(0, &mR, nullptr, 0);
}
~LockTextureRectD3D9()

View File

@ -23,7 +23,7 @@ namespace layers {
* Constructor and Destructor
*/
Nv3DVUtils::Nv3DVUtils()
: m3DVStreaming (NULL)
: m3DVStreaming (nullptr)
{
}
@ -60,14 +60,14 @@ Nv3DVUtils::Initialize()
/*
* Create the COM object. If we fail at any stage, just return
*/
HRESULT hr = CoCreateInstance(CLSID_NV3DVStreaming, NULL, CLSCTX_INPROC_SERVER, IID_INV3DVStreaming, (void**)(getter_AddRefs(m3DVStreaming)));
HRESULT hr = CoCreateInstance(CLSID_NV3DVStreaming, nullptr, CLSCTX_INPROC_SERVER, IID_INV3DVStreaming, (void**)(getter_AddRefs(m3DVStreaming)));
if (FAILED(hr) || !m3DVStreaming) {
WARNING("Nv3DVStreaming CoCreateInstance failed (disabled).");
return;
}
/*
* Initialize the object. Note that m3DVStreaming cannot be NULL at this point.
* Initialize the object. Note that m3DVStreaming cannot be nullptr at this point.
*/
bool bRetVal = m3DVStreaming->Nv3DVInitialize();
@ -79,7 +79,7 @@ Nv3DVUtils::Initialize()
/**
* Release resources used by the COM Object, and then release
* the COM Object (nsRefPtr gets released by setting to NULL)
* the COM Object (nsRefPtr gets released by setting to nullptr)
*
*/
void
@ -98,7 +98,7 @@ void
Nv3DVUtils::SetDeviceInfo(IUnknown *devUnknown)
{
if (!devUnknown) {
WARNING("D3D Device Pointer (IUnknown) is NULL.\n");
WARNING("D3D Device Pointer (IUnknown) is nullptr.\n");
return;
}

View File

@ -18,7 +18,7 @@ class ReadbackLayerD3D9 :
{
public:
ReadbackLayerD3D9(LayerManagerD3D9 *aManager)
: ReadbackLayer(aManager, NULL),
: ReadbackLayer(aManager, nullptr),
LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);

View File

@ -24,7 +24,7 @@ namespace mozilla {
namespace layers {
ThebesLayerD3D9::ThebesLayerD3D9(LayerManagerD3D9 *aManager)
: ThebesLayer(aManager, NULL)
: ThebesLayer(aManager, nullptr)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);
@ -261,7 +261,7 @@ ThebesLayerD3D9::RenderThebesLayer(ReadbackProcessor* aReadback)
// Restore defaults
device()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
device()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
device()->SetTexture(1, NULL);
device()->SetTexture(1, nullptr);
} else {
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER,
GetMaskLayer());
@ -340,7 +340,7 @@ ThebesLayerD3D9::VerifyContentType(SurfaceMode aMode)
class OpaqueRenderer {
public:
OpaqueRenderer(const nsIntRegion& aUpdateRegion) :
mUpdateRegion(aUpdateRegion), mDC(NULL) {}
mUpdateRegion(aUpdateRegion), mDC(nullptr) {}
~OpaqueRenderer() { End(); }
already_AddRefed<gfxWindowsSurface> Begin(LayerD3D9* aLayer);
void End();
@ -360,7 +360,7 @@ OpaqueRenderer::Begin(LayerD3D9* aLayer)
HRESULT hr = aLayer->device()->
CreateTexture(bounds.width, bounds.height, 1, 0, D3DFMT_X8R8G8B8,
D3DPOOL_SYSTEMMEM, getter_AddRefs(mTmpTexture), NULL);
D3DPOOL_SYSTEMMEM, getter_AddRefs(mTmpTexture), nullptr);
if (FAILED(hr)) {
aLayer->ReportFailure(NS_LITERAL_CSTRING("Failed to create temporary texture in system memory."), hr);
@ -390,8 +390,8 @@ OpaqueRenderer::End()
{
if (mSurface && mDC) {
mSurface->ReleaseDC(mDC);
mSurface = NULL;
mDC = NULL;
mSurface = nullptr;
mDC = nullptr;
}
}
@ -428,7 +428,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
case SURFACE_SINGLE_CHANNEL_ALPHA: {
hr = device()->CreateTexture(bounds.width, bounds.height, 1,
0, D3DFMT_A8R8G8B8,
D3DPOOL_SYSTEMMEM, getter_AddRefs(tmpTexture), NULL);
D3DPOOL_SYSTEMMEM, getter_AddRefs(tmpTexture), nullptr);
if (FAILED(hr)) {
ReportFailure(NS_LITERAL_CSTRING("Failed to create temporary texture in system memory."), hr);
@ -521,7 +521,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
context->Paint();
}
imgSurface = NULL;
imgSurface = nullptr;
srcTextures.AppendElement(tmpTexture);
destTextures.AppendElement(mTexture);
@ -579,7 +579,7 @@ ThebesLayerD3D9::CreateNewTextures(const gfxIntSize &aSize,
HRESULT hr = device()->CreateTexture(aSize.width, aSize.height, 1,
D3DUSAGE_RENDERTARGET,
aMode != SURFACE_SINGLE_CHANNEL_ALPHA ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), NULL);
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), nullptr);
if (FAILED(hr)) {
ReportFailure(NS_LITERAL_CSTRING("ThebesLayerD3D9::CreateNewTextures(): Failed to create texture"),
hr);
@ -590,7 +590,7 @@ ThebesLayerD3D9::CreateNewTextures(const gfxIntSize &aSize,
hr = device()->CreateTexture(aSize.width, aSize.height, 1,
D3DUSAGE_RENDERTARGET,
D3DFMT_X8R8G8B8,
D3DPOOL_DEFAULT, getter_AddRefs(mTextureOnWhite), NULL);
D3DPOOL_DEFAULT, getter_AddRefs(mTextureOnWhite), nullptr);
if (FAILED(hr)) {
ReportFailure(NS_LITERAL_CSTRING("ThebesLayerD3D9::CreateNewTextures(): Failed to create texture (2)"),
hr);

View File

@ -31,7 +31,7 @@ void
CompositorChild::Destroy()
{
mLayerManager->Destroy();
mLayerManager = NULL;
mLayerManager = nullptr;
while (size_t len = ManagedPLayerTransactionChild().Length()) {
LayerTransactionChild* layers =
static_cast<LayerTransactionChild*>(ManagedPLayerTransactionChild()[len - 1]);
@ -94,7 +94,7 @@ CompositorChild::ActorDestroy(ActorDestroyReason aWhy)
NS_RUNTIMEABORT("ActorDestroy by IPC channel failure at CompositorChild");
}
sCompositor = NULL;
sCompositor = nullptr;
// We don't want to release the ref to sCompositor here, during
// cleanup, because that will cause it to be deleted while it's
// still being used. So defer the deletion to after it's not in

View File

@ -132,7 +132,7 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
bool aUseExternalSurfaceSize,
int aSurfaceWidth, int aSurfaceHeight)
: mWidget(aWidget)
, mCurrentCompositeTask(NULL)
, mCurrentCompositeTask(nullptr)
, mIsTesting(false)
, mPaused(false)
, mUseExternalSurfaceSize(aUseExternalSurfaceSize)
@ -527,7 +527,7 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
if (!isFirstPaint &&
!mCompositionManager->IsFirstPaint() &&
mCompositionManager->RequiresReorientation(aTargetConfig.orientation())) {
if (mForceCompositionTask != NULL) {
if (mForceCompositionTask != nullptr) {
mForceCompositionTask->Cancel();
}
mForceCompositionTask = NewRunnableMethod(this, &CompositorParent::ForceComposition);

View File

@ -29,7 +29,8 @@ using mozilla::ScreenRotation;
using nsCSSProperty;
using mozilla::dom::ScreenOrientation;
using mozilla::layers::TextureInfo;
using mozilla::gfx::Margin;
using mozilla::LayerMargin;
using mozilla::LayerPoint;
using mozilla::layers::ImageLayer::ScaleMode;
namespace mozilla {
@ -186,8 +187,8 @@ struct CommonLayerAttributes {
bool useClipRect;
nsIntRect clipRect;
bool isFixedPosition;
gfxPoint fixedPositionAnchor;
Margin fixedPositionMargin;
LayerPoint fixedPositionAnchor;
LayerMargin fixedPositionMargin;
nullable PLayer maskLayer;
// Animated colors will only honored for ColorLayers.
Animation[] animations;

View File

@ -185,7 +185,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
EditReplyVector replyv;
layer_manager()->BeginTransactionWithTarget(NULL);
layer_manager()->BeginTransactionWithTarget(nullptr);
for (EditArray::index_type i = 0; i < cset.Length(); ++i) {
const Edit& edit = cset[i];
@ -251,7 +251,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
layer->SetVisibleRegion(common.visibleRegion());
layer->SetContentFlags(common.contentFlags());
layer->SetOpacity(common.opacity());
layer->SetClipRect(common.useClipRect() ? &common.clipRect() : NULL);
layer->SetClipRect(common.useClipRect() ? &common.clipRect() : nullptr);
layer->SetBaseTransform(common.transform().value());
layer->SetPostScale(common.postXScale(), common.postYScale());
layer->SetIsFixedPosition(common.isFixedPosition());
@ -260,7 +260,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
if (PLayerParent* maskLayer = common.maskLayerParent()) {
layer->SetMaskLayer(cast(maskLayer)->AsLayer());
} else {
layer->SetMaskLayer(NULL);
layer->SetMaskLayer(nullptr);
}
layer->SetAnimations(common.animations());
@ -361,7 +361,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
const OpAppendChild& oac = edit.get_OpAppendChild();
ShadowContainer(oac)->AsContainer()->InsertAfter(
ShadowChild(oac)->AsLayer(), NULL);
ShadowChild(oac)->AsLayer(), nullptr);
break;
}
case Edit::TOpRemoveChild: {
@ -385,7 +385,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
const OpRaiseToTopChild& rtc = edit.get_OpRaiseToTopChild();
ShadowContainer(rtc)->AsContainer()->RepositionChild(
ShadowChild(rtc)->AsLayer(), NULL);
ShadowChild(rtc)->AsLayer(), nullptr);
break;
}
case Edit::TCompositableOperation: {
@ -411,7 +411,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
}
}
layer_manager()->EndTransaction(NULL, NULL, LayerManager::END_NO_IMMEDIATE_REDRAW);
layer_manager()->EndTransaction(nullptr, nullptr, LayerManager::END_NO_IMMEDIATE_REDRAW);
if (reply) {
reply->SetCapacity(replyv.size());

View File

@ -14,7 +14,7 @@
namespace mozilla {
namespace layers {
ShadowLayerParent::ShadowLayerParent() : mLayer(NULL)
ShadowLayerParent::ShadowLayerParent() : mLayer(nullptr)
{
}
@ -77,7 +77,7 @@ ShadowLayerParent::ActorDestroy(ActorDestroyReason why)
return; // unreached
}
mLayer = NULL;
mLayer = nullptr;
}
} // namespace layers

View File

@ -164,7 +164,7 @@ CompositableForwarder::IdentifyTextureHost(const TextureFactoryIdentifier& aIden
}
ShadowLayerForwarder::ShadowLayerForwarder()
: mShadowManager(NULL)
: mShadowManager(nullptr)
, mIsFirstPaint(false)
, mDrawColoredBorders(false)
, mWindowOverlayChanged(false)
@ -199,7 +199,7 @@ template<typename OpCreateT>
static void
CreatedLayer(Transaction* aTxn, ShadowableLayer* aLayer)
{
aTxn->AddEdit(OpCreateT(NULL, Shadow(aLayer)));
aTxn->AddEdit(OpCreateT(nullptr, Shadow(aLayer)));
}
void
@ -248,7 +248,7 @@ mTxn->AddMutant(aMutant);
void
ShadowLayerForwarder::SetRoot(ShadowableLayer* aRoot)
{
mTxn->AddEdit(OpSetRoot(NULL, Shadow(aRoot)));
mTxn->AddEdit(OpSetRoot(nullptr, Shadow(aRoot)));
}
void
ShadowLayerForwarder::InsertAfter(ShadowableLayer* aContainer,
@ -256,12 +256,12 @@ ShadowLayerForwarder::InsertAfter(ShadowableLayer* aContainer,
ShadowableLayer* aAfter)
{
if (aAfter)
mTxn->AddEdit(OpInsertAfter(NULL, Shadow(aContainer),
NULL, Shadow(aChild),
NULL, Shadow(aAfter)));
mTxn->AddEdit(OpInsertAfter(nullptr, Shadow(aContainer),
nullptr, Shadow(aChild),
nullptr, Shadow(aAfter)));
else
mTxn->AddEdit(OpAppendChild(NULL, Shadow(aContainer),
NULL, Shadow(aChild)));
mTxn->AddEdit(OpAppendChild(nullptr, Shadow(aContainer),
nullptr, Shadow(aChild)));
}
void
ShadowLayerForwarder::RemoveChild(ShadowableLayer* aContainer,
@ -270,8 +270,8 @@ ShadowLayerForwarder::RemoveChild(ShadowableLayer* aContainer,
MOZ_LAYERS_LOG(("[LayersForwarder] OpRemoveChild container=%p child=%p\n",
aContainer->AsLayer(), aChild->AsLayer()));
mTxn->AddEdit(OpRemoveChild(NULL, Shadow(aContainer),
NULL, Shadow(aChild)));
mTxn->AddEdit(OpRemoveChild(nullptr, Shadow(aContainer),
nullptr, Shadow(aChild)));
}
void
ShadowLayerForwarder::RepositionChild(ShadowableLayer* aContainer,
@ -281,14 +281,14 @@ ShadowLayerForwarder::RepositionChild(ShadowableLayer* aContainer,
if (aAfter) {
MOZ_LAYERS_LOG(("[LayersForwarder] OpRepositionChild container=%p child=%p after=%p",
aContainer->AsLayer(), aChild->AsLayer(), aAfter->AsLayer()));
mTxn->AddEdit(OpRepositionChild(NULL, Shadow(aContainer),
NULL, Shadow(aChild),
NULL, Shadow(aAfter)));
mTxn->AddEdit(OpRepositionChild(nullptr, Shadow(aContainer),
nullptr, Shadow(aChild),
nullptr, Shadow(aAfter)));
} else {
MOZ_LAYERS_LOG(("[LayersForwarder] OpRaiseToTopChild container=%p child=%p",
aContainer->AsLayer(), aChild->AsLayer()));
mTxn->AddEdit(OpRaiseToTopChild(NULL, Shadow(aContainer),
NULL, Shadow(aChild)));
mTxn->AddEdit(OpRaiseToTopChild(nullptr, Shadow(aContainer),
nullptr, Shadow(aChild)));
}
}
@ -298,7 +298,7 @@ ShadowLayerForwarder::PaintedTiledLayerBuffer(CompositableClient* aCompositable,
{
if (XRE_GetProcessType() != GeckoProcessType_Default)
NS_RUNTIMEABORT("PaintedTiledLayerBuffer must be made IPC safe (not share pointers)");
mTxn->AddNoSwapPaint(OpPaintTiledLayerBuffer(NULL, aCompositable->GetIPDLActor(),
mTxn->AddNoSwapPaint(OpPaintTiledLayerBuffer(nullptr, aCompositable->GetIPDLActor(),
uintptr_t(aTiledLayerBuffer)));
}
@ -430,16 +430,16 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
if (Layer* maskLayer = mutant->GetMaskLayer()) {
common.maskLayerChild() = Shadow(maskLayer->AsShadowableLayer());
} else {
common.maskLayerChild() = NULL;
common.maskLayerChild() = nullptr;
}
common.maskLayerParent() = NULL;
common.maskLayerParent() = nullptr;
common.animations() = mutant->GetAnimations();
attrs.specific() = null_t();
mutant->FillSpecificAttributes(attrs.specific());
MOZ_LAYERS_LOG(("[LayersForwarder] OpSetLayerAttributes(%p)\n", mutant));
mTxn->AddEdit(OpSetLayerAttributes(NULL, Shadow(shadow), attrs));
mTxn->AddEdit(OpSetLayerAttributes(nullptr, Shadow(shadow), attrs));
}
AutoInfallibleTArray<Edit, 10> cset;

View File

@ -228,17 +228,17 @@ public:
void SetRoot(ShadowableLayer* aRoot);
/**
* Insert |aChild| after |aAfter| in |aContainer|. |aAfter| can be
* NULL to indicated that |aChild| should be appended to the end of
* nullptr to indicated that |aChild| should be appended to the end of
* |aContainer|'s child list.
*/
void InsertAfter(ShadowableLayer* aContainer,
ShadowableLayer* aChild,
ShadowableLayer* aAfter=NULL);
ShadowableLayer* aAfter = nullptr);
void RemoveChild(ShadowableLayer* aContainer,
ShadowableLayer* aChild);
void RepositionChild(ShadowableLayer* aContainer,
ShadowableLayer* aChild,
ShadowableLayer* aAfter=NULL);
ShadowableLayer* aAfter = nullptr);
/**
* Set aMaskLayer as the mask on aLayer.
@ -472,13 +472,13 @@ public:
/**
* Return the IPC handle to a Shadow*Layer referring to this if one
* exists, NULL if not.
* exists, nullptr if not.
*/
PLayerChild* GetShadow() { return mShadow; }
virtual CompositableClient* GetCompositableClient() { return nullptr; }
protected:
ShadowableLayer() : mShadow(NULL) {}
ShadowableLayer() : mShadow(nullptr) {}
PLayerChild* mShadow;
};

View File

@ -26,7 +26,7 @@ class CanvasLayerOGL :
{
public:
CanvasLayerOGL(LayerManagerOGL *aManager)
: CanvasLayer(aManager, NULL)
: CanvasLayer(aManager, nullptr)
, LayerOGL(aManager)
, mLayerProgram(RGBALayerProgramType)
, mTexture(0)

View File

@ -19,7 +19,7 @@ class ColorLayerOGL : public ColorLayer,
{
public:
ColorLayerOGL(LayerManagerOGL *aManager)
: ColorLayer(aManager, NULL)
: ColorLayer(aManager, nullptr)
, LayerOGL(aManager)
{
mImplData = static_cast<LayerOGL*>(this);

View File

@ -428,7 +428,7 @@ CompositorOGL::Initialize()
0,
LOCAL_GL_RGBA,
LOCAL_GL_UNSIGNED_BYTE,
NULL);
nullptr);
// unbind this texture, in preparation for binding it to the FBO
mGLContext->fBindTexture(target, 0);
@ -911,7 +911,7 @@ CompositorOGL::CreateFBOWithTexture(const IntRect& aRect, SurfaceInitMode aInit,
0,
LOCAL_GL_RGBA,
LOCAL_GL_UNSIGNED_BYTE,
NULL);
nullptr);
}
mGLContext->fTexParameteri(mFBOTextureTarget, LOCAL_GL_TEXTURE_MIN_FILTER,
LOCAL_GL_LINEAR);

View File

@ -347,7 +347,7 @@ ContainerRender(Container* aContainer,
}
ContainerLayerOGL::ContainerLayerOGL(LayerManagerOGL *aManager)
: ContainerLayer(aManager, NULL)
: ContainerLayer(aManager, nullptr)
, LayerOGL(aManager)
{
mImplData = static_cast<LayerOGL*>(this);

View File

@ -395,7 +395,7 @@ UploadYUVToTexture(GLContext* gl, const PlanarYCbCrImage::Data& aData,
}
ImageLayerOGL::ImageLayerOGL(LayerManagerOGL *aManager)
: ImageLayer(aManager, NULL)
: ImageLayer(aManager, nullptr)
, LayerOGL(aManager)
, mTextureRecycleBin(new TextureRecycleBin())
{

View File

@ -339,7 +339,7 @@ LayerManagerOGL::Initialize(bool force)
0,
LOCAL_GL_RGBA,
LOCAL_GL_UNSIGNED_BYTE,
NULL);
nullptr);
// unbind this texture, in preparation for binding it to the FBO
mGLContext->fBindTexture(target, 0);
@ -564,7 +564,7 @@ LayerManagerOGL::EndTransaction(DrawThebesLayerCallback aCallback,
mThebesLayerCallbackData = nullptr;
}
mTarget = NULL;
mTarget = nullptr;
#ifdef MOZ_LAYERS_HAVE_LOG
Log();
@ -1078,7 +1078,7 @@ LayerManagerOGL::SetupBackBuffer(int aWidth, int aHeight)
0,
LOCAL_GL_RGBA,
LOCAL_GL_UNSIGNED_BYTE,
NULL);
nullptr);
mGLContext->fBindTexture(mFBOTextureTarget, 0);
mGLContext->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mBackBufferFBO);
@ -1236,7 +1236,7 @@ LayerManagerOGL::CreateFBOWithTexture(const nsIntRect& aRect, InitMode aInit,
0,
LOCAL_GL_RGBA,
LOCAL_GL_UNSIGNED_BYTE,
NULL);
nullptr);
}
mGLContext->fTexParameteri(mFBOTextureTarget, LOCAL_GL_TEXTURE_MIN_FILTER,
LOCAL_GL_LINEAR);

View File

@ -16,7 +16,7 @@
#include <windows.h>
#endif
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
#define BUFFER_OFFSET(i) ((char *)nullptr + (i))
#include "gfxContext.h"
#include "gfx3DMatrix.h"
@ -321,7 +321,7 @@ private:
nsIntSize mSurfaceSize;
/**
* Context target, NULL when drawing directly to our swap chain.
* Context target, nullptr when drawing directly to our swap chain.
*/
nsRefPtr<gfxContext> mTarget;

View File

@ -329,7 +329,7 @@ ShaderProgramOGL::CreateShader(GLenum aShaderType, const char *aShaderSource)
GLint success, len = 0;
GLint sh = mGL->fCreateShader(aShaderType);
mGL->fShaderSource(sh, 1, (const GLchar**)&aShaderSource, NULL);
mGL->fShaderSource(sh, 1, (const GLchar**)&aShaderSource, nullptr);
mGL->fCompileShader(sh);
mGL->fGetShaderiv(sh, LOCAL_GL_COMPILE_STATUS, &success);
mGL->fGetShaderiv(sh, LOCAL_GL_INFO_LOG_LENGTH, (GLint*) &len);

View File

@ -12,10 +12,10 @@
namespace mozilla {
namespace gl {
static GLContext* sActiveContext = NULL;
static GLContext* sActiveContext = nullptr;
static Monitor* sMonitor = NULL;
static nsDeque* sTextures = NULL;
static Monitor* sMonitor = nullptr;
static nsDeque* sTextures = nullptr;
GLuint TexturePoolOGL::AcquireTexture()
{
@ -89,7 +89,7 @@ void TexturePoolOGL::Fill(GLContext* aContext)
sActiveContext->MakeCurrent();
GLuint* texture = NULL;
GLuint* texture = nullptr;
while (sTextures->GetSize() < TEXTURE_POOL_SIZE) {
texture = (GLuint*)malloc(sizeof(GLuint));
sActiveContext->fGenTextures(1, texture);

View File

@ -44,8 +44,8 @@ DefaultXDisplay()
/**
* Sets *aVisual to point to aDisplay's Visual struct corresponding to
* aVisualID, and *aDepth to its depth. When aVisualID is None, these are set
* to NULL and 0 respectively. Both out-parameter pointers are assumed
* non-NULL.
* to nullptr and 0 respectively. Both out-parameter pointers are assumed
* non-nullptr.
*/
void
FindVisualAndDepth(Display* aDisplay, VisualID aVisualID,
@ -72,8 +72,8 @@ template <typename T>
struct ScopedXFreePtrTraits
{
typedef T *type;
static T *empty() { return NULL; }
static void release(T *ptr) { if (ptr!=NULL) XFree(ptr); }
static T *empty() { return nullptr; }
static void release(T *ptr) { if (ptr != nullptr) XFree(ptr); }
};
SCOPED_TEMPLATE(ScopedXFree, ScopedXFreePtrTraits)

Some files were not shown because too many files have changed in this diff Show More