Modified:
/trunk/source/directwrite/BitmapRenderTargetDW.cpp
=======================================
--- /trunk/source/directwrite/BitmapRenderTargetDW.cpp Sat Jan 28 10:03:11
2012
+++ /trunk/source/directwrite/BitmapRenderTargetDW.cpp Sun Mar 4 15:52:08
2012
@@ -56,9 +56,13 @@
Result BitmapRenderTarget::DrawGlyphRun(float baselineOriginX, float
baselineOriginY, MeasuringMode measuringMode, GlyphRun^ glyphRun,
RenderingParameters^ renderingParameters, Color4 color, [Out]
System::Drawing::Rectangle% blackBoxBounds)
{
- stack_array<UINT16> indices = stackalloc(UINT16,
(glyphRun->GlyphIndices != nullptr) ? glyphRun->GlyphIndices->Length : 0);
- stack_array<FLOAT> advances = stackalloc(FLOAT,
(glyphRun->GlyphAdvances != nullptr) ? glyphRun->GlyphAdvances->Length : 0);
- stack_array<DWRITE_GLYPH_OFFSET> offsets =
stackalloc(DWRITE_GLYPH_OFFSET, (glyphRun->GlyphOffsets != nullptr) ?
glyphRun->GlyphOffsets->Length : 0);
+ int indexCount = (glyphRun->GlyphIndices != nullptr) ?
glyphRun->GlyphIndices->Length : 0;
+ int advanceCount = (glyphRun->GlyphAdvances != nullptr) ?
glyphRun->GlyphAdvances->Length : 0;
+ int offsetCount = (glyphRun->GlyphOffsets != nullptr) ?
glyphRun->GlyphOffsets->Length : 0;
+
+ stack_array<UINT16> indices = stackalloc(UINT16, indexCount);
+ stack_array<FLOAT> advances = stackalloc(FLOAT, advanceCount);
+ stack_array<DWRITE_GLYPH_OFFSET> offsets =
stackalloc(DWRITE_GLYPH_OFFSET, offsetCount);
DWRITE_GLYPH_RUN glyphs = glyphRun->ToUnmanaged(indices, advances,
offsets);
Color c = color.ToColor();