diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 14:37:48 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 14:37:48 +0000 |
commit | 60c671ca9dc52bb7c6a0bac0773d526d9060e87a (patch) | |
tree | 24885879abfe576ff8fa1f1b70a3cee3a8b69623 /skia/ext/vector_canvas_linux.cc | |
parent | fb630c1cdb74e955d343272a1c9b6ac2968e3a0c (diff) | |
download | chromium_src-60c671ca9dc52bb7c6a0bac0773d526d9060e87a.zip chromium_src-60c671ca9dc52bb7c6a0bac0773d526d9060e87a.tar.gz chromium_src-60c671ca9dc52bb7c6a0bac0773d526d9060e87a.tar.bz2 |
Pass printing result to the browser.
The resulting PDF file will now be passed to the browser and be saved as "chromium_printing_test.pdf" under current directory.
BUG=9847
TEST=printing on linux should now generate chromium_printing_test.pdf in download directory. Printing on Windows should still work.
Patch contributed by minyu.huang@gmail.com
Review URL: http://codereview.chromium.org/172115
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25615 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/vector_canvas_linux.cc')
-rw-r--r-- | skia/ext/vector_canvas_linux.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/skia/ext/vector_canvas_linux.cc b/skia/ext/vector_canvas_linux.cc index 95722c9..c3024f3 100644 --- a/skia/ext/vector_canvas_linux.cc +++ b/skia/ext/vector_canvas_linux.cc @@ -9,14 +9,14 @@ namespace skia { -VectorCanvas::VectorCanvas(int width, int height) { - bool initialized = initialize(width, height); +VectorCanvas::VectorCanvas(cairo_t* context, int width, int height) { + bool initialized = initialize(context, width, height); SkASSERT(initialized); } -bool VectorCanvas::initialize(int width, int height) { - SkDevice* device = createPlatformDevice(width, height, true); +bool VectorCanvas::initialize(cairo_t* context, int width, int height) { + SkDevice* device = createPlatformDevice(context, width, height, true); if (!device) return false; @@ -29,19 +29,23 @@ SkDevice* VectorCanvas::createDevice(SkBitmap::Config config, int width, int height, bool is_opaque, bool isForLayer) { SkASSERT(config == SkBitmap::kARGB_8888_Config); - return createPlatformDevice(width, height, is_opaque); + return createPlatformDevice(NULL, width, height, is_opaque); } -SkDevice* VectorCanvas::createPlatformDevice(int width, - int height, bool is_opaque) { +SkDevice* VectorCanvas::createPlatformDevice(cairo_t* context, + int width, + int height, + bool is_opaque) { // TODO(myhuang): Here we might also have similar issues as those on Windows // (vector_canvas_win.cc, http://crbug.com/18382 & http://crbug.com/18383). // Please note that is_opaque is true when we use this class for printing. - if (!is_opaque) { + // Fallback to bitmap when context is NULL. + if (!is_opaque || NULL == context) { return BitmapPlatformDevice::Create(width, height, is_opaque); } - PlatformDevice* device = VectorPlatformDevice::create(width, height); + PlatformDevice* device = + VectorPlatformDevice::create(context, width, height); return device; } |