summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authorvmpstr <vmpstr@chromium.org>2015-06-02 15:14:46 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-02 22:15:17 +0000
commit0eca2e87110112c678c5f4c89b7f99e2de6026bb (patch)
tree6a3e39b085e5d8851c42ccf0b8a0f3e0a92775f6 /mojo
parent6c8207fe7d79a2150ce7c4007678d10c23475630 (diff)
downloadchromium_src-0eca2e87110112c678c5f4c89b7f99e2de6026bb.zip
chromium_src-0eca2e87110112c678c5f4c89b7f99e2de6026bb.tar.gz
chromium_src-0eca2e87110112c678c5f4c89b7f99e2de6026bb.tar.bz2
cc: Remove DrawQuad::IterateResoruces
This patch removes IterateResources function in favor of iterating resources directly on the quad. In order to accomplish this, each derived quad uses new resources object on the base class to store all of the resources it needs. This allows the calling code that used to call IterateResources with a callback to instead directly iterate all of the ids and manipulate them in any way that is required. This improves the performance of the IterateResources test by ~30%. BUG=492765 R=danakj, piman@chromium.org CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1152473006 Cr-Commit-Position: refs/heads/master@{#332476}
Diffstat (limited to 'mojo')
-rw-r--r--mojo/converters/surfaces/surfaces_type_converters.cc14
-rw-r--r--mojo/converters/surfaces/tests/surface_unittest.cc2
2 files changed, 8 insertions, 8 deletions
diff --git a/mojo/converters/surfaces/surfaces_type_converters.cc b/mojo/converters/surfaces/surfaces_type_converters.cc
index 0c27f78..f17cfea 100644
--- a/mojo/converters/surfaces/surfaces_type_converters.cc
+++ b/mojo/converters/surfaces/surfaces_type_converters.cc
@@ -255,7 +255,7 @@ QuadPtr TypeConverter<QuadPtr, cc::DrawQuad>::Convert(
RenderPassQuadStatePtr pass_state = RenderPassQuadState::New();
pass_state->render_pass_id =
RenderPassId::From(render_pass_quad->render_pass_id);
- pass_state->mask_resource_id = render_pass_quad->mask_resource_id;
+ pass_state->mask_resource_id = render_pass_quad->mask_resource_id();
pass_state->mask_uv_scale = PointF::From(
gfx::PointAtOffsetFromOrigin(render_pass_quad->mask_uv_scale));
pass_state->mask_texture_size =
@@ -290,7 +290,7 @@ QuadPtr TypeConverter<QuadPtr, cc::DrawQuad>::Convert(
const cc::TextureDrawQuad* texture_quad =
cc::TextureDrawQuad::MaterialCast(&input);
TextureQuadStatePtr texture_state = TextureQuadState::New();
- texture_state->resource_id = texture_quad->resource_id;
+ texture_state->resource_id = texture_quad->resource_id();
texture_state->premultiplied_alpha = texture_quad->premultiplied_alpha;
texture_state->uv_top_left = PointF::From(texture_quad->uv_top_left);
texture_state->uv_bottom_right =
@@ -314,7 +314,7 @@ QuadPtr TypeConverter<QuadPtr, cc::DrawQuad>::Convert(
tile_state->texture_size = Size::From(tile_quad->texture_size);
tile_state->swizzle_contents = tile_quad->swizzle_contents;
tile_state->nearest_neighbor = tile_quad->nearest_neighbor;
- tile_state->resource_id = tile_quad->resource_id;
+ tile_state->resource_id = tile_quad->resource_id();
quad->tile_quad_state = tile_state.Pass();
break;
}
@@ -326,10 +326,10 @@ QuadPtr TypeConverter<QuadPtr, cc::DrawQuad>::Convert(
// TODO(sky): uv_tex_coord_rect
// TODO(sky): ya_texture_size
// TODO(sky): uv_texture_size
- yuv_state->y_plane_resource_id = yuv_quad->y_plane_resource_id;
- yuv_state->u_plane_resource_id = yuv_quad->u_plane_resource_id;
- yuv_state->v_plane_resource_id = yuv_quad->v_plane_resource_id;
- yuv_state->a_plane_resource_id = yuv_quad->a_plane_resource_id;
+ yuv_state->y_plane_resource_id = yuv_quad->y_plane_resource_id();
+ yuv_state->u_plane_resource_id = yuv_quad->u_plane_resource_id();
+ yuv_state->v_plane_resource_id = yuv_quad->v_plane_resource_id();
+ yuv_state->a_plane_resource_id = yuv_quad->a_plane_resource_id();
yuv_state->color_space =
static_cast<YUVColorSpace>(yuv_quad->color_space);
quad->yuv_video_quad_state = yuv_state.Pass();
diff --git a/mojo/converters/surfaces/tests/surface_unittest.cc b/mojo/converters/surfaces/tests/surface_unittest.cc
index f987dff..845a9e3 100644
--- a/mojo/converters/surfaces/tests/surface_unittest.cc
+++ b/mojo/converters/surfaces/tests/surface_unittest.cc
@@ -354,7 +354,7 @@ TEST(SurfaceLibTest, RenderPass) {
ASSERT_EQ(cc::DrawQuad::TEXTURE_CONTENT, round_trip_quad->material);
const cc::TextureDrawQuad* round_trip_texture_quad =
cc::TextureDrawQuad::MaterialCast(round_trip_quad);
- EXPECT_EQ(resource_id, round_trip_texture_quad->resource_id);
+ EXPECT_EQ(resource_id, round_trip_texture_quad->resource_id());
EXPECT_EQ(premultiplied_alpha, round_trip_texture_quad->premultiplied_alpha);
EXPECT_EQ(uv_top_left, round_trip_texture_quad->uv_top_left);
EXPECT_EQ(uv_bottom_right, round_trip_texture_quad->uv_bottom_right);