• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2013 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkPaintPriv_DEFINED
9 #define SkPaintPriv_DEFINED
10 
11 #include "SkPaint.h"
12 
13 class SkBitmap;
14 class SkImage;
15 
16 class SkPaintPriv {
17 public:
18     enum ShaderOverrideOpacity {
19         kNone_ShaderOverrideOpacity,        //!< there is no overriding shader (bitmap or image)
20         kOpaque_ShaderOverrideOpacity,      //!< the overriding shader is opaque
21         kNotOpaque_ShaderOverrideOpacity,   //!< the overriding shader may not be opaque
22     };
23 
24     /**
25      *  Returns true if drawing with this paint (or nullptr) will ovewrite all affected pixels.
26      *
27      *  Note: returns conservative true, meaning it may return false even though the paint might
28      *        in fact overwrite its pixels.
29      */
30     static bool Overwrites(const SkPaint* paint, ShaderOverrideOpacity);
31 
Overwrites(const SkPaint & paint)32     static bool Overwrites(const SkPaint& paint) {
33         return Overwrites(&paint, kNone_ShaderOverrideOpacity);
34     }
35 
36     /**
37      *  Returns true if drawing this bitmap with this paint (or nullptr) will ovewrite all affected
38      *  pixels.
39      */
40     static bool Overwrites(const SkBitmap&, const SkPaint* paint);
41 
42     /**
43      *  Returns true if drawing this image with this paint (or nullptr) will ovewrite all affected
44      *  pixels.
45      */
46     static bool Overwrites(const SkImage*, const SkPaint* paint);
47 
48     static void ScaleFontMetrics(SkPaint::FontMetrics*, SkScalar);
49 };
50 
51 #endif
52