Fix alignment issues with stack allocated memory allocated as bytes but used to hold other types.
Review URL: http://codereview.appspot.com/4435060/
git-svn-id: http://skia.googlecode.com/svn/trunk@1162 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/include/GrInOrderDrawBuffer.h b/gpu/include/GrInOrderDrawBuffer.h
index 9d3f91a..c80afd9 100644
--- a/gpu/include/GrInOrderDrawBuffer.h
+++ b/gpu/include/GrInOrderDrawBuffer.h
@@ -158,18 +158,17 @@
size_t fReservedIndexBytes;
size_t fUsedReservedVertexBytes;
size_t fUsedReservedIndexBytes;
+
+ enum {
+ kDrawPreallocCnt = 8,
+ kStatePreallocCnt = 8,
+ kClipPreallocCnt = 8,
+ };
- static const uint32_t STATES_BLOCK_SIZE = 8;
- static const uint32_t DRAWS_BLOCK_SIZE = 8;
- static const uint32_t CLIPS_BLOCK_SIZE = 8;
- static const uint32_t VERTEX_BLOCK_SIZE = 1 << 12;
- static const uint32_t INDEX_BLOCK_SIZE = 1 << 10;
- int8_t fDrawsStorage[sizeof(Draw) *
- DRAWS_BLOCK_SIZE];
- int8_t fStatesStorage[sizeof(SavedDrawState) *
- STATES_BLOCK_SIZE];
- int8_t fClipsStorage[sizeof(GrClip) *
- CLIPS_BLOCK_SIZE];
+ GrAlignedSTStorage<kDrawPreallocCnt, Draw> fDrawStorage;
+ GrAlignedSTStorage<kStatePreallocCnt, SavedDrawState> fStateStorage;
+ GrAlignedSTStorage<kClipPreallocCnt, GrClip> fClipStorage;
+
typedef GrDrawTarget INHERITED;
};