Skip to content

Commit

Permalink
Fix image flip
Browse files Browse the repository at this point in the history
git-svn-id: https://explorercanvas.googlecode.com/svn/trunk@52 fd59bba8-8519-0410-9389-e36bf2bdbbd6
  • Loading branch information
erik.arvidsson committed Apr 14, 2009
2 parents 0bb5789 + 40972e0 commit 08ccb63
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 21 deletions.
5 changes: 2 additions & 3 deletions excanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ if (!document.createElement('canvas').getContext) {
'text-align:left;width:300px;height:150px}' +
'g_vml_\\:*{behavior:url(#default#VML)}' +
'g_o_\\:*{behavior:url(#default#VML)}';

}

// find all canvas elements
Expand All @@ -135,7 +134,6 @@ if (!document.createElement('canvas').getContext) {
*/
initElement: function(el) {
if (!el.getContext) {

el.getContext = getContext;

// Remove fallback content. There is no way to hide text nodes so we
Expand Down Expand Up @@ -539,7 +537,8 @@ if (!document.createElement('canvas').getContext) {
// The following check doesn't account for skews (which don't exist
// in the canvas spec (yet) anyway.

if (this.m_[0][0] != 1 || this.m_[0][1]) {
if (this.m_[0][0] != 1 || this.m_[0][1] ||
this.m_[1][1] != 1 || this.m_[1][0]) {
var filter = [];

// Note the 12/21 reversal
Expand Down
2 changes: 1 addition & 1 deletion testcases/arc.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

</style>
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
<!--[if IE]><script src="../excanvas.js"></script><![endif]-->
<script>

window.onload = function() {
Expand Down
2 changes: 1 addition & 1 deletion testcases/clearpath.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

</style>
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
<!--[if IE]><script src="../excanvas.js"></script><![endif]-->
<script>

window.onload = function() {
Expand Down
57 changes: 57 additions & 0 deletions testcases/draw-image-flip.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<title>Overflow Test</title>
<style>

body {
text-align: center
}

</style>
<!--[if IE]><script src="../excanvas.js"></script><![endif]-->
<script>

function draw() {
var ctx = document.getElementById('c').getContext('2d');
var w = 608 / 2;
var h = 380 / 2;

ctx.save();
ctx.translate(w, 0);
ctx.drawImage(img, 0, 0, w, h);
ctx.restore();

ctx.save();
ctx.translate(w, 0);
ctx.scale(-1, 1);
ctx.drawImage(img, 0, 0, w, h);
ctx.restore();

ctx.save();
ctx.translate(w, 2 * h);
ctx.scale(1, -1);
ctx.drawImage(img, 0, 0, w, h);
ctx.restore();

ctx.save();
ctx.translate(w, 2 * h);
ctx.scale(-1, -1);
ctx.drawImage(img, 0, 0, w, h);
ctx.restore();
};

var img = new Image;
img.onload = draw;
window.onload = function() {
img.src = '../examples/ff.jpg';
};

</script>
</head>
<body>

<canvas id=c width=608 height=380></canvas>

</body>
</html>
2 changes: 1 addition & 1 deletion testcases/drawimage.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

</style>
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
<!--[if IE]><script src="../excanvas.js"></script><![endif]-->
<script>

window.onload = function() {
Expand Down
2 changes: 1 addition & 1 deletion testcases/gradient.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

</style>
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
<!--[if IE]><script src="../excanvas.js"></script><![endif]-->
<script>

window.onload = function() {
Expand Down
5 changes: 3 additions & 2 deletions testcases/gradient2.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
<style>

body {
text-align: center
text-align: center;
background: pink
}

</style>
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
<!--[if IE]><script src="../excanvas.js"></script><![endif]-->
<script>

window.onload = function() {
Expand Down
4 changes: 2 additions & 2 deletions testcases/linewidth.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

</style>
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
<!--[if IE]><script src="../excanvas.js"></script><![endif]-->
<script>

window.onload = function() {
Expand Down Expand Up @@ -44,4 +44,4 @@
using sub pixel coordinates.</p>

</body>
</html>
</html>
10 changes: 5 additions & 5 deletions testcases/overflow.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
}

</style>
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
<!--[if IE]><script src="../excanvas.js"></script><![endif]-->
<script>

window.onload = function() {
var ctx = document.getElementById('c').getContext('2d');

ctx.fillStyle = 'blue';
ctx.fillRect(-50, -50, 100, 100);

ctx.fillStyle = 'green';
ctx.fillRect(50, 50, 100, 100);

ctx.strokeStyle = 'black';
ctx.strokeRect(0, 0, 100, 100);
};
Expand All @@ -34,4 +34,4 @@
<p>This tests if content gets cropped if painting outside the canvas.</p>

</body>
</html>
</html>
2 changes: 1 addition & 1 deletion testcases/quadraticcurve.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

</style>
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
<!--[if IE]><script src="../excanvas.js"></script><![endif]-->
<script>

window.onload = function() {
Expand Down
2 changes: 1 addition & 1 deletion testcases/resizing.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>ExplorerCanvas Text Case</title>
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
<!--[if IE]><script src="../excanvas.js"></script><![endif]-->
<script>
// Safari is known not to handle resizing well, expect this to
// compare to Firefox
Expand Down
2 changes: 1 addition & 1 deletion testcases/saverestorepath.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

</style>
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
<!--[if IE]><script src="../excanvas.js"></script><![endif]-->
<script>

window.onload = function() {
Expand Down
2 changes: 1 addition & 1 deletion testcases/stroke-scale-rotate.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}

</style>
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
<!--[if IE]><script src="../excanvas.js"></script><![endif]-->
<script>

// draw a star
Expand Down
2 changes: 1 addition & 1 deletion testcases/stroke-should-not-close-path.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

</style>
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
<!--[if IE]><script src="../excanvas.js"></script><![endif]-->
<script>

window.onload = function() {
Expand Down

0 comments on commit 08ccb63

Please sign in to comment.