Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: src/core/SkPaintPriv.h

Issue 1236023004: have canvas send discard instead of retain if the draw would overwrite everything (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 class SkPaintPriv { 17 class SkPaintPriv {
18 public: 18 public:
19 enum ShaderOverrideOpacity {
20 kNone_ShaderOverrideOpacity, //!< there is no overriding shader ( bitmap or image)
21 kOpaque_ShaderOverrideOpacity, //!< the overriding shader is opaque
22 kNotOpaque_ShaderOverrideOpacity, //!< the overriding shader may not b e opaque
23 };
24
19 /** 25 /**
20 * Returns true if drawing with this paint (or NULL) will ovewrite all affe cted pixels. 26 * Returns true if drawing with this paint (or NULL) will ovewrite all affe cted pixels.
21 * 27 *
22 * Note: returns conservative true, meaning it may return false even though the paint might 28 * Note: returns conservative true, meaning it may return false even though the paint might
23 * in fact overwrite its pixels. 29 * in fact overwrite its pixels.
24 */ 30 */
25 static bool Overwrites(const SkPaint& paint); 31 static bool Overwrites(const SkPaint* paint, ShaderOverrideOpacity);
32
33 static bool Overwrites(const SkPaint& paint) {
34 return Overwrites(&paint, kNone_ShaderOverrideOpacity);
35 }
26 36
27 /** 37 /**
28 * Returns true if drawing this bitmap with this paint (or NULL) will ovewr ite all affected 38 * Returns true if drawing this bitmap with this paint (or NULL) will ovewr ite all affected
29 * pixels. 39 * pixels.
30 */ 40 */
31 static bool Overwrites(const SkBitmap&, const SkPaint* paint); 41 static bool Overwrites(const SkBitmap&, const SkPaint* paint);
32 42
33 /** 43 /**
34 * Returns true if drawing this image with this paint (or NULL) will ovewri te all affected 44 * Returns true if drawing this image with this paint (or NULL) will ovewri te all affected
35 * pixels. 45 * pixels.
36 */ 46 */
37 static bool Overwrites(const SkImage*, const SkPaint* paint); 47 static bool Overwrites(const SkImage*, const SkPaint* paint);
38 }; 48 };
39 49
40 #endif 50 #endif
OLDNEW
« src/core/SkCanvas.cpp ('K') | « src/core/SkCanvas.cpp ('k') | src/core/SkPaintPriv.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698