Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: skia/ext/vector_canvas_unittest.cc

Issue 7273013: Stop using deprecated factory API for SkDevice (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « skia/ext/vector_canvas.cc ('k') | skia/ext/vector_platform_device_cairo_linux.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « skia/ext/vector_canvas.cc ('k') | skia/ext/vector_platform_device_cairo_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698