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 14 matching lines...) Expand all Loading... | |
25 class SkClipStack; | 25 class SkClipStack; |
26 class SkData; | 26 class SkData; |
27 class SkDraw; | 27 class SkDraw; |
28 class SkDrawable; | 28 class SkDrawable; |
29 class SkDrawFilter; | 29 class SkDrawFilter; |
30 class SkImageFilter; | 30 class SkImageFilter; |
31 class SkMetaData; | 31 class SkMetaData; |
32 class SkPath; | 32 class SkPath; |
33 class SkPicture; | 33 class SkPicture; |
34 class SkPixmap; | 34 class SkPixmap; |
35 class SkRasterCanvasLayerAllocator; | |
35 class SkRRect; | 36 class SkRRect; |
36 struct SkRSXform; | 37 struct SkRSXform; |
37 class SkSurface; | 38 class SkSurface; |
38 class SkSurface_Base; | 39 class SkSurface_Base; |
39 class SkTextBlob; | 40 class SkTextBlob; |
40 | 41 |
41 /** \class SkCanvas | 42 /** \class SkCanvas |
42 | 43 |
43 A Canvas encapsulates all of the state about drawing into a device (bitmap). | 44 A Canvas encapsulates all of the state about drawing into a device (bitmap). |
44 This includes a reference to the device itself, and a stack of matrix/clip | 45 This includes a reference to the device itself, and a stack of matrix/clip |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1186 } | 1187 } |
1187 | 1188 |
1188 typedef SkCanvasClipVisitor ClipVisitor; | 1189 typedef SkCanvasClipVisitor ClipVisitor; |
1189 /** | 1190 /** |
1190 * Replays the clip operations, back to front, that have been applied to | 1191 * Replays the clip operations, back to front, that have been applied to |
1191 * the canvas, calling the appropriate method on the visitor for each | 1192 * the canvas, calling the appropriate method on the visitor for each |
1192 * clip. All clips have already been transformed into device space. | 1193 * clip. All clips have already been transformed into device space. |
1193 */ | 1194 */ |
1194 void replayClips(ClipVisitor*) const; | 1195 void replayClips(ClipVisitor*) const; |
1195 | 1196 |
1197 /** | |
1198 * Returns any OS-specific native context backing this SkCanvas, | |
1199 * or nullptr. | |
1200 */ | |
1201 void* getTopLayerNative() const; | |
1202 | |
1196 /////////////////////////////////////////////////////////////////////////// | 1203 /////////////////////////////////////////////////////////////////////////// |
1197 | 1204 |
1198 /** After calling saveLayer(), there can be any number of devices that make | 1205 /** After calling saveLayer(), there can be any number of devices that make |
1199 up the top-most drawing area. LayerIter can be used to iterate through | 1206 up the top-most drawing area. LayerIter can be used to iterate through |
1200 those devices. Note that the iterator is only valid until the next API | 1207 those devices. Note that the iterator is only valid until the next API |
1201 call made on the canvas. Ownership of all pointers in the iterator stays | 1208 call made on the canvas. Ownership of all pointers in the iterator stays |
1202 with the canvas, so none of them should be modified or deleted. | 1209 with the canvas, so none of them should be modified or deleted. |
1203 */ | 1210 */ |
1204 class SK_API LayerIter /*: SkNoncopyable*/ { | 1211 class SK_API LayerIter /*: SkNoncopyable*/ { |
1205 public: | 1212 public: |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1374 class MCRec; | 1381 class MCRec; |
1375 | 1382 |
1376 SkAutoTUnref<SkClipStack> fClipStack; | 1383 SkAutoTUnref<SkClipStack> fClipStack; |
1377 SkDeque fMCStack; | 1384 SkDeque fMCStack; |
1378 // points to top of stack | 1385 // points to top of stack |
1379 MCRec* fMCRec; | 1386 MCRec* fMCRec; |
1380 // the first N recs that can fit here mean we won't call malloc | 1387 // the first N recs that can fit here mean we won't call malloc |
1381 enum { | 1388 enum { |
1382 kMCRecSize = 128, // most recent measurement | 1389 kMCRecSize = 128, // most recent measurement |
1383 kMCRecCount = 32, // common depth for save/restores | 1390 kMCRecCount = 32, // common depth for save/restores |
1384 kDeviceCMSize = 136, // most recent measurement | 1391 kDeviceCMSize = 152, // most recent measurement |
1385 }; | 1392 }; |
1386 intptr_t fMCRecStorage[kMCRecSize * kMCRecCount / sizeof(intptr_t)]; | 1393 intptr_t fMCRecStorage[kMCRecSize * kMCRecCount / sizeof(intptr_t)]; |
1387 intptr_t fDeviceCMStorage[kDeviceCMSize / sizeof(intptr_t)]; | 1394 intptr_t fDeviceCMStorage[kDeviceCMSize / sizeof(intptr_t)]; |
1388 | 1395 |
1389 const SkSurfaceProps fProps; | 1396 const SkSurfaceProps fProps; |
1390 | 1397 |
1391 int fSaveCount; // value returned by getSaveCount() | 1398 int fSaveCount; // value returned by getSaveCount() |
1392 | 1399 |
1393 SkMetaData* fMetaData; | 1400 SkMetaData* fMetaData; |
1394 | 1401 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1502 private: | 1509 private: |
1503 const SkCanvas* fCanvas; | 1510 const SkCanvas* fCanvas; |
1504 }; | 1511 }; |
1505 | 1512 |
1506 #ifdef SK_DEBUG | 1513 #ifdef SK_DEBUG |
1507 void validateClip() const; | 1514 void validateClip() const; |
1508 #else | 1515 #else |
1509 void validateClip() const {} | 1516 void validateClip() const {} |
1510 #endif | 1517 #endif |
1511 | 1518 |
1519 SkRasterCanvasLayerAllocator* fAllocator; | |
reed1
2016/05/11 18:58:24
I presume we'll add a constructor that takes an al
tomhudson
2016/05/26 16:36:16
With the next patchset, I'm proposing a factory on
| |
1520 | |
1512 typedef SkRefCnt INHERITED; | 1521 typedef SkRefCnt INHERITED; |
1513 }; | 1522 }; |
1514 | 1523 |
1515 /** Stack helper class to automatically call restoreToCount() on the canvas | 1524 /** Stack helper class to automatically call restoreToCount() on the canvas |
1516 when this object goes out of scope. Use this to guarantee that the canvas | 1525 when this object goes out of scope. Use this to guarantee that the canvas |
1517 is restored to a known state. | 1526 is restored to a known state. |
1518 */ | 1527 */ |
1519 class SkAutoCanvasRestore : SkNoncopyable { | 1528 class SkAutoCanvasRestore : SkNoncopyable { |
1520 public: | 1529 public: |
1521 SkAutoCanvasRestore(SkCanvas* canvas, bool doSave) : fCanvas(canvas), fSaveC ount(0) { | 1530 SkAutoCanvasRestore(SkCanvas* canvas, bool doSave) : fCanvas(canvas), fSaveC ount(0) { |
(...skipping 29 matching lines...) Expand all Loading... | |
1551 | 1560 |
1552 class SkCanvasClipVisitor { | 1561 class SkCanvasClipVisitor { |
1553 public: | 1562 public: |
1554 virtual ~SkCanvasClipVisitor(); | 1563 virtual ~SkCanvasClipVisitor(); |
1555 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1564 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1556 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1565 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1557 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1566 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1558 }; | 1567 }; |
1559 | 1568 |
1560 #endif | 1569 #endif |
OLD | NEW |