[slimdx] r2176 committed - Fixed incorrect usage of stackalloc in DWrite.

0 views
Skip to first unread message

sli...@googlecode.com

unread,
Mar 4, 2012, 6:52:45 PM3/4/12
to slimdx...@googlegroups.com
Revision: 2176
Author: mike.popoloski
Date: Sun Mar 4 15:52:08 2012
Log: Fixed incorrect usage of stackalloc in DWrite.
http://code.google.com/p/slimdx/source/detail?r=2176

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();

Reply all
Reply to author
Forward
0 new messages