aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/QuartzTextLayout.h
diff options
context:
space:
mode:
Diffstat (limited to 'cocoa/QuartzTextLayout.h')
-rw-r--r--cocoa/QuartzTextLayout.h21
1 files changed, 6 insertions, 15 deletions
diff --git a/cocoa/QuartzTextLayout.h b/cocoa/QuartzTextLayout.h
index 0f813f301..f2387dd9b 100644
--- a/cocoa/QuartzTextLayout.h
+++ b/cocoa/QuartzTextLayout.h
@@ -19,13 +19,9 @@
class QuartzTextLayout
{
public:
- /** Create a text layout for drawing on the specified context. */
- explicit QuartzTextLayout( CGContextRef context )
+ /** Create a text layout for drawing. */
+ QuartzTextLayout() : mString(NULL), mLine(NULL), stringLength(0)
{
- mString = NULL;
- mLine = NULL;
- stringLength = 0;
- setContext(context);
}
~QuartzTextLayout()
@@ -63,12 +59,13 @@ public:
CFRelease( str );
}
- /** Draw the text layout into the current CGContext at the specified position.
+ /** Draw the text layout into a CGContext at the specified position.
+ * @param gc The CGContext in which to draw the text.
* @param x The x axis position to draw the baseline in the current CGContext.
* @param y The y axis position to draw the baseline in the current CGContext. */
- void draw( float x, float y )
+ void draw( CGContextRef gc, float x, float y )
{
- if (mLine == NULL)
+ if (!mLine)
return;
::CGContextSetTextMatrix(gc, CGAffineTransformMakeScale(1.0, -1.0));
@@ -96,13 +93,7 @@ public:
return stringLength;
}
- inline void setContext (CGContextRef context)
- {
- gc = context;
- }
-
private:
- CGContextRef gc;
CFAttributedStringRef mString;
CTLineRef mLine;
CFIndex stringLength;