[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:40:34 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit c26d218c3d444433997556a54090b992d9acca15
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue May 6 15:59:35 2003 +0000
Reviewed by Ken.
- used ObjectAlloc to find large numbers of allocations on startup and get rid of some
* kwq/KWQColor.mm: (QColor::getNSColor): Keep a cache of 32 colors instead of returning a new
one each time. Also use special cases for black and white.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4283 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index c45ccaa..176d3d8 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,12 @@
+2003-05-06 Darin Adler <darin at apple.com>
+
+ Reviewed by Ken.
+
+ - used ObjectAlloc to find large numbers of allocations on startup and get rid of some
+
+ * kwq/KWQColor.mm: (QColor::getNSColor): Keep a cache of 32 colors instead of returning a new
+ one each time. Also use special cases for black and white.
+
2003-05-05 Maciej Stachowiak <mjs at apple.com>
Reviewed by Dave.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index c45ccaa..176d3d8 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,12 @@
+2003-05-06 Darin Adler <darin at apple.com>
+
+ Reviewed by Ken.
+
+ - used ObjectAlloc to find large numbers of allocations on startup and get rid of some
+
+ * kwq/KWQColor.mm: (QColor::getNSColor): Keep a cache of 32 colors instead of returning a new
+ one each time. Also use special cases for black and white.
+
2003-05-05 Maciej Stachowiak <mjs at apple.com>
Reviewed by Dave.
diff --git a/WebCore/kwq/KWQColor.mm b/WebCore/kwq/KWQColor.mm
index 61bbda8..ebfb029 100644
--- a/WebCore/kwq/KWQColor.mm
+++ b/WebCore/kwq/KWQColor.mm
@@ -196,8 +196,41 @@ QColor QColor::dark(int factor) const
NSColor *QColor::getNSColor() const
{
- return [NSColor colorWithCalibratedRed:red() / 255.0
- green:green() / 255.0
- blue:blue() / 255.0
- alpha:1.0];
+ unsigned c = color & 0xFFFFFF;
+ switch (c) {
+ case Qt::black: {
+ static NSColor *blackColor = [[NSColor blackColor] retain];
+ return blackColor;
+ }
+ case Qt::white: {
+ static NSColor *whiteColor = [[NSColor whiteColor] retain];
+ return whiteColor;
+ }
+ default: {
+ const int cacheSize = 32;
+ static unsigned cachedRGBValues[cacheSize];
+ static NSColor *cachedColors[cacheSize];
+
+ for (int i = 0; i != cacheSize; ++i) {
+ if (cachedRGBValues[i] == c) {
+ return cachedColors[i];
+ }
+ }
+
+ NSColor *result = [NSColor colorWithCalibratedRed:red() / 255.0
+ green:green() / 255.0
+ blue:blue() / 255.0
+ alpha:1.0];
+
+ static int cursor;
+ cachedRGBValues[cursor] = c;
+ [cachedColors[cursor] autorelease];
+ cachedColors[cursor] = [result retain];
+ if (++cursor == cacheSize) {
+ cursor = 0;
+ }
+
+ return result;
+ }
+ }
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list