| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 cairo_reference(context_); | 115 cairo_reference(context_); |
| 116 | 116 |
| 117 transform_.reset(); | 117 transform_.reset(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 VectorPlatformDevice::~VectorPlatformDevice() { | 120 VectorPlatformDevice::~VectorPlatformDevice() { |
| 121 // Un-ref |context_| since we referenced it in the constructor. | 121 // Un-ref |context_| since we referenced it in the constructor. |
| 122 cairo_destroy(context_); | 122 cairo_destroy(context_); |
| 123 } | 123 } |
| 124 | 124 |
| 125 SkDeviceFactory* VectorPlatformDevice::getDeviceFactory() { |
| 126 return SkNEW(VectorPlatformDeviceFactory); |
| 127 } |
| 128 |
| 129 bool VectorPlatformDevice::IsVectorial() { |
| 130 return true; |
| 131 } |
| 132 |
| 133 PlatformDevice::PlatformSurface VectorPlatformDevice::beginPlatformPaint() { |
| 134 return context_; |
| 135 } |
| 136 |
| 125 void VectorPlatformDevice::drawBitmap(const SkDraw& draw, | 137 void VectorPlatformDevice::drawBitmap(const SkDraw& draw, |
| 126 const SkBitmap& bitmap, | 138 const SkBitmap& bitmap, |
| 127 const SkMatrix& matrix, | 139 const SkMatrix& matrix, |
| 128 const SkPaint& paint) { | 140 const SkPaint& paint) { |
| 129 SkASSERT(bitmap.getConfig() == SkBitmap::kARGB_8888_Config); | 141 SkASSERT(bitmap.getConfig() == SkBitmap::kARGB_8888_Config); |
| 130 | 142 |
| 131 // Load the temporary matrix. This is what will translate, rotate and resize | 143 // Load the temporary matrix. This is what will translate, rotate and resize |
| 132 // the bitmap. | 144 // the bitmap. |
| 133 SkMatrix actual_transform(transform_); | 145 SkMatrix actual_transform(transform_); |
| 134 actual_transform.preConcat(matrix); | 146 actual_transform.preConcat(matrix); |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 DCHECK(it->second.font_stream); | 689 DCHECK(it->second.font_stream); |
| 678 | 690 |
| 679 cairo_font_face_destroy(it->second.cairo_face); | 691 cairo_font_face_destroy(it->second.cairo_face); |
| 680 // |it->second.ft_face| is handled by Cairo. | 692 // |it->second.ft_face| is handled by Cairo. |
| 681 it->second.font_stream->unref(); | 693 it->second.font_stream->unref(); |
| 682 } | 694 } |
| 683 g_font_cache->clear(); | 695 g_font_cache->clear(); |
| 684 } | 696 } |
| 685 | 697 |
| 686 } // namespace skia | 698 } // namespace skia |
| OLD | NEW |