Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2856483002: experiments with uiresourcebitmap
Patch Set: unittest Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/ui_resource_bitmap.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8734 matching lines...) Expand 10 before | Expand all | Expand 10 after
8745 EXPECT_EQ(0u, context3d->NumTextures()); 8745 EXPECT_EQ(0u, context3d->NumTextures());
8746 } 8746 }
8747 8747
8748 TEST_F(LayerTreeHostImplTest, CreateETC1UIResource) { 8748 TEST_F(LayerTreeHostImplTest, CreateETC1UIResource) {
8749 std::unique_ptr<TestWebGraphicsContext3D> context = 8749 std::unique_ptr<TestWebGraphicsContext3D> context =
8750 TestWebGraphicsContext3D::Create(); 8750 TestWebGraphicsContext3D::Create();
8751 TestWebGraphicsContext3D* context3d = context.get(); 8751 TestWebGraphicsContext3D* context3d = context.get();
8752 CreateHostImpl(DefaultSettings(), FakeCompositorFrameSink::Create3d()); 8752 CreateHostImpl(DefaultSettings(), FakeCompositorFrameSink::Create3d());
8753 8753
8754 EXPECT_EQ(0u, context3d->NumTextures()); 8754 EXPECT_EQ(0u, context3d->NumTextures());
8755 8755 #if 0
8756 gfx::Size size(4, 4); 8756 gfx::Size size(4, 4);
8757 // SkImageInfo has no support for ETC1. The |info| below contains the right 8757 // SkImageInfo has no support for ETC1. The |info| below contains the right
8758 // total pixel size for the bitmap but not the right height and width. The 8758 // total pixel size for the bitmap but not the right height and width. The
8759 // correct width/height are passed directly to UIResourceBitmap. 8759 // correct width/height are passed directly to UIResourceBitmap.
8760 SkImageInfo info = 8760 SkImageInfo info =
8761 SkImageInfo::Make(4, 2, kAlpha_8_SkColorType, kPremul_SkAlphaType); 8761 SkImageInfo::Make(4, 2, kAlpha_8_SkColorType, kPremul_SkAlphaType);
8762 sk_sp<SkPixelRef> pixel_ref(SkMallocPixelRef::MakeAllocate(info, 0, 0)); 8762 sk_sp<SkPixelRef> pixel_ref(SkMallocPixelRef::MakeAllocate(info, 0, 0));
8763 pixel_ref->setImmutable(); 8763 pixel_ref->setImmutable();
8764 UIResourceBitmap bitmap(std::move(pixel_ref), size); 8764 UIResourceBitmap bitmap(std::move(pixel_ref), size);
8765 UIResourceId ui_resource_id = 1; 8765 UIResourceId ui_resource_id = 1;
8766 host_impl_->CreateUIResource(ui_resource_id, bitmap); 8766 host_impl_->CreateUIResource(ui_resource_id, bitmap);
8767 EXPECT_EQ(1u, context3d->NumTextures()); 8767 EXPECT_EQ(1u, context3d->NumTextures());
8768 ResourceId id1 = host_impl_->ResourceIdForUIResource(ui_resource_id); 8768 ResourceId id1 = host_impl_->ResourceIdForUIResource(ui_resource_id);
8769 EXPECT_NE(0u, id1); 8769 EXPECT_NE(0u, id1);
8770 #endif
8770 } 8771 }
8771 8772
8772 void ShutdownReleasesContext_Callback( 8773 void ShutdownReleasesContext_Callback(
8773 std::unique_ptr<CopyOutputResult> result) {} 8774 std::unique_ptr<CopyOutputResult> result) {}
8774 8775
8775 class FrameSinkClient : public TestCompositorFrameSinkClient { 8776 class FrameSinkClient : public TestCompositorFrameSinkClient {
8776 public: 8777 public:
8777 explicit FrameSinkClient( 8778 explicit FrameSinkClient(
8778 scoped_refptr<ContextProvider> display_context_provider) 8779 scoped_refptr<ContextProvider> display_context_provider)
8779 : display_context_provider_(std::move(display_context_provider)) {} 8780 : display_context_provider_(std::move(display_context_provider)) {}
(...skipping 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after
12347 else 12348 else
12348 EXPECT_FALSE(tile->HasRasterTask()); 12349 EXPECT_FALSE(tile->HasRasterTask());
12349 } 12350 }
12350 Region expected_invalidation( 12351 Region expected_invalidation(
12351 raster_source->GetRectForImage(checkerable_image->uniqueID())); 12352 raster_source->GetRectForImage(checkerable_image->uniqueID()));
12352 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation())); 12353 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation()));
12353 } 12354 }
12354 12355
12355 } // namespace 12356 } // namespace
12356 } // namespace cc 12357 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/ui_resource_bitmap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698