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" |
12 #include "SkPaint.h" | 13 #include "SkPaint.h" |
13 #include "SkShader.h" | 14 #include "SkShader.h" |
14 | 15 |
15 bool isPaintOpaque(const SkPaint* paint, SkPaintBitmapOpacity contentType) { | 16 bool isPaintOpaque(const SkPaint* paint, SkPaintBitmapOpacity contentType) { |
16 if (!paint) { | 17 if (!paint) { |
17 return contentType != kUnknown_SkPaintBitmapOpacity; | 18 return contentType != kUnknown_SkPaintBitmapOpacity; |
18 } | 19 } |
19 SkXfermode::SrcColorOpacity opacityType = SkXfermode::kUnknown_SrcColorOpaci
ty; | 20 SkXfermode::SrcColorOpacity opacityType = SkXfermode::kUnknown_SrcColorOpaci
ty; |
20 | 21 |
21 if (!paint->getColorFilter() || | 22 if (!paint->getColorFilter() || |
(...skipping 20 matching lines...) Expand all Loading... |
42 | 43 |
43 if(!bmpReplacesShader) | 44 if(!bmpReplacesShader) |
44 contentType = kNoBitmap_SkPaintBitmapOpacity; | 45 contentType = kNoBitmap_SkPaintBitmapOpacity; |
45 else if(bmpReplacesShader->isOpaque()) | 46 else if(bmpReplacesShader->isOpaque()) |
46 contentType = kOpaque_SkPaintBitmapOpacity; | 47 contentType = kOpaque_SkPaintBitmapOpacity; |
47 else | 48 else |
48 contentType = kUnknown_SkPaintBitmapOpacity; | 49 contentType = kUnknown_SkPaintBitmapOpacity; |
49 | 50 |
50 return isPaintOpaque(paint, contentType); | 51 return isPaintOpaque(paint, contentType); |
51 } | 52 } |
| 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 |