Closed
Bug 329259
Opened 19 years ago
Closed 19 years ago
implement _cairo_win32_surface_show_glyphs
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: pavlov, Assigned: pavlov)
References
Details
Attachments
(1 file, 1 obsolete file)
5.74 KB,
patch
|
pavlov
:
review+
|
Details | Diff | Splinter Review |
Implementing the win32 surface's show_glyphs method allows us to avoid a lot of glyph metric lookup stuff that is unneeded in the general case.
Assignee | ||
Comment 1•19 years ago
|
||
Attachment #213918 -
Flags: review?(vladimir)
Assignee | ||
Comment 2•19 years ago
|
||
text still rotates properly because we use SetWorldTransform
Status: NEW → ASSIGNED
Comment on attachment 213918 [details] [diff] [review]
impl
I don't understand what you mean about SetWorldTransform; does scaled_font_select_font call SWT? If so, add a comment indicating that.
>+/* LOGICAL_SCALE be the same value as it is in cairo-win32-font.c */
>+#define LOGICAL_SCALE 32
Move this into cairo-win32-private.h and share it between the surface and the font impl; call it CAIRO_WIN32_FONT_LOGICAL_SCALE or something.
>+static cairo_int_status_t
>+_cairo_win32_surface_show_glyphs (void *surface,
>+ cairo_operator_t op,
>+ cairo_pattern_t *source,
>+ const cairo_glyph_t *glyphs,
>+ int num_glyphs,
>+ cairo_scaled_font_t *scaled_font)
>+{
>+ cairo_win32_surface_t *dst = surface;
>+ cairo_solid_pattern_t *solid_pattern = (cairo_solid_pattern_t *)source;
>+ WORD *glyphBuf = NULL;
>+ int *dxBuf = NULL;
>+ COLORREF color;
>+ BOOL result = 0;
>+ int i;
>+
>+ if ((op != CAIRO_OPERATOR_SOURCE && op != CAIRO_OPERATOR_OVER) ||
>+ (dst->format != CAIRO_FORMAT_RGB24) ||
>+ (!_cairo_pattern_is_opaque_solid(source)))
>+ return CAIRO_INT_STATUS_UNSUPPORTED;
>+
>+ glyphBuf = (WORD *)malloc(num_glyphs * sizeof(WORD));
>+ dxBuf = (int *)malloc(num_glyphs * sizeof(int));
>+
>+ for (i = 0; i < num_glyphs; ++i) {
>+ glyphBuf[i] = glyphs[i].index;
>+ if (i == num_glyphs - 1)
>+ dxBuf[i] = 0;
>+ else
>+ dxBuf[i] = (glyphs[i+1].x - glyphs[i].x) * LOGICAL_SCALE;
>+ }
Maybe check for any y offset that's not equal to the first y offset and bail? I don't know if the current scaled font code does any better, but it would be good to have that check in place anyway.
>+ SaveDC(dst->dc);
>+
>+ cairo_win32_scaled_font_select_font(scaled_font, dst->dc);
>+
>+ color = RGB(((int)solid_pattern->color.red_short) >> 8,
>+ ((int)solid_pattern->color.green_short) >> 8,
>+ ((int)solid_pattern->color.blue_short) >> 8);
>+
>+ SetTextColor(dst->dc, color);
>+ SetTextAlign(dst->dc, TA_BASELINE | TA_LEFT);
>+ SetBkMode(dst->dc, TRANSPARENT);
>+
>+ result = ExtTextOutW(dst->dc,
>+ glyphs[0].x * LOGICAL_SCALE,
>+ glyphs[0].y * LOGICAL_SCALE,
>+ ETO_GLYPH_INDEX,
>+ NULL,
>+ glyphBuf,
>+ num_glyphs,
>+ dxBuf);
>+
>+ RestoreDC(dst->dc, -1);
>+
>+ free(glyphBuf);
>+ free(dxBuf);
>+ return (result) ? CAIRO_STATUS_SUCCESS : CAIRO_INT_STATUS_UNSUPPORTED;
>+}
Assignee | ||
Comment 4•19 years ago
|
||
Attachment #213918 -
Attachment is obsolete: true
Attachment #214502 -
Flags: review?(vladimir)
Attachment #213918 -
Flags: review?(vladimir)
Assignee | ||
Comment 5•19 years ago
|
||
Comment on attachment 214502 [details] [diff] [review]
fix
verbal r+ from vlad with addition of stack buffers for the glyph buffer and dx buffer.
Attachment #214502 -
Flags: review?(vladimir) → review+
Assignee | ||
Updated•19 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•