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 "printing/emf_win.h" | 5 #include "printing/emf_win.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 static_cast<float>(page_bounds.x()), | 562 static_cast<float>(page_bounds.x()), |
563 static_cast<float>(page_bounds.y()), | 563 static_cast<float>(page_bounds.y()), |
564 }; | 564 }; |
565 ::SetWorldTransform(hdc, &xform); | 565 ::SetWorldTransform(hdc, &xform); |
566 ::BitBlt(hdc, 0, 0, bitmap_rect.width(), bitmap_rect.height(), | 566 ::BitBlt(hdc, 0, 0, bitmap_rect.width(), bitmap_rect.height(), |
567 bitmap.context(), bitmap_rect.x(), bitmap_rect.y(), SRCCOPY); | 567 bitmap.context(), bitmap_rect.x(), bitmap_rect.y(), SRCCOPY); |
568 | 568 |
569 result->FinishPage(); | 569 result->FinishPage(); |
570 result->FinishDocument(); | 570 result->FinishDocument(); |
571 | 571 |
572 return result.Pass(); | 572 return result; |
573 } | 573 } |
574 | 574 |
575 scoped_ptr<Emf> Emf::RasterizeAlphaBlend() const { | 575 scoped_ptr<Emf> Emf::RasterizeAlphaBlend() const { |
576 gfx::Rect page_bounds = GetPageBounds(1); | 576 gfx::Rect page_bounds = GetPageBounds(1); |
577 if (page_bounds.size().GetArea() <= 0) { | 577 if (page_bounds.size().GetArea() <= 0) { |
578 NOTREACHED() << "Metafile is empty"; | 578 NOTREACHED() << "Metafile is empty"; |
579 page_bounds = gfx::Rect(1, 1); | 579 page_bounds = gfx::Rect(1, 1); |
580 } | 580 } |
581 | 581 |
582 RasterBitmap bitmap(page_bounds.size()); | 582 RasterBitmap bitmap(page_bounds.size()); |
(...skipping 12 matching lines...) Expand all Loading... |
595 HDC hdc = result->context(); | 595 HDC hdc = result->context(); |
596 DCHECK(hdc); | 596 DCHECK(hdc); |
597 skia::InitializeDC(hdc); | 597 skia::InitializeDC(hdc); |
598 | 598 |
599 HDC bitmap_dc = bitmap.context(); | 599 HDC bitmap_dc = bitmap.context(); |
600 RECT rect = page_bounds.ToRECT(); | 600 RECT rect = page_bounds.ToRECT(); |
601 ::EnumEnhMetaFile(hdc, emf(), &RasterizeAlphaBlendProc, &bitmap_dc, &rect); | 601 ::EnumEnhMetaFile(hdc, emf(), &RasterizeAlphaBlendProc, &bitmap_dc, &rect); |
602 | 602 |
603 result->FinishDocument(); | 603 result->FinishDocument(); |
604 | 604 |
605 return result.Pass(); | 605 return result; |
606 } | 606 } |
607 | 607 |
608 | 608 |
609 } // namespace printing | 609 } // namespace printing |
OLD | NEW |