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

Unified Diff: skia/ext/vector_canvas_linux.cc

Issue 172115: Pass printing result to the browser.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: skia/ext/vector_canvas_linux.cc
===================================================================
--- skia/ext/vector_canvas_linux.cc (revision 25608)
+++ skia/ext/vector_canvas_linux.cc (working copy)
@@ -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 @@
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;
}

Powered by Google App Engine
This is Rietveld 408576698