OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkCanvas_DEFINED | 8 #ifndef SkCanvas_DEFINED |
9 #define SkCanvas_DEFINED | 9 #define SkCanvas_DEFINED |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 SkImageInfo imageInfo() const; | 83 SkImageInfo imageInfo() const; |
84 | 84 |
85 /////////////////////////////////////////////////////////////////////////// | 85 /////////////////////////////////////////////////////////////////////////// |
86 | 86 |
87 /** | 87 /** |
88 * Trigger the immediate execution of all pending draw operations. | 88 * Trigger the immediate execution of all pending draw operations. |
89 */ | 89 */ |
90 void flush(); | 90 void flush(); |
91 | 91 |
92 /** | 92 /** |
93 * DEPRECATED: call imageInfo() instead. | 93 * Gets the size of the base or root layer in global canvas coordinates. The |
94 * Return the width/height of the underlying device. The current drawable | 94 * origin of the base layer is always (0,0). The current drawable area may b
e |
95 * area may be small (due to clipping or saveLayer). For a canvas with | 95 * smaller (due to clipping or saveLayer). |
96 * no device, 0,0 will be returned. | |
97 */ | 96 */ |
98 SkISize getDeviceSize() const; | 97 SkISize getBaseLayerSize() const; |
| 98 |
| 99 /** |
| 100 * DEPRECATED: call getBaseLayerSize |
| 101 */ |
| 102 SkISize getDeviceSize() const { return this->getBaseLayerSize(); } |
99 | 103 |
100 /** | 104 /** |
101 * DEPRECATED. | 105 * DEPRECATED. |
102 * Return the canvas' device object, which may be null. The device holds | 106 * Return the canvas' device object, which may be null. The device holds |
103 * the bitmap of the pixels that the canvas draws into. The reference count | 107 * the bitmap of the pixels that the canvas draws into. The reference count |
104 * of the returned device is not changed by this call. | 108 * of the returned device is not changed by this call. |
105 */ | 109 */ |
106 SkBaseDevice* getDevice() const; | 110 SkBaseDevice* getDevice() const; |
107 | 111 |
108 /** | 112 /** |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 fSurfaceBase = sb; | 1126 fSurfaceBase = sb; |
1123 } | 1127 } |
1124 friend class SkSurface_Base; | 1128 friend class SkSurface_Base; |
1125 friend class SkSurface_Gpu; | 1129 friend class SkSurface_Gpu; |
1126 | 1130 |
1127 bool fDeviceCMDirty; // cleared by updateDeviceCMCache() | 1131 bool fDeviceCMDirty; // cleared by updateDeviceCMCache() |
1128 void updateDeviceCMCache(); | 1132 void updateDeviceCMCache(); |
1129 | 1133 |
1130 friend class SkDrawIter; // needs setupDrawForLayerDevice() | 1134 friend class SkDrawIter; // needs setupDrawForLayerDevice() |
1131 friend class AutoDrawLooper; | 1135 friend class AutoDrawLooper; |
| 1136 friend class SkLua; // needs top layer size and offset |
1132 | 1137 |
1133 SkBaseDevice* createLayerDevice(const SkImageInfo&); | 1138 SkBaseDevice* createLayerDevice(const SkImageInfo&); |
1134 | 1139 |
1135 SkBaseDevice* init(SkBaseDevice*); | 1140 SkBaseDevice* init(SkBaseDevice*); |
1136 | 1141 |
1137 /** | 1142 /** |
1138 * DEPRECATED | 1143 * DEPRECATED |
1139 * | 1144 * |
1140 * Specify a device for this canvas to draw into. If it is not null, its | 1145 * Specify a device for this canvas to draw into. If it is not null, its |
1141 * reference count is incremented. If the canvas was already holding a | 1146 * reference count is incremented. If the canvas was already holding a |
1142 * device, its reference count is decremented. The new device is returned. | 1147 * device, its reference count is decremented. The new device is returned. |
1143 */ | 1148 */ |
1144 SkBaseDevice* setRootDevice(SkBaseDevice* device); | 1149 SkBaseDevice* setRootDevice(SkBaseDevice* device); |
1145 | 1150 |
| 1151 /** |
| 1152 * Gets the size/origin of the top level layer in global canvas coordinates.
We don't want this |
| 1153 * to be public because it exposes decisions about layer sizes that are inte
rnal to the canvas. |
| 1154 */ |
| 1155 SkISize getTopLayerSize() const; |
| 1156 SkIPoint getTopLayerOrigin() const; |
1146 | 1157 |
1147 // internal methods are not virtual, so they can safely be called by other | 1158 // internal methods are not virtual, so they can safely be called by other |
1148 // canvas apis, without confusing subclasses (like SkPictureRecording) | 1159 // canvas apis, without confusing subclasses (like SkPictureRecording) |
1149 void internalDrawBitmap(const SkBitmap&, const SkMatrix& m, const SkPaint* p
aint); | 1160 void internalDrawBitmap(const SkBitmap&, const SkMatrix& m, const SkPaint* p
aint); |
1150 void internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, | 1161 void internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, |
1151 const SkRect& dst, const SkPaint* paint, | 1162 const SkRect& dst, const SkPaint* paint, |
1152 DrawBitmapRectFlags flags); | 1163 DrawBitmapRectFlags flags); |
1153 void internalDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, | 1164 void internalDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
1154 const SkRect& dst, const SkPaint* paint); | 1165 const SkRect& dst, const SkPaint* paint); |
1155 void internalDrawPaint(const SkPaint& paint); | 1166 void internalDrawPaint(const SkPaint& paint); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 bool asROBitmap(SkBitmap*) const; | 1311 bool asROBitmap(SkBitmap*) const; |
1301 | 1312 |
1302 private: | 1313 private: |
1303 SkBitmap fBitmap; // used if peekPixels() fails | 1314 SkBitmap fBitmap; // used if peekPixels() fails |
1304 const void* fAddr; // NULL on failure | 1315 const void* fAddr; // NULL on failure |
1305 SkImageInfo fInfo; | 1316 SkImageInfo fInfo; |
1306 size_t fRowBytes; | 1317 size_t fRowBytes; |
1307 }; | 1318 }; |
1308 | 1319 |
1309 #endif | 1320 #endif |
OLD | NEW |