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

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

Issue 2225393002: Optimized implementation of quickReject() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments Created 4 years, 4 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
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 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 * paint (or default if null) would overwrite the entire root device of the canvas 1598 * paint (or default if null) would overwrite the entire root device of the canvas
1599 * (i.e. the canvas' surface if it had one). 1599 * (i.e. the canvas' surface if it had one).
1600 */ 1600 */
1601 bool wouldOverwriteEntireSurface(const SkRect*, const SkPaint*, ShaderOverri deOpacity) const; 1601 bool wouldOverwriteEntireSurface(const SkRect*, const SkPaint*, ShaderOverri deOpacity) const;
1602 1602
1603 /** 1603 /**
1604 * Returns true if the paint's imagefilter can be invoked directly, without needed a layer. 1604 * Returns true if the paint's imagefilter can be invoked directly, without needed a layer.
1605 */ 1605 */
1606 bool canDrawBitmapAsSprite(SkScalar x, SkScalar y, int w, int h, const SkPai nt&); 1606 bool canDrawBitmapAsSprite(SkScalar x, SkScalar y, int w, int h, const SkPai nt&);
1607 1607
1608 /* These maintain a cache of the clip bounds in local coordinates, 1608
1609 (converted to 2s-compliment if floats are slow). 1609 /**
1610 * Keep track of the device clip bounds and if the matrix is scale-translat e. This allows
1611 * us to do a fast quick reject in the common case.
1610 */ 1612 */
1611 mutable SkRect fCachedLocalClipBounds; 1613 bool fConservativeIsScaleTranslate;
1612 mutable bool fCachedLocalClipBoundsDirty; 1614 SkRect fDeviceClipBounds;
1615 void setCachedClipDeviceBounds(const SkIRect& bounds);
1616
1613 bool fAllowSoftClip; 1617 bool fAllowSoftClip;
1614 bool fAllowSimplifyClip; 1618 bool fAllowSimplifyClip;
1615 const bool fConservativeRasterClip; 1619 const bool fConservativeRasterClip;
1616 1620
1617 const SkRect& getLocalClipBounds() const {
1618 if (fCachedLocalClipBoundsDirty) {
1619 if (!this->getClipBounds(&fCachedLocalClipBounds)) {
1620 fCachedLocalClipBounds.setEmpty();
1621 }
1622 fCachedLocalClipBoundsDirty = false;
1623 }
1624 return fCachedLocalClipBounds;
1625 }
1626
1627 class AutoValidateClip : ::SkNoncopyable { 1621 class AutoValidateClip : ::SkNoncopyable {
1628 public: 1622 public:
1629 explicit AutoValidateClip(SkCanvas* canvas) : fCanvas(canvas) { 1623 explicit AutoValidateClip(SkCanvas* canvas) : fCanvas(canvas) {
1630 fCanvas->validateClip(); 1624 fCanvas->validateClip();
1631 } 1625 }
1632 ~AutoValidateClip() { fCanvas->validateClip(); } 1626 ~AutoValidateClip() { fCanvas->validateClip(); }
1633 1627
1634 private: 1628 private:
1635 const SkCanvas* fCanvas; 1629 const SkCanvas* fCanvas;
1636 }; 1630 };
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 1677
1684 class SkCanvasClipVisitor { 1678 class SkCanvasClipVisitor {
1685 public: 1679 public:
1686 virtual ~SkCanvasClipVisitor(); 1680 virtual ~SkCanvasClipVisitor();
1687 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1681 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1688 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1682 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1689 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1683 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1690 }; 1684 };
1691 1685
1692 #endif 1686 #endif
OLDNEW
« no previous file with comments | « bench/QuickRejectBench.cpp ('k') | include/core/SkPostConfig.h » ('j') | src/core/SkCanvas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698