Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: include/core/SkCanvas.h

Issue 1236023004: have canvas send discard instead of retain if the draw would overwrite everything (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: wip Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | src/core/SkCanvas.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 // Clip rectangle bounds. Called internally by saveLayer. 1350 // Clip rectangle bounds. Called internally by saveLayer.
1351 // returns false if the entire rectangle is entirely clipped out 1351 // returns false if the entire rectangle is entirely clipped out
1352 // If non-NULL, The imageFilter parameter will be used to expand the clip 1352 // If non-NULL, The imageFilter parameter will be used to expand the clip
1353 // and offscreen bounds for any margin required by the filter DAG. 1353 // and offscreen bounds for any margin required by the filter DAG.
1354 bool clipRectBounds(const SkRect* bounds, SaveFlags flags, 1354 bool clipRectBounds(const SkRect* bounds, SaveFlags flags,
1355 SkIRect* intersection, 1355 SkIRect* intersection,
1356 const SkImageFilter* imageFilter = NULL); 1356 const SkImageFilter* imageFilter = NULL);
1357 1357
1358 // notify our surface (if we have one) that we are about to draw, so it 1358 // notify our surface (if we have one) that we are about to draw, so it
1359 // can perform copy-on-write or invalidate any cached images 1359 // can perform copy-on-write or invalidate any cached images
1360 void predrawNotify(); 1360 void predrawNotify(bool completeOverwrite = false);
1361 void predrawNotify(const SkRect*, const SkPaint*);
1361 1362
1362 private: 1363 private:
1363 class MCRec; 1364 class MCRec;
1364 1365
1365 SkAutoTUnref<SkClipStack> fClipStack; 1366 SkAutoTUnref<SkClipStack> fClipStack;
1366 SkDeque fMCStack; 1367 SkDeque fMCStack;
1367 // points to top of stack 1368 // points to top of stack
1368 MCRec* fMCRec; 1369 MCRec* fMCRec;
1369 // the first N recs that can fit here mean we won't call malloc 1370 // the first N recs that can fit here mean we won't call malloc
1370 enum { 1371 enum {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 void internalRestore(); 1447 void internalRestore();
1447 static void DrawRect(const SkDraw& draw, const SkPaint& paint, 1448 static void DrawRect(const SkDraw& draw, const SkPaint& paint,
1448 const SkRect& r, SkScalar textSize); 1449 const SkRect& r, SkScalar textSize);
1449 static void DrawTextDecorations(const SkDraw& draw, const SkPaint& paint, 1450 static void DrawTextDecorations(const SkDraw& draw, const SkPaint& paint,
1450 const char text[], size_t byteLength, 1451 const char text[], size_t byteLength,
1451 SkScalar x, SkScalar y); 1452 SkScalar x, SkScalar y);
1452 1453
1453 // only for canvasutils 1454 // only for canvasutils
1454 const SkRegion& internal_private_getTotalClip() const; 1455 const SkRegion& internal_private_getTotalClip() const;
1455 1456
1457 bool willOverwriteAllPixels(const SkRect*, const SkPaint*) const;
1458
1459
1456 /* These maintain a cache of the clip bounds in local coordinates, 1460 /* These maintain a cache of the clip bounds in local coordinates,
1457 (converted to 2s-compliment if floats are slow). 1461 (converted to 2s-compliment if floats are slow).
1458 */ 1462 */
1459 mutable SkRect fCachedLocalClipBounds; 1463 mutable SkRect fCachedLocalClipBounds;
1460 mutable bool fCachedLocalClipBoundsDirty; 1464 mutable bool fCachedLocalClipBoundsDirty;
1461 bool fAllowSoftClip; 1465 bool fAllowSoftClip;
1462 bool fAllowSimplifyClip; 1466 bool fAllowSimplifyClip;
1463 bool fConservativeRasterClip; 1467 bool fConservativeRasterClip;
1464 1468
1465 const SkRect& getLocalClipBounds() const { 1469 const SkRect& getLocalClipBounds() const {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 1589
1586 class SkCanvasClipVisitor { 1590 class SkCanvasClipVisitor {
1587 public: 1591 public:
1588 virtual ~SkCanvasClipVisitor(); 1592 virtual ~SkCanvasClipVisitor();
1589 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1593 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1590 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1594 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1591 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1595 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1592 }; 1596 };
1593 1597
1594 #endif 1598 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | src/core/SkCanvas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698