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 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1399 class MCRec; | 1399 class MCRec; |
1400 | 1400 |
1401 SkAutoTUnref<SkClipStack> fClipStack; | 1401 SkAutoTUnref<SkClipStack> fClipStack; |
1402 SkDeque fMCStack; | 1402 SkDeque fMCStack; |
1403 // points to top of stack | 1403 // points to top of stack |
1404 MCRec* fMCRec; | 1404 MCRec* fMCRec; |
1405 // the first N recs that can fit here mean we won't call malloc | 1405 // the first N recs that can fit here mean we won't call malloc |
1406 enum { | 1406 enum { |
1407 kMCRecSize = 128, // most recent measurement | 1407 kMCRecSize = 128, // most recent measurement |
1408 kMCRecCount = 32, // common depth for save/restores | 1408 kMCRecCount = 32, // common depth for save/restores |
1409 kDeviceCMSize = 136, // most recent measurement | 1409 kDeviceCMSize = 176, // most recent measurement |
1410 }; | 1410 }; |
1411 intptr_t fMCRecStorage[kMCRecSize * kMCRecCount / sizeof(intptr_t)]; | 1411 intptr_t fMCRecStorage[kMCRecSize * kMCRecCount / sizeof(intptr_t)]; |
1412 intptr_t fDeviceCMStorage[kDeviceCMSize / sizeof(intptr_t)]; | 1412 intptr_t fDeviceCMStorage[kDeviceCMSize / sizeof(intptr_t)]; |
1413 | 1413 |
1414 const SkSurfaceProps fProps; | 1414 const SkSurfaceProps fProps; |
1415 | 1415 |
1416 int fSaveCount; // value returned by getSaveCount() | 1416 int fSaveCount; // value returned by getSaveCount() |
1417 | 1417 |
1418 SkMetaData* fMetaData; | 1418 SkMetaData* fMetaData; |
1419 | 1419 |
1420 SkSurface_Base* fSurfaceBase; | 1420 SkSurface_Base* fSurfaceBase; |
1421 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; } | 1421 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; } |
1422 void setSurfaceBase(SkSurface_Base* sb) { | 1422 void setSurfaceBase(SkSurface_Base* sb) { |
1423 fSurfaceBase = sb; | 1423 fSurfaceBase = sb; |
1424 } | 1424 } |
1425 friend class SkSurface_Base; | 1425 friend class SkSurface_Base; |
1426 friend class SkSurface_Gpu; | 1426 friend class SkSurface_Gpu; |
1427 | 1427 |
1428 bool fDeviceCMDirty; // cleared by updateDeviceCMCache() | 1428 bool fDeviceCMDirty; // cleared by updateDeviceCMCache() |
1429 void updateDeviceCMCache(); | 1429 void updateDeviceCMCache(); |
1430 | 1430 |
1431 void doSave(); | 1431 void doSave(); |
1432 void checkForDeferredSave(); | 1432 void checkForDeferredSave(); |
1433 void internalSetMatrix(const SkMatrix&); | |
1433 | 1434 |
1434 friend class SkDrawIter; // needs setupDrawForLayerDevice() | 1435 friend class SkDrawIter; // needs setupDrawForLayerDevice() |
1435 friend class AutoDrawLooper; | 1436 friend class AutoDrawLooper; |
1436 friend class SkLua; // needs top layer size and offset | 1437 friend class SkLua; // needs top layer size and offset |
1437 friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip | 1438 friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip |
1438 friend class SkSurface_Raster; // needs getDevice() | 1439 friend class SkSurface_Raster; // needs getDevice() |
1439 friend class SkRecorder; // InitFlags | 1440 friend class SkRecorder; // InitFlags |
1440 friend class SkNoSaveLayerCanvas; // InitFlags | 1441 friend class SkNoSaveLayerCanvas; // InitFlags |
1441 friend class SkPictureImageFilter; // SkCanvas(SkBaseDevice*, SkSurfaceProp s*, InitFlags) | 1442 friend class SkPictureImageFilter; // SkCanvas(SkBaseDevice*, SkSurfaceProp s*, InitFlags) |
1442 friend class SkPictureRecord; // predrawNotify (why does it need it? <reed >) | 1443 friend class SkPictureRecord; // predrawNotify (why does it need it? <reed >) |
(...skipping 20 matching lines...) Expand all Loading... | |
1463 | 1464 |
1464 /** | 1465 /** |
1465 * Gets the bounds of the top level layer in global canvas coordinates. We d on't want this | 1466 * Gets the bounds of the top level layer in global canvas coordinates. We d on't want this |
1466 * to be public because it exposes decisions about layer sizes that are inte rnal to the canvas. | 1467 * to be public because it exposes decisions about layer sizes that are inte rnal to the canvas. |
1467 */ | 1468 */ |
1468 SkIRect getTopLayerBounds() const; | 1469 SkIRect getTopLayerBounds() const; |
1469 | 1470 |
1470 void internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, | 1471 void internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, |
1471 const SkRect& dst, const SkPaint* paint, | 1472 const SkRect& dst, const SkPaint* paint, |
1472 SrcRectConstraint); | 1473 SrcRectConstraint); |
1473 void internalDrawPaint(const SkPaint& paint); | 1474 void internalDrawPaint(const SkPaint& paint); |
robertphillips
2016/04/20 18:34:53
This flag is going away right?
reed1
2016/04/20 19:42:50
Done in #6
| |
1474 void internalSaveLayer(const SaveLayerRec&, SaveLayerStrategy); | 1475 void internalSaveLayer(const SaveLayerRec&, SaveLayerStrategy, bool doAAInMa trixFilter = false); |
1475 void internalDrawDevice(SkBaseDevice*, int x, int y, const SkPaint*, bool is BitmapDevice); | 1476 void internalDrawDevice(SkBaseDevice*, int x, int y, const SkPaint*, bool is BitmapDevice); |
1476 | 1477 |
1477 // shared by save() and saveLayer() | 1478 // shared by save() and saveLayer() |
1478 void internalSave(); | 1479 void internalSave(); |
1479 void internalRestore(); | 1480 void internalRestore(); |
1480 static void DrawRect(const SkDraw& draw, const SkPaint& paint, | 1481 static void DrawRect(const SkDraw& draw, const SkPaint& paint, |
1481 const SkRect& r, SkScalar textSize); | 1482 const SkRect& r, SkScalar textSize); |
1482 static void DrawTextDecorations(const SkDraw& draw, const SkPaint& paint, | 1483 static void DrawTextDecorations(const SkDraw& draw, const SkPaint& paint, |
1483 const char text[], size_t byteLength, | 1484 const char text[], size_t byteLength, |
1484 SkScalar x, SkScalar y); | 1485 SkScalar x, SkScalar y); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1576 | 1577 |
1577 class SkCanvasClipVisitor { | 1578 class SkCanvasClipVisitor { |
1578 public: | 1579 public: |
1579 virtual ~SkCanvasClipVisitor(); | 1580 virtual ~SkCanvasClipVisitor(); |
1580 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1581 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1581 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1582 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1582 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1583 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1583 }; | 1584 }; |
1584 | 1585 |
1585 #endif | 1586 #endif |
OLD | NEW |