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 SkPaint_DEFINED | 8 #ifndef SkPaint_DEFINED |
9 #define SkPaint_DEFINED | 9 #define SkPaint_DEFINED |
10 | 10 |
11 #include "SkColor.h" | 11 #include "SkColor.h" |
| 12 #include "SkDrawLooper.h" |
12 #include "SkFilterQuality.h" | 13 #include "SkFilterQuality.h" |
13 #include "SkMatrix.h" | 14 #include "SkMatrix.h" |
14 #include "SkXfermode.h" | 15 #include "SkXfermode.h" |
15 | 16 |
16 class SkAnnotation; | 17 class SkAnnotation; |
17 class SkAutoDescriptor; | 18 class SkAutoDescriptor; |
18 class SkAutoGlyphCache; | 19 class SkAutoGlyphCache; |
19 class SkColorFilter; | 20 class SkColorFilter; |
20 class SkData; | 21 class SkData; |
21 class SkDescriptor; | 22 class SkDescriptor; |
22 class SkDrawLooper; | |
23 class SkReadBuffer; | 23 class SkReadBuffer; |
24 class SkWriteBuffer; | 24 class SkWriteBuffer; |
25 class SkGlyph; | 25 class SkGlyph; |
26 struct SkRect; | 26 struct SkRect; |
27 class SkGlyphCache; | 27 class SkGlyphCache; |
28 class SkImageFilter; | 28 class SkImageFilter; |
29 class SkMaskFilter; | 29 class SkMaskFilter; |
30 class SkPath; | 30 class SkPath; |
31 class SkPathEffect; | 31 class SkPathEffect; |
32 struct SkPoint; | 32 struct SkPoint; |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 // mean that we need not draw at all (e.g. SrcOver + 0-alpha) | 902 // mean that we need not draw at all (e.g. SrcOver + 0-alpha) |
903 bool nothingToDraw() const; | 903 bool nothingToDraw() const; |
904 | 904 |
905 /////////////////////////////////////////////////////////////////////////// | 905 /////////////////////////////////////////////////////////////////////////// |
906 // would prefer to make these private... | 906 // would prefer to make these private... |
907 | 907 |
908 /** Returns true if the current paint settings allow for fast computation of | 908 /** Returns true if the current paint settings allow for fast computation of |
909 bounds (i.e. there is nothing complex like a patheffect that would make | 909 bounds (i.e. there is nothing complex like a patheffect that would make |
910 the bounds computation expensive. | 910 the bounds computation expensive. |
911 */ | 911 */ |
912 bool canComputeFastBounds() const; | 912 bool canComputeFastBounds() const { |
| 913 if (this->getLooper()) { |
| 914 return this->getLooper()->canComputeFastBounds(*this); |
| 915 } |
| 916 return !this->getRasterizer(); |
| 917 } |
913 | 918 |
914 /** Only call this if canComputeFastBounds() returned true. This takes a | 919 /** Only call this if canComputeFastBounds() returned true. This takes a |
915 raw rectangle (the raw bounds of a shape), and adjusts it for stylistic | 920 raw rectangle (the raw bounds of a shape), and adjusts it for stylistic |
916 effects in the paint (e.g. stroking). If needed, it uses the storage | 921 effects in the paint (e.g. stroking). If needed, it uses the storage |
917 rect parameter. It returns the adjusted bounds that can then be used | 922 rect parameter. It returns the adjusted bounds that can then be used |
918 for quickReject tests. | 923 for quickReject tests. |
919 | 924 |
920 The returned rect will either be orig or storage, thus the caller | 925 The returned rect will either be orig or storage, thus the caller |
921 should not rely on storage being set to the result, but should always | 926 should not rely on storage being set to the result, but should always |
922 use the retured value. It is legal for orig and storage to be the same | 927 use the retured value. It is legal for orig and storage to be the same |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 friend class GrStencilAndCoverTextContext; | 1094 friend class GrStencilAndCoverTextContext; |
1090 friend class GrPathRendering; | 1095 friend class GrPathRendering; |
1091 friend class GrTextContext; | 1096 friend class GrTextContext; |
1092 friend class GrGLPathRendering; | 1097 friend class GrGLPathRendering; |
1093 friend class SkScalerContext; | 1098 friend class SkScalerContext; |
1094 friend class SkTextToPathIter; | 1099 friend class SkTextToPathIter; |
1095 friend class SkCanonicalizePaint; | 1100 friend class SkCanonicalizePaint; |
1096 }; | 1101 }; |
1097 | 1102 |
1098 #endif | 1103 #endif |
OLD | NEW |