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

Unified Diff: cc/quads/render_pass.cc

Issue 2174843003: cc mojo: Use ArrayDataViews in RenderPasses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix RenderPassId Created 4 years, 5 months 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/quads/render_pass.h ('k') | mojo/public/cpp/bindings/array_traits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/quads/render_pass.cc
diff --git a/cc/quads/render_pass.cc b/cc/quads/render_pass.cc
index 9b9e0b21ac1c0b408a3af712a0317116641bf57e..021352866802d152b287e7c0868b533625e6c989 100644
--- a/cc/quads/render_pass.cc
+++ b/cc/quads/render_pass.cc
@@ -98,51 +98,50 @@ std::unique_ptr<RenderPass> RenderPass::Copy(RenderPassId new_id) const {
return copy_pass;
}
-// static
-void RenderPass::CopyAll(const std::vector<std::unique_ptr<RenderPass>>& in,
- std::vector<std::unique_ptr<RenderPass>>* out) {
- for (const auto& source : in) {
- // Since we can't copy these, it's wrong to use CopyAll in a situation where
- // you may have copy_requests present.
- DCHECK_EQ(source->copy_requests.size(), 0u);
-
- std::unique_ptr<RenderPass> copy_pass(Create(
- source->shared_quad_state_list.size(), source->quad_list.size()));
- copy_pass->SetAll(source->id,
- source->output_rect,
- source->damage_rect,
- source->transform_to_root_target,
- source->has_transparent_background);
- for (auto* shared_quad_state : source->shared_quad_state_list) {
- SharedQuadState* copy_shared_quad_state =
- copy_pass->CreateAndAppendSharedQuadState();
- *copy_shared_quad_state = *shared_quad_state;
+std::unique_ptr<RenderPass> RenderPass::DeepCopy() const {
+ // Since we can't copy these, it's wrong to use DeepCopy in a situation where
+ // you may have copy_requests present.
+ DCHECK_EQ(copy_requests.size(), 0u);
+
+ std::unique_ptr<RenderPass> copy_pass(
+ Create(shared_quad_state_list.size(), quad_list.size()));
+ copy_pass->SetAll(id, output_rect, damage_rect, transform_to_root_target,
+ has_transparent_background);
+ for (auto* shared_quad_state : shared_quad_state_list) {
+ SharedQuadState* copy_shared_quad_state =
+ copy_pass->CreateAndAppendSharedQuadState();
+ *copy_shared_quad_state = *shared_quad_state;
+ }
+ SharedQuadStateList::ConstIterator sqs_iter = shared_quad_state_list.begin();
+ SharedQuadStateList::Iterator copy_sqs_iter =
+ copy_pass->shared_quad_state_list.begin();
+ for (auto* quad : quad_list) {
+ while (quad->shared_quad_state != *sqs_iter) {
+ ++sqs_iter;
+ ++copy_sqs_iter;
+ DCHECK(sqs_iter != shared_quad_state_list.end());
}
- SharedQuadStateList::Iterator sqs_iter =
- source->shared_quad_state_list.begin();
- SharedQuadStateList::Iterator copy_sqs_iter =
- copy_pass->shared_quad_state_list.begin();
- for (auto* quad : source->quad_list) {
- while (quad->shared_quad_state != *sqs_iter) {
- ++sqs_iter;
- ++copy_sqs_iter;
- DCHECK(sqs_iter != source->shared_quad_state_list.end());
- }
- DCHECK(quad->shared_quad_state == *sqs_iter);
-
- SharedQuadState* copy_shared_quad_state = *copy_sqs_iter;
-
- if (quad->material == DrawQuad::RENDER_PASS) {
- const RenderPassDrawQuad* pass_quad =
- RenderPassDrawQuad::MaterialCast(quad);
- copy_pass->CopyFromAndAppendRenderPassDrawQuad(
- pass_quad, copy_shared_quad_state, pass_quad->render_pass_id);
- } else {
- copy_pass->CopyFromAndAppendDrawQuad(quad, copy_shared_quad_state);
- }
+ DCHECK(quad->shared_quad_state == *sqs_iter);
+
+ SharedQuadState* copy_shared_quad_state = *copy_sqs_iter;
+
+ if (quad->material == DrawQuad::RENDER_PASS) {
+ const RenderPassDrawQuad* pass_quad =
+ RenderPassDrawQuad::MaterialCast(quad);
+ copy_pass->CopyFromAndAppendRenderPassDrawQuad(
+ pass_quad, copy_shared_quad_state, pass_quad->render_pass_id);
+ } else {
+ copy_pass->CopyFromAndAppendDrawQuad(quad, copy_shared_quad_state);
}
- out->push_back(std::move(copy_pass));
}
+ return copy_pass;
+}
+
+// static
+void RenderPass::CopyAll(const std::vector<std::unique_ptr<RenderPass>>& in,
+ std::vector<std::unique_ptr<RenderPass>>* out) {
+ for (const auto& source : in)
+ out->push_back(source->DeepCopy());
}
void RenderPass::SetNew(RenderPassId id,
« no previous file with comments | « cc/quads/render_pass.h ('k') | mojo/public/cpp/bindings/array_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698