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 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 typedef SkCanvasClipVisitor ClipVisitor; | 1213 typedef SkCanvasClipVisitor ClipVisitor; |
1214 /** | 1214 /** |
1215 * Replays the clip operations, back to front, that have been applied to | 1215 * Replays the clip operations, back to front, that have been applied to |
1216 * the canvas, calling the appropriate method on the visitor for each | 1216 * the canvas, calling the appropriate method on the visitor for each |
1217 * clip. All clips have already been transformed into device space. | 1217 * clip. All clips have already been transformed into device space. |
1218 */ | 1218 */ |
1219 void replayClips(ClipVisitor*) const; | 1219 void replayClips(ClipVisitor*) const; |
1220 | 1220 |
1221 /////////////////////////////////////////////////////////////////////////// | 1221 /////////////////////////////////////////////////////////////////////////// |
1222 | 1222 |
1223 #ifndef SK_SUPPORT_LEGACY_LAYERITER | 1223 // don't call |
| 1224 GrRenderTarget* internal_private_accessTopLayerRenderTarget(); |
| 1225 |
| 1226 // don't call |
| 1227 static void Internal_Private_SetIgnoreSaveLayerBounds(bool); |
| 1228 static bool Internal_Private_GetIgnoreSaveLayerBounds(); |
| 1229 static void Internal_Private_SetTreatSpriteAsBitmap(bool); |
| 1230 static bool Internal_Private_GetTreatSpriteAsBitmap(); |
| 1231 |
| 1232 // TEMP helpers until we switch virtual over to const& for src-rect |
| 1233 void legacy_drawImageRect(const SkImage* image, const SkRect* src, const SkR
ect& dst, |
| 1234 const SkPaint* paint, |
| 1235 SrcRectConstraint constraint = kStrict_SrcRectCons
traint); |
| 1236 void legacy_drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const
SkRect& dst, |
| 1237 const SkPaint* paint, |
| 1238 SrcRectConstraint constraint = kStrict_SrcRectCon
straint); |
| 1239 |
1224 protected: | 1240 protected: |
1225 #endif | |
1226 /** After calling saveLayer(), there can be any number of devices that make | 1241 /** After calling saveLayer(), there can be any number of devices that make |
1227 up the top-most drawing area. LayerIter can be used to iterate through | 1242 up the top-most drawing area. LayerIter can be used to iterate through |
1228 those devices. Note that the iterator is only valid until the next API | 1243 those devices. Note that the iterator is only valid until the next API |
1229 call made on the canvas. Ownership of all pointers in the iterator stays | 1244 call made on the canvas. Ownership of all pointers in the iterator stays |
1230 with the canvas, so none of them should be modified or deleted. | 1245 with the canvas, so none of them should be modified or deleted. |
1231 */ | 1246 */ |
1232 class SK_API LayerIter /*: SkNoncopyable*/ { | 1247 class LayerIter /*: SkNoncopyable*/ { |
1233 public: | 1248 public: |
1234 /** Initialize iterator with canvas, and set values for 1st device */ | 1249 /** Initialize iterator with canvas, and set values for 1st device */ |
1235 LayerIter(SkCanvas*, bool skipEmptyClips); | 1250 LayerIter(SkCanvas*, bool skipEmptyClips); |
1236 ~LayerIter(); | 1251 ~LayerIter(); |
1237 | 1252 |
1238 /** Return true if the iterator is done */ | 1253 /** Return true if the iterator is done */ |
1239 bool done() const { return fDone; } | 1254 bool done() const { return fDone; } |
1240 /** Cycle to the next device */ | 1255 /** Cycle to the next device */ |
1241 void next(); | 1256 void next(); |
1242 | 1257 |
(...skipping 11 matching lines...) Expand all Loading... |
1254 // having to expose that class def to the public. There is an assert | 1269 // having to expose that class def to the public. There is an assert |
1255 // in our constructor to ensure that fStorage is large enough | 1270 // in our constructor to ensure that fStorage is large enough |
1256 // (though needs to be a compile-time-assert!). We use intptr_t to work | 1271 // (though needs to be a compile-time-assert!). We use intptr_t to work |
1257 // safely with 32 and 64 bit machines (to ensure the storage is enough) | 1272 // safely with 32 and 64 bit machines (to ensure the storage is enough) |
1258 intptr_t fStorage[32]; | 1273 intptr_t fStorage[32]; |
1259 class SkDrawIter* fImpl; // this points at fStorage | 1274 class SkDrawIter* fImpl; // this points at fStorage |
1260 SkPaint fDefaultPaint; | 1275 SkPaint fDefaultPaint; |
1261 bool fDone; | 1276 bool fDone; |
1262 }; | 1277 }; |
1263 | 1278 |
1264 public: | |
1265 // don't call | |
1266 GrRenderTarget* internal_private_accessTopLayerRenderTarget(); | |
1267 | |
1268 // don't call | |
1269 static void Internal_Private_SetIgnoreSaveLayerBounds(bool); | |
1270 static bool Internal_Private_GetIgnoreSaveLayerBounds(); | |
1271 static void Internal_Private_SetTreatSpriteAsBitmap(bool); | |
1272 static bool Internal_Private_GetTreatSpriteAsBitmap(); | |
1273 | |
1274 // TEMP helpers until we switch virtual over to const& for src-rect | |
1275 void legacy_drawImageRect(const SkImage* image, const SkRect* src, const SkR
ect& dst, | |
1276 const SkPaint* paint, | |
1277 SrcRectConstraint constraint = kStrict_SrcRectCons
traint); | |
1278 void legacy_drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const
SkRect& dst, | |
1279 const SkPaint* paint, | |
1280 SrcRectConstraint constraint = kStrict_SrcRectCon
straint); | |
1281 | |
1282 protected: | |
1283 // default impl defers to getDevice()->newSurface(info) | 1279 // default impl defers to getDevice()->newSurface(info) |
1284 virtual sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfacePro
ps&); | 1280 virtual sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfacePro
ps&); |
1285 | 1281 |
1286 // default impl defers to its device | 1282 // default impl defers to its device |
1287 virtual bool onPeekPixels(SkPixmap*); | 1283 virtual bool onPeekPixels(SkPixmap*); |
1288 virtual bool onAccessTopLayerPixels(SkPixmap*); | 1284 virtual bool onAccessTopLayerPixels(SkPixmap*); |
1289 | 1285 |
1290 // Subclass save/restore notifiers. | 1286 // Subclass save/restore notifiers. |
1291 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. | 1287 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. |
1292 // getSaveLayerStrategy()'s return value may suppress full layer allocation. | 1288 // getSaveLayerStrategy()'s return value may suppress full layer allocation. |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 | 1578 |
1583 class SkCanvasClipVisitor { | 1579 class SkCanvasClipVisitor { |
1584 public: | 1580 public: |
1585 virtual ~SkCanvasClipVisitor(); | 1581 virtual ~SkCanvasClipVisitor(); |
1586 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1582 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1587 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1583 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1588 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1584 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1589 }; | 1585 }; |
1590 | 1586 |
1591 #endif | 1587 #endif |
OLD | NEW |