OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "cc/output/begin_frame_args.h" | 28 #include "cc/output/begin_frame_args.h" |
29 #include "cc/output/compositor_frame_ack.h" | 29 #include "cc/output/compositor_frame_ack.h" |
30 #include "cc/output/compositor_frame_metadata.h" | 30 #include "cc/output/compositor_frame_metadata.h" |
31 #include "cc/output/copy_output_request.h" | 31 #include "cc/output/copy_output_request.h" |
32 #include "cc/output/copy_output_result.h" | 32 #include "cc/output/copy_output_result.h" |
33 #include "cc/output/gl_renderer.h" | 33 #include "cc/output/gl_renderer.h" |
34 #include "cc/quads/render_pass_draw_quad.h" | 34 #include "cc/quads/render_pass_draw_quad.h" |
35 #include "cc/quads/solid_color_draw_quad.h" | 35 #include "cc/quads/solid_color_draw_quad.h" |
36 #include "cc/quads/texture_draw_quad.h" | 36 #include "cc/quads/texture_draw_quad.h" |
37 #include "cc/quads/tile_draw_quad.h" | 37 #include "cc/quads/tile_draw_quad.h" |
38 #include "cc/resources/etc1_pixel_ref.h" | |
39 #include "cc/resources/layer_tiling_data.h" | 38 #include "cc/resources/layer_tiling_data.h" |
40 #include "cc/test/animation_test_common.h" | 39 #include "cc/test/animation_test_common.h" |
41 #include "cc/test/fake_layer_tree_host_impl.h" | 40 #include "cc/test/fake_layer_tree_host_impl.h" |
42 #include "cc/test/fake_output_surface.h" | 41 #include "cc/test/fake_output_surface.h" |
43 #include "cc/test/fake_output_surface_client.h" | 42 #include "cc/test/fake_output_surface_client.h" |
44 #include "cc/test/fake_picture_layer_impl.h" | 43 #include "cc/test/fake_picture_layer_impl.h" |
45 #include "cc/test/fake_picture_pile_impl.h" | 44 #include "cc/test/fake_picture_pile_impl.h" |
46 #include "cc/test/fake_proxy.h" | 45 #include "cc/test/fake_proxy.h" |
47 #include "cc/test/fake_rendering_stats_instrumentation.h" | 46 #include "cc/test/fake_rendering_stats_instrumentation.h" |
48 #include "cc/test/fake_video_frame_provider.h" | 47 #include "cc/test/fake_video_frame_provider.h" |
(...skipping 5077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5126 TEST_F(LayerTreeHostImplTest, CreateETC1UIResource) { | 5125 TEST_F(LayerTreeHostImplTest, CreateETC1UIResource) { |
5127 scoped_ptr<TestWebGraphicsContext3D> context = | 5126 scoped_ptr<TestWebGraphicsContext3D> context = |
5128 TestWebGraphicsContext3D::Create(); | 5127 TestWebGraphicsContext3D::Create(); |
5129 TestWebGraphicsContext3D* context3d = context.get(); | 5128 TestWebGraphicsContext3D* context3d = context.get(); |
5130 scoped_ptr<OutputSurface> output_surface = CreateFakeOutputSurface(); | 5129 scoped_ptr<OutputSurface> output_surface = CreateFakeOutputSurface(); |
5131 CreateHostImpl(DefaultSettings(), output_surface.Pass()); | 5130 CreateHostImpl(DefaultSettings(), output_surface.Pass()); |
5132 | 5131 |
5133 EXPECT_EQ(0u, context3d->NumTextures()); | 5132 EXPECT_EQ(0u, context3d->NumTextures()); |
5134 | 5133 |
5135 SkImageInfo info = {4, 4, kPMColor_SkColorType, kPremul_SkAlphaType}; | 5134 SkImageInfo info = {4, 4, kPMColor_SkColorType, kPremul_SkAlphaType}; |
5136 size_t rowBytes = info.minRowBytes(); | 5135 UIResourceBitmap bitmap(info); |
5137 scoped_ptr<uint8_t[]> pixels(new uint8_t[rowBytes * info.fHeight]); | |
5138 skia::RefPtr<ETC1PixelRef> etc1_pixel_ref = | |
5139 skia::AdoptRef(new ETC1PixelRef(info, rowBytes, pixels.Pass())); | |
5140 UIResourceBitmap bitmap(etc1_pixel_ref, gfx::Size(info.fWidth, info.fHeight)); | |
5141 // TODO(powel) Now that pixel_refs have info, the UIResourceBitmap | |
5142 // constructor can get the can size from (pixelref->info().fWidth, | |
5143 // pixelref->info().fHeight). | |
5144 | |
5145 UIResourceId ui_resource_id = 1; | 5136 UIResourceId ui_resource_id = 1; |
5146 host_impl_->CreateUIResource(ui_resource_id, bitmap); | 5137 host_impl_->CreateUIResource(ui_resource_id, bitmap); |
5147 EXPECT_EQ(1u, context3d->NumTextures()); | 5138 EXPECT_EQ(1u, context3d->NumTextures()); |
5148 ResourceProvider::ResourceId id1 = | 5139 ResourceProvider::ResourceId id1 = |
5149 host_impl_->ResourceIdForUIResource(ui_resource_id); | 5140 host_impl_->ResourceIdForUIResource(ui_resource_id); |
5150 EXPECT_NE(0u, id1); | 5141 EXPECT_NE(0u, id1); |
5151 } | 5142 } |
5152 | 5143 |
5153 void ShutdownReleasesContext_Callback(scoped_ptr<CopyOutputResult> result) { | 5144 void ShutdownReleasesContext_Callback(scoped_ptr<CopyOutputResult> result) { |
5154 } | 5145 } |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5435 &set_needs_redraw_count)); | 5426 &set_needs_redraw_count)); |
5436 // Empty damage rect won't signal the monitor. | 5427 // Empty damage rect won't signal the monitor. |
5437 host_impl_->SetNeedsRedrawRect(gfx::Rect()); | 5428 host_impl_->SetNeedsRedrawRect(gfx::Rect()); |
5438 EXPECT_EQ(0, set_needs_commit_count); | 5429 EXPECT_EQ(0, set_needs_commit_count); |
5439 EXPECT_EQ(2, set_needs_redraw_count); | 5430 EXPECT_EQ(2, set_needs_redraw_count); |
5440 } | 5431 } |
5441 } | 5432 } |
5442 | 5433 |
5443 } // namespace | 5434 } // namespace |
5444 } // namespace cc | 5435 } // namespace cc |
OLD | NEW |