| 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 5435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5446 | 5446 |
| 5447 TEST_F(LayerTreeHostImplTest, CreateETC1UIResource) { | 5447 TEST_F(LayerTreeHostImplTest, CreateETC1UIResource) { |
| 5448 scoped_ptr<TestWebGraphicsContext3D> context = | 5448 scoped_ptr<TestWebGraphicsContext3D> context = |
| 5449 TestWebGraphicsContext3D::Create(); | 5449 TestWebGraphicsContext3D::Create(); |
| 5450 TestWebGraphicsContext3D* context3d = context.get(); | 5450 TestWebGraphicsContext3D* context3d = context.get(); |
| 5451 scoped_ptr<OutputSurface> output_surface = CreateFakeOutputSurface(); | 5451 scoped_ptr<OutputSurface> output_surface = CreateFakeOutputSurface(); |
| 5452 CreateHostImpl(DefaultSettings(), output_surface.Pass()); | 5452 CreateHostImpl(DefaultSettings(), output_surface.Pass()); |
| 5453 | 5453 |
| 5454 EXPECT_EQ(0u, context3d->NumTextures()); | 5454 EXPECT_EQ(0u, context3d->NumTextures()); |
| 5455 | 5455 |
| 5456 gfx::Size size(4, 4); | |
| 5457 // SkImageInfo has no support for ETC1. The |info| below contains the right | |
| 5458 // total pixel size for the bitmap but not the right height and width. The | |
| 5459 // correct width/height are passed directly to UIResourceBitmap. | |
| 5460 SkImageInfo info = | 5456 SkImageInfo info = |
| 5461 SkImageInfo::Make(4, 2, kAlpha_8_SkColorType, kPremul_SkAlphaType); | 5457 SkImageInfo::Make(4, 4, kPMColor_SkColorType, kPremul_SkAlphaType); |
| 5462 skia::RefPtr<SkPixelRef> pixel_ref = | 5458 skia::RefPtr<SkPixelRef> pixel_ref = |
| 5463 skia::AdoptRef(SkMallocPixelRef::NewAllocate(info, 0, 0)); | 5459 skia::AdoptRef(SkMallocPixelRef::NewAllocate(info, 0, 0)); |
| 5464 pixel_ref->setImmutable(); | 5460 pixel_ref->setImmutable(); |
| 5465 UIResourceBitmap bitmap(pixel_ref, size); | 5461 UIResourceBitmap bitmap(pixel_ref); |
| 5466 UIResourceId ui_resource_id = 1; | 5462 UIResourceId ui_resource_id = 1; |
| 5467 host_impl_->CreateUIResource(ui_resource_id, bitmap); | 5463 host_impl_->CreateUIResource(ui_resource_id, bitmap); |
| 5468 EXPECT_EQ(1u, context3d->NumTextures()); | 5464 EXPECT_EQ(1u, context3d->NumTextures()); |
| 5469 ResourceProvider::ResourceId id1 = | 5465 ResourceProvider::ResourceId id1 = |
| 5470 host_impl_->ResourceIdForUIResource(ui_resource_id); | 5466 host_impl_->ResourceIdForUIResource(ui_resource_id); |
| 5471 EXPECT_NE(0u, id1); | 5467 EXPECT_NE(0u, id1); |
| 5472 } | 5468 } |
| 5473 | 5469 |
| 5474 void ShutdownReleasesContext_Callback(scoped_ptr<CopyOutputResult> result) { | 5470 void ShutdownReleasesContext_Callback(scoped_ptr<CopyOutputResult> result) { |
| 5475 } | 5471 } |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5772 &set_needs_redraw_count)); | 5768 &set_needs_redraw_count)); |
| 5773 // Empty damage rect won't signal the monitor. | 5769 // Empty damage rect won't signal the monitor. |
| 5774 host_impl_->SetNeedsRedrawRect(gfx::Rect()); | 5770 host_impl_->SetNeedsRedrawRect(gfx::Rect()); |
| 5775 EXPECT_EQ(0, set_needs_commit_count); | 5771 EXPECT_EQ(0, set_needs_commit_count); |
| 5776 EXPECT_EQ(2, set_needs_redraw_count); | 5772 EXPECT_EQ(2, set_needs_redraw_count); |
| 5777 } | 5773 } |
| 5778 } | 5774 } |
| 5779 | 5775 |
| 5780 } // namespace | 5776 } // namespace |
| 5781 } // namespace cc | 5777 } // namespace cc |
| OLD | NEW |