Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2548)

Unified Diff: cc/tile_draw_quad.cc

Issue 11411050: cc: Make the DrawQuad subclasses into struct-like classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/tile_draw_quad.h ('k') | cc/tiled_layer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tile_draw_quad.cc
diff --git a/cc/tile_draw_quad.cc b/cc/tile_draw_quad.cc
index 1f2e9f5465f4dab04a643a7b090f2c4133fffc20..965bb0361eadabc66844c89dd7d730d78b00c91c 100644
--- a/cc/tile_draw_quad.cc
+++ b/cc/tile_draw_quad.cc
@@ -9,30 +9,76 @@
namespace cc {
-scoped_ptr<TileDrawQuad> TileDrawQuad::create(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::RectF& texCoordRect, const gfx::Size& textureSize, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
-{
- return make_scoped_ptr(new TileDrawQuad(sharedQuadState, quadRect, opaqueRect, resourceId, texCoordRect, textureSize, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA));
+TileDrawQuad::TileDrawQuad()
+ : resource_id(0),
+ swizzle_contents(false),
+ left_edge_aa(false),
+ top_edge_aa(false),
+ right_edge_aa(false),
+ bottom_edge_aa(false) {
}
-TileDrawQuad::TileDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::RectF& texCoordRect, const gfx::Size& textureSize, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
- : m_resourceId(resourceId)
- , m_texCoordRect(texCoordRect)
- , m_textureSize(textureSize)
- , m_swizzleContents(swizzleContents)
- , m_leftEdgeAA(leftEdgeAA)
- , m_topEdgeAA(topEdgeAA)
- , m_rightEdgeAA(rightEdgeAA)
- , m_bottomEdgeAA(bottomEdgeAA)
-{
- gfx::Rect visibleRect = quadRect;
- bool needsBlending = isAntialiased();
- DrawQuad::SetAll(sharedQuadState, DrawQuad::TILED_CONTENT, quadRect, opaqueRect, visibleRect, needsBlending);
+scoped_ptr<TileDrawQuad> TileDrawQuad::Create() {
+ return make_scoped_ptr(new TileDrawQuad);
}
-const TileDrawQuad* TileDrawQuad::materialCast(const DrawQuad* quad)
-{
- DCHECK(quad->material == DrawQuad::TILED_CONTENT);
- return static_cast<const TileDrawQuad*>(quad);
+void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
+ gfx::Rect rect,
+ gfx::Rect opaque_rect,
+ unsigned resource_id,
+ const gfx::RectF& tex_coord_rect,
+ gfx::Size texture_size,
+ bool swizzle_contents,
+ bool left_edge_aa,
+ bool top_edge_aa,
+ bool right_edge_aa,
+ bool bottom_edge_aa) {
+ gfx::Rect visible_rect = rect;
+ bool needs_blending = false;
+ DrawQuad::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect,
+ opaque_rect, visible_rect, needs_blending);
+ this->resource_id = resource_id;
+ this->tex_coord_rect = tex_coord_rect;
+ this->texture_size = texture_size;
+ this->swizzle_contents = swizzle_contents;
+ this->left_edge_aa = left_edge_aa;
+ this->top_edge_aa = top_edge_aa;
+ this->right_edge_aa = right_edge_aa;
+ this->bottom_edge_aa = bottom_edge_aa;
+
+ // Override needs_blending after initializing the quad.
+ this->needs_blending = IsAntialiased();
+}
+
+void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
+ gfx::Rect rect,
+ gfx::Rect opaque_rect,
+ gfx::Rect visible_rect,
+ bool needs_blending,
+ unsigned resource_id,
+ const gfx::RectF& tex_coord_rect,
+ gfx::Size texture_size,
+ bool swizzle_contents,
+ bool left_edge_aa,
+ bool top_edge_aa,
+ bool right_edge_aa,
+ bool bottom_edge_aa) {
+ DrawQuad::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect,
+ opaque_rect, visible_rect, needs_blending);
+ this->resource_id = resource_id;
+ this->tex_coord_rect = tex_coord_rect;
+ this->texture_size = texture_size;
+ this->swizzle_contents = swizzle_contents;
+ this->left_edge_aa = left_edge_aa;
+ this->top_edge_aa = top_edge_aa;
+ this->right_edge_aa = right_edge_aa;
+ this->bottom_edge_aa = bottom_edge_aa;
+}
+
+const TileDrawQuad* TileDrawQuad::MaterialCast(
+ const DrawQuad* quad) {
+ DCHECK(quad->material == DrawQuad::TILED_CONTENT);
+ return static_cast<const TileDrawQuad*>(quad);
}
} // namespace cc
« no previous file with comments | « cc/tile_draw_quad.h ('k') | cc/tiled_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698