| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/shared_memory.h" | 6 #include "base/memory/shared_memory.h" |
| 7 #include "skia/ext/platform_canvas.h" | 7 #include "skia/ext/platform_canvas.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gfx/blit.h" | 9 #include "ui/gfx/blit.h" |
| 10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 // Sanity check on input. | 74 // Sanity check on input. |
| 75 VerifyCanvasValues<5, 5>(canvas.get(), initial_values); | 75 VerifyCanvasValues<5, 5>(canvas.get(), initial_values); |
| 76 | 76 |
| 77 // Scroll none and make sure it's a NOP. | 77 // Scroll none and make sure it's a NOP. |
| 78 gfx::ScrollCanvas(canvas.get(), | 78 gfx::ScrollCanvas(canvas.get(), |
| 79 gfx::Rect(0, 0, kCanvasWidth, kCanvasHeight), | 79 gfx::Rect(0, 0, kCanvasWidth, kCanvasHeight), |
| 80 gfx::Vector2d(0, 0)); | 80 gfx::Vector2d(0, 0)); |
| 81 VerifyCanvasValues<5, 5>(canvas.get(), initial_values); | 81 VerifyCanvasValues<5, 5>(canvas.get(), initial_values); |
| 82 | 82 |
| 83 // Scroll with a empty clip and make sure it's a NOP. |
| 84 gfx::Rect empty_clip(1, 1, 0, 0); |
| 85 gfx::ScrollCanvas(canvas.get(), empty_clip, gfx::Vector2d(0, 1)); |
| 86 VerifyCanvasValues<5, 5>(canvas.get(), initial_values); |
| 87 |
| 83 // Scroll the center 3 pixels up one. | 88 // Scroll the center 3 pixels up one. |
| 84 gfx::Rect center_three(1, 1, 3, 3); | 89 gfx::Rect center_three(1, 1, 3, 3); |
| 85 gfx::ScrollCanvas(canvas.get(), center_three, gfx::Vector2d(0, -1)); | 90 gfx::ScrollCanvas(canvas.get(), center_three, gfx::Vector2d(0, -1)); |
| 86 uint8 scroll_up_expected[kCanvasHeight][kCanvasWidth] = { | 91 uint8 scroll_up_expected[kCanvasHeight][kCanvasWidth] = { |
| 87 { 0x00, 0x01, 0x02, 0x03, 0x04 }, | 92 { 0x00, 0x01, 0x02, 0x03, 0x04 }, |
| 88 { 0x10, 0x21, 0x22, 0x23, 0x14 }, | 93 { 0x10, 0x21, 0x22, 0x23, 0x14 }, |
| 89 { 0x20, 0x31, 0x32, 0x33, 0x24 }, | 94 { 0x20, 0x31, 0x32, 0x33, 0x24 }, |
| 90 { 0x30, 0x31, 0x32, 0x33, 0x34 }, | 95 { 0x30, 0x31, 0x32, 0x33, 0x34 }, |
| 91 { 0x40, 0x41, 0x42, 0x43, 0x44 }}; | 96 { 0x40, 0x41, 0x42, 0x43, 0x44 }}; |
| 92 VerifyCanvasValues<5, 5>(canvas.get(), scroll_up_expected); | 97 VerifyCanvasValues<5, 5>(canvas.get(), scroll_up_expected); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 { 0x30, 0x31, 0x32, 0x33, 0x34 }, | 162 { 0x30, 0x31, 0x32, 0x33, 0x34 }, |
| 158 { 0x40, 0x41, 0x42, 0x43, 0x44 }}; | 163 { 0x40, 0x41, 0x42, 0x43, 0x44 }}; |
| 159 SetToCanvas<5, 5>(canvas.get(), initial_values); | 164 SetToCanvas<5, 5>(canvas.get(), initial_values); |
| 160 | 165 |
| 161 // Sanity check on input. | 166 // Sanity check on input. |
| 162 VerifyCanvasValues<5, 5>(canvas.get(), initial_values); | 167 VerifyCanvasValues<5, 5>(canvas.get(), initial_values); |
| 163 } | 168 } |
| 164 | 169 |
| 165 #endif | 170 #endif |
| 166 | 171 |
| OLD | NEW |