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 #include "SkPaintPriv.h" | 8 #include "SkPaintPriv.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
11 #include "SkColorFilter.h" | 11 #include "SkColorFilter.h" |
12 #include "SkImage.h" | |
13 #include "SkPaint.h" | 12 #include "SkPaint.h" |
14 #include "SkShader.h" | 13 #include "SkShader.h" |
15 | 14 |
16 bool isPaintOpaque(const SkPaint* paint, SkPaintBitmapOpacity contentType) { | 15 bool isPaintOpaque(const SkPaint* paint, SkPaintBitmapOpacity contentType) { |
17 if (!paint) { | 16 if (!paint) { |
18 return contentType != kUnknown_SkPaintBitmapOpacity; | 17 return contentType != kUnknown_SkPaintBitmapOpacity; |
19 } | 18 } |
20 SkXfermode::SrcColorOpacity opacityType = SkXfermode::kUnknown_SrcColorOpaci
ty; | 19 SkXfermode::SrcColorOpacity opacityType = SkXfermode::kUnknown_SrcColorOpaci
ty; |
21 | 20 |
22 if (!paint->getColorFilter() || | 21 if (!paint->getColorFilter() || |
(...skipping 20 matching lines...) Expand all Loading... |
43 | 42 |
44 if(!bmpReplacesShader) | 43 if(!bmpReplacesShader) |
45 contentType = kNoBitmap_SkPaintBitmapOpacity; | 44 contentType = kNoBitmap_SkPaintBitmapOpacity; |
46 else if(bmpReplacesShader->isOpaque()) | 45 else if(bmpReplacesShader->isOpaque()) |
47 contentType = kOpaque_SkPaintBitmapOpacity; | 46 contentType = kOpaque_SkPaintBitmapOpacity; |
48 else | 47 else |
49 contentType = kUnknown_SkPaintBitmapOpacity; | 48 contentType = kUnknown_SkPaintBitmapOpacity; |
50 | 49 |
51 return isPaintOpaque(paint, contentType); | 50 return isPaintOpaque(paint, contentType); |
52 } | 51 } |
53 | |
54 bool isPaintOpaque(const SkPaint* paint, const SkImage* image) { | |
55 return isPaintOpaque(paint, image->isOpaque() ? | |
56 kOpaque_SkPaintBitmapOpacity : kUnknown_SkPaintBitmapOp
acity); | |
57 } | |
OLD | NEW |