| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/platform_device.h" | 5 #include "skia/ext/platform_device.h" |
| 6 #include "skia/ext/bitmap_platform_device.h" | 6 #include "skia/ext/bitmap_platform_device.h" |
| 7 | 7 |
| 8 #import <ApplicationServices/ApplicationServices.h> | 8 #import <ApplicationServices/ApplicationServices.h> |
| 9 #include "skia/ext/skia_utils_mac.h" | 9 #include "skia/ext/skia_utils_mac.h" |
| 10 #include "third_party/skia/include/core/SkMatrix.h" | 10 #include "third_party/skia/include/core/SkMatrix.h" |
| 11 #include "third_party/skia/include/core/SkPath.h" | 11 #include "third_party/skia/include/core/SkPath.h" |
| 12 #include "third_party/skia/include/core/SkTypes.h" | 12 #include "third_party/skia/include/core/SkTypes.h" |
| 13 #include "third_party/skia/include/core/SkUtils.h" | 13 #include "third_party/skia/include/core/SkUtils.h" |
| 14 | 14 |
| 15 namespace skia { | 15 namespace skia { |
| 16 | 16 |
| 17 CGContextRef GetBitmapContext(SkDevice* device) { | 17 CGContextRef GetBitmapContext(SkDevice* device) { |
| 18 PlatformDevice* platform_device = GetPlatformDevice(device); | 18 PlatformDevice* platform_device = GetPlatformDevice(device); |
| 19 if (platform_device) | 19 if (platform_device) |
| 20 return platform_device->GetBitmapContext(); | 20 return platform_device->GetBitmapContext(); |
| 21 | 21 |
| 22 return NULL; | 22 return NULL; |
| 23 } | 23 } |
| 24 | 24 |
| 25 PlatformDevice::PlatformDevice(const SkBitmap& bitmap) | 25 PlatformDevice::PlatformDevice(SkDevice* device) |
| 26 : SkDevice(bitmap) { | 26 : device_(device) { |
| 27 SetPlatformDevice(this, this); | 27 } |
| 28 } | |
| 29 | 28 |
| 30 bool PlatformDevice::IsNativeFontRenderingAllowed() { | 29 bool PlatformDevice::IsNativeFontRenderingAllowed() { |
| 31 return true; | 30 return true; |
| 32 } | 31 } |
| 33 | 32 |
| 34 CGContextRef PlatformDevice::BeginPlatformPaint() { | 33 CGContextRef PlatformDevice::BeginPlatformPaint() { |
| 35 return GetBitmapContext(); | 34 return GetBitmapContext(); |
| 36 } | 35 } |
| 37 | 36 |
| 38 void PlatformDevice::EndPlatformPaint() { | 37 void PlatformDevice::EndPlatformPaint() { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 path.transform(transformation); | 155 path.transform(transformation); |
| 157 // TODO(playmobil): Implement. | 156 // TODO(playmobil): Implement. |
| 158 SkASSERT(false); | 157 SkASSERT(false); |
| 159 // LoadPathToDC(context, path); | 158 // LoadPathToDC(context, path); |
| 160 // hrgn = PathToRegion(context); | 159 // hrgn = PathToRegion(context); |
| 161 } | 160 } |
| 162 } | 161 } |
| 163 | 162 |
| 164 } // namespace skia | 163 } // namespace skia |
| 165 | 164 |
| OLD | NEW |