| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "skia/ext/vector_platform_device.h" | 5 #include "skia/ext/vector_platform_device.h" |
| 6 | 6 |
| 7 #include <cairo.h> | 7 #include <cairo.h> |
| 8 #include <cairo-ft.h> | 8 #include <cairo-ft.h> |
| 9 | 9 |
| 10 #include <ft2build.h> | 10 #include <ft2build.h> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 SkDevice* VectorPlatformDeviceFactory::newDevice(SkCanvas* ignored, | 71 SkDevice* VectorPlatformDeviceFactory::newDevice(SkCanvas* ignored, |
| 72 SkBitmap::Config config, | 72 SkBitmap::Config config, |
| 73 int width, int height, | 73 int width, int height, |
| 74 bool isOpaque, | 74 bool isOpaque, |
| 75 bool isForLayer) { | 75 bool isForLayer) { |
| 76 SkASSERT(config == SkBitmap::kARGB_8888_Config); | 76 SkASSERT(config == SkBitmap::kARGB_8888_Config); |
| 77 return CreateDevice(NULL, width, height, isOpaque); | 77 return CreateDevice(NULL, width, height, isOpaque); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // static | 80 // static |
| 81 SkDevice* VectorPlatformDeviceFactory::CreateDevice(cairo_t* context, | 81 PlatformDevice* VectorPlatformDeviceFactory::CreateDevice(cairo_t* context, |
| 82 int width, int height, | 82 int width, int height, |
| 83 bool isOpaque) { | 83 bool isOpaque) { |
| 84 // TODO(myhuang): Here we might also have similar issues as those on Windows | 84 // TODO(myhuang): Here we might also have similar issues as those on Windows |
| 85 // (vector_canvas_win.cc, http://crbug.com/18382 & http://crbug.com/18383). | 85 // (vector_canvas_win.cc, http://crbug.com/18382 & http://crbug.com/18383). |
| 86 // Please note that is_opaque is true when we use this class for printing. | 86 // Please note that is_opaque is true when we use this class for printing. |
| 87 // Fallback to bitmap when context is NULL. | 87 // Fallback to bitmap when context is NULL. |
| 88 if (!isOpaque || NULL == context) { | 88 if (!isOpaque || NULL == context) { |
| 89 return BitmapPlatformDevice::Create(width, height, isOpaque); | 89 return BitmapPlatformDevice::Create(width, height, isOpaque); |
| 90 } | 90 } |
| 91 | 91 |
| 92 PlatformDevice* device = | 92 PlatformDevice* device = |
| 93 VectorPlatformDevice::create(context, width, height); | 93 VectorPlatformDevice::create(context, width, height); |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 DCHECK(it->second.font_stream); | 697 DCHECK(it->second.font_stream); |
| 698 | 698 |
| 699 cairo_font_face_destroy(it->second.cairo_face); | 699 cairo_font_face_destroy(it->second.cairo_face); |
| 700 // |it->second.ft_face| is handled by Cairo. | 700 // |it->second.ft_face| is handled by Cairo. |
| 701 it->second.font_stream->unref(); | 701 it->second.font_stream->unref(); |
| 702 } | 702 } |
| 703 g_font_cache->clear(); | 703 g_font_cache->clear(); |
| 704 } | 704 } |
| 705 | 705 |
| 706 } // namespace skia | 706 } // namespace skia |
| OLD | NEW |