OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 delete context_; | 382 delete context_; |
383 context_ = NULL; | 383 context_ = NULL; |
384 | 384 |
385 parent::TearDown(); | 385 parent::TearDown(); |
386 } | 386 } |
387 | 387 |
388 void Init(int size) { | 388 void Init(int size) { |
389 size_ = size; | 389 size_ = size; |
390 context_ = new Context(); | 390 context_ = new Context(); |
391 bitmap_ = new Bitmap(*context_, size_, size_); | 391 bitmap_ = new Bitmap(*context_, size_, size_); |
392 vcanvas_ = new VectorCanvas(VectorPlatformDeviceEmfFactory::CreateDevice( | 392 vcanvas_ = new VectorCanvas(VectorPlatformDeviceEmf::CreateDevice( |
393 size_, size_, true, context_->context())); | 393 size_, size_, true, context_->context())); |
394 pcanvas_ = new PlatformCanvas(size_, size_, false); | 394 pcanvas_ = new PlatformCanvas(size_, size_, false); |
395 | 395 |
396 // Clear white. | 396 // Clear white. |
397 vcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode); | 397 vcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode); |
398 pcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode); | 398 pcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode); |
399 } | 399 } |
400 | 400 |
401 // Compares both canvas and returns the pixel difference in percentage between | 401 // Compares both canvas and returns the pixel difference in percentage between |
402 // both images. 0 on success and ]0, 100] on failure. | 402 // both images. 0 on success and ]0, 100] on failure. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 449 |
450 TEST_F(VectorCanvasTest, Uninitialized) { | 450 TEST_F(VectorCanvasTest, Uninitialized) { |
451 // Do a little mubadumba do get uninitialized stuff. | 451 // Do a little mubadumba do get uninitialized stuff. |
452 VectorCanvasTest::TearDown(); | 452 VectorCanvasTest::TearDown(); |
453 | 453 |
454 // The goal is not to verify that have the same uninitialized data. | 454 // The goal is not to verify that have the same uninitialized data. |
455 compare_canvas_ = false; | 455 compare_canvas_ = false; |
456 | 456 |
457 context_ = new Context(); | 457 context_ = new Context(); |
458 bitmap_ = new Bitmap(*context_, size_, size_); | 458 bitmap_ = new Bitmap(*context_, size_, size_); |
459 vcanvas_ = new VectorCanvas(VectorPlatformDeviceEmfFactory::CreateDevice( | 459 vcanvas_ = new VectorCanvas(VectorPlatformDeviceEmf::CreateDevice( |
460 size_, size_, true, context_->context())); | 460 size_, size_, true, context_->context())); |
461 pcanvas_ = new PlatformCanvas(size_, size_, false); | 461 pcanvas_ = new PlatformCanvas(size_, size_, false); |
462 | 462 |
463 // VectorCanvas default initialization is black. | 463 // VectorCanvas default initialization is black. |
464 // PlatformCanvas default initialization is almost white 0x01FFFEFD (invalid | 464 // PlatformCanvas default initialization is almost white 0x01FFFEFD (invalid |
465 // Skia color) in both Debug and Release. See magicTransparencyColor in | 465 // Skia color) in both Debug and Release. See magicTransparencyColor in |
466 // platform_device.cc | 466 // platform_device.cc |
467 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("empty"))); | 467 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("empty"))); |
468 } | 468 } |
469 | 469 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 { | 970 { |
971 vcanvas_->rotate(67); | 971 vcanvas_->rotate(67); |
972 pcanvas_->rotate(67); | 972 pcanvas_->rotate(67); |
973 vcanvas_->drawBitmap(bitmap, 20, -50, NULL); | 973 vcanvas_->drawBitmap(bitmap, 20, -50, NULL); |
974 pcanvas_->drawBitmap(bitmap, 20, -50, NULL); | 974 pcanvas_->drawBitmap(bitmap, 20, -50, NULL); |
975 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate"))); | 975 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate"))); |
976 } | 976 } |
977 } | 977 } |
978 | 978 |
979 } // namespace skia | 979 } // namespace skia |
OLD | NEW |