aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'cocoa')
-rw-r--r--cocoa/PlatCocoa.mm2
-rw-r--r--cocoa/QuartzTextStyle.h15
-rw-r--r--cocoa/QuartzTextStyleAttribute.h1
3 files changed, 16 insertions, 2 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 7e547e67d..6c1c5e8c4 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -922,6 +922,8 @@ void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, int ybase, con
QuartzTextStyle* style = reinterpret_cast<QuartzTextStyle*>(font_.GetID());
style->setCTStyleColor(color);
+
+ CGColorRelease(color);
textLayout->setText (reinterpret_cast<const UInt8*>(s), len, encoding, *reinterpret_cast<QuartzTextStyle*>(font_.GetID()));
textLayout->draw(rc.left, ybase);
diff --git a/cocoa/QuartzTextStyle.h b/cocoa/QuartzTextStyle.h
index 099684ca7..51d03cf91 100644
--- a/cocoa/QuartzTextStyle.h
+++ b/cocoa/QuartzTextStyle.h
@@ -16,7 +16,10 @@ public:
QuartzTextStyle()
{
fontRef = NULL;
- styleDict = CFDictionaryCreateMutable(NULL, 1, NULL, NULL);
+ styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+
characterSet = 0;
}
@@ -27,6 +30,12 @@ public:
CFRelease(styleDict);
styleDict = NULL;
}
+
+ if (fontRef)
+ {
+ CFRelease(fontRef);
+ fontRef = NULL;
+ }
}
CFMutableDictionaryRef getCTStyle() const
@@ -62,7 +71,9 @@ public:
if (styleDict != NULL)
CFRelease(styleDict);
- styleDict = CFDictionaryCreateMutable(NULL, 1, NULL, NULL);
+ styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef);
}
diff --git a/cocoa/QuartzTextStyleAttribute.h b/cocoa/QuartzTextStyleAttribute.h
index ecea73b91..33c49281c 100644
--- a/cocoa/QuartzTextStyleAttribute.h
+++ b/cocoa/QuartzTextStyleAttribute.h
@@ -65,6 +65,7 @@ public:
fontid = ::CTFontCreateWithName((CFStringRef)@"Monaco", size, NULL);
}
+ CFRelease(fontName);
}
CTFontRef getFontID()