aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/PlatCocoa.mm
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2018-05-21 15:20:08 +1000
committerNeil Hodgson <nyamatongwe@gmail.com>2018-05-21 15:20:08 +1000
commite0e105ea1559874a5a9097461d0d7933cb5cbbb4 (patch)
tree1cc61922e17beb3d98c7b689544dbdd36cbdde23 /cocoa/PlatCocoa.mm
parent521ef7054806424c97dac5ee71b3a05ed5b9d7f4 (diff)
downloadscintilla-mirror-e0e105ea1559874a5a9097461d0d7933cb5cbbb4.tar.gz
Remove CGContextRef field in QuartzTextLayout as it is only used in draw method
where it can easily be provided. Retaining a CGContextRef in QuartzTextLayout could lead to it being used after being invalidated.
Diffstat (limited to 'cocoa/PlatCocoa.mm')
-rw-r--r--cocoa/PlatCocoa.mm7
1 files changed, 2 insertions, 5 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 75c386f76..1141cca44 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -127,7 +127,7 @@ SurfaceImpl::SurfaceImpl() {
y = 0;
gc = NULL;
- textLayout.reset(new QuartzTextLayout(nullptr));
+ textLayout.reset(new QuartzTextLayout());
codePage = 0;
verticalDeviceResolution = 0;
@@ -147,7 +147,6 @@ SurfaceImpl::~SurfaceImpl() {
//--------------------------------------------------------------------------------------------------
void SurfaceImpl::Clear() {
- textLayout->setContext(nullptr);
if (bitmapData) {
bitmapData.reset();
// We only "own" the graphics context if we are a bitmap context
@@ -193,7 +192,6 @@ void SurfaceImpl::Init(SurfaceID sid, WindowID) {
Release();
gc = static_cast<CGContextRef>(sid);
CGContextSetLineWidth(gc, 1.0);
- textLayout->setContext(gc);
}
//--------------------------------------------------------------------------------------------------
@@ -229,7 +227,6 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID
// and we have no use for the bitmap without the context
bitmapData.reset();
}
- textLayout->setContext(gc);
// the context retains the color space, so we can release it
CGColorSpaceRelease(colorSpace);
@@ -863,7 +860,7 @@ void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION yba
CGColorRelease(color);
textLayout->setText(text, encoding, *style);
- textLayout->draw(rc.left, ybase);
+ textLayout->draw(gc, rc.left, ybase);
}
//--------------------------------------------------------------------------------------------------