summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authorsenorblanco@chromium.org <senorblanco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-12 16:34:40 +0000
committersenorblanco@chromium.org <senorblanco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-12 16:34:40 +0000
commitb2b0fceea58bf7e13cc73020133aff6d6b4f4640 (patch)
tree4e6991eb82096663c5072a3c28183036d1215acd /skia
parent76fcc3e9dc467366b9d1938834d7faff595ab873 (diff)
downloadchromium_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 'skia')
-rw-r--r--skia/ext/vector_platform_device_win.cc5
-rw-r--r--skia/ext/vector_platform_device_win.h4
2 files changed, 8 insertions, 1 deletions
diff --git a/skia/ext/vector_platform_device_win.cc b/skia/ext/vector_platform_device_win.cc
index 31ac722..6ec4e39 100644
--- a/skia/ext/vector_platform_device_win.cc
+++ b/skia/ext/vector_platform_device_win.cc
@@ -104,7 +104,8 @@ VectorPlatformDevice::VectorPlatformDevice(HDC dc, const SkBitmap& bitmap)
: PlatformDevice(bitmap),
hdc_(dc),
previous_brush_(NULL),
- previous_pen_(NULL) {
+ previous_pen_(NULL),
+ alpha_blend_used_(false) {
transform_.reset();
}
@@ -698,6 +699,8 @@ void VectorPlatformDevice::InternalDrawBitmap(const SkBitmap& bitmap,
result = SetStretchBltMode(dc, previous_mode);
SkASSERT(result);
+ alpha_blend_used_ = true;
+
::SelectObject(bitmap_dc, static_cast<HBITMAP>(old_bitmap));
DeleteObject(hbitmap);
DeleteDC(bitmap_dc);
diff --git a/skia/ext/vector_platform_device_win.h b/skia/ext/vector_platform_device_win.h
index 2a5057e..3050a90 100644
--- a/skia/ext/vector_platform_device_win.h
+++ b/skia/ext/vector_platform_device_win.h
@@ -81,6 +81,7 @@ class VectorPlatformDevice : public PlatformDevice {
virtual bool IsVectorial() { return true; }
void LoadClipRegion();
+ bool alpha_blend_used() const { return alpha_blend_used_; }
private:
// Applies the SkPaint's painting properties in the current GDI context, if
@@ -129,6 +130,9 @@ class VectorPlatformDevice : public PlatformDevice {
// Previously selected pen before the current drawing.
HGDIOBJ previous_pen_;
+ // True if AlphaBlend() was called during this print.
+ bool alpha_blend_used_;
+
// Copy & assign are not supported.
VectorPlatformDevice(const VectorPlatformDevice&);
const VectorPlatformDevice& operator=(const VectorPlatformDevice&);