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

Side by Side Diff: skia/ext/platform_device_mac.cc

Issue 7633040: CL removing inheritance of SkDevice from PlatformDevice. Flavours of PlatformDevice classes now ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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)
26 : SkDevice(bitmap) {
27 SetPlatformDevice(this, this);
28 }
29
30 bool PlatformDevice::IsNativeFontRenderingAllowed() {
31 return true;
32 }
33
34 CGContextRef PlatformDevice::BeginPlatformPaint() { 25 CGContextRef PlatformDevice::BeginPlatformPaint() {
35 return GetBitmapContext(); 26 return GetBitmapContext();
36 } 27 }
37 28
38 void PlatformDevice::EndPlatformPaint() { 29 void PlatformDevice::EndPlatformPaint() {
39 // Flushing will be done in onAccessBitmap. 30 // Flushing will be done in onAccessBitmap.
40 } 31 }
41 32
33 void PlatformDevice::DrawToNativeContext(PlatformSurface surface, int x, int y,
34 const PlatformRect* src_rect) {
35 }
36
42 // Set up the CGContextRef for peaceful coexistence with Skia 37 // Set up the CGContextRef for peaceful coexistence with Skia
43 void PlatformDevice::InitializeCGContext(CGContextRef context) { 38 void PlatformDevice::InitializeCGContext(CGContextRef context) {
44 // CG defaults to the same settings as Skia 39 // CG defaults to the same settings as Skia
45 } 40 }
46 41
47 // static 42 // static
48 void PlatformDevice::LoadPathToCGContext(CGContextRef context, 43 void PlatformDevice::LoadPathToCGContext(CGContextRef context,
49 const SkPath& path) { 44 const SkPath& path) {
50 // instead of a persistent attribute of the context, CG specifies the fill 45 // instead of a persistent attribute of the context, CG specifies the fill
51 // type per call, so we just have to load up the geometry. 46 // type per call, so we just have to load up the geometry.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // transform so apply it manually. 150 // transform so apply it manually.
156 path.transform(transformation); 151 path.transform(transformation);
157 // TODO(playmobil): Implement. 152 // TODO(playmobil): Implement.
158 SkASSERT(false); 153 SkASSERT(false);
159 // LoadPathToDC(context, path); 154 // LoadPathToDC(context, path);
160 // hrgn = PathToRegion(context); 155 // hrgn = PathToRegion(context);
161 } 156 }
162 } 157 }
163 158
164 } // namespace skia 159 } // namespace skia
165
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698