diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-12 16:34:40 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-12 16:34:40 +0000 |
commit | b2b0fceea58bf7e13cc73020133aff6d6b4f4640 (patch) | |
tree | 4e6991eb82096663c5072a3c28183036d1215acd /printing | |
parent | 76fcc3e9dc467366b9d1938834d7faff595ab873 (diff) | |
download | chromium_src-b2b0fceea58bf7e13cc73020133aff6d6b4f4640.zip chromium_src-b2b0fceea58bf7e13cc73020133aff6d6b4f4640.tar.gz chromium_src-b2b0fceea58bf7e13cc73020133aff6d6b4f4640.tar.bz2 |
When printing a page containing alpha blending on a printer which doesn't support alpha blending, post-process the
metafile to replace the AlphaBlend calls with BitBlts from a software-composited rendering of the page so far.
BUG=7434
TEST=see bug
Review URL: http://codereview.chromium.org/5362002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71177 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r-- | printing/emf_win.cc | 2 | ||||
-rw-r--r-- | printing/print_settings.cc | 4 | ||||
-rw-r--r-- | printing/print_settings.h | 7 | ||||
-rw-r--r-- | printing/print_settings_initializer_win.cc | 3 |
4 files changed, 15 insertions, 1 deletions
diff --git a/printing/emf_win.cc b/printing/emf_win.cc index 9629bb2..5de962b 100644 --- a/printing/emf_win.cc +++ b/printing/emf_win.cc @@ -396,6 +396,8 @@ bool Emf::Record::SafePlayback(const XFORM* base_matrix) const { } else { res = Play(); } + } else { + res = true; } break; } diff --git a/printing/print_settings.cc b/printing/print_settings.cc index cf8c50a..3f0f842 100644 --- a/printing/print_settings.cc +++ b/printing/print_settings.cc @@ -19,7 +19,8 @@ PrintSettings::PrintSettings() selection_only(false), use_overlays(true), dpi_(0), - landscape_(false) { + landscape_(false), + supports_alpha_blend_(true) { } PrintSettings::~PrintSettings() { @@ -36,6 +37,7 @@ void PrintSettings::Clear() { page_setup_device_units_.Clear(); dpi_ = 0; landscape_ = false; + supports_alpha_blend_ = true; } void PrintSettings::SetPrinterPrintableArea( diff --git a/printing/print_settings.h b/printing/print_settings.h index bc9cbaf..298fcd2 100644 --- a/printing/print_settings.h +++ b/printing/print_settings.h @@ -42,6 +42,10 @@ class PrintSettings { const std::wstring& device_name() const { return device_name_; } void set_dpi(int dpi) { dpi_ = dpi; } int dpi() const { return dpi_; } + void set_supports_alpha_blend(bool supports_alpha_blend) { + supports_alpha_blend_ = supports_alpha_blend; + } + bool supports_alpha_blend() const { return supports_alpha_blend_; } const PageSetup& page_setup_device_units() const { return page_setup_device_units_; } @@ -108,6 +112,9 @@ class PrintSettings { // Is the orientation landscape or portrait. bool landscape_; + + // True if this printer supports AlphaBlend. + bool supports_alpha_blend_; }; } // namespace printing diff --git a/printing/print_settings_initializer_win.cc b/printing/print_settings_initializer_win.cc index f840f4d..065a8db 100644 --- a/printing/print_settings_initializer_win.cc +++ b/printing/print_settings_initializer_win.cc @@ -29,6 +29,9 @@ void PrintSettingsInitializerWin::InitPrintSettings( int dpi = GetDeviceCaps(hdc, LOGPIXELSX); print_settings->set_dpi(dpi); + const int kAlphaCaps = SB_CONST_ALPHA | SB_PIXEL_ALPHA; + print_settings->set_supports_alpha_blend( + (GetDeviceCaps(hdc, SHADEBLENDCAPS) & kAlphaCaps) == kAlphaCaps); // No printer device is known to advertise different dpi in X and Y axis; even // the fax device using the 200x100 dpi setting. It's ought to break so many // applications that it's not even needed to care about. WebKit doesn't |