| 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 6229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6240 TestWebGraphicsContext3D::Create(); | 6240 TestWebGraphicsContext3D::Create(); |
| 6241 TestWebGraphicsContext3D* context3d = context.get(); | 6241 TestWebGraphicsContext3D* context3d = context.get(); |
| 6242 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d( | 6242 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d( |
| 6243 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 6243 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
| 6244 host_impl_->InitializeRenderer(output_surface.Pass()); | 6244 host_impl_->InitializeRenderer(output_surface.Pass()); |
| 6245 | 6245 |
| 6246 EXPECT_EQ(0u, context3d->NumTextures()); | 6246 EXPECT_EQ(0u, context3d->NumTextures()); |
| 6247 | 6247 |
| 6248 UIResourceId ui_resource_id = 1; | 6248 UIResourceId ui_resource_id = 1; |
| 6249 scoped_refptr<UIResourceBitmap> bitmap = UIResourceBitmap::Create( | 6249 scoped_refptr<UIResourceBitmap> bitmap = UIResourceBitmap::Create( |
| 6250 new uint8_t[1], UIResourceBitmap::RGBA8, gfx::Size(1, 1)); | 6250 new uint8_t[1], |
| 6251 UIResourceBitmap::RGBA8, |
| 6252 UIResourceBitmap::ClampToEdge, |
| 6253 gfx::Size(1, 1)); |
| 6251 host_impl_->CreateUIResource(ui_resource_id, bitmap); | 6254 host_impl_->CreateUIResource(ui_resource_id, bitmap); |
| 6252 EXPECT_EQ(1u, context3d->NumTextures()); | 6255 EXPECT_EQ(1u, context3d->NumTextures()); |
| 6253 ResourceProvider::ResourceId id1 = | 6256 ResourceProvider::ResourceId id1 = |
| 6254 host_impl_->ResourceIdForUIResource(ui_resource_id); | 6257 host_impl_->ResourceIdForUIResource(ui_resource_id); |
| 6255 EXPECT_NE(0u, id1); | 6258 EXPECT_NE(0u, id1); |
| 6256 | 6259 |
| 6257 // Multiple requests with the same id is allowed. The previous texture is | 6260 // Multiple requests with the same id is allowed. The previous texture is |
| 6258 // deleted. | 6261 // deleted. |
| 6259 host_impl_->CreateUIResource(ui_resource_id, bitmap); | 6262 host_impl_->CreateUIResource(ui_resource_id, bitmap); |
| 6260 EXPECT_EQ(1u, context3d->NumTextures()); | 6263 EXPECT_EQ(1u, context3d->NumTextures()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 6276 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); | 6279 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); |
| 6277 EXPECT_EQ(0u, context3d->NumTextures()); | 6280 EXPECT_EQ(0u, context3d->NumTextures()); |
| 6278 | 6281 |
| 6279 // Should not change state for multiple deletion on one UIResourceId | 6282 // Should not change state for multiple deletion on one UIResourceId |
| 6280 host_impl_->DeleteUIResource(ui_resource_id); | 6283 host_impl_->DeleteUIResource(ui_resource_id); |
| 6281 EXPECT_EQ(0u, context3d->NumTextures()); | 6284 EXPECT_EQ(0u, context3d->NumTextures()); |
| 6282 } | 6285 } |
| 6283 | 6286 |
| 6284 } // namespace | 6287 } // namespace |
| 6285 } // namespace cc | 6288 } // namespace cc |
| OLD | NEW |