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

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

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
« no previous file with comments | « skia/ext/platform_device_linux.cc ('k') | skia/ext/platform_device_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SKIA_EXT_PLATFORM_DEVICE_MAC_H_
6 #define SKIA_EXT_PLATFORM_DEVICE_MAC_H_
7 #pragma once
8
9 #include "third_party/skia/include/core/SkDevice.h"
10
11 typedef struct CGContext* CGContextRef;
12 typedef struct CGRect CGRect;
13
14 class SkMatrix;
15 class SkPath;
16 class SkRegion;
17
18 namespace skia {
19
20 // Returns the CGContext that backing the SkDevice. Forwards to the bound
21 // PlatformDevice. Returns NULL if no PlatformDevice is bound.
22 SK_API CGContextRef GetBitmapContext(SkDevice* device);
23
24 // A device is basically a wrapper around SkBitmap that provides a surface for
25 // SkCanvas to draw into. Our device provides a surface CoreGraphics can also
26 // write to. It also provides functionality to play well with CG drawing
27 // functions.
28 // This class is abstract and must be subclassed. It provides the basic
29 // interface to implement it either with or without a bitmap backend.
30 class PlatformDevice : public SkDevice {
31 public:
32 typedef CGContextRef PlatformSurface;
33
34 // The CGContext that corresponds to the bitmap, used for CoreGraphics
35 // operations drawing into the bitmap. This is possibly heavyweight, so it
36 // should exist only during one pass of rendering.
37 virtual CGContextRef GetBitmapContext() = 0;
38
39 // Draws to the given graphics context. If the bitmap context doesn't exist,
40 // this will temporarily create it. However, if you have created the bitmap
41 // context, it will be more efficient if you don't free it until after this
42 // call so it doesn't have to be created twice. If src_rect is null, then
43 // the entirety of the source device will be copied.
44 virtual void DrawToNativeContext(CGContextRef context, int x, int y,
45 const CGRect* src_rect) = 0;
46
47 // Sets the opacity of each pixel in the specified region to be opaque.
48 virtual void MakeOpaque(int x, int y, int width, int height) { }
49
50 // Returns if native platform APIs are allowed to render text to this device.
51 virtual bool IsNativeFontRenderingAllowed();
52
53 virtual PlatformSurface BeginPlatformPaint();
54 virtual void EndPlatformPaint();
55
56 // Initializes the default settings and colors in a device context.
57 static void InitializeCGContext(CGContextRef context);
58
59 // Loads a SkPath into the CG context. The path can there after be used for
60 // clipping or as a stroke.
61 static void LoadPathToCGContext(CGContextRef context, const SkPath& path);
62
63 // Loads a SkRegion into the CG context.
64 static void LoadClippingRegionToCGContext(CGContextRef context,
65 const SkRegion& region,
66 const SkMatrix& transformation);
67
68 protected:
69 // Forwards |bitmap| to SkDevice's constructor.
70 PlatformDevice(const SkBitmap& bitmap);
71
72 // Loads the specified Skia transform into the device context
73 static void LoadTransformToCGContext(CGContextRef context,
74 const SkMatrix& matrix);
75 };
76
77 } // namespace skia
78
79 #endif // SKIA_EXT_PLATFORM_DEVICE_MAC_H_
80
OLDNEW
« no previous file with comments | « skia/ext/platform_device_linux.cc ('k') | skia/ext/platform_device_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698