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