OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_CANVAS_H_ | 5 #ifndef SKIA_EXT_PLATFORM_CANVAS_H_ |
6 #define SKIA_EXT_PLATFORM_CANVAS_H_ | 6 #define SKIA_EXT_PLATFORM_CANVAS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // The platform-specific device will include the necessary platform headers | 9 // The platform-specific device will include the necessary platform headers |
10 // to get the surface type. | 10 // to get the surface type. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 #endif | 62 #endif |
63 | 63 |
64 // Shared -------------------------------------------------------------------- | 64 // Shared -------------------------------------------------------------------- |
65 | 65 |
66 // These calls should surround calls to platform drawing routines, the | 66 // These calls should surround calls to platform drawing routines, the |
67 // surface returned here can be used with the native platform routines | 67 // surface returned here can be used with the native platform routines |
68 // | 68 // |
69 // Call endPlatformPaint when you are done and want to use Skia operations | 69 // Call endPlatformPaint when you are done and want to use Skia operations |
70 // after calling the platform-specific beginPlatformPaint; this will | 70 // after calling the platform-specific beginPlatformPaint; this will |
71 // synchronize the bitmap to OS if necessary. | 71 // synchronize the bitmap to OS if necessary. |
72 PlatformDevice::PlatformSurface beginPlatformPaint() const; | 72 skia::platform_util::PlatformSurface beginPlatformPaint() const; |
alokp
2011/05/18 03:25:42
do we need these member functions? Can't we direct
Jeff Timanus
2011/05/18 22:10:28
Yes, the functions below can be directly used.
| |
73 void endPlatformPaint() const; | 73 void endPlatformPaint() const; |
74 | 74 |
75 // Returns the platform device pointer of the topmost rect with a non-empty | 75 // Returns the SkDevice pointer of the topmost rect with a non-empty |
76 // clip. In practice, this is usually either the top layer or nothing, since | 76 // clip. In practice, this is usually either the top layer or nothing, since |
77 // we usually set the clip to new layers when we make them. | 77 // we usually set the clip to new layers when we make them. |
78 // | 78 // |
79 // If there is no layer that is not all clipped out, this will return a | 79 // If there is no layer that is not all clipped out, this will return a |
80 // dummy device so callers do not have to check. If you are concerned about | 80 // dummy device so callers do not have to check. If you are concerned about |
81 // performance, check the clip before doing any painting. | 81 // performance, check the clip before doing any painting. |
82 // | 82 // |
83 // This is different than SkCanvas' getDevice, because that returns the | 83 // This is different than SkCanvas' getDevice, because that returns the |
84 // bottommost device. | 84 // bottommost device. |
85 // | 85 // |
86 // Danger: the resulting device should not be saved. It will be invalidated | 86 // Danger: the resulting device should not be saved. It will be invalidated |
87 // by the next call to save() or restore(). | 87 // by the next call to save() or restore(). |
88 PlatformDevice& getTopPlatformDevice() const; | 88 SkDevice& getTopDevice() const; |
alokp
2011/05/18 03:25:42
SkCanvas also has a function named getTopDevice().
Jeff Timanus
2011/05/18 22:10:28
I looked into the difference of behaviour between
| |
89 | 89 |
90 // Return the stride (length of a line in bytes) for the given width. Because | 90 // Return the stride (length of a line in bytes) for the given width. Because |
91 // we use 32-bits per pixel, this will be roughly 4*width. However, for | 91 // we use 32-bits per pixel, this will be roughly 4*width. However, for |
92 // alignment reasons we may wish to increase that. | 92 // alignment reasons we may wish to increase that. |
93 static size_t StrideForWidth(unsigned width); | 93 static size_t StrideForWidth(unsigned width); |
94 | 94 |
95 // Allow callers to see the non-virtual function even though we have an | 95 // Allow callers to see the non-virtual function even though we have an |
96 // override of a virtual one. | 96 // override of a virtual one. |
97 // FIXME(brettw) is this necessary? | 97 // FIXME(brettw) is this necessary? |
98 using SkCanvas::clipRect; | 98 using SkCanvas::clipRect; |
(...skipping 27 matching lines...) Expand all Loading... | |
126 | 126 |
127 // These calls should surround calls to platform drawing routines, the | 127 // These calls should surround calls to platform drawing routines, the |
128 // surface returned here can be used with the native platform routines. | 128 // surface returned here can be used with the native platform routines. |
129 // | 129 // |
130 // Call EndPlatformPaint when you are done and want to use skia operations | 130 // Call EndPlatformPaint when you are done and want to use skia operations |
131 // after calling the platform-specific BeginPlatformPaint; this will | 131 // after calling the platform-specific BeginPlatformPaint; this will |
132 // synchronize the bitmap to OS if necessary. | 132 // synchronize the bitmap to OS if necessary. |
133 // | 133 // |
134 // Note: These functions will eventually replace | 134 // Note: These functions will eventually replace |
135 // PlatformCanvas::beginPlatformPaint and PlatformCanvas::endPlatformPaint. | 135 // PlatformCanvas::beginPlatformPaint and PlatformCanvas::endPlatformPaint. |
136 SK_API PlatformDevice::PlatformSurface BeginPlatformPaint(SkCanvas* canvas); | 136 SK_API skia::platform_util::PlatformSurface BeginPlatformPaint( |
137 SkCanvas* canvas); | |
137 SK_API void EndPlatformPaint(SkCanvas* canvas); | 138 SK_API void EndPlatformPaint(SkCanvas* canvas); |
138 | 139 |
139 } // namespace skia | 140 } // namespace skia |
140 | 141 |
141 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ | 142 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ |
OLD | NEW |