Merge last green PGO build from mozilla-inbound to mozilla-central

This commit is contained in:
Marco Bonardo 2012-01-04 13:25:07 +01:00
commit 05fe7c6e1a
760 changed files with 3688 additions and 4795 deletions

View File

@ -819,7 +819,7 @@ called, Windows sends the window in question a <a
href="http://lxr.mozilla.org/seamonkey/search?string=WM_GETOBJECT">WM_GETOBJECT</a>
message requesting an IAccessible for your root object in the window. In
our case, this event is received in <a
href="http://lxr.mozilla.org/seamonkey/source/widget/src/windows/nsWindow.cpp#4370">mozilla/widget/src/windows/nsWindow.cpp</a>.
href="http://lxr.mozilla.org/mozilla-central/source/widget/windows/nsWindow.cpp#4370">mozilla/widget/windows/nsWindow.cpp</a>.
We send back an IAccessible pointer which can be used by the client to
get information about this root object. The assistive technology will
use that root IAccessible to traverse the rest of the object tree, by

View File

@ -614,7 +614,7 @@ toplevel_event_watcher(GSignalInvocationHint* ihint,
bool
nsApplicationAccessibleWrap::Init()
{
// XXX following code is copied from widget/src/gtk2/nsWindow.cpp
// XXX following code is copied from widget/gtk2/nsWindow.cpp
// we should put it to somewhere that can be used from both modules
// see bug 390761

View File

@ -40,7 +40,7 @@
#import "mozView.h"
/* This protocol's primary use is so widget/src/cocoa can talk back to us
/* This protocol's primary use is so widget/cocoa can talk back to us
properly.
ChildView owns the topmost mozRootAccessible, and needs to take care of setting up

View File

@ -384,7 +384,7 @@ pref("security.fileuri.strict_origin_policy", false);
// Temporarily force-enable GL compositing. This is default-disabled
// deep within the bowels of the widgetry system. Remove me when GL
// compositing isn't default disabled in widget/src/android.
// compositing isn't default disabled in widget/android.
pref("layers.acceleration.force-enabled", true);
// screen.enabled and screen.brightness properties.

View File

@ -140,7 +140,7 @@
<menuitem id="context-copyimage-contents"
label="&copyImageContentsCmd.label;"
accesskey="&copyImageContentsCmd.accesskey;"
oncommand="goDoCommand('cmd_copyImageContents');"/>
oncommand="goDoCommand('cmd_copyImage');"/>
#endif
<menuitem id="context-copyimage"
label="&copyImageCmd.label;"

View File

@ -83,9 +83,9 @@
.devtools-searchinput {
-moz-appearance: none;
margin: 0 3px;
background-color: transparent;
border: 1px solid hsla(210,8%,5%,.6);
border-radius: 20px;
border-radius: 2px;
background-color: transparent;
background-image: url(magnifying-glass.png), -moz-linear-gradient(hsla(210,16%,76%,.15), hsla(210,16%,76%,.35));
background-repeat: no-repeat;
background-position: 4px 3px, top left, top left;

View File

@ -500,7 +500,10 @@ class NetworkTools:
return None
def getLanIp(self):
ip = socket.gethostbyname(socket.gethostname())
try:
ip = socket.gethostbyname(socket.gethostname())
except socket.gaierror:
ip = socket.gethostbyname(socket.gethostname() + ".local") # for Mac OS X
if ip.startswith("127.") and os.name != "nt":
interfaces = ["eth0","eth1","eth2","wlan0","wlan1","wifi0","ath0","ath1","ppp0"]
for ifname in interfaces:

View File

@ -94,7 +94,6 @@ OMNIJAR_NAME = @OMNIJAR_NAME@
MOZ_WIDGET_TOOLKIT = @MOZ_WIDGET_TOOLKIT@
MOZ_GFX_OPTIMIZE_MOBILE = @MOZ_GFX_OPTIMIZE_MOBILE@
MOZ_DFB = @MOZ_DFB@
MOZ_X11 = @MOZ_X11@
MOZ_PANGO = @MOZ_PANGO@

View File

@ -113,11 +113,6 @@ fusion/protocol.h
fusion/fusion.h
fusion/arena.h
fusion/object.h
directfbgl.h
directfb_version.h
directfb.h
directfb_util.h
directfb_keynames.h
dgiff.h
direct/util.h
direct/memcpy.h

View File

@ -4799,7 +4799,6 @@ MOZ_ARG_HEADER(Toolkit Options)
Mac OS X - cairo-cocoa
OS/2 - cairo-os2
Win32 - cairo-windows
Gtk2 with DirectFB - cairo-gtk2-dfb
* - cairo-gtk2
* - cairo-qt],
[ _DEFAULT_TOOLKIT=$enableval ],
@ -4807,7 +4806,6 @@ MOZ_ARG_HEADER(Toolkit Options)
if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
-o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
-o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
@ -4854,24 +4852,6 @@ cairo-gtk2|cairo-gtk2-x11)
MOZ_INSTRUMENT_EVENT_LOOP=1
;;
cairo-gtk2-dfb)
MOZ_WIDGET_TOOLKIT=gtk2
MOZ_ENABLE_GTK2=1
MOZ_WEBGL=
AC_DEFINE(MOZ_DFB)
MOZ_DFB=1
TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
TK_LIBS='$(MOZ_GTK2_LIBS)'
AC_DEFINE(MOZ_WIDGET_GTK2)
if test "$no_x" != "yes"; then
AC_MSG_WARN([Disabling X when DirectFB is specified.])
no_x=yes
fi
MOZ_PDF_PRINTING=1
;;
cairo-qt)
MOZ_WIDGET_TOOLKIT=qt
MOZ_ENABLE_QT=1
@ -4967,9 +4947,6 @@ if test "$COMPILE_ENVIRONMENT"; then
if test "$MOZ_ENABLE_GTK2"; then
if test "$MOZ_X11"; then
GDK_PACKAGES=gdk-x11-2.0
elif test "$MOZ_DFB"; then
PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
GDK_PACKAGES=directfb
fi
PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
@ -5127,7 +5104,6 @@ AC_SUBST(MOZ_QT_LIBS)
AC_SUBST(MOC)
AC_SUBST(RCC)
AC_SUBST(MOZ_DFB)
AC_SUBST(MOZ_X11)
dnl ========================================================

View File

@ -1,4 +1,4 @@
This is a local copy of the WebGL conformance suite, SVN revision 16237
This is a local copy of the WebGL conformance suite, SVN revision 16456
The canonical location for this testsuite is:

View File

@ -11,7 +11,10 @@ var wtu = WebGLTestUtils;
var canvas;
var gl;
var shouldGenerateGLError;
var extension_name = "WEBGL_EXT_lose_context";
var extensionNames = [
"WEBKIT_WEBGL_lose_context",
"MOZ_WEBGL_lose_context",
];
var extension;
var bufferObjects;
var program;
@ -33,22 +36,19 @@ function init()
testLosingContext();
}
function runTest1()
{
testLosingAndRestoringContext();
finishTest();
}
function setupTest()
{
canvas = document.createElement("canvas");
canvas.width = 1;
canvas.height = 1;
gl = wtu.create3DContext(canvas);
extension = gl.getExtension(extension_name);
for (var ii = 0; ii < extensionNames.length; ++ii) {
extension = gl.getExtension(extensionNames[ii]);
if (extension)
break;
}
if (!extension) {
debug(extension_name + " extension not found.");
debug("Could not find lose_context extension under the following names: " + extensionNames.join(" "));
return false;
}
return true;
@ -61,13 +61,13 @@ function testLosingContext()
debug("Test losing a context and inability to restore it.");
canvas.addEventListener("webglcontextlost", function() {
testLostContext();
canvas.addEventListener("webglcontextlost", function(e) {
testLostContext(e);
// restore the context after this event has exited.
setTimeout(function() {
// we didn't call prevent default so we should not be able to restore the context
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "extension.restoreContext()");
testLosingAndRetoreingContext();
testLosingAndRestoringContext();
}, 1);
});
canvas.addEventListener("webglcontextrestored", testShouldNotRestoreContext);
@ -82,7 +82,7 @@ function testLosingContext()
shouldBe("gl.getError()", "gl.CONTEXT_LOST_WEBGL");
shouldBe("gl.getError()", "gl.NO_ERROR");
// gl methods should be no-ops
shouldGenerateGLError(gl, gl.NO_ERROR, gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP));
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP)");
// but the event should not have been fired.
shouldBeFalse("contextLostEventFired");
}
@ -95,8 +95,8 @@ function testLosingAndRestoringContext()
debug("");
debug("Test losing and restoring a context.");
canvas.addEventListener("webglcontextlost", function() {
testLostContext();
canvas.addEventListener("webglcontextlost", function(e) {
testLostContext(e);
// restore the context after this event has exited.
setTimeout(function() {
shouldGenerateGLError(gl, gl.NO_ERROR, "extension.restoreContext()");
@ -105,7 +105,7 @@ function testLosingAndRestoringContext()
shouldBeTrue("gl.isContextLost()");
shouldBe("gl.getError()", "gl.NO_ERROR");
// gl methods should still be no-ops
shouldGenerateGLError(gl, gl.NO_ERROR, gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP));
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP)");
}, 1);
});
canvas.addEventListener("webglcontextrestored", function() {
@ -123,7 +123,7 @@ function testLosingAndRestoringContext()
shouldBe("gl.getError()", "gl.CONTEXT_LOST_WEBGL");
shouldBe("gl.getError()", "gl.NO_ERROR");
// gl methods should be no-ops
shouldGenerateGLError(gl, gl.NO_ERROR, gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP));
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP)");
// but the event should not have been fired.
shouldBeFalse("contextLostEventFired");
}

View File

@ -11,7 +11,11 @@ var wtu;
var canvas;
var gl;
var shouldGenerateGLError;
var extension_name = "WEBGL_EXT_lose_context";
var extensionNames = [
"WEBKIT_WEBGL_lose_context",
"MOZ_WEBGL_lose_context",
];
var extensionName;
var extension;
var buffer;
@ -48,11 +52,17 @@ function init()
// for the isContextLost() method, which we want to do regardless of the extension's presence.
testValidContext();
extension = gl.getExtension(extension_name);
for (var ii = 0; ii < extensionNames.length; ++ii) {
extension = gl.getExtension(extensionNames[ii]);
if (extension) {
extensionName = extensionNames[ii];
break;
}
}
if (!extension) {
debug(extension_name + " extension not found.");
debug("Could not find lose_context extension under the following names: " + extensionNames.join(" "));
finishTest();
return;
return false;
}
canvas.addEventListener("webglcontextlost", testLostContext, false);
@ -67,7 +77,7 @@ function loseContext()
// Note: this will cause the context to be lost, but the
// webglcontextlost event listener to be queued.
shouldGenerateGLError(gl, gl.NO_ERROR, "extension.loseContext()");
extension.loseContext();
debug("");
}
@ -283,7 +293,7 @@ function testLostContext()
"gl.getUniformLocation(program, 'vPosition')",
"gl.getVertexAttrib(0, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING)",
"gl.getSupportedExtensions()",
"gl.getExtension('" + extension_name + "')",
"gl.getExtension('" + extensionName + "')",
];
for (var i = 0; i < nullTests.length; ++i) {
shouldBeNull(nullTests[i]);

View File

@ -1,5 +1,7 @@
functions/00_test_list.txt
implicit/00_test_list.txt
# commented out for version 1.0.1 of the conforamnce tests.
#matrices/00_test_list.txt
misc/00_test_list.txt
reserved/00_test_list.txt
# commented out for version 1.0.1 of the conforamnce tests.

View File

@ -5,7 +5,7 @@ invalid-passed-params.html
is-object.html
null-object-behaviour.html
object-deletion-behaviour.html
#shader-precision-format.html
type-conversion-test.html
uninitialized-test.html
webgl-specific.html

View File

@ -81,6 +81,7 @@ shouldThrowWithNew(WebGLRenderbuffer, 'WebGLRenderbuffer');
shouldThrowWithNew(WebGLShader, 'WebGLShader');
shouldThrowWithNew(WebGLTexture, 'WebGLTexture');
shouldThrowWithNew(WebGLUniformLocation, 'WebGLUniformLocation');
shouldThrowWithNew(WebGLShaderPrecisionFormat, 'WebGLShaderPrecisionFormat');
successfullyParsed = true;
</script>

View File

@ -1,5 +1,8 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Copyright (c) 2011 The Chromium Authors.
Copyright (c) 2011 Mozilla Foundation.
All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
@ -32,7 +35,7 @@ var fragmentShader = wtu.loadStandardFragmentShader(gl);
assertMsg(fragmentShader, "fragment shader loaded");
var program = gl.createProgram();
shouldBeTrue("program != null");
shouldBeNonNull("program");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.attachShader(program, vertexShader)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.attachShader(program, fragmentShader)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.linkProgram(program)");
@ -57,13 +60,13 @@ debug("");
debug("texture deletion");
var fbo = gl.createFramebuffer(), fbo2 = gl.createFramebuffer(), fbo3 = gl.createFramebuffer();
shouldBeTrue("fbo != null");
shouldBeTrue("fbo2 != null");
shouldBeTrue("fbo3 != null");
shouldBeNonNull("fbo");
shouldBeNonNull("fbo2");
shouldBeNonNull("fbo3");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
var tex = gl.createTexture();
shouldBeTrue("tex != null");
shouldBeNonNull("tex");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, tex)");
shouldBe("gl.getParameter(gl.TEXTURE_BINDING_2D)", "tex");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0)");
@ -80,7 +83,7 @@ shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, tex)");
shouldBeNull("gl.getParameter(gl.TEXTURE_BINDING_2D)");
var texCubeMap = gl.createTexture();
shouldBeTrue("texCubeMap != null");
shouldBeNonNull("texCubeMap");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_CUBE_MAP, texCubeMap)");
shouldBe("gl.getParameter(gl.TEXTURE_BINDING_CUBE_MAP)", "texCubeMap");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteTexture(texCubeMap)");
@ -90,7 +93,7 @@ shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_CUBE_MAP, texC
shouldBeNull("gl.getParameter(gl.TEXTURE_BINDING_CUBE_MAP)");
var t = gl.createTexture();
shouldBeTrue("t != null");
shouldBeNonNull("t");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, t)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteTexture(t)");
@ -98,7 +101,7 @@ shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, t)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)");
var t2 = gl.createTexture();
shouldBeTrue("t2 != null");
shouldBeNonNull("t2");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.activeTexture(gl.TEXTURE0)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, t2)");
shouldBe("gl.getParameter(gl.TEXTURE_BINDING_2D)", "t2");
@ -114,9 +117,9 @@ debug("");
debug("renderbuffer deletion");
var rbo = gl.createRenderbuffer(), rbo2 = gl.createRenderbuffer(), rbo3 = gl.createRenderbuffer();
shouldBeTrue("rbo != null");
shouldBeTrue("rbo2 != null");
shouldBeTrue("rbo3 != null");
shouldBeNonNull("rbo");
shouldBeNonNull("rbo2");
shouldBeNonNull("rbo3");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindRenderbuffer(gl.RENDERBUFFER, rbo)");
shouldBe("gl.getParameter(gl.RENDERBUFFER_BINDING)", "rbo");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo)");
@ -175,23 +178,23 @@ shouldGenerateGLError(gl, gl.NO_ERROR, "gl.renderbufferStorage(gl.RENDERBUFFER,
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo)");
if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE) {
var rbo2 = gl.createRenderbuffer();
rbo2 = gl.createRenderbuffer();
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindRenderbuffer(gl.RENDERBUFFER, rbo2)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16)");
// attach rbo2 at two attachment points incompatible with it
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, rbo2)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, rbo2)");
shouldBeTrue("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) == rbo2");
shouldBeTrue("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) == rbo2");
shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)", "rbo2");
shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)", "rbo2");
// fbo can't be complete as rbo2 is attached at incompatible attachment points
shouldBeFalse("gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE");
shouldNotBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
// now we delete rbo2, which detaches it from the two attachment points where it currently is attached
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteRenderbuffer(rbo2)");
shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)", "gl.NONE");
shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)", "gl.NONE");
// we should now be in the same state as before with only rbo attached, so fbo should be complete again
shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
shouldBeTrue("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) == rbo");
shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)", "rbo");
}
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteRenderbuffer(rbo)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, null)");
@ -229,7 +232,7 @@ if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE) {
debug("");
debug("using deleted renderbuffer");
rbo = gl.createRenderbuffer();
shouldBeTrue("rbo != null");
shouldBeNonNull("rbo");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindRenderbuffer(gl.RENDERBUFFER, rbo)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
@ -249,19 +252,19 @@ if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE) {
// delete renderbuffer. It should still be attached to fbo2 though.
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteRenderbuffer(rbo)");
// fbo has no attachments
shouldBeTrue("gl.checkFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE");
shouldNotBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
// Use fbo2 that has deleted rbo.
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo2)");
shouldGenerateGLError(gl, gl.NO_ERROR, 'wtu.checkCanvasRect(gl, 0, 0, 16, 16, [0,255,0,255], "fbo should be green")');
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clearColor(0,0,1,1)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clear(gl.COLOR_BUFFER_BIT)");
shouldGenerateGLError(gl, gl.NO_ERROR, 'wtu.checkCanvasRect(gl, 0, 0, 16, 16, [0,0,255,255], "fbo should be blue")');
shouldBeTrue("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) == rbo");
shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)", "rbo");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)");
shouldGenerateGLError(gl, gl.NONE, "gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)");
shouldBeTrue("gl.checkFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE");
shouldNotBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
// Bind backbuffer.
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, null)");
shouldGenerateGLError(gl, gl.NO_ERROR, 'wtu.checkCanvasRect(gl, 0, 0, 16, 16, [255,0,0,255], "backbuffer should be red")');
@ -270,7 +273,7 @@ if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE) {
debug("");
debug("using deleted texture");
tex = gl.createTexture();
shouldBeTrue("tex != null");
shouldBeNonNull("tex");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindTexture(gl.TEXTURE_2D, tex)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0)");
@ -285,19 +288,19 @@ if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE) {
// delete texture. It should still be attached to fbo2 though.
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteTexture(tex)");
// fbo has no attachments
shouldBeTrue("gl.checkFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE");
shouldNotBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
// Use fbo that has deleted texture.
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo2)");
shouldBeTrue("gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE");
shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
shouldGenerateGLError(gl, gl.NO_ERROR, 'wtu.checkCanvasRect(gl, 0, 0, 1, 1, [0,255,0,255], "fbo should be green")');
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clearColor(0,0,1,1)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.clear(gl.COLOR_BUFFER_BIT)");
shouldGenerateGLError(gl, gl.NO_ERROR, 'wtu.checkCanvasRect(gl, 0, 0, 1, 1, [0,0,255,255], "fbo should be blue")');
shouldBeTrue("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) == tex");
shouldBe("gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)", "tex");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)");
shouldBeTrue("gl.checkFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE");
shouldNotBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
// Bind backbuffer.
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, null)");
shouldGenerateGLError(gl, gl.NO_ERROR, 'wtu.checkCanvasRect(gl, 0, 0, 16, 16, [255,0,0,255], "backbuffer should be red")');
@ -307,7 +310,7 @@ debug("");
debug("buffer deletion");
var buffer = gl.createBuffer();
shouldBeTrue("buffer != null");
shouldBeNonNull("buffer");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, buffer)");
shouldBe("gl.getParameter(gl.ARRAY_BUFFER_BINDING)", "buffer");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteBuffer(buffer)");
@ -317,7 +320,7 @@ shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, buffer)")
shouldBeNull("gl.getParameter(gl.ARRAY_BUFFER_BINDING)");
var buffer2 = gl.createBuffer();
shouldBeTrue("buffer2 != null");
shouldBeNonNull("buffer2");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, buffer2)");
shouldBe("gl.getParameter(gl.ARRAY_BUFFER_BINDING)", "buffer2");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, null)");
@ -328,7 +331,7 @@ shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, buffer2)"
shouldBeNull("gl.getParameter(gl.ARRAY_BUFFER_BINDING)");
var bufferElement = gl.createBuffer();
shouldBeTrue("bufferElement != null");
shouldBeNonNull("bufferElement");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, bufferElement)");
shouldBe("gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING)", "bufferElement");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteBuffer(bufferElement)");
@ -338,7 +341,7 @@ shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, b
shouldBeNull("gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING)");
var b = gl.createBuffer();
shouldBeTrue("b != null");
shouldBeNonNull("b");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, b)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.deleteBuffer(b)");
@ -346,12 +349,12 @@ shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, b)");
shouldGenerateGLError(gl, gl.INVALID_OPERATION, "gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW)");
var b1 = gl.createBuffer();
shouldBeTrue("b1 != null");
shouldBeNonNull("b1");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, b1);");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.enableVertexAttribArray(1);");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.vertexAttribPointer(1, 4, gl.FLOAT, false, 0, 0);");
var b2 = gl.createBuffer();
shouldBeTrue("b2 != null");
shouldBeNonNull("b2");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindBuffer(gl.ARRAY_BUFFER, b2);");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.enableVertexAttribArray(2);");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.vertexAttribPointer(2, 4, gl.FLOAT, false, 0, 0);");
@ -384,8 +387,8 @@ shouldBe("gl.getParameter(gl.FRAMEBUFFER_BINDING)", "fbo2");
fbo = gl.createFramebuffer();
rbo = gl.createRenderbuffer();
shouldBeTrue("fbo != null");
shouldBeTrue("rbo != null");
shouldBeNonNull("fbo");
shouldBeNonNull("rbo");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.bindRenderbuffer(gl.RENDERBUFFER, rbo)");
shouldGenerateGLError(gl, gl.NO_ERROR, "gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16)");

View File

@ -1,5 +1,8 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Copyright (c) 2011 The Chromium Authors.
Copyright (c) 2011 Mozilla Foundation.
All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
@ -31,7 +34,7 @@ const ALLOW_COMPLETE = 0x01;
const ALLOW_UNSUPPORTED = 0x02;
const ALLOW_INCOMPLETE_ATTACHMENT = 0x04;
function CheckFramebufferForAllowedStatuses(allowedStatuses)
function checkFramebufferForAllowedStatuses(allowedStatuses)
{
// If the framebuffer is in an error state for multiple reasons,
// we can't guarantee which one will be reported.
@ -53,7 +56,7 @@ function testAttachment(attachment, buffer, allowedStatuses)
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorBuffer);
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, buffer);
glErrorShouldBe(gl, gl.NO_ERROR);
CheckFramebufferForAllowedStatuses(allowedStatuses);
checkFramebufferForAllowedStatuses(allowedStatuses);
if ((allowedStatuses & ALLOW_COMPLETE) == 0) {
gl.clear(gl.COLOR_BUFFER_BIT);
glErrorShouldBe(gl, gl.INVALID_FRAMEBUFFER_OPERATION);
@ -72,7 +75,7 @@ function testAttachments(attachment0, buffer0, attachment1, buffer1, allowedStat
glErrorShouldBe(gl, gl.NO_ERROR);
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment1, gl.RENDERBUFFER, buffer1);
glErrorShouldBe(gl, gl.NO_ERROR);
CheckFramebufferForAllowedStatuses(allowedStatuses);
checkFramebufferForAllowedStatuses(allowedStatuses);
gl.deleteFramebuffer(fbo);
}
@ -238,7 +241,7 @@ if (checkValidColorDepthCombination()) {
testUsingIncompleteFramebuffer();
}
function CheckFramebuffer(expected) {
function checkFramebuffer(expected) {
var actual = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
var msg = "gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be " + wtu.glEnumToString(gl, expected) + " was " + wtu.glEnumToString(gl, actual);
if (expected != gl.FRAMEBUFFER_COMPLETE) {
@ -274,18 +277,18 @@ function testUsingIncompleteFramebuffer() {
gl.FRAMEBUFFER, depthAttachment, gl.RENDERBUFFER, depthBuffer);
gl.renderbufferStorage(gl.RENDERBUFFER, depthFormat, 16, 16);
glErrorShouldBe(gl, gl.NO_ERROR);
CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
// We pick this combination because it works on desktop OpenGL but should not work on OpenGL ES 2.0
gl.renderbufferStorage(gl.RENDERBUFFER, depthFormat, 32, 16);
CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
debug("");
debug("Drawing or reading from an incomplete framebuffer should generate INVALID_FRAMEBUFFER_OPERATION");
testRenderingAndReading();
shouldBeNonNull("fbo2 = gl.createFramebuffer()");
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo2);
CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
debug("");
debug("Drawing or reading from an incomplete framebuffer should generate INVALID_FRAMEBUFFER_OPERATION");
testRenderingAndReading();
@ -325,20 +328,20 @@ function testFramebufferIncompleteAttachment() {
gl.framebufferRenderbuffer(
gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorBuffer);
gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16);
CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
debug("");
debug("Wrong storage type for type of attachment be FRAMEBUFFER_INCOMPLETE_ATTACHMENT (OpenGL ES 2.0 4.4.5)");
gl.renderbufferStorage(gl.RENDERBUFFER, depthFormat, 16, 16);
CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT);
checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT);
gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16);
CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
debug("");
debug("0 size attachment should be FRAMEBUFFER_INCOMPLETE_ATTACHMENT (OpenGL ES 2.0 4.4.5)");
gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 0, 0);
CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT);
checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT);
glErrorShouldBe(gl, gl.NO_ERROR);
}
@ -348,18 +351,18 @@ function testFramebufferIncompleteMissingAttachment() {
debug("No attachments should be INCOMPLETE_FRAMEBUFFER_MISSING_ATTACHMENT (OpenGL ES 2.0 4.4.5)");
shouldBeNonNull("fbo = gl.createFramebuffer()");
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
shouldBeNonNull("colorBuffer = gl.createRenderbuffer()");
gl.bindRenderbuffer(gl.RENDERBUFFER, colorBuffer);
gl.framebufferRenderbuffer(
gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, colorBuffer);
gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16);
CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
gl.framebufferRenderbuffer(
gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, null);
CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
glErrorShouldBe(gl, gl.NO_ERROR);
}
@ -382,17 +385,17 @@ function testFramebufferIncompleteDimensions() {
gl.FRAMEBUFFER, depthAttachment, gl.RENDERBUFFER, depthBuffer);
gl.renderbufferStorage(gl.RENDERBUFFER, depthFormat, 16, 16);
glErrorShouldBe(gl, gl.NO_ERROR);
CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
gl.renderbufferStorage(gl.RENDERBUFFER, depthFormat, 32, 16);
CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
gl.renderbufferStorage(gl.RENDERBUFFER, depthFormat, 16, 16);
CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
gl.bindRenderbuffer(gl.RENDERBUFFER, colorBuffer);
gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 32);
CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16);
CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
glErrorShouldBe(gl, gl.NO_ERROR);
var tex = gl.createTexture();
@ -405,9 +408,9 @@ function testFramebufferIncompleteDimensions() {
}
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
CheckFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
checkFramebuffer(gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
CheckFramebuffer(gl.FRAMEBUFFER_COMPLETE);
checkFramebuffer(gl.FRAMEBUFFER_COMPLETE);
glErrorShouldBe(gl, gl.NO_ERROR);
}

View File

@ -132,12 +132,15 @@ var bvecTypes = [
var replaceRE = /\$\((\w+)\)/g;
var replaceParams = function(str, params) {
var replaceParams = function(str) {
var args = arguments;
return str.replace(replaceRE, function(str, p1, offset, s) {
if (params[p1] === undefined) {
throw "unknown string param '" + p1 + "'";
for (var ii = 1; ii < args.length; ++ii) {
if (args[ii][p1] !== undefined) {
return args[ii][p1];
}
}
return params[p1];
throw "unknown string param '" + p1 + "'";
});
};
@ -443,6 +446,233 @@ var runFeatureTest = function(params) {
};
var runBasicTest = function(params) {
if (window.initNonKhronosFramework) {
window.initNonKhronosFramework(false);
}
var wtu = WebGLTestUtils;
var gridRes = params.gridRes;
var vertexTolerance = params.tolerance || 0;
var fragmentTolerance = vertexTolerance;
if ('fragmentTolerance' in params)
fragmentTolerance = params.fragmentTolerance || 0;
description("Testing : " + document.getElementsByTagName("title")[0].innerText);
var width = 32;
var height = 32;
var console = document.getElementById("console");
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
var gl = wtu.create3DContext(canvas);
if (!gl) {
testFailed("context does not exist");
finishTest();
return;
}
var canvas2d = document.createElement('canvas');
canvas2d.width = width;
canvas2d.height = height;
var ctx = canvas2d.getContext("2d");
var imgData = ctx.getImageData(0, 0, width, height);
var shaderInfos = [
{ type: "vertex",
input: "color",
output: "vColor",
vertexShaderTemplate: vertexShaderTemplate,
fragmentShaderTemplate: baseFragmentShader,
tolerance: vertexTolerance
},
{ type: "fragment",
input: "vColor",
output: "gl_FragColor",
vertexShaderTemplate: baseVertexShader,
fragmentShaderTemplate: fragmentShaderTemplate,
tolerance: fragmentTolerance
}
];
for (var ss = 0; ss < shaderInfos.length; ++ss) {
var shaderInfo = shaderInfos[ss];
var tests = params.tests;
// var testTypes = params.emuFuncs || (params.bvecTest ? bvecTypes : types);
// Test vertex shaders
for (var ii = 0; ii < tests.length; ++ii) {
var test = tests[ii];
debug("");
debug("Testing: " + test.name + " in " + shaderInfo.type + " shader");
function genShader(shaderInfo, template, shader, subs) {
shader = replaceParams(shader, subs, {
input: shaderInfo.input,
output: shaderInfo.output
});
shader = replaceParams(template, subs, {
test: shader,
emu: "",
extra: ""
});
return shader;
}
var referenceVertexShaderSource = genShader(
shaderInfo,
shaderInfo.vertexShaderTemplate,
test.reference.shader,
test.reference.subs);
var referenceFragmentShaderSource = genShader(
shaderInfo,
shaderInfo.fragmentShaderTemplate,
test.reference.shader,
test.reference.subs);
var testVertexShaderSource = genShader(
shaderInfo,
shaderInfo.vertexShaderTemplate,
test.test.shader,
test.test.subs);
var testFragmentShaderSource = genShader(
shaderInfo,
shaderInfo.fragmentShaderTemplate,
test.test.shader,
test.test.subs);
debug("");
addShaderSource(
"reference vertex shader", referenceVertexShaderSource);
addShaderSource(
"reference fragment shader", referenceFragmentShaderSource);
addShaderSource(
"test vertex shader", testVertexShaderSource);
addShaderSource(
"test fragment shader", testFragmentShaderSource);
debug("");
var refData = draw(
canvas, referenceVertexShaderSource, referenceFragmentShaderSource);
var refImg = makeImage(canvas);
if (ss == 0) {
var testData = draw(
canvas, testVertexShaderSource, referenceFragmentShaderSource);
} else {
var testData = draw(
canvas, referenceVertexShaderSource, testFragmentShaderSource);
}
var testImg = makeImage(canvas);
reportResults(refData, refImg, testData, testImg, shaderInfo.tolerance);
}
}
finishTest();
function addShaderSource(label, source) {
var div = document.createElement("div");
var s = document.createElement("pre");
s.className = "shader-source";
s.style.display = "none";
var ol = document.createElement("ol");
//s.appendChild(document.createTextNode(source));
var lines = source.split("\n");
for (var ii = 0; ii < lines.length; ++ii) {
var line = lines[ii];
var li = document.createElement("li");
li.appendChild(document.createTextNode(line));
ol.appendChild(li);
}
s.appendChild(ol);
var l = document.createElement("a");
l.href = "show-shader-source";
l.appendChild(document.createTextNode(label));
l.addEventListener('click', function(event) {
if (event.preventDefault) {
event.preventDefault();
}
s.style.display = (s.style.display == 'none') ? 'block' : 'none';
return false;
}, false);
div.appendChild(l);
div.appendChild(s);
console.appendChild(div);
}
function reportResults(refData, refImage, testData, testImage, tolerance) {
var same = true;
for (var yy = 0; yy < height; ++yy) {
for (var xx = 0; xx < width; ++xx) {
var offset = (yy * width + xx) * 4;
var imgOffset = ((height - yy - 1) * width + xx) * 4;
imgData.data[imgOffset + 0] = 0;
imgData.data[imgOffset + 1] = 0;
imgData.data[imgOffset + 2] = 0;
imgData.data[imgOffset + 3] = 255;
if (Math.abs(refData[offset + 0] - testData[offset + 0]) > tolerance ||
Math.abs(refData[offset + 1] - testData[offset + 1]) > tolerance ||
Math.abs(refData[offset + 2] - testData[offset + 2]) > tolerance ||
Math.abs(refData[offset + 3] - testData[offset + 3]) > tolerance) {
imgData.data[imgOffset] = 255;
same = false;
}
}
}
var diffImg = null;
if (!same) {
ctx.putImageData(imgData, 0, 0);
diffImg = makeImage(canvas2d);
}
var div = document.createElement("div");
div.className = "testimages";
insertImg(div, "ref", refImg);
insertImg(div, "test", testImg);
if (diffImg) {
insertImg(div, "diff", diffImg);
}
div.appendChild(document.createElement('br'));
function insertImg(element, caption, img) {
var div = document.createElement("div");
div.appendChild(img);
var label = document.createElement("div");
label.appendChild(document.createTextNode(caption));
div.appendChild(label);
element.appendChild(div);
}
console.appendChild(div);
if (!same) {
testFailed("images are different");
} else {
testPassed("images are the same");
}
console.appendChild(document.createElement('hr'));
}
function draw(canvas, vsSource, fsSource) {
var program = wtu.loadProgram(gl, vsSource, fsSource, testFailed);
var posLoc = gl.getAttribLocation(program, "aPosition");
WebGLTestUtils.setupQuad(gl, gridRes, posLoc);
gl.useProgram(program);
gl.clearColor(0, 0, 1, 1);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.drawElements(gl.TRIANGLES, gridRes * gridRes * 6, gl.UNSIGNED_SHORT, 0);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "no errors from draw");
var img = new Uint8Array(width * height * 4);
gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, img);
return img;
}
};
return {
/**
* runs a bunch of GLSL tests using the passed in parameters
@ -507,6 +737,82 @@ return {
*/
runFeatureTest: runFeatureTest,
/*
* Runs a bunch of GLSL tests using the passed in parameters
*
* The parameters are:
*
* tests:
* Array of tests. For each test the following parameters are expected
*
* name:
* some description of the test
* reference:
* parameters for the reference shader (see below)
* test:
* parameters for the test shader (see below)
*
* The parameter for the reference and test shaders are
*
* shader: the GLSL for the shader
* subs: any substitutions you wish to define for the shader.
*
* Each shader is created from a basic template that
* defines an input and an output. You can see the
* templates at the top of this file. The input and output
* change depending on whether or not we are generating
* a vertex or fragment shader.
*
* All this code function does is a bunch of string substitutions.
* A substitution is defined by $(name). If name is found in
* the 'subs' parameter it is replaced. 4 special names exist.
*
* 'input' the input to your GLSL. Always a vec4. All change
* from 0 to 1 over the quad to be drawn.
*
* 'output' the output color. Also a vec4
*
* 'emu' a place to insert extra stuff
* 'extra' a place to insert extra stuff.
*
* You can think of the templates like this
*
* $(extra)
* $(emu)
*
* void main() {
* // do math to calculate input
* ...
*
* $(shader)
* }
*
* Your shader first has any subs you provided applied as well
* as 'input' and 'output'
*
* It is then inserted into the template which is also provided
* with your subs.
*
* gridRes: (optional)
* The resolution of the mesh to generate. The default is a
* 1x1 grid but many vertex shaders need a higher resolution
* otherwise the only values passed in are the 4 corners
* which often have the same value.
*
* tolerance: (optional)
* Allow some tolerance in the comparisons. The tolerance is applied to
* both vertex and fragment shaders. The default tolerance is 0, meaning
* the values have to be identical.
*
* fragmentTolerance: (optional)
* Specify a tolerance which only applies to fragment shaders. The
* fragment-only tolerance will override the shared tolerance for
* fragment shaders if both are specified. Fragment shaders usually
* use mediump float precision so they sometimes require higher tolerance
* than vertex shaders which use highp.
*/
runBasicTest: runBasicTest,
none: false
};

View File

@ -905,6 +905,17 @@ var loadShaderFromFile = function(gl, file, type, opt_errorCallback) {
return loadShader(gl, shaderSource, type, opt_errorCallback);
};
/**
* Gets the content of script.
*/
var getScript = function(scriptId) {
var shaderScript = document.getElementById(scriptId);
if (!shaderScript) {
throw("*** Error: unknown script element" + scriptId);
}
return shaderScript.text;
};
/**
* Loads a shader from a script tag.
* @param {!WebGLContext} gl The WebGLContext to use.
@ -1123,6 +1134,7 @@ return {
endsWith: endsWith,
getFileListAsync: getFileListAsync,
getLastError: getLastError,
getScript: getScript,
getUrlArguments: getUrlArguments,
glEnumToString: glEnumToString,
glErrorShouldBe: glErrorShouldBe,

View File

@ -399,6 +399,18 @@ function runTests(imgs) {
// The image should be red.
checkPixelRange(buf, middle, center, [ 255, 0, 0, 255 ], 10);
debug("")
debug("check calling texImage2D with NULL clears the texture");
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB,
imgs['../resources/red-indexed.png'].width,
imgs['../resources/red-indexed.png'].height,
0, gl.RGB, gl.UNSIGNED_BYTE, null);
glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup");
wtu.drawQuad(gl);
gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf);
// The image should be white.
checkPixelRange(buf, middle, center, [ 0, 0, 0, 255 ], 10);
debug("");
successfullyParsed = true;
shouldBeTrue("successfullyParsed");

View File

@ -1,5 +1,5 @@
# HG changeset patch
# Parent 9c1a90f789e3d43455cb18a9a911627c80c0d9ac
# Parent 07fbbfde4173da7d8e513bb2d52ae07e333dbf43
diff --git a/content/canvas/test/webgl/conformance/more/functions/readPixelsBadArgs.html b/content/canvas/test/webgl/conformance/more/functions/readPixelsBadArgs.html
--- a/content/canvas/test/webgl/conformance/more/functions/readPixelsBadArgs.html
+++ b/content/canvas/test/webgl/conformance/more/functions/readPixelsBadArgs.html

View File

@ -0,0 +1,109 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<title>WebGL ouf of bounds uniform array access.</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="../conformance/resources/webgl-test-utils.js"> </script>
</head>
<body style="background: #666;">
<div id="description"></div>
<div id="console"></div>
<div>elem mult: <span id="elemMultDisplay"></span></div>
<input type="range" id="elemMult" value="4" min="0" max="2048" style="width: 100%;"/>
<div>line width: <span id="lineWidthDisplay"></span></div>
<input type="range" id="lineWidth" value="512" min="0" max="2540" style="width: 100%;"/>
<canvas id="example" width="256" height="256" style="background: black;">
</canvas>
<script id="vshader" type="x-shader/x-vertex">
attribute vec4 vPosition;
varying vec4 v_color;
uniform float lineWidth;
uniform int elemMult;
uniform vec4 someArray[2];
void main()
{
vec2 texcoord = vec2(vPosition.xy * 0.5 + vec2(0.5, 0.5));
int index = int(texcoord.x + texcoord.y * lineWidth) * elemMult;
v_color = someArray[index];
gl_Position = vPosition;
}
</script>
<script id="fshader" type="x-shader/x-fragment">
precision mediump float;
varying vec4 v_color;
void main()
{
gl_FragColor = v_color * vec4(1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0) + vec4(0,0,0,0.5);
}
</script>
<script>
window.onload = main;
debug("Tests a WebGL program that accesses out of bounds uniform array elements");
function main() {
var wtu = WebGLTestUtils;
var canvas = document.getElementById("example");
var gl = wtu.create3DContext(canvas);
var program = wtu.setupProgram(
gl,
[wtu.loadShaderFromScript(gl, 'vshader', gl.VERTEX_SHADER),
wtu.loadShaderFromScript(gl, 'fshader', gl.FRAGMENT_SHADER)],
['vPosition'], [0]);
var gridRes = 255;
wtu.setupQuad(gl, gridRes, 0);
var lineWidthLoc = gl.getUniformLocation(program, "lineWidth");
var elemMultLoc = gl.getUniformLocation(program, "elemMult");
assertMsg(gl.getError() == gl.NO_ERROR, "Should be no errors from setup.");
var lineWidth = 512;
var lineWidthElem = document.getElementById("lineWidth");
var lineWidthDisplayElem = document.getElementById("lineWidthDisplay");
lineWidthElem.value = lineWidth;
lineWidthElem.addEventListener('change', function(event) {
//console.log(event.target.value);
lineWidth = event.target.value;
draw();
}, false);
var elemMult = 4;
var elemMultElem = document.getElementById("elemMult");
var elemMultDisplayElem = document.getElementById("elemMultDisplay");
elemMultElem.value = elemMult;
elemMultElem.addEventListener('change', function(event) {
//console.log(event.target.value);
elemMult = event.target.value;
draw();
}, false);
draw();
function draw() {
lineWidthDisplayElem.innerText = lineWidth;
elemMultDisplayElem.innerText = elemMult;
gl.uniform1f(lineWidthLoc, lineWidth);
gl.uniform1i(elemMultLoc, elemMult);
gl.drawElements(gl.TRIANGLES, gridRes * gridRes * 6, gl.UNSIGNED_SHORT, 0);
}
successfullyParsed = true;
}
</script>
</body>
</html>

View File

@ -1,4 +1,3 @@
conformance/context/context-lost-restored.html
conformance/context/premultiplyalpha-test.html
conformance/glsl/misc/glsl-long-variable-names.html
conformance/glsl/misc/shader-with-256-character-identifier.frag.html

View File

@ -1,4 +1,3 @@
conformance/context/context-lost-restored.html
conformance/context/premultiplyalpha-test.html
conformance/glsl/misc/glsl-function-nodes.html
conformance/glsl/misc/glsl-long-variable-names.html

View File

@ -1,4 +1,3 @@
conformance/context/context-lost-restored.html
conformance/context/premultiplyalpha-test.html
conformance/glsl/functions/glsl-function-atan.html
conformance/glsl/functions/glsl-function-atan-xy.html

View File

@ -1,5 +1,5 @@
# HG changeset patch
# Parent 4ed0bad4933ba69927ee5f75cf67093d3e99566a
# Parent 1910ae60536dce7272cb0478089bf40806666de8
diff --git a/content/canvas/test/webgl/conformance/glsl/misc/glsl-function-nodes.html b/content/canvas/test/webgl/conformance/glsl/misc/glsl-function-nodes.html
--- a/content/canvas/test/webgl/conformance/glsl/misc/glsl-function-nodes.html
+++ b/content/canvas/test/webgl/conformance/glsl/misc/glsl-function-nodes.html

View File

@ -1,5 +1,5 @@
# HG changeset patch
# Parent bf9d7872738cdb7cf425e6dd060ae62882487e1a
# Parent a41d853e5110aca4f2c77c63db502f670d0e50a1
diff --git a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
--- a/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html
+++ b/content/canvas/test/webgl/conformance/extensions/oes-standard-derivatives.html

View File

@ -217,27 +217,52 @@ function evalAndLog(_a)
return _av;
}
function shouldBe(_a, _b)
function shouldBe(_a, _b, quiet)
{
if (typeof _a != "string" || typeof _b != "string")
debug("WARN: shouldBe() expects string arguments");
var exception;
var _av;
try {
_av = eval(_a);
} catch (e) {
exception = e;
}
var _bv = eval(_b);
if (typeof _a != "string" || typeof _b != "string")
debug("WARN: shouldBe() expects string arguments");
var exception;
var _av;
try {
_av = eval(_a);
} catch (e) {
exception = e;
}
var _bv = eval(_b);
if (exception)
testFailed(_a + " should be " + _bv + ". Threw exception " + exception);
else if (isResultCorrect(_av, _bv))
testPassed(_a + " is " + _b);
else if (typeof(_av) == typeof(_bv))
testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + ".");
else
testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
if (exception)
testFailed(_a + " should be " + _bv + ". Threw exception " + exception);
else if (isResultCorrect(_av, _bv)) {
if (!quiet) {
testPassed(_a + " is " + _b);
}
} else if (typeof(_av) == typeof(_bv))
testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + ".");
else
testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
}
function shouldNotBe(_a, _b, quiet)
{
if (typeof _a != "string" || typeof _b != "string")
debug("WARN: shouldNotBe() expects string arguments");
var exception;
var _av;
try {
_av = eval(_a);
} catch (e) {
exception = e;
}
var _bv = eval(_b);
if (exception)
testFailed(_a + " should not be " + _bv + ". Threw exception " + exception);
else if (!isResultCorrect(_av, _bv)) {
if (!quiet) {
testPassed(_a + " is not " + _b);
}
} else
testFailed(_a + " should not be " + _bv + ".");
}
function shouldBeTrue(_a) { shouldBe(_a, "true"); }

View File

@ -1,6 +1,5 @@
# HG changeset patch
# Parent 41137626edf2a358f2be1b7ed3f83211230ab4f5
# Parent fb36d18f04ef9b01ca87d3fde539d50c204f9bba
diff --git a/content/canvas/test/webgl/resources/webgl-test-harness.js b/content/canvas/test/webgl/resources/webgl-test-harness.js
--- a/content/canvas/test/webgl/resources/webgl-test-harness.js
+++ b/content/canvas/test/webgl/resources/webgl-test-harness.js

View File

@ -1170,7 +1170,7 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
bool shouldInitializeEditor = false;
nsCOMPtr<nsIEditor> newEditor; // the editor that we might create
nsresult rv;
nsresult rv = NS_OK;
if (!mEditor) {
shouldInitializeEditor = true;

View File

@ -2263,7 +2263,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
if (pPluginEvent) {
// Make event coordinates relative to our enclosing widget,
// not the widget they were received on.
// See use of NPEvent in widget/src/windows/nsWindow.cpp
// See use of NPEvent in widget/windows/nsWindow.cpp
// for why this assert should be safe
NS_ASSERTION(anEvent.message == NS_MOUSE_BUTTON_DOWN ||
anEvent.message == NS_MOUSE_BUTTON_UP ||

View File

@ -1622,7 +1622,7 @@ PluginInstanceParent::RecvNegotiatedCarbon()
focus from child -> focus manager:
Child picks up the local wm_setfocus and sends it via ipc over
here. We then post a custom event to widget/src/windows/nswindow
here. We then post a custom event to widget/windows/nswindow
which fires off a gui event letting the browser know.
*/

View File

@ -584,9 +584,6 @@ PluginModuleChild::InitGraphics()
#if defined(MOZ_X11)
if (!sGtkLib)
sGtkLib = PR_LoadLibrary("libgtk-x11-2.0.so.0");
#elif defined(MOZ_DFB)
if (!sGtkLib)
sGtkLib = PR_LoadLibrary("libgtk-directfb-2.0.so.0");
#endif
if (sGtkLib) {
s_gtk_init = (_gtk_init_fn)PR_FindFunctionSymbol(sGtkLib, "gtk_init");

View File

@ -64,7 +64,7 @@
importScripts("ril_consts.js");
const DEBUG = true;
let DEBUG = false;
const INT32_MAX = 2147483647;
const UINT8_SIZE = 1;

View File

@ -693,7 +693,6 @@ abstract public class GeckoApp
Map<String,String> envMap = System.getenv();
Set<Map.Entry<String,String>> envSet = envMap.entrySet();
Iterator<Map.Entry<String,String>> envIter = envSet.iterator();
StringBuffer envstr = new StringBuffer();
int c = 0;
while (envIter.hasNext()) {
Map.Entry<String,String> entry = envIter.next();

View File

@ -145,6 +145,13 @@ MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/desktop_notificati
MOZ_ANDROID_DRAWABLES += $(shell if test -e $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn; then cat $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn | tr '\n' ' '; fi)
RESOURCES=$(RES_LAYOUT) $(RES_VALUES)
RES_DIRS= \
res/layout \
res/values \
$(NULL)
include $(topsrcdir)/config/rules.mk
# Override the Java settings with some specific android settings
@ -169,19 +176,20 @@ res/drawable-hdpi/icon.png: $(MOZ_APP_ICON)
$(NSINSTALL) -D res/drawable-hdpi
cp $(ICON_PATH_HDPI) $@
$(RES_DIRS):
rm -rf $@
$(NSINSTALL) -D $@
RES_DRAWABLE = $(addprefix res/drawable/,$(notdir $(MOZ_ANDROID_DRAWABLES)))
$(RES_DRAWABLE): $(addprefix $(topsrcdir)/,$(MOZ_ANDROID_DRAWABLES))
$(NSINSTALL) -D res/drawable
$(NSINSTALL) $^ res/drawable/
$(RES_LAYOUT): $(subst res/,$(srcdir)/resources/,$(RES_LAYOUT))
$(NSINSTALL) -D res/layout
$(NSINSTALL) $(srcdir)/resources/layout/* res/layout/
$(RESOURCES): $(RES_DIRS) $(subst res/,$(srcdir)/resources/,$(RESOURCES))
@echo "creating $@"
$(NSINSTALL) $(subst res/,$(srcdir)/resources/,$@) $(dir $@)
$(RES_VALUES): $(subst res/,$(srcdir)/resources/,$(RES_VALUES))
$(NSINSTALL) -D res/values
$(NSINSTALL) $(srcdir)/resources/values/* res/values/
R.java: $(MOZ_APP_ICON) $(RES_LAYOUT) $(RES_DRAWABLE) $(RES_VALUES) res/drawable/icon.png res/drawable-hdpi/icon.png res/values/strings.xml AndroidManifest.xml
$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -J . --custom-package org.mozilla.gecko

View File

@ -1,6 +1,6 @@
This is the ANGLE project, from http://code.google.com/p/angleproject/
Current revision: r924
Current revision: r930
== Applied local patches ==

View File

@ -1,7 +1,7 @@
#define MAJOR_VERSION 1
#define MINOR_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 924
#define BUILD_REVISION 930
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)

View File

@ -188,7 +188,7 @@ void OutputHLSL::header()
if (mUsesFragCoord)
{
out << "uniform float4 dx_Viewport;\n"
out << "uniform float4 dx_Coord;\n"
"uniform float2 dx_Depth;\n";
}

View File

@ -1798,11 +1798,13 @@ bool Context::applyRenderTarget(bool ignoreViewport)
GLfloat xy[2] = {1.0f / viewport.Width, -1.0f / viewport.Height};
programObject->setUniform2fv(halfPixelSize, 1, xy);
GLint viewport = programObject->getDxViewportLocation();
GLfloat whxy[4] = {mState.viewportWidth / 2.0f, mState.viewportHeight / 2.0f,
// These values are used for computing gl_FragCoord in Program::linkVaryings(). The approach depends on Shader Model 3.0 support.
GLint coord = programObject->getDxCoordLocation();
float h = mSupportsShaderModel3 ? mRenderTargetDesc.Height : mState.viewportHeight / 2.0f;
GLfloat whxy[4] = {mState.viewportWidth / 2.0f, h,
(float)mState.viewportX + mState.viewportWidth / 2.0f,
(float)mState.viewportY + mState.viewportHeight / 2.0f};
programObject->setUniform4fv(viewport, 1, whxy);
programObject->setUniform4fv(coord, 1, whxy);
GLint depth = programObject->getDxDepthLocation();
GLfloat dz[2] = {(zFar - zNear) / 2.0f, (zNear + zFar) / 2.0f};
@ -2596,18 +2598,7 @@ void Context::clear(GLbitfield mask)
float depth = clamp01(mState.depthClearValue);
int stencil = mState.stencilClearValue & 0x000000FF;
IDirect3DSurface9 *renderTarget = framebufferObject->getRenderTarget();
if (!renderTarget)
{
return; // Context must be lost, return silently
}
D3DSURFACE_DESC desc;
renderTarget->GetDesc(&desc);
renderTarget->Release();
renderTarget = NULL;
bool alphaUnmasked = (dx2es::GetAlphaSize(desc.Format) == 0) || mState.colorMaskAlpha;
bool alphaUnmasked = (dx2es::GetAlphaSize(mRenderTargetDesc.Format) == 0) || mState.colorMaskAlpha;
const bool needMaskedStencilClear = (flags & D3DCLEAR_STENCIL) &&
(mState.stencilWritemask & stencilUnmasked) != stencilUnmasked;
@ -2708,12 +2699,12 @@ void Context::clear(GLbitfield mask)
float quad[4][4]; // A quadrilateral covering the target, aligned to match the edges
quad[0][0] = -0.5f;
quad[0][1] = desc.Height - 0.5f;
quad[0][1] = mRenderTargetDesc.Height - 0.5f;
quad[0][2] = 0.0f;
quad[0][3] = 1.0f;
quad[1][0] = desc.Width - 0.5f;
quad[1][1] = desc.Height - 0.5f;
quad[1][0] = mRenderTargetDesc.Width - 0.5f;
quad[1][1] = mRenderTargetDesc.Height - 0.5f;
quad[1][2] = 0.0f;
quad[1][3] = 1.0f;
@ -2722,7 +2713,7 @@ void Context::clear(GLbitfield mask)
quad[2][2] = 0.0f;
quad[2][3] = 1.0f;
quad[3][0] = desc.Width - 0.5f;
quad[3][0] = mRenderTargetDesc.Width - 0.5f;
quad[3][1] = -0.5f;
quad[3][2] = 0.0f;
quad[3][3] = 1.0f;

View File

@ -65,7 +65,7 @@ enum
MAX_TEXTURE_IMAGE_UNITS = 16,
MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF = 4, // For devices supporting vertex texture fetch
MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF = MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF,
MAX_FRAGMENT_UNIFORM_VECTORS_SM2 = 32 - 3, // Reserve space for dx_Viewport, dx_Depth, and dx_DepthRange. dx_PointOrLines and dx_FrontCCW use separate bool registers.
MAX_FRAGMENT_UNIFORM_VECTORS_SM2 = 32 - 3, // Reserve space for dx_Coord, dx_Depth, and dx_DepthRange. dx_PointOrLines and dx_FrontCCW use separate bool registers.
MAX_FRAGMENT_UNIFORM_VECTORS_SM3 = 224 - 3,
MAX_DRAW_BUFFERS = 1,

View File

@ -1600,13 +1600,20 @@ bool Program::linkVaryings()
if (mFragmentShader->mUsesFragCoord)
{
mPixelHLSL += " float rhw = 1.0 / input.gl_FragCoord.w;\n";
if (sm3) {
if (sm3)
{
// dx_Coord.y contains the render target height. See Context::applyRenderTarget()
mPixelHLSL += " gl_FragCoord.x = input.dx_VPos.x + 0.5;\n"
" gl_FragCoord.y = 2.0 * dx_Viewport.y - input.dx_VPos.y - 0.5;\n";
} else {
mPixelHLSL += " gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_Viewport.x + dx_Viewport.z;\n"
" gl_FragCoord.y = -(input.gl_FragCoord.y * rhw) * dx_Viewport.y + dx_Viewport.w;\n";
" gl_FragCoord.y = dx_Coord.y - input.dx_VPos.y - 0.5;\n";
}
else
{
// dx_Coord contains the viewport width/2, height/2, center.x and center.y. See Context::applyRenderTarget()
mPixelHLSL += " gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_Coord.x + dx_Coord.z;\n"
" gl_FragCoord.y = -(input.gl_FragCoord.y * rhw) * dx_Coord.y + dx_Coord.w;\n";
}
mPixelHLSL += " gl_FragCoord.z = (input.gl_FragCoord.z * rhw) * dx_Depth.x + dx_Depth.y;\n"
" gl_FragCoord.w = rhw;\n";
}
@ -1732,7 +1739,7 @@ void Program::link()
// are reserved prefixes, and do not receive additional decoration
mDxDepthRangeLocation = getUniformLocation("dx_DepthRange");
mDxDepthLocation = getUniformLocation("dx_Depth");
mDxViewportLocation = getUniformLocation("dx_Viewport");
mDxCoordLocation = getUniformLocation("dx_Coord");
mDxHalfPixelSizeLocation = getUniformLocation("dx_HalfPixelSize");
mDxFrontCCWLocation = getUniformLocation("dx_FrontCCW");
mDxPointsOrLinesLocation = getUniformLocation("dx_PointsOrLines");
@ -2420,7 +2427,7 @@ void Program::unlink(bool destroy)
mDxDepthRangeLocation = -1;
mDxDepthLocation = -1;
mDxViewportLocation = -1;
mDxCoordLocation = -1;
mDxHalfPixelSizeLocation = -1;
mDxFrontCCWLocation = -1;
mDxPointsOrLinesLocation = -1;
@ -2841,9 +2848,9 @@ GLint Program::getDxDepthLocation() const
return mDxDepthLocation;
}
GLint Program::getDxViewportLocation() const
GLint Program::getDxCoordLocation() const
{
return mDxViewportLocation;
return mDxCoordLocation;
}
GLint Program::getDxHalfPixelSizeLocation() const

View File

@ -103,7 +103,7 @@ class Program
GLint getDxDepthRangeLocation() const;
GLint getDxDepthLocation() const;
GLint getDxViewportLocation() const;
GLint getDxCoordLocation() const;
GLint getDxHalfPixelSizeLocation() const;
GLint getDxFrontCCWLocation() const;
GLint getDxPointsOrLinesLocation() const;
@ -207,7 +207,7 @@ class Program
GLint mDxDepthRangeLocation;
GLint mDxDepthLocation;
GLint mDxViewportLocation;
GLint mDxCoordLocation;
GLint mDxHalfPixelSizeLocation;
GLint mDxFrontCCWLocation;
GLint mDxPointsOrLinesLocation;

View File

@ -79,6 +79,28 @@ static D3DFORMAT ConvertTextureFormatType(GLenum format, GLenum type)
return D3DFMT_A8R8G8B8;
}
static bool IsTextureFormatRenderable(D3DFORMAT format)
{
switch(format)
{
case D3DFMT_L8:
case D3DFMT_A8L8:
case D3DFMT_DXT1:
case D3DFMT_DXT3:
case D3DFMT_DXT5:
return false;
case D3DFMT_A8R8G8B8:
case D3DFMT_X8R8G8B8:
case D3DFMT_A16B16G16R16F:
case D3DFMT_A32B32G32R32F:
return true;
default:
UNREACHABLE();
}
return false;
}
Image::Image()
{
mWidth = 0;
@ -207,26 +229,9 @@ void Image::unlock()
}
}
bool Image::isRenderable() const
bool Image::isRenderableFormat() const
{
switch(getD3DFormat())
{
case D3DFMT_L8:
case D3DFMT_A8L8:
case D3DFMT_DXT1:
case D3DFMT_DXT3:
case D3DFMT_DXT5:
return false;
case D3DFMT_A8R8G8B8:
case D3DFMT_X8R8G8B8:
case D3DFMT_A16B16G16R16F:
case D3DFMT_A32B32G32R32F:
return true;
default:
UNREACHABLE();
}
return false;
return IsTextureFormatRenderable(getD3DFormat());
}
D3DFORMAT Image::getD3DFormat() const
@ -1126,7 +1131,7 @@ void Image::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
int destYOffset = transformPixelYOffset(yoffset, height, mHeight);
RECT destRect = {xoffset, destYOffset, xoffset + width, destYOffset + height};
if (isRenderable())
if (isRenderableFormat())
{
result = D3DXLoadSurfaceFromSurface(getSurface(), NULL, &destRect, renderTargetData, NULL, &sourceRect, D3DX_FILTER_BOX, 0);
@ -1268,9 +1273,9 @@ void Image::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
mDirty = true;
}
TextureStorage::TextureStorage(bool renderable)
: mRenderable(renderable),
mD3DPool(getDisplay()->getTexturePool(renderable)),
TextureStorage::TextureStorage(bool renderTarget)
: mRenderTarget(renderTarget),
mD3DPool(getDisplay()->getTexturePool(mRenderTarget)),
mTextureSerial(issueTextureSerial())
{
}
@ -1279,9 +1284,9 @@ TextureStorage::~TextureStorage()
{
}
bool TextureStorage::isRenderable() const
bool TextureStorage::isRenderTarget() const
{
return mRenderable;
return mRenderTarget;
}
bool TextureStorage::isManaged() const
@ -1566,9 +1571,10 @@ IDirect3DBaseTexture9 *Texture::getTexture()
return NULL;
}
if (!getBaseTexture())
// ensure the underlying texture is created
if (getStorage(false) == NULL)
{
createTexture();
return NULL;
}
updateTexture();
@ -1592,15 +1598,15 @@ void Texture::resetDirty()
mDirtyImages = false;
}
unsigned int Texture::getTextureSerial() const
unsigned int Texture::getTextureSerial()
{
TextureStorage *texture = getStorage();
TextureStorage *texture = getStorage(false);
return texture ? texture->getTextureSerial() : 0;
}
unsigned int Texture::getRenderTargetSerial(GLenum target) const
unsigned int Texture::getRenderTargetSerial(GLenum target)
{
TextureStorage *texture = getStorage();
TextureStorage *texture = getStorage(true);
return texture ? texture->getRenderTargetSerial(target) : 0;
}
@ -1672,12 +1678,13 @@ TextureStorage2D::TextureStorage2D(IDirect3DTexture9 *surfaceTexture) : TextureS
mTexture = surfaceTexture;
}
TextureStorage2D::TextureStorage2D(int levels, D3DFORMAT format, int width, int height, bool renderable) : TextureStorage(renderable), mRenderTargetSerial(RenderbufferStorage::issueSerial())
TextureStorage2D::TextureStorage2D(int levels, D3DFORMAT format, int width, int height, bool renderTarget)
: TextureStorage(renderTarget), mRenderTargetSerial(RenderbufferStorage::issueSerial())
{
IDirect3DDevice9 *device = getDevice();
mTexture = NULL;
HRESULT result = device->CreateTexture(width, height, levels, renderable ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
HRESULT result = device->CreateTexture(width, height, levels, isRenderTarget() ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
if (FAILED(result))
{
@ -1902,14 +1909,14 @@ void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei
redefineImage(level, format, width, height, GL_UNSIGNED_BYTE);
if (!mImageArray[level].isRenderable())
if (!mImageArray[level].isRenderableFormat())
{
mImageArray[level].copy(0, 0, x, y, width, height, renderTarget);
mDirtyImages = true;
}
else
{
if (!mTexStorage || !mTexStorage->isRenderable())
if (!mTexStorage || !mTexStorage->isRenderTarget())
{
convertToRenderTarget();
}
@ -1954,14 +1961,14 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo
return error(GL_OUT_OF_MEMORY);
}
if (!mImageArray[level].isRenderable() || (!mTexStorage && !isSamplerComplete()))
if (!mImageArray[level].isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
{
mImageArray[level].copy(xoffset, yoffset, x, y, width, height, renderTarget);
mDirtyImages = true;
}
else
{
if (!mTexStorage || !mTexStorage->isRenderable())
if (!mTexStorage || !mTexStorage->isRenderTarget())
{
convertToRenderTarget();
}
@ -1996,10 +2003,10 @@ void Texture2D::storage(GLsizei levels, GLenum internalformat, GLsizei width, GL
GLenum format = gl::ExtractFormat(internalformat);
GLenum type = gl::ExtractType(internalformat);
D3DFORMAT d3dfmt = ConvertTextureFormatType(format, type);
const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
const bool renderTarget = IsTextureFormatRenderable(d3dfmt) && (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
delete mTexStorage;
mTexStorage = new TextureStorage2D(levels, d3dfmt, width, height, renderable);
mTexStorage = new TextureStorage2D(levels, d3dfmt, width, height, renderTarget);
mImmutable = true;
for (int level = 0; level < levels; level++)
@ -2154,10 +2161,10 @@ void Texture2D::createTexture()
GLsizei height = mImageArray[0].getHeight();
GLint levels = creationLevels(width, height);
D3DFORMAT format = mImageArray[0].getD3DFormat();
const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
const bool renderTarget = IsTextureFormatRenderable(format) && (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
delete mTexStorage;
mTexStorage = new TextureStorage2D(levels, format, width, height, renderable);
mTexStorage = new TextureStorage2D(levels, format, width, height, renderTarget);
if (mTexStorage->isManaged())
{
@ -2249,7 +2256,7 @@ void Texture2D::generateMipmaps()
mImageArray[0].getType());
}
if (mTexStorage && mTexStorage->isRenderable())
if (mTexStorage && mTexStorage->isRenderTarget())
{
for (unsigned int i = 1; i <= q; i++)
{
@ -2305,12 +2312,8 @@ IDirect3DSurface9 *Texture2D::getRenderTarget(GLenum target)
{
ASSERT(target == GL_TEXTURE_2D);
if (!mTexStorage || !mTexStorage->isRenderable())
{
convertToRenderTarget();
}
if (mTexStorage == NULL)
// ensure the underlying texture is created
if (getStorage(true) == NULL)
{
return NULL;
}
@ -2320,17 +2323,30 @@ IDirect3DSurface9 *Texture2D::getRenderTarget(GLenum target)
return mTexStorage->getSurfaceLevel(0);
}
TextureStorage *Texture2D::getStorage() const
TextureStorage *Texture2D::getStorage(bool renderTarget)
{
if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
{
if (renderTarget)
{
convertToRenderTarget();
}
else
{
createTexture();
}
}
return mTexStorage;
}
TextureStorageCubeMap::TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderable) : TextureStorage(renderable), mFirstRenderTargetSerial(RenderbufferStorage::issueCubeSerials())
TextureStorageCubeMap::TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderTarget)
: TextureStorage(renderTarget), mFirstRenderTargetSerial(RenderbufferStorage::issueCubeSerials())
{
IDirect3DDevice9 *device = getDevice();
mTexture = NULL;
HRESULT result = device->CreateCubeTexture(size, levels, renderable ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
HRESULT result = device->CreateCubeTexture(size, levels, isRenderTarget() ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
if (FAILED(result))
{
@ -2630,10 +2646,10 @@ void TextureCubeMap::createTexture()
GLsizei size = mImageArray[0][0].getWidth();
GLint levels = creationLevels(size, 0);
D3DFORMAT format = mImageArray[0][0].getD3DFormat();
const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
const bool renderTarget = IsTextureFormatRenderable(format) && (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
delete mTexStorage;
mTexStorage = new TextureStorageCubeMap(levels, format, size, renderable);
mTexStorage = new TextureStorageCubeMap(levels, format, size, renderTarget);
if (mTexStorage->isManaged())
{
@ -2767,14 +2783,14 @@ void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint
unsigned int faceindex = faceIndex(target);
redefineImage(faceindex, level, format, width, height, GL_UNSIGNED_BYTE);
if (!mImageArray[faceindex][level].isRenderable())
if (!mImageArray[faceindex][level].isRenderableFormat())
{
mImageArray[faceindex][level].copy(0, 0, x, y, width, height, renderTarget);
mDirtyImages = true;
}
else
{
if (!mTexStorage || !mTexStorage->isRenderable())
if (!mTexStorage || !mTexStorage->isRenderTarget())
{
convertToRenderTarget();
}
@ -2825,14 +2841,14 @@ void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLi
unsigned int faceindex = faceIndex(target);
if (!mImageArray[faceindex][level].isRenderable() || (!mTexStorage && !isSamplerComplete()))
if (!mImageArray[faceindex][level].isRenderableFormat() || (!mTexStorage && !isSamplerComplete()))
{
mImageArray[faceindex][level].copy(0, 0, x, y, width, height, renderTarget);
mDirtyImages = true;
}
else
{
if (!mTexStorage || !mTexStorage->isRenderable())
if (!mTexStorage || !mTexStorage->isRenderTarget())
{
convertToRenderTarget();
}
@ -2867,10 +2883,10 @@ void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size
GLenum format = gl::ExtractFormat(internalformat);
GLenum type = gl::ExtractType(internalformat);
D3DFORMAT d3dfmt = ConvertTextureFormatType(format, type);
const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
const bool renderTarget = IsTextureFormatRenderable(d3dfmt) && (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
delete mTexStorage;
mTexStorage = new TextureStorageCubeMap(levels, d3dfmt, size, renderable);
mTexStorage = new TextureStorageCubeMap(levels, d3dfmt, size, renderTarget);
mImmutable = true;
for (int level = 0; level < levels; level++)
@ -2933,7 +2949,7 @@ void TextureCubeMap::generateMipmaps()
}
}
if (mTexStorage && mTexStorage->isRenderable())
if (mTexStorage && mTexStorage->isRenderTarget())
{
for (unsigned int f = 0; f < 6; f++)
{
@ -2997,12 +3013,8 @@ IDirect3DSurface9 *TextureCubeMap::getRenderTarget(GLenum target)
{
ASSERT(IsCubemapTextureTarget(target));
if (!mTexStorage || !mTexStorage->isRenderable())
{
convertToRenderTarget();
}
if (mTexStorage == NULL)
// ensure the underlying texture is created
if (getStorage(true) == NULL)
{
return NULL;
}
@ -3012,8 +3024,20 @@ IDirect3DSurface9 *TextureCubeMap::getRenderTarget(GLenum target)
return mTexStorage->getCubeMapSurface(target, 0);
}
TextureStorage *TextureCubeMap::getStorage() const
TextureStorage *TextureCubeMap::getStorage(bool renderTarget)
{
if (!mTexStorage || (renderTarget && !mTexStorage->isRenderTarget()))
{
if (renderTarget)
{
convertToRenderTarget();
}
else
{
createTexture();
}
}
return mTexStorage;
}

View File

@ -56,7 +56,7 @@ class Image
HRESULT lock(D3DLOCKED_RECT *lockedRect, const RECT *rect);
void unlock();
bool isRenderable() const;
bool isRenderableFormat() const;
D3DFORMAT getD3DFormat() const;
GLsizei getWidth() const {return mWidth;}
@ -144,11 +144,11 @@ class Image
class TextureStorage
{
public:
explicit TextureStorage(bool renderable);
explicit TextureStorage(bool renderTarget);
virtual ~TextureStorage();
bool isRenderable() const;
bool isRenderTarget() const;
bool isManaged() const;
D3DPOOL getPool() const;
unsigned int getTextureSerial() const;
@ -157,7 +157,7 @@ class TextureStorage
private:
DISALLOW_COPY_AND_ASSIGN(TextureStorage);
const bool mRenderable;
const bool mRenderTarget;
const D3DPOOL mD3DPool;
const unsigned int mTextureSerial;
@ -205,8 +205,8 @@ class Texture : public RefCountObject
bool hasDirtyParameters() const;
bool hasDirtyImages() const;
void resetDirty();
unsigned int getTextureSerial() const;
unsigned int getRenderTargetSerial(GLenum target) const;
unsigned int getTextureSerial();
unsigned int getRenderTargetSerial(GLenum target);
bool isImmutable() const;
@ -248,14 +248,14 @@ class Texture : public RefCountObject
private:
DISALLOW_COPY_AND_ASSIGN(Texture);
virtual TextureStorage *getStorage() const = 0;
virtual TextureStorage *getStorage(bool renderTarget) = 0;
};
class TextureStorage2D : public TextureStorage
{
public:
explicit TextureStorage2D(IDirect3DTexture9 *surfaceTexture);
TextureStorage2D(int levels, D3DFORMAT format, int width, int height, bool renderable);
TextureStorage2D(int levels, D3DFORMAT format, int width, int height, bool renderTarget);
virtual ~TextureStorage2D();
@ -311,7 +311,7 @@ class Texture2D : public Texture
virtual void updateTexture();
virtual void convertToRenderTarget();
virtual IDirect3DSurface9 *getRenderTarget(GLenum target);
virtual TextureStorage *getStorage() const;
virtual TextureStorage *getStorage(bool renderTarget);
bool isMipmapComplete() const;
@ -329,7 +329,7 @@ class Texture2D : public Texture
class TextureStorageCubeMap : public TextureStorage
{
public:
TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderable);
TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderTarget);
virtual ~TextureStorageCubeMap();
@ -392,7 +392,7 @@ class TextureCubeMap : public Texture
virtual void updateTexture();
virtual void convertToRenderTarget();
virtual IDirect3DSurface9 *getRenderTarget(GLenum target);
virtual TextureStorage *getStorage() const;
virtual TextureStorage *getStorage(bool renderTarget);
bool isCubeComplete() const;
bool isMipmapCubeComplete() const;

View File

@ -128,8 +128,8 @@ CPPSRCS += \
endif
endif
EXPORTS_NAMESPACES = IPC mozilla/layers
EXPORTS_IPC = ShadowLayerUtils.h
EXPORTS_NAMESPACES = gfxipc mozilla/layers
EXPORTS_gfxipc = ShadowLayerUtils.h
EXPORTS_mozilla/layers =\
ShadowLayers.h \
ShadowLayersChild.h \

View File

@ -42,7 +42,7 @@
include protocol PLayer;
include protocol PRenderFrame;
include "IPC/ShadowLayerUtils.h";
include "gfxipc/ShadowLayerUtils.h";
using gfx3DMatrix;
using gfxRGBA;

View File

@ -49,7 +49,7 @@
#include "mozilla/layers/PLayersParent.h"
#include "ShadowLayers.h"
#include "ShadowLayerChild.h"
#include "ShadowLayerUtils.h"
#include "gfxipc/ShadowLayerUtils.h"
using namespace mozilla::ipc;

View File

@ -105,7 +105,6 @@ EXPORTS += \
gfxPlatformMac.h \
gfxQuartzSurface.h \
gfxQuartzImageSurface.h \
gfxQuartzPDFSurface.h \
gfxQuartzNativeDrawing.h \
$(NULL)
endif
@ -132,9 +131,6 @@ else
EXPORTS += gfxFT2Fonts.h
endif
ifdef MOZ_DFB
EXPORTS += gfxDirectFBSurface.h
endif
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
@ -328,14 +324,6 @@ CPPSRCS += gfxFT2FontBase.cpp
CPPSRCS += gfxFT2Utils.cpp
CPPSRCS += nsUnicodeRange.cpp
ifdef MOZ_DFB
CSRCS = cairo-gdk-utils.c
endif
endif
ifdef MOZ_DFB
CPPSRCS += gfxDirectFBSurface.cpp
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
@ -359,7 +347,6 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
CPPSRCS += \
gfxQuartzSurface.cpp \
gfxQuartzImageSurface.cpp \
gfxQuartzPDFSurface.cpp \
gfxPlatformMac.cpp \
gfxMacFont.cpp \
gfxCoreTextShaper.cpp \

View File

@ -1,107 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Novell code.
*
* The Initial Developer of the Original Code is Novell.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* rocallahan@novell.com
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "cairo-gdk-utils.h"
#include <stdlib.h>
#if HAVE_STDINT_H
#include <stdint.h>
#elif HAVE_INTTYPES_H
#include <inttypes.h>
#elif HAVE_SYS_INT_TYPES_H
#include <sys/int_types.h>
#endif
/* We have three basic strategies available:
1) 'direct': cr targets a native surface, and other conditions are met: we can
pass the underlying drawable directly to the callback
2) 'opaque': the image is opaque: we can create a temporary cairo native surface,
pass its underlying drawable to the callback, and paint the result
using cairo
3) 'default': create a temporary cairo native surface, fill with black, pass its
underlying drawable to the callback, copy the results to a cairo
image surface, repeat with a white background, update the on-black
image alpha values by comparing the two images, then paint the on-black
image using cairo
Sure would be nice to have an X extension to do 3 for us on the server...
*/
static cairo_bool_t
_convert_coord_to_short (double coord, short *v)
{
*v = (short)coord;
/* XXX allow some tolerance here? */
return *v == coord;
}
static cairo_bool_t
_convert_coord_to_unsigned_short (double coord, unsigned short *v)
{
*v = (unsigned short)coord;
/* XXX allow some tolerance here? */
return *v == coord;
}
void cairo_draw_with_gdk (cairo_t *cr,
cairo_gdk_drawing_callback callback,
void * closure,
unsigned int width, unsigned int height,
cairo_gdk_drawing_opacity_t is_opaque,
cairo_gdk_drawing_support_t capabilities,
cairo_gdk_drawing_result_t *result)
{
double device_offset_x, device_offset_y;
short offset_x = 0, offset_y = 0;
//cairo_surface_t * target = cairo_get_group_target (cr);
cairo_surface_t * target = cairo_get_target (cr);
cairo_matrix_t matrix;
cairo_surface_get_device_offset (target, &device_offset_x, &device_offset_y);
cairo_get_matrix (cr, &matrix);
_convert_coord_to_short (matrix.x0 + device_offset_x, &offset_x);
_convert_coord_to_short (matrix.y0 + device_offset_y, &offset_y);
cairo_surface_flush (target);
callback (closure, target, offset_x, offset_y, NULL, 0);
cairo_surface_mark_dirty (target);
}

View File

@ -1,119 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Novell code.
*
* The Initial Developer of the Original Code is Novell.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* rocallahan@novell.com
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef CAIROGDKUTILS_H_
#define CAIROGDKUTILS_H_
#include "cairo.h"
#include <gdk/gdk.h>
CAIRO_BEGIN_DECLS
/**
* This callback encapsulates GDK-based rendering. We assume that the
* execution of the callback is equivalent to compositing some RGBA image of
* size (bounds_width, bounds_height) onto the drawable at offset (offset_x,
* offset_y), clipped to the union of the clip_rects if num_rects is greater
* than zero. This includes the assumption that the same RGBA image
* is composited if you call the callback multiple times with the same closure,
* display and visual during a single cairo_draw_with_gdk call.
*
* @return True when able to draw, False otherwise
*/
typedef cairo_bool_t (* cairo_gdk_drawing_callback)
(void *closure,
cairo_surface_t *surface,
short offset_x, short offset_y,
GdkRectangle * clip_rects, unsigned int num_rects);
/**
* This type specifies whether the native drawing callback draws all pixels
* in its bounds opaquely, independent of the contents of the target drawable,
* or whether it leaves pixels transparent/translucent or depends on the
* existing contents of the target drawable in some way.
*/
typedef enum _cairo_gdk_drawing_opacity {
CAIRO_GDK_DRAWING_OPAQUE,
CAIRO_GDK_DRAWING_TRANSPARENT
} cairo_gdk_drawing_opacity_t;
/**
* This type encodes the capabilities of the native drawing callback.
*
* If CAIRO_GDK_DRAWING_SUPPORTS_CLIP_RECT is set, then 'num_rects' can be
* zero or one in the call to the callback. Otherwise 'num_rects' will be
* zero.
*/
typedef enum {
CAIRO_GDK_DRAWING_SUPPORTS_CLIP_RECT = 0x02,
} cairo_gdk_drawing_support_t;
/**
* Draw GDK output into any cairo context. All cairo transforms and effects
* are honored, including the current operator. This is equivalent to a
* cairo_set_source_surface and then cairo_paint.
* @param cr the context to draw into
* @param drawable a GDK Drawable that we're targetting
* @param callback the code to perform GDK rendering
* @param closure associated data
* @param width the width of the putative image drawn by the callback
* @param height the height of the putative image drawn by the callback
* @param is_opaque set to CAIRO_GDK_DRAWING_IS_OPAQUE to indicate
* that all alpha values of the putative image will be 1.0; the pixels drawn into
* the Drawable must not depend on the prior contents of the Drawable
* in any way
* @param capabilities the capabilities of the callback as described above.
* @param result if non-NULL, we *may* fill in the struct with information about
* the rendered image. 'surface' may be filled in with a surface representing
* the image, similar to the target of 'cr'. If 'uniform_alpha' is True then
* every pixel of the image has the same alpha value 'alpha'. If
* 'uniform_color' is True then every pixel of the image has the same RGB
* color (r, g, b). If the image has uniform color and alpha (or alpha is zero,
* in which case the color is always uniform) then we won't bother returning
* a surface for it.
*/
void cairo_draw_with_gdk (cairo_t *cr,
cairo_gdk_drawing_callback callback,
void * closure,
unsigned int width, unsigned int height,
cairo_gdk_drawing_opacity_t is_opaque,
cairo_gdk_drawing_support_t capabilities,
cairo_gdk_drawing_result_t *result);
CAIRO_END_DECLS
#endif /*CAIROGDKUTILS_H_*/

View File

@ -64,10 +64,6 @@
#include "gfxQuartzImageSurface.h"
#endif
#ifdef MOZ_DFB
#include "gfxDirectFBSurface.h"
#endif
#if defined(CAIRO_HAS_QT_SURFACE) && defined(MOZ_WIDGET_QT)
#include "gfxQPainterSurface.h"
#endif
@ -203,11 +199,6 @@ gfxASurface::Wrap (cairo_surface_t *csurf)
result = new gfxQuartzImageSurface(csurf);
}
#endif
#ifdef MOZ_DFB
else if (stype == CAIRO_SURFACE_TYPE_DIRECTFB) {
result = new gfxDirectFBSurface(csurf);
}
#endif
#if defined(CAIRO_HAS_QT_SURFACE) && defined(MOZ_WIDGET_QT)
else if (stype == CAIRO_SURFACE_TYPE_QT) {
result = new gfxQPainterSurface(csurf);
@ -579,11 +570,11 @@ static const SurfaceMemoryReporterAttrs sSurfaceMemoryReporterAttrs[] = {
"accounted for here aren't counted in vsize, resident, explicit, or any of "
"the other measurements on this page."},
{"gfx-surface-xcb", nsnull},
{"gfx-surface-glitz", nsnull},
{"gfx-surface-glitz???", nsnull}, // should never be used
{"gfx-surface-quartz", nsnull},
{"gfx-surface-win32", nsnull},
{"gfx-surface-beos", nsnull},
{"gfx-surface-directfb", nsnull},
{"gfx-surface-directfb???", nsnull}, // should never be used
{"gfx-surface-svg", nsnull},
{"gfx-surface-os2", nsnull},
{"gfx-surface-win32printing", nsnull},

View File

@ -80,11 +80,11 @@ public:
SurfaceTypePS,
SurfaceTypeXlib,
SurfaceTypeXcb,
SurfaceTypeGlitz,
SurfaceTypeGlitz, // unused, but needed for cairo parity
SurfaceTypeQuartz,
SurfaceTypeWin32,
SurfaceTypeBeOS,
SurfaceTypeDirectFB,
SurfaceTypeDirectFB, // unused, but needed for cairo parity
SurfaceTypeSVG,
SurfaceTypeOS2,
SurfaceTypeWin32Printing,

View File

@ -1,147 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Corporation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "gfxDirectFBSurface.h"
#include "cairo-directfb.h"
gfxDirectFBSurface::gfxDirectFBSurface(IDirectFB *dfb, IDirectFBSurface *dfbs)
: mDFB(nsnull), mDFBSurface(nsnull)
{
dfb->AddRef( dfb );
dfbs->AddRef( dfbs );
cairo_surface_t *surf = cairo_directfb_surface_create(dfb, dfbs);
mDFB = dfb;
mDFBSurface = dfbs;
Init(surf);
}
gfxDirectFBSurface::gfxDirectFBSurface(IDirectFBSurface *dfbs)
: mDFB(nsnull), mDFBSurface(nsnull)
{
DFBResult ret;
dfbs->AddRef( dfbs );
/* Lightweight, getting singleton */
ret = DirectFBCreate( &mDFB );
if (ret) {
D_DERROR( (DirectResult) ret, "gfxDirectFBSurface: DirectFBCreate() failed!\n" );
return;
}
cairo_surface_t *surf = cairo_directfb_surface_create(mDFB, dfbs);
mDFBSurface = dfbs;
Init(surf);
}
gfxDirectFBSurface::gfxDirectFBSurface(cairo_surface_t *csurf)
{
mDFB = nsnull;
mDFBSurface = nsnull;
Init(csurf, true);
}
gfxDirectFBSurface::gfxDirectFBSurface(const gfxIntSize& size, gfxImageFormat format) :
mDFB(nsnull), mDFBSurface(nsnull)
{
DFBResult ret;
DFBSurfaceDescription desc;
if (!CheckSurfaceSize(size) || size.width <= 0 || size.height <= 0)
return;
/* Lightweight, getting singleton */
ret = DirectFBCreate( &mDFB );
if (ret) {
D_DERROR( (DirectResult) ret, "gfxDirectFBSurface: DirectFBCreate() failed!\n" );
return;
}
desc.flags = (DFBSurfaceDescriptionFlags)( DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT );
desc.width = size.width;
desc.height = size.height;
switch (format) {
case gfxASurface::ImageFormatARGB32:
desc.pixelformat = DSPF_ARGB;
break;
case gfxASurface::ImageFormatRGB24:
desc.pixelformat = DSPF_RGB32;
break;
case gfxASurface::ImageFormatA8:
desc.pixelformat = DSPF_A8;
break;
case gfxASurface::ImageFormatA1:
desc.pixelformat = DSPF_A1;
break;
default:
D_BUG( "unknown format" );
return;
}
ret = mDFB->CreateSurface( mDFB, &desc, &mDFBSurface );
if (ret) {
D_DERROR( (DirectResult) ret, "gfxDirectFBSurface: "
"IDirectFB::CreateSurface( %dx%d ) failed!\n", desc.width, desc.height );
return;
}
cairo_surface_t *surface = cairo_directfb_surface_create(mDFB, mDFBSurface);
Init(surface);
}
gfxDirectFBSurface::~gfxDirectFBSurface()
{
if (mDFBSurface)
mDFBSurface->Release( mDFBSurface );
if (mDFB)
mDFB->Release( mDFB );
}

View File

@ -1,69 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is DirectFB Thebes code.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_DIRECTFBSURFACE_H
#define GFX_DIRECTFBSURFACE_H
#include "gfxASurface.h"
extern "C" {
#include "direct/messages.h"
typedef struct _IDirectFB IDirectFB;
typedef struct _IDirectFBSurface IDirectFBSurface;
}
class THEBES_API gfxDirectFBSurface : public gfxASurface {
public:
gfxDirectFBSurface(IDirectFB *dfb, IDirectFBSurface *surface);
gfxDirectFBSurface(IDirectFBSurface *surface);
gfxDirectFBSurface(cairo_surface_t *csurf);
gfxDirectFBSurface(const gfxIntSize& size, gfxImageFormat format);
virtual ~gfxDirectFBSurface();
IDirectFB* DirectFB() { return mDFB; }
IDirectFBSurface* DirectFBSurface() { return mDFBSurface; }
protected:
IDirectFB *mDFB;
IDirectFBSurface *mDFBSurface;
};
#endif /* GFX_DIRECTFBSURFACE_H */

View File

@ -93,56 +93,3 @@ gfxGdkNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
}
#endif
#ifdef MOZ_DFB
#include "cairo-gdk-utils.h"
typedef struct {
gfxGdkNativeRenderer* mRenderer;
nsresult mRV;
} NativeRenderingClosure;
static cairo_bool_t
NativeRendering(void *closure,
cairo_surface_t *surface,
short offset_x, short offset_y,
GdkRectangle * rectangles, unsigned int num_rects)
{
NativeRenderingClosure* cl = (NativeRenderingClosure*)closure;
nsRefPtr<gfxASurface> gfxSurface = gfxASurface::Wrap(surface);
GdkDrawable *drawable = gfxPlatformGtk::GetGdkDrawable(gfxSurface);
if (!drawable)
return 0;
nsresult rv = cl->mRenderer->
DrawWithGDK(drawable, offset_x, offset_y,
rectangles, num_rects);
cl->mRV = rv;
return NS_SUCCEEDED(rv);
}
void
gfxGdkNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
PRUint32 flags, GdkVisual* visual)
{
NativeRenderingClosure closure = { this, NS_OK };
cairo_gdk_drawing_result_t result;
int cairoFlags = 0;
if (flags & DRAW_SUPPORTS_CLIP_RECT) {
cairoFlags |= CAIRO_GDK_DRAWING_SUPPORTS_CLIP_RECT;
}
cairo_draw_with_gdk(ctx->GetCairo(),
NativeRendering,
&closure, size.width, size.height,
(flags & DRAW_IS_OPAQUE) ? CAIRO_GDK_DRAWING_OPAQUE : CAIRO_GDK_DRAWING_TRANSPARENT,
(cairo_gdk_drawing_support_t)cairoFlags,
NULL);
if (NS_FAILED(closure.mRV)) {
return closure.mRV;
}
return NS_OK;
}
#endif // MOZ_DFB

View File

@ -1,73 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Oracle Corporation code.
*
* The Initial Developer of the Original Code is Oracle Corporation.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_GLITZSURFACE_H
#define GFX_GLITZSURFACE_H
#include "gfxASurface.h"
#include <cairo-glitz.h>
/**
* A surface that wraps a glitz surface.
*/
class THEBES_API gfxGlitzSurface : public gfxASurface {
public:
gfxGlitzSurface(glitz_drawable_t *drawable,
glitz_surface_t *glitzSurface,
bool takeOwnership = false);
virtual ~gfxGlitzSurface();
/**
* When double-buffering is used, swaps the back and the front buffer.
*/
void SwapBuffers();
unsigned long Width();
unsigned long Height();
glitz_surface_t* GlitzSurface() { return mGlitzSurface; }
glitz_drawable_t* GlitzDrawable() { return mGlitzDrawable; }
protected:
glitz_drawable_t *mGlitzDrawable;
glitz_surface_t *mGlitzSurface;
bool mOwnsSurface;
};
#endif /* GFX_GLITZSURFACE_H */

View File

@ -72,14 +72,6 @@
#endif /* MOZ_X11 */
#ifdef MOZ_DFB
#include "gfxDirectFBSurface.h"
#endif
#ifdef MOZ_DFB
#include "gfxDirectFBSurface.h"
#endif
#include <fontconfig/fontconfig.h>
#include "nsMathUtils.h"
@ -204,13 +196,6 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
}
#endif
#ifdef MOZ_DFB
if (size.width < GDK_PIXMAP_SIZE_MAX && size.height < GDK_PIXMAP_SIZE_MAX) {
newSurface = new gfxDirectFBSurface(size, imageFormat);
}
#endif
if (!newSurface) {
// We couldn't create a native surface for whatever reason;
// e.g., no display, no RENDER, bad size, etc.

View File

@ -1,93 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Corporation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <stuart@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "gfxQuartzPDFSurface.h"
#include "cairo-quartz.h"
gfxQuartzPDFSurface::gfxQuartzPDFSurface(const char *filename, gfxSize aSizeInPoints)
{
mRect = CGRectMake(0.0, 0.0, aSizeInPoints.width, aSizeInPoints.height);
CFStringRef file = CFStringCreateWithCString(kCFAllocatorDefault, filename, kCFStringEncodingUTF8);
CFURLRef fileURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, file, kCFURLPOSIXPathStyle, false);
mCGContext = CGPDFContextCreateWithURL(fileURL, &mRect, NULL);
CFRelease(file);
CFRelease(fileURL);
Init(cairo_quartz_surface_create_for_cg_context(mCGContext, aSizeInPoints.width, aSizeInPoints.height));
}
gfxQuartzPDFSurface::~gfxQuartzPDFSurface()
{
CGContextRelease(mCGContext);
}
nsresult
gfxQuartzPDFSurface::BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName)
{
return NS_OK;
}
nsresult
gfxQuartzPDFSurface::EndPrinting()
{
return NS_OK;
}
nsresult
gfxQuartzPDFSurface::AbortPrinting()
{
return NS_OK;
}
nsresult
gfxQuartzPDFSurface::BeginPage()
{
CGContextBeginPage(mCGContext, &mRect);
return NS_OK;
}
nsresult
gfxQuartzPDFSurface::EndPage()
{
CGContextEndPage(mCGContext);
return NS_OK;
}

View File

@ -1,74 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Corporation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <stuart@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_QUARTZPDFSURFACE_H
#define GFX_QUARTZPDFSURFACE_H
#include "gfxASurface.h"
#include "gfxContext.h"
#include <Carbon/Carbon.h>
class THEBES_API gfxQuartzPDFSurface : public gfxASurface {
public:
gfxQuartzPDFSurface(const char *filename, gfxSize aSizeInPoints);
virtual ~gfxQuartzPDFSurface();
nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName);
nsresult EndPrinting();
nsresult AbortPrinting();
nsresult BeginPage();
nsresult EndPage();
virtual const gfxIntSize GetSize() const {
gfxIntSize size(mRect.size.width, mRect.size.height);
return size;
}
CGContextRef GetCGContext() { return mCGContext; }
virtual PRInt32 GetDefaultContextFlags() const
{
return gfxContext::FLAG_DISABLE_SNAPPING |
gfxContext::FLAG_DISABLE_COPY_BACKGROUND;
}
protected:
CGContextRef mCGContext;
CGRect mRect;
};
#endif /* GFX_QUARTZPDFSURFACE_H */

View File

@ -39,6 +39,8 @@
#ifndef nsIconChannel_h_
#define nsIconChannel_h_
#include "mozilla/Attributes.h"
#include "nsIChannel.h"
#include "nsIURI.h"
#include "nsIIconURI.h"
@ -49,7 +51,7 @@
* It asks Android for an icon, and creates a new channel for
* that file to which all calls will be proxied.
*/
class nsIconChannel : public nsIChannel {
class nsIconChannel MOZ_FINAL : public nsIChannel {
public:
NS_DECL_ISUPPORTS
NS_FORWARD_NSIREQUEST(mRealChannel->)

View File

@ -283,6 +283,7 @@ moz_gtk_icon_size(const char *name)
return GTK_ICON_SIZE_MENU;
}
#if defined(MOZ_ENABLE_GNOMEUI) || defined(MOZ_ENABLE_GIO)
static PRInt32
GetIconSize(nsIMozIconURI *aIconURI)
{
@ -320,6 +321,7 @@ ScaleIconBuf(GdkPixbuf **aBuf, PRInt32 iconSize)
}
return NS_OK;
}
#endif
#ifdef MOZ_ENABLE_GNOMEUI
nsresult

View File

@ -37,6 +37,8 @@
#ifndef nsIconChannel_h_
#define nsIconChannel_h_
#include "mozilla/Attributes.h"
#include "nsIChannel.h"
#include "nsIStreamListener.h"
#include "nsIURI.h"
@ -48,7 +50,7 @@
* gtk/gnome for an icon, saves it as a tmp icon, and creates a new channel for
* that file to which all calls will be proxied.
*/
class nsIconChannel : public nsIChannel {
class nsIconChannel MOZ_FINAL : public nsIChannel {
public:
NS_DECL_ISUPPORTS
NS_FORWARD_NSIREQUEST(mRealChannel->)

View File

@ -41,6 +41,8 @@
#ifndef nsIconChannel_h___
#define nsIconChannel_h___
#include "mozilla/Attributes.h"
#include "nsCOMPtr.h"
#include "nsXPIDLString.h"
#include "nsIChannel.h"
@ -53,7 +55,7 @@
class nsIFile;
class nsIconChannel : public nsIChannel, public nsIStreamListener
class nsIconChannel MOZ_FINAL : public nsIChannel, public nsIStreamListener
{
public:
NS_DECL_ISUPPORTS

View File

@ -41,6 +41,8 @@
#ifndef nsIconChannel_h___
#define nsIconChannel_h___
#include "mozilla/Attributes.h"
#include "nsCOMPtr.h"
#include "nsXPIDLString.h"
#include "nsIChannel.h"
@ -53,7 +55,7 @@
class nsIFile;
class nsIconChannel : public nsIChannel, public nsIStreamListener
class nsIconChannel MOZ_FINAL : public nsIChannel, public nsIStreamListener
{
public:
NS_DECL_ISUPPORTS

View File

@ -38,6 +38,8 @@
#ifndef nsIconChannel_h_
#define nsIconChannel_h_
#include "mozilla/Attributes.h"
#include "nsIChannel.h"
#include "nsIStreamListener.h"
#include "nsIURI.h"
@ -49,7 +51,7 @@
* qt for an icon, and creates a new channel for
* that file to which all calls will be proxied.
*/
class nsIconChannel : public nsIChannel {
class nsIconChannel MOZ_FINAL : public nsIChannel {
public:
NS_DECL_ISUPPORTS
NS_FORWARD_NSIREQUEST(mRealChannel->)

View File

@ -40,6 +40,8 @@
#ifndef nsIconChannel_h___
#define nsIconChannel_h___
#include "mozilla/Attributes.h"
#include "nsCOMPtr.h"
#include "nsXPIDLString.h"
#include "nsIChannel.h"
@ -55,7 +57,7 @@
class nsIFile;
class nsIconChannel : public nsIChannel, public nsIStreamListener
class nsIconChannel MOZ_FINAL : public nsIChannel, public nsIStreamListener
{
public:
NS_DECL_ISUPPORTS

View File

@ -35,11 +35,12 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Attributes.h"
#include "mozilla/ReentrantMonitor.h"
#include "imgIEncoder.h"
#include "BMPFileHeaders.h"
#include "mozilla/ReentrantMonitor.h"
#include "nsCOMPtr.h"
#define NS_BMPENCODER_CID \
@ -53,7 +54,7 @@
// Provides BMP encoding functionality. Use InitFromData() to do the
// encoding. See that function definition for encoding options.
class nsBMPEncoder : public imgIEncoder
class nsBMPEncoder MOZ_FINAL : public imgIEncoder
{
typedef mozilla::ReentrantMonitor ReentrantMonitor;
public:

View File

@ -50,15 +50,13 @@ using namespace mozilla::imagelib;
NS_IMPL_THREADSAFE_ISUPPORTS3(nsICOEncoder, imgIEncoder, nsIInputStream, nsIAsyncInputStream)
nsICOEncoder::nsICOEncoder() : mFinished(false),
mImageBufferStart(nsnull),
nsICOEncoder::nsICOEncoder() : mImageBufferStart(nsnull),
mImageBufferCurr(0),
mImageBufferSize(0),
mImageBufferReadPoint(0),
mCallback(nsnull),
mCallbackTarget(nsnull),
mNotifyThreshold(0),
mUsePNG(true)
mFinished(false),
mUsePNG(true),
mNotifyThreshold(0)
{
}

View File

@ -35,10 +35,11 @@
*
* ***** END LICENSE BLOCK ***** */
#include "imgIEncoder.h"
#include "mozilla/Attributes.h"
#include "mozilla/ReentrantMonitor.h"
#include "imgIEncoder.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "ICOFileHeaders.h"
@ -57,7 +58,7 @@ class nsPNGEncoder;
// Provides ICO encoding functionality. Use InitFromData() to do the
// encoding. See that function definition for encoding options.
class nsICOEncoder : public imgIEncoder
class nsICOEncoder MOZ_FINAL : public imgIEncoder
{
typedef mozilla::ReentrantMonitor ReentrantMonitor;
public:

View File

@ -35,10 +35,11 @@
*
* ***** END LICENSE BLOCK ***** */
#include "imgIEncoder.h"
#include "mozilla/Attributes.h"
#include "mozilla/ReentrantMonitor.h"
#include "imgIEncoder.h"
#include "nsCOMPtr.h"
#include <png.h>
@ -54,7 +55,7 @@
// Provides PNG encoding functionality. Use InitFromData() to do the
// encoding. See that function definition for encoding options.
class nsPNGEncoder : public imgIEncoder
class nsPNGEncoder MOZ_FINAL : public imgIEncoder
{
typedef mozilla::ReentrantMonitor ReentrantMonitor;
public:

View File

@ -138,4 +138,4 @@ enum ERLEState {
eRLEStateAbsoluteModePadded ///< As above, but another byte of data has to be read as padding
};
#endif
#endif

View File

@ -48,13 +48,13 @@ Decoder::Decoder(RasterImage &aImage, imgIDecoderObserver* aObserver)
: mImage(aImage)
, mObserver(aObserver)
, mDecodeFlags(0)
, mDecodeDone(false)
, mDataError(false)
, mFrameCount(0)
, mFailCode(NS_OK)
, mInitialized(false)
, mSizeDecode(false)
, mInFrame(false)
, mDecodeDone(false)
, mDataError(false)
, mIsAnimated(false)
{
}

View File

@ -146,6 +146,13 @@ DiscardTracker::DiscardAll()
TimerOff();
}
static int
DiscardTimeoutChangedCallback(const char* aPref, void *aClosure)
{
DiscardTracker::ReloadTimeout();
return 0;
}
/**
* Initialize the tracker.
*/
@ -161,7 +168,10 @@ DiscardTracker::Initialize()
sSentinel.prev = &sHead;
sSentinel.next = &sTail;
// Load the timeout
// Watch the timeout pref for changes.
Preferences::RegisterCallback(DiscardTimeoutChangedCallback,
DISCARD_TIMEOUT_PREF);
ReloadTimeout();
// Create and start the timer
@ -191,7 +201,7 @@ DiscardTracker::Shutdown()
}
/**
* Sets the minimum timeout.
* Read the discard timeout from about:config.
*/
void
DiscardTracker::ReloadTimeout()

View File

@ -58,6 +58,7 @@
#include "ImageLogging.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Preferences.h"
#include "ImageLayers.h"
#include "nsPNGDecoder.h"
@ -84,25 +85,24 @@ static PRLogModuleInfo *gCompressedImageAccountingLog = PR_NewLogModule ("Compre
#define gCompressedImageAccountingLog
#endif
// Tweakable progressive decoding parameters
static PRUint32 gDecodeBytesAtATime = 200000;
static PRUint32 gMaxMSBeforeYield = 400;
static PRUint32 gMaxBytesForSyncDecode = 150000;
// Tweakable progressive decoding parameters. These are initialized to 0 here
// because otherwise, we have to initialize them in a static initializer, which
// makes us slower to start up.
static bool gInitializedPrefCaches = false;
static PRUint32 gDecodeBytesAtATime = 0;
static PRUint32 gMaxMSBeforeYield = 0;
static PRUint32 gMaxBytesForSyncDecode = 0;
void
RasterImage::SetDecodeBytesAtATime(PRUint32 aBytesAtATime)
static void
InitPrefCaches()
{
gDecodeBytesAtATime = aBytesAtATime;
}
void
RasterImage::SetMaxMSBeforeYield(PRUint32 aMaxMS)
{
gMaxMSBeforeYield = aMaxMS;
}
void
RasterImage::SetMaxBytesForSyncDecode(PRUint32 aMaxBytes)
{
gMaxBytesForSyncDecode = aMaxBytes;
Preferences::AddUintVarCache(&gDecodeBytesAtATime,
"image.mem.decode_bytes_at_a_time", 200000);
Preferences::AddUintVarCache(&gMaxMSBeforeYield,
"image.mem.max_ms_before_yield", 400);
Preferences::AddUintVarCache(&gMaxBytesForSyncDecode,
"image.mem.max_bytes_for_sync_decode", 150000);
gInitializedPrefCaches = true;
}
/* We define our own error checking macros here for 2 reasons:
@ -216,6 +216,11 @@ RasterImage::RasterImage(imgStatusTracker* aStatusTracker) :
// Statistics
num_containers++;
// Register our pref observers if we haven't yet.
if (NS_UNLIKELY(!gInitializedPrefCaches)) {
InitPrefCaches();
}
}
//******************************************************************************

View File

@ -344,11 +344,6 @@ public:
kDisposeRestorePrevious // Restore the previous (composited) frame
};
// Progressive decoding knobs
static void SetDecodeBytesAtATime(PRUint32 aBytesAtATime);
static void SetMaxMSBeforeYield(PRUint32 aMaxMS);
static void SetMaxBytesForSyncDecode(PRUint32 aMaxBytes);
const char* GetURIString() { return mURIString.get();}
private:

View File

@ -41,6 +41,8 @@
#ifndef mozilla_imagelib_SVGDocumentWrapper_h_
#define mozilla_imagelib_SVGDocumentWrapper_h_
#include "mozilla/Attributes.h"
#include "nsCOMPtr.h"
#include "nsIStreamListener.h"
#include "nsIObserver.h"
@ -62,9 +64,9 @@ class nsSVGSVGElement;
namespace mozilla {
namespace imagelib {
class SVGDocumentWrapper : public nsIStreamListener,
public nsIObserver,
nsSupportsWeakReference
class SVGDocumentWrapper MOZ_FINAL : public nsIStreamListener,
public nsIObserver,
nsSupportsWeakReference
{
public:
SVGDocumentWrapper();

View File

@ -37,6 +37,10 @@
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Attributes.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
#include "ImageLogging.h"
#include "imgLoader.h"
#include "imgRequestProxy.h"
@ -89,9 +93,6 @@
#include "nsIContentSecurityPolicy.h"
#include "nsIChannelPolicy.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
#include "nsContentUtils.h"
using namespace mozilla;
@ -136,7 +137,7 @@ static void PrintImageDecoders()
#endif
class imgMemoryReporter :
class imgMemoryReporter MOZ_FINAL :
public nsIMemoryReporter
{
public:
@ -759,7 +760,7 @@ nsresult imgLoader::CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup
return NS_OK;
}
class imgCacheObserver : public nsIObserver
class imgCacheObserver MOZ_FINAL : public nsIObserver
{
public:
NS_DECL_ISUPPORTS
@ -783,7 +784,8 @@ imgCacheObserver::Observe(nsISupports* aSubject, const char* aTopic, const PRUni
return NS_OK;
}
class imgCacheExpirationTracker : public nsExpirationTracker<imgCacheEntry, 3>
class imgCacheExpirationTracker MOZ_FINAL
: public nsExpirationTracker<imgCacheEntry, 3>
{
enum { TIMEOUT_SECONDS = 10 };
public:

View File

@ -41,6 +41,8 @@
#ifndef imgLoader_h__
#define imgLoader_h__
#include "mozilla/Attributes.h"
#include "imgILoader.h"
#include "imgICache.h"
#include "nsWeakReference.h"
@ -392,9 +394,10 @@ private:
* nsIInterfaceRequestor and gives out itself for nsIProgressEventSink calls,
* and forwards everything else to the channel's notification callbacks.
*/
class nsProgressNotificationProxy : public nsIProgressEventSink
, public nsIChannelEventSink
, public nsIInterfaceRequestor
class nsProgressNotificationProxy MOZ_FINAL
: public nsIProgressEventSink
, public nsIChannelEventSink
, public nsIInterfaceRequestor
{
public:
nsProgressNotificationProxy(nsIChannel* channel,

View File

@ -84,90 +84,21 @@
#include "DiscardTracker.h"
#include "nsAsyncRedirectVerifyHelper.h"
#define DISCARD_PREF "image.mem.discardable"
#define DECODEONDRAW_PREF "image.mem.decodeondraw"
#define BYTESATATIME_PREF "image.mem.decode_bytes_at_a_time"
#define MAXMS_PREF "image.mem.max_ms_before_yield"
#define MAXBYTESFORSYNC_PREF "image.mem.max_bytes_for_sync_decode"
#define SVG_MIMETYPE "image/svg+xml"
using namespace mozilla;
using namespace mozilla::imagelib;
/* Kept up to date by a pref observer. */
static bool gInitializedPrefCaches = false;
static bool gDecodeOnDraw = false;
static bool gDiscardable = false;
static const char* kObservedPrefs[] = {
DISCARD_PREF,
DECODEONDRAW_PREF,
DISCARD_TIMEOUT_PREF,
nsnull
};
/*
* Pref observer goop. Yuck.
*/
// Flag
static bool gRegisteredPrefObserver = false;
// Reloader
static void
ReloadPrefs()
InitPrefCaches()
{
// Discardable
gDiscardable = Preferences::GetBool(DISCARD_PREF, gDiscardable);
// Decode-on-draw
gDecodeOnDraw = Preferences::GetBool(DECODEONDRAW_PREF, gDecodeOnDraw);
// Progressive decoding knobs
PRInt32 bytesAtATime, maxMS, maxBytesForSync;
if (NS_SUCCEEDED(Preferences::GetInt(BYTESATATIME_PREF, &bytesAtATime))) {
RasterImage::SetDecodeBytesAtATime(bytesAtATime);
}
if (NS_SUCCEEDED(Preferences::GetInt(MAXMS_PREF, &maxMS))) {
RasterImage::SetMaxMSBeforeYield(maxMS);
}
if (NS_SUCCEEDED(Preferences::GetInt(MAXBYTESFORSYNC_PREF,
&maxBytesForSync))) {
RasterImage::SetMaxBytesForSyncDecode(maxBytesForSync);
}
// Discard timeout
mozilla::imagelib::DiscardTracker::ReloadTimeout();
}
// Observer
class imgRequestPrefObserver : public nsIObserver {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
};
NS_IMPL_ISUPPORTS1(imgRequestPrefObserver, nsIObserver)
// Callback
NS_IMETHODIMP
imgRequestPrefObserver::Observe(nsISupports *aSubject,
const char *aTopic,
const PRUnichar *aData)
{
// Right topic
NS_ABORT_IF_FALSE(!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID), "invalid topic");
// Right pref
if (strcmp(NS_LossyConvertUTF16toASCII(aData).get(), DISCARD_PREF) &&
strcmp(NS_LossyConvertUTF16toASCII(aData).get(), DECODEONDRAW_PREF) &&
strcmp(NS_LossyConvertUTF16toASCII(aData).get(), DISCARD_TIMEOUT_PREF))
return NS_OK;
// Process the change
ReloadPrefs();
return NS_OK;
Preferences::AddBoolVarCache(&gDiscardable, "image.mem.discardable");
Preferences::AddBoolVarCache(&gDecodeOnDraw, "image.mem.decodeondraw");
gInitializedPrefCaches = true;
}
#if defined(PR_LOGGING)
@ -187,7 +118,12 @@ imgRequest::imgRequest() :
mInnerWindowId(0), mCORSMode(imgIRequest::CORS_NONE),
mDecodeRequested(false), mIsMultiPartChannel(false), mGotData(false),
mIsInCache(false)
{}
{
// Register our pref observers if we haven't yet.
if (NS_UNLIKELY(!gInitializedPrefCaches)) {
InitPrefCaches();
}
}
imgRequest::~imgRequest()
{
@ -240,14 +176,6 @@ nsresult imgRequest::Init(nsIURI *aURI,
SetLoadId(aLoadId);
// Register our pref observer if it hasn't been done yet.
if (NS_UNLIKELY(!gRegisteredPrefObserver)) {
nsCOMPtr<nsIObserver> observer(new imgRequestPrefObserver());
Preferences::AddStrongObservers(observer, kObservedPrefs);
ReloadPrefs();
gRegisteredPrefObserver = true;
}
return NS_OK;
}

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -17,5 +17,8 @@
== bmp-size-32x32-8bpp.bmp bmp-size-32x32-8bpp.png
== bmp-size-33x33-8bpp.bmp bmp-size-33x33-8bpp.png
== bmp-not-square-8bpp.bmp bmp-not-square-8bpp.png
== os2bmp-size-32x32-8bpp.bmp bmp-size-32x32-8bpp.png
== rle-bmp-not-square-8bpp.bmp bmp-not-square-8bpp.png
== os2-bmp-size-32x32-8bpp.bmp bmp-size-32x32-8bpp.png
== rle-bmp-size-32x32-8bpp.bmp bmp-size-32x32-8bpp.png
== top-to-bottom-rle-bmp-size-32x32-8bpp.bmp bmp-size-32x32-8bpp.png
== top-to-bottom-16x16-8bpp.bmp bmp-size-16x16-8bpp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,114 +0,0 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla 2.
#
# The Initial Developer of the Original Code is
# the Mozilla Foundation <http://www.mozilla.org>.
#
# Portions created by the Initial Developer are Copyright (C) 2008
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Benjamin Smedberg <benjamin@smedbergs.us> (Author)
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
# we will do compilations that create dependency files.
NEED_MDDEPDIR = 1
include $(DEPTH)/config/autoconf.mk
REDGREEN_WARNING_TESTCASES = \
green-callred.cpp \
green-accessred.cpp \
green-tored-badpath.cpp \
misdeclared-red-funcptr.cpp \
misdeclared-red-funcptr2.cpp \
red-togreenptr.cpp \
red-togreenptr-return.cpp \
red-togreenptr-arg.cpp \
red-togreenptr-field.cpp \
red-togreenptr-initializer.cpp \
red-togreenptr-initializer-struct.cpp \
red-togreenptr-initializer-array.cpp \
red-togreenptr-initializer-nested.cpp \
red-togreenptr-initializer-cast.cpp \
green-callredptr.cpp \
$(NULL)
REDGREEN_SUCCESS_TESTCASES = \
red-callred.cpp \
red-callgreen.cpp \
red-accessred.cpp \
green-tored.cpp \
green-toredptr.cpp \
$(NULL)
STATIC_WARNING_TESTCASES = \
$(REDGREEN_WARNING_TESTCASES) \
$(NULL)
STATIC_PASS_TESTCASES = \
$(REDGREEN_SUCCESS_TESTCASES) \
$(NULL)
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += -I$(srcdir)/.. -I..
check:: \
$(STATIC_WARNING_TESTCASES:.cpp=.s-warn) \
$(STATIC_PASS_TESTCASES:.cpp=.s-pass) \
$(NULL)
# We want to compile each file and invert the result to ensure that
# compilation failed.
%.s-warn: %.cpp $(GLOBAL_DEPS) $(DEHYDRA_SCRIPTS)
@printf "Compiling $(<F) to check that the static-analysis script is checking properly..."
@if $(CCC) -Werror $(OUTOPTION)/dev/null -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) >$(*F).errlog 2>&1; then \
printf "fail:\nerror: compilation of $(<F) succeeded with -Werror. It shouldn't have!\n"; \
exit 1; \
fi
@if $(CCC) $(OUTOPTION)/dev/null -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) >$(*F).werrlog 2>&1; then \
printf "ok.\n"; \
else \
printf "fail:\nerror: compilation of $(<F) without -Werror failed. A warning should have been issued.\n"; \
exit 1; \
fi
%.s-pass: %.cpp $(GLOBAL_DEPS) $(DEHYDRA_SCRIPTS)
@printf "Compiling $(<F) to check that the static-analysis script is checking properly..."
@if $(CCC) -Werror $(OUTOPTION)/dev/null -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) >$(*F).errlog 2>&1; then \
printf "ok.\n"; \
else \
printf "fail:\nerror: compilation of $(<F) failed. It shouldn't have!\n"; \
exit 1; \
fi

View File

@ -1,11 +0,0 @@
#include "jstypes.h"
struct Foo
{
JS_REQUIRES_STACK void *redmember;
};
void* GreenFunc(Foo *f)
{
return f->redmember;
}

View File

@ -1,12 +0,0 @@
#include "jstypes.h"
#ifndef NS_STATIC_CHECKING
#error Running this without NS_STATIC_CHECKING is silly
#endif
JS_REQUIRES_STACK void RedFunc();
void GreenFunc()
{
RedFunc();
}

View File

@ -1,8 +0,0 @@
#include "jstypes.h"
typedef void (JS_REQUIRES_STACK *RedFuncPtr)();
void GreenFunc(RedFuncPtr f)
{
f();
}

View File

@ -1,14 +0,0 @@
#include "jstypes.h"
JS_REQUIRES_STACK void RedFunc();
JS_FORCES_STACK void TurnRedFunc();
void GreenPartlyRedFunc(int i)
{
if (i) {
TurnRedFunc();
}
RedFunc();
}

View File

@ -1,12 +0,0 @@
#include "jstypes.h"
JS_REQUIRES_STACK void RedFunc();
JS_FORCES_STACK void TurnRedFunc();
void GreenToRedFunc()
{
TurnRedFunc();
RedFunc();
}

View File

@ -1,12 +0,0 @@
#include "jstypes.h"
void GreenFunc();
typedef void (JS_REQUIRES_STACK *RedFuncPtr)();
RedFuncPtr Test()
{
// assigning a green function to a red function pointer is ok
RedFuncPtr p = GreenFunc;
return p;
}

View File

@ -1,5 +0,0 @@
#include "jstypes.h"
// JS_REQUIRES_STACK should come before the *
typedef void (* JS_REQUIRES_STACK RedFuncPtr)();

View File

@ -1,5 +0,0 @@
#include "jstypes.h"
// JS_REQUIRES_STACK should come before the *
typedef void (* RedFuncPtr)() JS_REQUIRES_STACK;

View File

@ -1,11 +0,0 @@
#include "jstypes.h"
struct Foo
{
JS_REQUIRES_STACK void *redmember;
};
JS_REQUIRES_STACK void * RedFunc(Foo *f)
{
return f->redmember;
}

View File

@ -1,8 +0,0 @@
#include "jstypes.h"
void GreenFunc();
void JS_REQUIRES_STACK RedFunc()
{
GreenFunc();
}

View File

@ -1,8 +0,0 @@
#include "jstypes.h"
JS_REQUIRES_STACK void RedFunc1();
JS_REQUIRES_STACK void RedFunc2()
{
RedFunc1();
}

View File

@ -1,11 +0,0 @@
#include "jstypes.h"
typedef void (*GreenFuncPtr)();
typedef void (JS_REQUIRES_STACK *RedFuncPtr)();
void TakesAsArgument(GreenFuncPtr g);
void Test(RedFuncPtr p)
{
TakesAsArgument(p);
}

View File

@ -1,15 +0,0 @@
#include "jstypes.h"
typedef void (*GreenFuncPtr)();
typedef void (JS_REQUIRES_STACK *RedFuncPtr)();
struct Foo
{
int i;
GreenFuncPtr p;
};
void Test(Foo *foo, RedFuncPtr p)
{
foo->p = p;
}

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