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 7735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7746 CreateHostImpl(DefaultSettings(), FakeOutputSurface::Create3d()); | 7746 CreateHostImpl(DefaultSettings(), FakeOutputSurface::Create3d()); |
7747 | 7747 |
7748 EXPECT_EQ(0u, context3d->NumTextures()); | 7748 EXPECT_EQ(0u, context3d->NumTextures()); |
7749 | 7749 |
7750 gfx::Size size(4, 4); | 7750 gfx::Size size(4, 4); |
7751 // SkImageInfo has no support for ETC1. The |info| below contains the right | 7751 // SkImageInfo has no support for ETC1. The |info| below contains the right |
7752 // total pixel size for the bitmap but not the right height and width. The | 7752 // total pixel size for the bitmap but not the right height and width. The |
7753 // correct width/height are passed directly to UIResourceBitmap. | 7753 // correct width/height are passed directly to UIResourceBitmap. |
7754 SkImageInfo info = | 7754 SkImageInfo info = |
7755 SkImageInfo::Make(4, 2, kAlpha_8_SkColorType, kPremul_SkAlphaType); | 7755 SkImageInfo::Make(4, 2, kAlpha_8_SkColorType, kPremul_SkAlphaType); |
7756 skia::RefPtr<SkPixelRef> pixel_ref = | 7756 sk_sp<SkPixelRef> pixel_ref(SkMallocPixelRef::NewAllocate(info, 0, 0)); |
7757 skia::AdoptRef(SkMallocPixelRef::NewAllocate(info, 0, 0)); | |
7758 pixel_ref->setImmutable(); | 7757 pixel_ref->setImmutable(); |
7759 UIResourceBitmap bitmap(pixel_ref, size); | 7758 UIResourceBitmap bitmap(pixel_ref, size); |
7760 UIResourceId ui_resource_id = 1; | 7759 UIResourceId ui_resource_id = 1; |
7761 host_impl_->CreateUIResource(ui_resource_id, bitmap); | 7760 host_impl_->CreateUIResource(ui_resource_id, bitmap); |
7762 EXPECT_EQ(1u, context3d->NumTextures()); | 7761 EXPECT_EQ(1u, context3d->NumTextures()); |
7763 ResourceId id1 = host_impl_->ResourceIdForUIResource(ui_resource_id); | 7762 ResourceId id1 = host_impl_->ResourceIdForUIResource(ui_resource_id); |
7764 EXPECT_NE(0u, id1); | 7763 EXPECT_NE(0u, id1); |
7765 } | 7764 } |
7766 | 7765 |
7767 void ShutdownReleasesContext_Callback( | 7766 void ShutdownReleasesContext_Callback( |
(...skipping 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10672 // There should not be any jitter measured till we hit the fixed point hits | 10671 // There should not be any jitter measured till we hit the fixed point hits |
10673 // threshold. | 10672 // threshold. |
10674 float expected_jitter = | 10673 float expected_jitter = |
10675 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; | 10674 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; |
10676 EXPECT_EQ(jitter, expected_jitter); | 10675 EXPECT_EQ(jitter, expected_jitter); |
10677 } | 10676 } |
10678 } | 10677 } |
10679 | 10678 |
10680 } // namespace | 10679 } // namespace |
10681 } // namespace cc | 10680 } // namespace cc |
OLD | NEW |