| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/content_layer.h" | 5 #include "cc/content_layer.h" |
| 6 | 6 |
| 7 #include "cc/bitmap_content_layer_updater.h" | 7 #include "cc/bitmap_content_layer_updater.h" |
| 8 #include "cc/content_layer_client.h" | 8 #include "cc/content_layer_client.h" |
| 9 #include "cc/rendering_stats.h" | |
| 10 #include "cc/test/geometry_test_utils.h" | 9 #include "cc/test/geometry_test_utils.h" |
| 11 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "ui/gfx/rect_conversions.h" | 12 #include "ui/gfx/rect_conversions.h" |
| 14 | 13 |
| 15 using namespace WebKit; | 14 using namespace WebKit; |
| 16 | 15 |
| 17 namespace cc { | 16 namespace cc { |
| 18 namespace { | 17 namespace { |
| 19 | 18 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 36 TEST(ContentLayerTest, ContentLayerPainterWithDeviceScale) | 35 TEST(ContentLayerTest, ContentLayerPainterWithDeviceScale) |
| 37 { | 36 { |
| 38 float contentsScale = 2; | 37 float contentsScale = 2; |
| 39 gfx::Rect contentRect(10, 10, 100, 100); | 38 gfx::Rect contentRect(10, 10, 100, 100); |
| 40 gfx::Rect opaqueRectInLayerSpace(5, 5, 20, 20); | 39 gfx::Rect opaqueRectInLayerSpace(5, 5, 20, 20); |
| 41 gfx::RectF opaqueRectInContentSpace = gfx::ScaleRect(opaqueRectInLayerSpace,
contentsScale, contentsScale); | 40 gfx::RectF opaqueRectInContentSpace = gfx::ScaleRect(opaqueRectInLayerSpace,
contentsScale, contentsScale); |
| 42 MockContentLayerClient client(opaqueRectInLayerSpace); | 41 MockContentLayerClient client(opaqueRectInLayerSpace); |
| 43 scoped_refptr<BitmapContentLayerUpdater> updater = BitmapContentLayerUpdater
::create(ContentLayerPainter::create(&client).PassAs<LayerPainter>()); | 42 scoped_refptr<BitmapContentLayerUpdater> updater = BitmapContentLayerUpdater
::create(ContentLayerPainter::create(&client).PassAs<LayerPainter>()); |
| 44 | 43 |
| 45 gfx::Rect resultingOpaqueRect; | 44 gfx::Rect resultingOpaqueRect; |
| 46 RenderingStats stats; | 45 updater->prepareToUpdate(contentRect, gfx::Size(256, 256), contentsScale, co
ntentsScale, resultingOpaqueRect, NULL); |
| 47 updater->prepareToUpdate(contentRect, gfx::Size(256, 256), contentsScale, co
ntentsScale, resultingOpaqueRect, stats); | |
| 48 | 46 |
| 49 EXPECT_RECT_EQ(gfx::ToEnclosingRect(opaqueRectInContentSpace), resultingOpaq
ueRect); | 47 EXPECT_RECT_EQ(gfx::ToEnclosingRect(opaqueRectInContentSpace), resultingOpaq
ueRect); |
| 50 } | 48 } |
| 51 | 49 |
| 52 } // namespace | 50 } // namespace |
| 53 } // namespace cc | 51 } // namespace cc |
| OLD | NEW |