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

Unified Diff: src/core/SkPaintPriv.cpp

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 side-by-side diff with in-line comments
Download patch
Index: src/core/SkPaintPriv.cpp
diff --git a/src/core/SkPaintPriv.cpp b/src/core/SkPaintPriv.cpp
index a4a7327110ff930e48b7986bbe95b5ddf8206f0a..6725cb49befd4c191bda3b817d7a7eb82d0915ce 100644
--- a/src/core/SkPaintPriv.cpp
+++ b/src/core/SkPaintPriv.cpp
@@ -5,26 +5,19 @@
* found in the LICENSE file.
*/
-#include "SkPaintPriv.h"
-
#include "SkBitmap.h"
#include "SkColorFilter.h"
+#include "SkPaintPriv.h"
#include "SkImage.h"
#include "SkPaint.h"
#include "SkShader.h"
-enum ShaderOverrideOpacity {
- kNone_ShaderOverrideOpacity, //!< there is no overriding shader (bitmap or image)
- kOpaque_ShaderOverrideOpacity, //!< the overriding shader is opaque
- kNotOpaque_ShaderOverrideOpacity, //!< the overriding shader may not be opaque
-};
-
static bool changes_alpha(const SkPaint& paint) {
SkColorFilter* cf = paint.getColorFilter();
return cf && !(cf->getFlags() & SkColorFilter::kAlphaUnchanged_Flag);
}
-static bool overwrites(const SkPaint* paint, ShaderOverrideOpacity overrideOpacity) {
+bool SkPaintPriv::Overwrites(const SkPaint* paint, ShaderOverrideOpacity overrideOpacity) {
if (!paint) {
// No paint means we default to SRC_OVER, so we overwrite iff our shader-override
// is opaque, or we don't have one.
@@ -51,16 +44,12 @@ static bool overwrites(const SkPaint* paint, ShaderOverrideOpacity overrideOpaci
return SkXfermode::IsOpaque(paint->getXfermode(), opacityType);
}
-bool SkPaintPriv::Overwrites(const SkPaint& paint) {
- return overwrites(&paint, kNone_ShaderOverrideOpacity);
-}
-
bool SkPaintPriv::Overwrites(const SkBitmap& bitmap, const SkPaint* paint) {
- return overwrites(paint, bitmap.isOpaque() ? kOpaque_ShaderOverrideOpacity
+ return Overwrites(paint, bitmap.isOpaque() ? kOpaque_ShaderOverrideOpacity
: kNotOpaque_ShaderOverrideOpacity);
}
bool SkPaintPriv::Overwrites(const SkImage* image, const SkPaint* paint) {
- return overwrites(paint, image->isOpaque() ? kOpaque_ShaderOverrideOpacity
+ return Overwrites(paint, image->isOpaque() ? kOpaque_ShaderOverrideOpacity
: kNotOpaque_ShaderOverrideOpacity);
}
« src/core/SkCanvas.cpp ('K') | « src/core/SkPaintPriv.h ('k') | src/image/SkSurface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698