blob: 8ae1fa5a4ae8706e908fcad03ad1173c4f7a211d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/test/fake_delegated_renderer_layer_impl.h"
#include "base/bind.h"
#include "cc/output/delegated_frame_data.h"
#include "cc/quads/draw_quad.h"
namespace cc {
FakeDelegatedRendererLayerImpl::FakeDelegatedRendererLayerImpl(
LayerTreeImpl* tree_impl, int id)
: DelegatedRendererLayerImpl(tree_impl, id) {}
FakeDelegatedRendererLayerImpl::~FakeDelegatedRendererLayerImpl() {}
static ResourceProvider::ResourceId AddResourceToFrame(
DelegatedFrameData* frame,
ResourceProvider::ResourceId resource_id) {
TransferableResource resource;
resource.id = resource_id;
frame->resource_list.push_back(resource);
return resource_id;
}
void FakeDelegatedRendererLayerImpl::SetFrameDataForRenderPasses(
ScopedPtrVector<RenderPass>* pass_list) {
scoped_ptr<DelegatedFrameData> delegated_frame(new DelegatedFrameData);
delegated_frame->render_pass_list.swap(*pass_list);
DrawQuad::ResourceIteratorCallback add_resource_to_frame_callback =
base::Bind(&AddResourceToFrame,
delegated_frame.get());
for (size_t i = 0; i < delegated_frame->render_pass_list.size(); ++i) {
RenderPass* pass = delegated_frame->render_pass_list[i];
for (size_t j = 0; j < pass->quad_list.size(); ++j)
pass->quad_list[j]->IterateResources(add_resource_to_frame_callback);
}
TransferableResourceArray resources_for_ack;
SetFrameData(delegated_frame.Pass(), gfx::RectF(), &resources_for_ack);
}
} // namespace cc
|