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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 7739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7750 CreateHostImpl(DefaultSettings(), FakeOutputSurface::Create3d()); | 7750 CreateHostImpl(DefaultSettings(), FakeOutputSurface::Create3d()); |
7751 | 7751 |
7752 EXPECT_EQ(0u, context3d->NumTextures()); | 7752 EXPECT_EQ(0u, context3d->NumTextures()); |
7753 | 7753 |
7754 gfx::Size size(4, 4); | 7754 gfx::Size size(4, 4); |
7755 // SkImageInfo has no support for ETC1. The |info| below contains the right | 7755 // SkImageInfo has no support for ETC1. The |info| below contains the right |
7756 // total pixel size for the bitmap but not the right height and width. The | 7756 // total pixel size for the bitmap but not the right height and width. The |
7757 // correct width/height are passed directly to UIResourceBitmap. | 7757 // correct width/height are passed directly to UIResourceBitmap. |
7758 SkImageInfo info = | 7758 SkImageInfo info = |
7759 SkImageInfo::Make(4, 2, kAlpha_8_SkColorType, kPremul_SkAlphaType); | 7759 SkImageInfo::Make(4, 2, kAlpha_8_SkColorType, kPremul_SkAlphaType); |
7760 skia::RefPtr<SkPixelRef> pixel_ref = | 7760 sk_sp<SkPixelRef> pixel_ref(SkMallocPixelRef::NewAllocate(info, 0, 0)); |
7761 skia::AdoptRef(SkMallocPixelRef::NewAllocate(info, 0, 0)); | |
7762 pixel_ref->setImmutable(); | 7761 pixel_ref->setImmutable(); |
7763 UIResourceBitmap bitmap(pixel_ref, size); | 7762 UIResourceBitmap bitmap(std::move(pixel_ref), size); |
7764 UIResourceId ui_resource_id = 1; | 7763 UIResourceId ui_resource_id = 1; |
7765 host_impl_->CreateUIResource(ui_resource_id, bitmap); | 7764 host_impl_->CreateUIResource(ui_resource_id, bitmap); |
7766 EXPECT_EQ(1u, context3d->NumTextures()); | 7765 EXPECT_EQ(1u, context3d->NumTextures()); |
7767 ResourceId id1 = host_impl_->ResourceIdForUIResource(ui_resource_id); | 7766 ResourceId id1 = host_impl_->ResourceIdForUIResource(ui_resource_id); |
7768 EXPECT_NE(0u, id1); | 7767 EXPECT_NE(0u, id1); |
7769 } | 7768 } |
7770 | 7769 |
7771 void ShutdownReleasesContext_Callback( | 7770 void ShutdownReleasesContext_Callback( |
7772 std::unique_ptr<CopyOutputResult> result) {} | 7771 std::unique_ptr<CopyOutputResult> result) {} |
7773 | 7772 |
(...skipping 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10679 // There should not be any jitter measured till we hit the fixed point hits | 10678 // There should not be any jitter measured till we hit the fixed point hits |
10680 // threshold. | 10679 // threshold. |
10681 float expected_jitter = | 10680 float expected_jitter = |
10682 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; | 10681 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; |
10683 EXPECT_EQ(jitter, expected_jitter); | 10682 EXPECT_EQ(jitter, expected_jitter); |
10684 } | 10683 } |
10685 } | 10684 } |
10686 | 10685 |
10687 } // namespace | 10686 } // namespace |
10688 } // namespace cc | 10687 } // namespace cc |
OLD | NEW |