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

Side by Side Diff: printing/emf_win.cc

Issue 6665046: Unfork VectorPlatformCanvas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 9 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 | « printing/emf_win.h ('k') | printing/native_metafile.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 "printing/emf_win.h" 5 #include "printing/emf_win.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "skia/ext/vector_platform_device_win.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "ui/gfx/codec/jpeg_codec.h" 14 #include "ui/gfx/codec/jpeg_codec.h"
14 #include "ui/gfx/codec/png_codec.h" 15 #include "ui/gfx/codec/png_codec.h"
15 #include "ui/gfx/gdi_util.h" 16 #include "ui/gfx/gdi_util.h"
16 #include "ui/gfx/point.h" 17 #include "ui/gfx/point.h"
17 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
18 #include "ui/gfx/size.h" 19 #include "ui/gfx/size.h"
19 20
20 namespace { 21 namespace {
21 const int kCustomGdiCommentSignature = 0xdeadbabe; 22 const int kCustomGdiCommentSignature = 0xdeadbabe;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 break; 406 break;
406 } 407 }
407 default: { 408 default: {
408 res = Play(); 409 res = Play();
409 break; 410 break;
410 } 411 }
411 } 412 }
412 return res; 413 return res;
413 } 414 }
414 415
416 skia::PlatformDevice* Emf::StartPageForVectorCanvas(
417 const gfx::Size& page_size, const gfx::Point& content_origin,
418 const float& scale_factor) {
419 if (!StartPage(page_size, content_origin, scale_factor))
420 return NULL;
421
422 return skia::VectorPlatformDeviceFactory::CreateDevice(page_size.width(),
423 page_size.height(),
424 true, hdc_);
425 }
426
415 bool Emf::StartPage(const gfx::Size& /*page_size*/, 427 bool Emf::StartPage(const gfx::Size& /*page_size*/,
416 const gfx::Point& /*content_origin*/, 428 const gfx::Point& /*content_origin*/,
417 const float& scale_factor) { 429 const float& scale_factor) {
418 DCHECK_EQ(scale_factor, 1); 430 DCHECK_EQ(1.0f, scale_factor); // We don't support scaling here.
419 DCHECK(hdc_); 431 DCHECK(hdc_);
420 if (!hdc_) 432 if (!hdc_)
421 return false; 433 return false;
422 PageBreakRecord record(PageBreakRecord::START_PAGE); 434 PageBreakRecord record(PageBreakRecord::START_PAGE);
423 return !!GdiComment(hdc_, sizeof(record), 435 return !!GdiComment(hdc_, sizeof(record),
424 reinterpret_cast<const BYTE *>(&record)); 436 reinterpret_cast<const BYTE *>(&record));
425 } 437 }
426 438
427 bool Emf::FinishPage() { 439 bool Emf::FinishPage() {
428 DCHECK(hdc_); 440 DCHECK(hdc_);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 } else { 484 } else {
473 DCHECK_EQ(emf.context_.handle_table, handle_table); 485 DCHECK_EQ(emf.context_.handle_table, handle_table);
474 DCHECK_EQ(emf.context_.objects_count, objects_count); 486 DCHECK_EQ(emf.context_.objects_count, objects_count);
475 DCHECK_EQ(emf.context_.hdc, hdc); 487 DCHECK_EQ(emf.context_.hdc, hdc);
476 } 488 }
477 emf.items_.push_back(Record(&emf.context_, record)); 489 emf.items_.push_back(Record(&emf.context_, record));
478 return 1; 490 return 1;
479 } 491 }
480 492
481 } // namespace printing 493 } // namespace printing
OLDNEW
« no previous file with comments | « printing/emf_win.h ('k') | printing/native_metafile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698