mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-09 16:38:45 +00:00
Fix for using transform() instead of in code calculation when available.
[#148 state:resolved] Reviewed by me.
This commit is contained in:
1 parent
538adfeb61
commit
a92243314a
2 files changed
+29
-4
No files matched your search
@@ -41,6 +41,7 @@ CPJavascriptTextContentFeature = 1 << 9;
|
||||
CPJavascriptClipboardEventsFeature = 1 << 10;
|
||||
CPJavascriptClipboardAccessFeature = 1 << 11;
|
||||
CPJavaScriptCanvasDrawFeature = 1 << 12;
|
||||
CPJavaScriptCanvasTransformFeature = 1 << 13;
|
||||
|
||||
CPVMLFeature = 1 << 14;
|
||||
|
||||
@@ -101,13 +102,13 @@ else if (USER_AGENT.indexOf("AppleWebKit/") != -1)
|
||||
}
|
||||
|
||||
// KHTML
|
||||
else if (USER_AGENT.indexOf('KHTML') != -1) // Must follow WebKit check.
|
||||
else if (USER_AGENT.indexOf("KHTML") != -1) // Must follow WebKit check.
|
||||
{
|
||||
PLATFORM_ENGINE = CPKHTMLBrowserEngine;
|
||||
}
|
||||
|
||||
// Gecko
|
||||
else if (USER_AGENT.indexOf('Gecko') != -1) // Must follow KHTML check.
|
||||
else if (USER_AGENT.indexOf("Gecko") != -1) // Must follow KHTML check.
|
||||
{
|
||||
PLATFORM_ENGINE = CPGeckoBrowserEngine;
|
||||
|
||||
@@ -123,10 +124,19 @@ else if (USER_AGENT.indexOf('Gecko') != -1) // Must follow KHTML check.
|
||||
// Feature Specific Checks
|
||||
if (typeof document != "undefined")
|
||||
{
|
||||
var canvasElement = document.createElement("canvas");
|
||||
// Detect Canvas Support
|
||||
if (document.createElement("canvas").getContext)
|
||||
if (canvasElement && canvasElement.getContext)
|
||||
{
|
||||
PLATFORM_FEATURES |= CPHTMLCanvasFeature;
|
||||
|
||||
// Detect Canvas setTransform/transform support
|
||||
var context = document.createElement("canvas").getContext("2d");
|
||||
|
||||
if (context && context.setTransform && context.transform)
|
||||
PLATFORM_FEATURES |= CPJavaScriptCanvasTransformFeature;
|
||||
}
|
||||
|
||||
var DOMElement = document.createElement("div");
|
||||
|
||||
// Detect whether we have innerText or textContent (or neither)
|
||||
|
||||
@@ -333,7 +333,20 @@ function eigen(anAffineTransform)
|
||||
alert("IMPLEMENT ME!");
|
||||
}
|
||||
|
||||
function CGContextConcatCTM(aContext, anAffineTransform)
|
||||
|
||||
if (CPFeatureIsCompatible(CPJavaScriptCanvasTransformFeature))
|
||||
{
|
||||
|
||||
CGContextConcatCTM = function(aContext, anAffineTransform)
|
||||
{
|
||||
aContext.transform(anAffineTransform.a, anAffineTransform.b, anAffineTransform.c, anAffineTransform.d, anAffineTransform.tx, anAffineTransform.ty);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
CGContextConcatCTM = function(aContext, anAffineTransform)
|
||||
{
|
||||
var a = anAffineTransform.a,
|
||||
b = anAffineTransform.b,
|
||||
@@ -399,6 +412,8 @@ function CGContextConcatCTM(aContext, anAffineTransform)
|
||||
CGContextRotateCTM(aContext, a2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function CGContextDrawImage(aContext, aRect, anImage)
|
||||
{
|
||||
aContext.drawImage(anImage._image, _CGRectGetMinX(aRect), _CGRectGetMinY(aRect), _CGRectGetWidth(aRect), _CGRectGetHeight(aRect));
|
||||
|
||||
Reference in new issue
Block a user