-#define CREATE_SHARED_STATE() \
- scoped_ptr<SharedQuadState> shared_state(CreateSharedQuadState()); \
- scoped_ptr<SharedQuadState> copy_shared_state(shared_state->Copy()); \
-
-#define QUAD_DATA \
- gfx::Rect quad_rect(30, 40, 50, 60); \
- gfx::Rect quad_visible_rect(40, 50, 30, 20); \
- gfx::Rect ALLOW_UNUSED quad_opaque_rect(60, 55, 10, 10); \
- bool ALLOW_UNUSED needs_blending = true;
-
-#define SETUP_AND_COPY_QUAD_NEW(Type, quad) \
- scoped_ptr<DrawQuad> copy_new(quad_new->Copy(copy_shared_state.get())); \
- CompareDrawQuad(quad_new.get(), copy_new.get(), copy_shared_state.get()); \
- const Type* ALLOW_UNUSED copy_quad = Type::MaterialCast(copy_new.get());
-
-#define SETUP_AND_COPY_QUAD_ALL(Type, quad) \
- scoped_ptr<DrawQuad> copy_all(quad_all->Copy(copy_shared_state.get())); \
- CompareDrawQuad(quad_all.get(), copy_all.get(), copy_shared_state.get()); \
- copy_quad = Type::MaterialCast(copy_all.get());
-
-#define SETUP_AND_COPY_QUAD_NEW_1(Type, quad, a) \
- scoped_ptr<DrawQuad> copy_new(quad_new->Copy(copy_shared_state.get(), a)); \
- CompareDrawQuad(quad_new.get(), copy_new.get(), copy_shared_state.get()); \
- const Type* ALLOW_UNUSED copy_quad = Type::MaterialCast(copy_new.get());
-
-#define SETUP_AND_COPY_QUAD_ALL_1(Type, quad, a) \
- scoped_ptr<DrawQuad> copy_all(quad_all->Copy(copy_shared_state.get(), a)); \
- CompareDrawQuad(quad_all.get(), copy_all.get(), copy_shared_state.get()); \
- copy_quad = Type::MaterialCast(copy_all.get());
-
-#define CREATE_QUAD_1_NEW(Type, a) \
- scoped_ptr<Type> quad_new(Type::Create()); \
- { \
- QUAD_DATA \
- quad_new->SetNew(shared_state.get(), quad_rect, a); \
- } \
- SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
-
-#define CREATE_QUAD_1_ALL(Type, a) \
- scoped_ptr<Type> quad_all(Type::Create()); \
- { \
- QUAD_DATA \
- quad_all->SetAll(shared_state.get(), quad_rect, quad_opaque_rect, \
- quad_visible_rect, needs_blending, a); \
- } \
- SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
-
-#define CREATE_QUAD_2_NEW(Type, a, b) \
- scoped_ptr<Type> quad_new(Type::Create()); \
- { \
- QUAD_DATA \
- quad_new->SetNew(shared_state.get(), quad_rect, a, b); \
- } \
- SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
-
-#define CREATE_QUAD_2_ALL(Type, a, b) \
- scoped_ptr<Type> quad_all(Type::Create()); \
- { \
- QUAD_DATA \
- quad_all->SetAll(shared_state.get(), quad_rect, quad_opaque_rect, \
- quad_visible_rect, needs_blending, a, b); \
- } \
- SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
-
-#define CREATE_QUAD_3_NEW(Type, a, b, c) \
- scoped_ptr<Type> quad_new(Type::Create()); \
- { \
- QUAD_DATA \
- quad_new->SetNew(shared_state.get(), quad_rect, a, b, c); \
- } \
- SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
-
-#define CREATE_QUAD_3_ALL(Type, a, b, c) \
- scoped_ptr<Type> quad_all(Type::Create()); \
- { \
- QUAD_DATA \
- quad_all->SetAll(shared_state.get(), quad_rect, quad_opaque_rect, \
- quad_visible_rect, needs_blending, a, b, c); \
- } \
- SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
-
-#define CREATE_QUAD_4_NEW(Type, a, b, c, d) \
- scoped_ptr<Type> quad_new(Type::Create()); \
- { \
- QUAD_DATA \
- quad_new->SetNew(shared_state.get(), quad_rect, a, b, c, d); \
- } \
- SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
-
-#define CREATE_QUAD_4_ALL(Type, a, b, c, d) \
- scoped_ptr<Type> quad_all(Type::Create()); \
- { \
- QUAD_DATA \
- quad_all->SetAll(shared_state.get(), quad_rect, quad_opaque_rect, \
- quad_visible_rect, needs_blending, a, b, c, d); \
- } \
- SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
-
-#define CREATE_QUAD_5_NEW(Type, a, b, c, d, e) \
- scoped_ptr<Type> quad_new(Type::Create()); \
- { \
- QUAD_DATA \
- quad_new->SetNew(shared_state.get(), quad_rect, a, b, c, d, e); \
- } \
- SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
-
-#define CREATE_QUAD_5_ALL(Type, a, b, c, d, e) \
- scoped_ptr<Type> quad_all(Type::Create()); \
- { \
- QUAD_DATA \
- quad_all->SetAll(shared_state.get(), quad_rect, quad_opaque_rect, \
- quad_visible_rect, needs_blending, a, b, c, d, e); \
- } \
- SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
-
-#define CREATE_QUAD_5_NEW_1(Type, a, b, c, d, e, copy_a) \
- scoped_ptr<Type> quad_new(Type::Create()); \
- { \
- QUAD_DATA \
- quad_new->SetNew(shared_state.get(), quad_rect, a, b, c, d, e); \
- } \
- SETUP_AND_COPY_QUAD_NEW_1(Type, quad_new, copy_a);
-
-#define CREATE_QUAD_5_ALL_1(Type, a, b, c, d, e, copy_a) \
- scoped_ptr<Type> quad_all(Type::Create()); \
- { \
- QUAD_DATA \
- quad_all->SetAll(shared_state.get(), quad_rect, quad_opaque_rect, \
- quad_visible_rect, needs_blending, a, b, c, d, e); \
- } \
- SETUP_AND_COPY_QUAD_ALL_1(Type, quad_all, copy_a);
-
-#define CREATE_QUAD_6_NEW(Type, a, b, c, d, e, f) \
- scoped_ptr<Type> quad_new(Type::Create()); \
- { \
- QUAD_DATA \
- quad_new->SetNew(shared_state.get(), quad_rect, a, b, c, d, e, f); \
- } \
- SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
-
-#define CREATE_QUAD_6_ALL(Type, a, b, c, d, e, f) \
- scoped_ptr<Type> quad_all(Type::Create()); \
- { \
- QUAD_DATA \
- quad_all->SetAll(shared_state.get(), quad_rect, quad_opaque_rect, \
- quad_visible_rect, needs_blending, a, b, c, d, e, f); \
- } \
- SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
-
-#define CREATE_QUAD_7_NEW(Type, a, b, c, d, e, f, g) \
- scoped_ptr<Type> quad_new(Type::Create()); \
- { \
- QUAD_DATA \
- quad_new->SetNew(shared_state.get(), quad_rect, a, b, c, d, e, f, g); \
- } \
- SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
-
-#define CREATE_QUAD_7_ALL(Type, a, b, c, d, e, f, g) \
- scoped_ptr<Type> quad_all(Type::Create()); \
- { \
- QUAD_DATA \
- quad_all->SetAll(shared_state.get(), quad_rect, quad_opaque_rect, \
- quad_visible_rect, needs_blending, \
- a, b, c, d, e, f, g); \
- } \
- SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
-
-#define CREATE_QUAD_7_NEW_1(Type, a, b, c, d, e, f, g, copy_a) \
- scoped_ptr<Type> quad_new(Type::Create()); \
- { \
- QUAD_DATA \
- quad_new->SetNew(shared_state.get(), quad_rect, a, b, c, d, e, f, g); \
- } \
- SETUP_AND_COPY_QUAD_NEW_1(Type, quad_new, copy_a);
-
-#define CREATE_QUAD_7_ALL_1(Type, a, b, c, d, e, f, g, copy_a) \
- scoped_ptr<Type> quad_all(Type::Create()); \
- { \
- QUAD_DATA \
- quad_all->SetAll(shared_state.get(), quad_rect, quad_opaque_rect, \
- quad_visible_rect, needs_blending, \
- a, b, c, d, e, f, g); \
- } \
- SETUP_AND_COPY_QUAD_ALL_1(Type, quad_all, copy_a);
-
-#define CREATE_QUAD_8_NEW(Type, a, b, c, d, e, f, g, h) \
- scoped_ptr<Type> quad_new(Type::Create()); \
- { \
- QUAD_DATA \
- quad_new->SetNew(shared_state.get(), quad_rect, a, b, c, d, e, f, g, h); \
- } \
- SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
-
-#define CREATE_QUAD_8_ALL(Type, a, b, c, d, e, f, g, h) \
- scoped_ptr<Type> quad_all(Type::Create()); \
- { \
- QUAD_DATA \
- quad_all->SetAll(shared_state.get(), quad_rect, quad_opaque_rect, \
- quad_visible_rect, needs_blending, \
- a, b, c, d, e, f, g, h); \
- } \
- SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
-
-#define CREATE_QUAD_8_NEW_1(Type, a, b, c, d, e, f, g, h, copy_a) \
- scoped_ptr<Type> quad_new(Type::Create()); \
- { \
- QUAD_DATA \
- quad_new->SetNew(shared_state.get(), quad_rect, a, b, c, d, e, f, g, h); \
- } \
- SETUP_AND_COPY_QUAD_NEW_1(Type, quad_new, copy_a);
-
-#define CREATE_QUAD_8_ALL_1(Type, a, b, c, d, e, f, g, h, copy_a) \
- scoped_ptr<Type> quad_all(Type::Create()); \
- { \
- QUAD_DATA \
- quad_all->SetAll(shared_state.get(), quad_rect, quad_opaque_rect, \
- quad_visible_rect, needs_blending, \
- a, b, c, d, e, f, g, h); \
- } \
- SETUP_AND_COPY_QUAD_ALL_1(Type, quad_all, copy_a);
-
-#define CREATE_QUAD_9_NEW(Type, a, b, c, d, e, f, g, h, i) \
- scoped_ptr<Type> quad_new(Type::Create()); \
- { \
- QUAD_DATA \
- quad_new->SetNew(shared_state.get(), quad_rect, \
- a, b, c, d, e, f, g, h, i); \
- } \
- SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
+#define CREATE_SHARED_STATE() \
+ scoped_ptr<RenderPass> render_pass = RenderPass::Create(); \
+ SharedQuadState* shared_state(CreateSharedQuadState(render_pass.get())); \
+ SharedQuadState* copy_shared_state = \
+ render_pass->CreateAndAppendSharedQuadState(); \
+ copy_shared_state->CopyFrom(shared_state);
+
+#define QUAD_DATA \
+ gfx::Rect quad_rect(30, 40, 50, 60); \
+ gfx::Rect quad_visible_rect(40, 50, 30, 20); \
+ gfx::Rect quad_opaque_rect(60, 55, 10, 10); \
+ ALLOW_UNUSED_LOCAL(quad_opaque_rect); \
+ bool needs_blending = true; \
+ ALLOW_UNUSED_LOCAL(needs_blending);
+
+#define SETUP_AND_COPY_QUAD_NEW(Type, quad) \
+ DrawQuad* copy_new = \
+ render_pass->CopyFromAndAppendDrawQuad(quad_new, copy_shared_state); \
+ CompareDrawQuad(quad_new, copy_new, copy_shared_state); \
+ const Type* copy_quad = Type::MaterialCast(copy_new); \
+ ALLOW_UNUSED_LOCAL(copy_quad);
+
+#define SETUP_AND_COPY_QUAD_ALL(Type, quad) \
+ DrawQuad* copy_all = \
+ render_pass->CopyFromAndAppendDrawQuad(quad_all, copy_shared_state); \
+ CompareDrawQuad(quad_all, copy_all, copy_shared_state); \
+ copy_quad = Type::MaterialCast(copy_all);
+
+#define SETUP_AND_COPY_QUAD_NEW_RP(Type, quad, a) \
+ DrawQuad* copy_new = render_pass->CopyFromAndAppendRenderPassDrawQuad( \
+ quad_new, copy_shared_state, a); \
+ CompareDrawQuad(quad_new, copy_new, copy_shared_state); \
+ const Type* copy_quad = Type::MaterialCast(copy_new); \
+ ALLOW_UNUSED_LOCAL(copy_quad);
+
+#define SETUP_AND_COPY_QUAD_ALL_RP(Type, quad, a) \
+ DrawQuad* copy_all = render_pass->CopyFromAndAppendRenderPassDrawQuad( \
+ quad_all, copy_shared_state, a); \
+ CompareDrawQuad(quad_all, copy_all, copy_shared_state); \
+ copy_quad = Type::MaterialCast(copy_all);
+
+#define CREATE_QUAD_1_NEW(Type, a) \
+ Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a); } \
+ SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
+
+#define CREATE_QUAD_1_ALL(Type, a) \
+ Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { \
+ QUAD_DATA quad_all->SetAll(shared_state, \
+ quad_rect, \
+ quad_opaque_rect, \
+ quad_visible_rect, \
+ needs_blending, \
+ a); \
+ } \
+ SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
+
+#define CREATE_QUAD_2_NEW(Type, a, b) \
+ Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b); } \
+ SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
+
+#define CREATE_QUAD_2_ALL(Type, a, b) \
+ Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { \
+ QUAD_DATA quad_all->SetAll(shared_state, \
+ quad_rect, \
+ quad_opaque_rect, \
+ quad_visible_rect, \
+ needs_blending, \
+ a, \
+ b); \
+ } \
+ SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
+
+#define CREATE_QUAD_3_NEW(Type, a, b, c) \
+ Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c); } \
+ SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
+
+#define CREATE_QUAD_3_ALL(Type, a, b, c) \
+ Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { \
+ QUAD_DATA quad_all->SetAll(shared_state, \
+ quad_rect, \
+ quad_opaque_rect, \
+ quad_visible_rect, \
+ needs_blending, \
+ a, \
+ b, \
+ c); \
+ } \
+ SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
+
+#define CREATE_QUAD_4_NEW(Type, a, b, c, d) \
+ Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c, d); } \
+ SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
+
+#define CREATE_QUAD_4_ALL(Type, a, b, c, d) \
+ Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { \
+ QUAD_DATA quad_all->SetAll(shared_state, \
+ quad_rect, \
+ quad_opaque_rect, \
+ quad_visible_rect, \
+ needs_blending, \
+ a, \
+ b, \
+ c, \
+ d); \
+ } \
+ SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
+
+#define CREATE_QUAD_5_NEW(Type, a, b, c, d, e) \
+ Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c, d, e); } \
+ SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
+
+#define CREATE_QUAD_5_ALL(Type, a, b, c, d, e) \
+ Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { \
+ QUAD_DATA quad_all->SetAll(shared_state, \
+ quad_rect, \
+ quad_opaque_rect, \
+ quad_visible_rect, \
+ needs_blending, \
+ a, \
+ b, \
+ c, \
+ d, \
+ e); \
+ } \
+ SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
+
+#define CREATE_QUAD_6_NEW(Type, a, b, c, d, e, f) \
+ Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c, d, e, f); } \
+ SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
+
+#define CREATE_QUAD_6_ALL(Type, a, b, c, d, e, f) \
+ Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { \
+ QUAD_DATA quad_all->SetAll(shared_state, \
+ quad_rect, \
+ quad_opaque_rect, \
+ quad_visible_rect, \
+ needs_blending, \
+ a, \
+ b, \
+ c, \
+ d, \
+ e, \
+ f); \
+ } \
+ SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
+
+#define CREATE_QUAD_7_NEW(Type, a, b, c, d, e, f, g) \
+ Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { \
+ QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c, d, e, f, g); \
+ } \
+ SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
+
+#define CREATE_QUAD_7_ALL(Type, a, b, c, d, e, f, g) \
+ Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { \
+ QUAD_DATA quad_all->SetAll(shared_state, \
+ quad_rect, \
+ quad_opaque_rect, \
+ quad_visible_rect, \
+ needs_blending, \
+ a, \
+ b, \
+ c, \
+ d, \
+ e, \
+ f, \
+ g); \
+ } \
+ SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
+
+#define CREATE_QUAD_8_NEW(Type, a, b, c, d, e, f, g, h) \
+ Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { \
+ QUAD_DATA quad_new->SetNew( \
+ shared_state, quad_rect, a, b, c, d, e, f, g, h); \
+ } \
+ SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
+
+#define CREATE_QUAD_8_ALL(Type, a, b, c, d, e, f, g, h) \
+ Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { \
+ QUAD_DATA quad_all->SetAll(shared_state, \
+ quad_rect, \
+ quad_opaque_rect, \
+ quad_visible_rect, \
+ needs_blending, \
+ a, \
+ b, \
+ c, \
+ d, \
+ e, \
+ f, \
+ g, \
+ h); \
+ } \
+ SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
+
+#define CREATE_QUAD_9_NEW(Type, a, b, c, d, e, f, g, h, i) \
+ Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
+ { \
+ QUAD_DATA quad_new->SetNew( \
+ shared_state, quad_rect, a, b, c, d, e, f, g, h, i); \
+ } \
+ SETUP_AND_COPY_QUAD_NEW(Type, quad_new);