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

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

Issue 143803004: android: Migrate old content readback to use async readback (and delegated renderer) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: consistent device scaling Created 6 years, 10 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') | content/browser/android/content_startup_flags.cc » ('j') | 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 <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
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<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d(); 5451 scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d();
5452 CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>()); 5452 CreateHostImpl(DefaultSettings(), output_surface.PassAs<OutputSurface>());
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.
5456 SkImageInfo info = 5460 SkImageInfo info =
5457 SkImageInfo::Make(4, 4, kPMColor_SkColorType, kPremul_SkAlphaType); 5461 SkImageInfo::Make(4, 2, kAlpha_8_SkColorType, kPremul_SkAlphaType);
5458 skia::RefPtr<SkPixelRef> pixel_ref = 5462 skia::RefPtr<SkPixelRef> pixel_ref =
5459 skia::AdoptRef(SkMallocPixelRef::NewAllocate(info, 0, 0)); 5463 skia::AdoptRef(SkMallocPixelRef::NewAllocate(info, 0, 0));
5460 pixel_ref->setImmutable(); 5464 pixel_ref->setImmutable();
5461 UIResourceBitmap bitmap(pixel_ref); 5465 UIResourceBitmap bitmap(pixel_ref, size);
5462 UIResourceId ui_resource_id = 1; 5466 UIResourceId ui_resource_id = 1;
5463 host_impl_->CreateUIResource(ui_resource_id, bitmap); 5467 host_impl_->CreateUIResource(ui_resource_id, bitmap);
5464 EXPECT_EQ(1u, context3d->NumTextures()); 5468 EXPECT_EQ(1u, context3d->NumTextures());
5465 ResourceProvider::ResourceId id1 = 5469 ResourceProvider::ResourceId id1 =
5466 host_impl_->ResourceIdForUIResource(ui_resource_id); 5470 host_impl_->ResourceIdForUIResource(ui_resource_id);
5467 EXPECT_NE(0u, id1); 5471 EXPECT_NE(0u, id1);
5468 } 5472 }
5469 5473
5470 void ShutdownReleasesContext_Callback(scoped_ptr<CopyOutputResult> result) { 5474 void ShutdownReleasesContext_Callback(scoped_ptr<CopyOutputResult> result) {
5471 } 5475 }
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
5768 &set_needs_redraw_count)); 5772 &set_needs_redraw_count));
5769 // Empty damage rect won't signal the monitor. 5773 // Empty damage rect won't signal the monitor.
5770 host_impl_->SetNeedsRedrawRect(gfx::Rect()); 5774 host_impl_->SetNeedsRedrawRect(gfx::Rect());
5771 EXPECT_EQ(0, set_needs_commit_count); 5775 EXPECT_EQ(0, set_needs_commit_count);
5772 EXPECT_EQ(2, set_needs_redraw_count); 5776 EXPECT_EQ(2, set_needs_redraw_count);
5773 } 5777 }
5774 } 5778 }
5775 5779
5776 } // namespace 5780 } // namespace
5777 } // namespace cc 5781 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/ui_resource_bitmap.cc ('k') | content/browser/android/content_startup_flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698