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

Unified Diff: skia/ext/analysis_canvas.cc

Issue 13726013: Smart layer invalidation for LCD text. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed compile error Created 7 years, 8 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
« no previous file with comments | « skia/ext/analysis_canvas.h ('k') | skia/ext/analysis_canvas_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/analysis_canvas.cc
diff --git a/skia/ext/analysis_canvas.cc b/skia/ext/analysis_canvas.cc
index 93580b013288acecc3548baf0af3087261fb681c..0af76f276cb4be0b472b273117e28c8e960aa10a 100644
--- a/skia/ext/analysis_canvas.cc
+++ b/skia/ext/analysis_canvas.cc
@@ -96,8 +96,8 @@ AnalysisDevice::AnalysisDevice(const SkBitmap& bm)
, isForcedNotSolid_(false)
, isForcedNotTransparent_(false)
, isSolidColor_(false)
- , isTransparent_(false) {
-
+ , isTransparent_(false)
+ , hasText_(false) {
}
AnalysisDevice::~AnalysisDevice() {
@@ -118,6 +118,10 @@ bool AnalysisDevice::isTransparent() const {
return isTransparent_;
}
+bool AnalysisDevice::hasText() const {
+ return hasText_;
+}
+
void AnalysisDevice::setForceNotSolid(bool flag) {
isForcedNotSolid_ = flag;
if (isForcedNotSolid_)
@@ -181,6 +185,7 @@ void AnalysisDevice::clear(SkColor color) {
estimatedCost_ += kUnknownExpensiveCost;
isTransparent_ = (!isForcedNotTransparent_ && SkColorGetA(color) == 0);
+ hasText_ = false;
if (!isForcedNotSolid_ && SkColorGetA(color) == 255) {
isSolidColor_ = true;
@@ -246,6 +251,7 @@ void AnalysisDevice::drawRect(const SkDraw& draw, const SkRect& rect,
!isForcedNotTransparent_ &&
xferMode == SkXfermode::kClear_Mode) {
isTransparent_ = true;
+ hasText_ = false;
}
else if (paint.getAlpha() != 0 ||
xferMode != SkXfermode::kSrc_Mode) {
@@ -262,6 +268,7 @@ void AnalysisDevice::drawRect(const SkDraw& draw, const SkRect& rect,
doesCoverCanvas) {
isSolidColor_ = true;
color_ = paint.getColor();
+ hasText_ = false;
}
else {
isSolidColor_ = false;
@@ -346,6 +353,7 @@ void AnalysisDevice::drawText(const SkDraw&, const void* text, size_t len,
}
isSolidColor_ = false;
isTransparent_ = false;
+ hasText_ = true;
}
void AnalysisDevice::drawPosText(const SkDraw& draw, const void* text,
@@ -361,6 +369,7 @@ void AnalysisDevice::drawPosText(const SkDraw& draw, const void* text,
}
isSolidColor_ = false;
isTransparent_ = false;
+ hasText_ = true;
}
void AnalysisDevice::drawTextOnPath(const SkDraw&, const void* text,
@@ -374,6 +383,7 @@ void AnalysisDevice::drawTextOnPath(const SkDraw&, const void* text,
}
isSolidColor_ = false;
isTransparent_ = false;
+ hasText_ = true;
}
#ifdef SK_BUILD_FOR_ANDROID
@@ -388,6 +398,7 @@ void AnalysisDevice::drawPosTextOnPath(const SkDraw& draw, const void* text,
}
isSolidColor_ = false;
isTransparent_ = false;
+ hasText_ = true;
}
#endif
@@ -441,6 +452,10 @@ bool AnalysisCanvas::isTransparent() const {
return (static_cast<AnalysisDevice*>(getDevice()))->isTransparent();
}
+bool AnalysisCanvas::hasText() const {
+ return (static_cast<AnalysisDevice*>(getDevice()))->hasText();
+}
+
int AnalysisCanvas::getEstimatedCost() const {
return (static_cast<AnalysisDevice*>(getDevice()))->getEstimatedCost();
}
« no previous file with comments | « skia/ext/analysis_canvas.h ('k') | skia/ext/analysis_canvas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698