OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 SkPaintPriv_DEFINED | 8 #ifndef SkPaintPriv_DEFINED |
9 #define SkPaintPriv_DEFINED | 9 #define SkPaintPriv_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 | 12 |
13 class SkBitmap; | 13 class SkBitmap; |
14 class SkImage; | 14 class SkImage; |
15 class SkPaint; | 15 class SkPaint; |
16 | 16 |
17 enum SkPaintBitmapOpacity { | 17 class SkPaintPriv { |
18 // No content replaces the paint's color | 18 public: |
19 kNoBitmap_SkPaintBitmapOpacity = 0, | 19 enum ShaderOverrideOpacity { |
20 // The color replacement is known to be opaque | 20 kNone_ShaderOverrideOpacity, //!< there is no overriding shader ( bitmap or image) |
21 kOpaque_SkPaintBitmapOpacity = 1, | 21 kOpaque_ShaderOverrideOpacity, //!< the overriding shader is opaque |
robertphillips
2015/07/15 15:53:51
kNotOpaque -> kUnknownOpacity ?
reed1
2015/07/15 18:03:03
Hmm, I deliberately changed that 'cause it felt co
| |
22 // We have no information about the color or it is transparent | 22 kNotOpaque_ShaderOverrideOpacity, //!< the overriding shader may not b e opaque |
23 kUnknown_SkPaintBitmapOpacity = 2 | 23 }; |
24 | |
25 /** | |
robertphillips
2015/07/15 15:53:51
space between 'with' and 'this' ?
reed1
2015/07/15 18:03:03
Done.
| |
26 * Returns true if drawing withthis paint (or NULL) will ovewrite all affe cted pixels. | |
robertphillips
2015/07/15 15:53:51
// The 'overrideOpacity' parameter allows the call
reed1
2015/07/15 18:03:03
Done.
| |
27 * | |
28 * Note: returns conservative true, meaning it may return false even though the paint might | |
29 * in fact overwrite its pixels. | |
30 */ | |
31 static bool Overwrites(const SkPaint* paint, | |
32 ShaderOverrideOpacity = kNone_ShaderOverrideOpacity); | |
33 | |
34 /** | |
35 * Returns true if drawing this bitmap with this paint (or NULL) will ovewr ite all affected | |
36 * pixels. | |
37 */ | |
38 static bool Overwrites(const SkPaint* paint, const SkBitmap&); | |
39 | |
40 /** | |
41 * Returns true if drawing this image with this paint (or NULL) will ovewri te all affected | |
42 * pixels. | |
43 */ | |
robertphillips
2015/07/15 15:53:51
Why not a 'const SkImage&' ?
I looks like the imag
reed1
2015/07/15 18:03:03
True, but this is consistent with all the rest of
| |
44 static bool Overwrites(const SkPaint* paint, const SkImage*); | |
24 }; | 45 }; |
25 | 46 |
26 /** Returns true if draw calls that use the paint will completely occlude | |
27 canvas contents that are covered by the draw. | |
28 @param paint The paint to be analyzed, NULL is equivalent to | |
29 the default paint. | |
30 @param contentType The type of the content that will be drawn, | |
31 kNoBitmap_SkPaintBitmapOpacity if there is no content in adition to the paint. | |
32 @return true if paint is opaque | |
33 */ | |
34 bool isPaintOpaque(const SkPaint* paint, SkPaintBitmapOpacity contentType); | |
35 | |
36 /** Returns true if draw calls that use the paint will completely occlude | |
37 canvas contents that are covered by the draw. | |
38 @param paint The paint to be analyzed, NULL is equivalent to | |
39 the default paint. | |
40 @param bmpReplacesShader a bitmap to be used in place of the paint's | |
41 shader. | |
42 @return true if paint is opaque | |
43 */ | |
44 bool isPaintOpaque(const SkPaint* paint, const SkBitmap* bmpReplacesShader = NUL L); | |
45 bool isPaintOpaque(const SkPaint* paint, const SkImage* image); | |
46 | |
47 #endif | 47 #endif |
OLD | NEW |