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

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

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Syncing merge conflicts. Created 9 years, 7 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
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 #ifndef SKIA_EXT_PLATFORM_DEVICE_MAC_H_ 5 #ifndef SKIA_EXT_PLATFORM_DEVICE_MAC_H_
6 #define SKIA_EXT_PLATFORM_DEVICE_MAC_H_ 6 #define SKIA_EXT_PLATFORM_DEVICE_MAC_H_
7 #pragma once 7 #pragma once
8 8
9 #include "third_party/skia/include/core/SkDevice.h" 9 #include "third_party/skia/include/core/SkDevice.h"
10 10
11 typedef struct CGContext* CGContextRef; 11 typedef struct CGContext* CGContextRef;
12 typedef struct CGRect CGRect; 12 typedef struct CGRect CGRect;
13 13
14 class SkMatrix; 14 class SkMatrix;
15 class SkPath; 15 class SkPath;
16 class SkRegion; 16 class SkRegion;
17 17
18 namespace skia { 18 namespace skia {
19 19
20 // Returns the CGContext that backing the SkDevice. Forwards to the bound
21 // PlatformDevice. Returns NULL if no PlatformDevice is bound.
22 CGContextRef GetBitmapContext(SkDevice* device);
23
20 // A device is basically a wrapper around SkBitmap that provides a surface for 24 // A device is basically a wrapper around SkBitmap that provides a surface for
21 // SkCanvas to draw into. Our device provides a surface CoreGraphics can also 25 // SkCanvas to draw into. Our device provides a surface CoreGraphics can also
22 // write to. It also provides functionality to play well with CG drawing 26 // write to. It also provides functionality to play well with CG drawing
23 // functions. 27 // functions.
24 // This class is abstract and must be subclassed. It provides the basic 28 // This class is abstract and must be subclassed. It provides the basic
25 // interface to implement it either with or without a bitmap backend. 29 // interface to implement it either with or without a bitmap backend.
26 class PlatformDevice : public SkDevice { 30 class PlatformDevice : public SkDevice {
27 public: 31 public:
28 typedef CGContextRef PlatformSurface; 32 typedef CGContextRef PlatformSurface;
29 33
30 // The CGContext that corresponds to the bitmap, used for CoreGraphics 34 // The CGContext that corresponds to the bitmap, used for CoreGraphics
31 // operations drawing into the bitmap. This is possibly heavyweight, so it 35 // operations drawing into the bitmap. This is possibly heavyweight, so it
32 // should exist only during one pass of rendering. 36 // should exist only during one pass of rendering.
33 virtual CGContextRef GetBitmapContext() = 0; 37 virtual CGContextRef GetBitmapContext() = 0;
34 38
35 // Draws to the given graphics context. If the bitmap context doesn't exist, 39 // Draws to the given graphics context. If the bitmap context doesn't exist,
36 // this will temporarily create it. However, if you have created the bitmap 40 // this will temporarily create it. However, if you have created the bitmap
37 // context, it will be more efficient if you don't free it until after this 41 // context, it will be more efficient if you don't free it until after this
38 // call so it doesn't have to be created twice. If src_rect is null, then 42 // call so it doesn't have to be created twice. If src_rect is null, then
39 // the entirety of the source device will be copied. 43 // the entirety of the source device will be copied.
40 virtual void DrawToContext(CGContextRef context, int x, int y, 44 virtual void DrawToNativeContext(CGContextRef context, int x, int y,
41 const CGRect* src_rect) = 0; 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) { }
42 49
43 // Returns if the preferred rendering engine is vectorial or bitmap based. 50 // Returns if the preferred rendering engine is vectorial or bitmap based.
44 virtual bool IsVectorial() = 0; 51 virtual bool IsVectorial() = 0;
45 52
46 // Returns if native platform APIs are allowed to render text to this device. 53 // Returns if native platform APIs are allowed to render text to this device.
47 virtual bool IsNativeFontRenderingAllowed(); 54 virtual bool IsNativeFontRenderingAllowed();
48 55
49 virtual PlatformSurface BeginPlatformPaint(); 56 virtual PlatformSurface BeginPlatformPaint();
50 virtual void EndPlatformPaint(); 57 virtual void EndPlatformPaint();
51 58
(...skipping 15 matching lines...) Expand all
67 74
68 // Loads the specified Skia transform into the device context 75 // Loads the specified Skia transform into the device context
69 static void LoadTransformToCGContext(CGContextRef context, 76 static void LoadTransformToCGContext(CGContextRef context,
70 const SkMatrix& matrix); 77 const SkMatrix& matrix);
71 }; 78 };
72 79
73 } // namespace skia 80 } // namespace skia
74 81
75 #endif // SKIA_EXT_PLATFORM_DEVICE_MAC_H_ 82 #endif // SKIA_EXT_PLATFORM_DEVICE_MAC_H_
76 83
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