| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if !defined(OS_WIN) | 7 #if !defined(OS_WIN) |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 385 |
| 386 parent::TearDown(); | 386 parent::TearDown(); |
| 387 } | 387 } |
| 388 | 388 |
| 389 void Init(int size) { | 389 void Init(int size) { |
| 390 size_ = size; | 390 size_ = size; |
| 391 context_ = new Context(); | 391 context_ = new Context(); |
| 392 bitmap_ = new Bitmap(*context_, size_, size_); | 392 bitmap_ = new Bitmap(*context_, size_, size_); |
| 393 vcanvas_ = new VectorCanvas(VectorPlatformDeviceEmf::CreateDevice( | 393 vcanvas_ = new VectorCanvas(VectorPlatformDeviceEmf::CreateDevice( |
| 394 size_, size_, true, context_->context())); | 394 size_, size_, true, context_->context())); |
| 395 pcanvas_ = new PlatformCanvas(size_, size_, false); | 395 pcanvas_ = CreatePlatformCanvas(size_, size_, false); |
| 396 | 396 |
| 397 // Clear white. | 397 // Clear white. |
| 398 vcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode); | 398 vcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode); |
| 399 pcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode); | 399 pcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode); |
| 400 } | 400 } |
| 401 | 401 |
| 402 // Compares both canvas and returns the pixel difference in percentage between | 402 // Compares both canvas and returns the pixel difference in percentage between |
| 403 // both images. 0 on success and ]0, 100] on failure. | 403 // both images. 0 on success and ]0, 100] on failure. |
| 404 double ProcessImage(const FilePath::StringType& filename) { | 404 double ProcessImage(const FilePath::StringType& filename) { |
| 405 std::wstring number(base::StringPrintf(L"%02d_", number_++)); | 405 std::wstring number(base::StringPrintf(L"%02d_", number_++)); |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 pcanvas_->rotate(67); | 959 pcanvas_->rotate(67); |
| 960 vcanvas_->drawBitmap(bitmap, 20, -50, NULL); | 960 vcanvas_->drawBitmap(bitmap, 20, -50, NULL); |
| 961 pcanvas_->drawBitmap(bitmap, 20, -50, NULL); | 961 pcanvas_->drawBitmap(bitmap, 20, -50, NULL); |
| 962 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate"))); | 962 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate"))); |
| 963 } | 963 } |
| 964 } | 964 } |
| 965 | 965 |
| 966 #endif // !defined(USE_AURA) | 966 #endif // !defined(USE_AURA) |
| 967 | 967 |
| 968 } // namespace skia | 968 } // namespace skia |
| OLD | NEW |