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

Unified Diff: cc/output/filter_operation.cc

Issue 317663005: Scale the ALPHA_THRESHOLD filter's region based on the device scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove call to SetAlphaShape from this cl Created 6 years, 6 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: cc/output/filter_operation.cc
diff --git a/cc/output/filter_operation.cc b/cc/output/filter_operation.cc
index 7682853b2e29f202085ee191965e22a503c75986..44f471308227c6f137e492c85ec913519f6a3d71 100644
--- a/cc/output/filter_operation.cc
+++ b/cc/output/filter_operation.cc
@@ -26,8 +26,9 @@ bool FilterOperation::operator==(const FilterOperation& other) const {
return image_filter_.get() == other.image_filter_.get();
if (type_ == ALPHA_THRESHOLD) {
return region_ == other.region_ &&
- amount_ == other.amount_ &&
- outer_threshold_ == other.outer_threshold_;
+ device_scale_factor_ == other.device_scale_factor_ &&
+ amount_ == other.amount_ &&
+ outer_threshold_ == other.outer_threshold_;
}
return amount_ == other.amount_;
}
@@ -38,7 +39,8 @@ FilterOperation::FilterOperation(FilterType type, float amount)
outer_threshold_(0),
drop_shadow_offset_(0, 0),
drop_shadow_color_(0),
- zoom_inset_(0) {
+ zoom_inset_(0),
+ device_scale_factor_(1.f) {
DCHECK_NE(type_, DROP_SHADOW);
DCHECK_NE(type_, COLOR_MATRIX);
DCHECK_NE(type_, REFERENCE);
@@ -54,7 +56,8 @@ FilterOperation::FilterOperation(FilterType type,
outer_threshold_(0),
drop_shadow_offset_(offset),
drop_shadow_color_(color),
- zoom_inset_(0) {
+ zoom_inset_(0),
+ device_scale_factor_(1.f) {
DCHECK_EQ(type_, DROP_SHADOW);
memset(matrix_, 0, sizeof(matrix_));
}
@@ -65,7 +68,8 @@ FilterOperation::FilterOperation(FilterType type, SkScalar matrix[20])
outer_threshold_(0),
drop_shadow_offset_(0, 0),
drop_shadow_color_(0),
- zoom_inset_(0) {
+ zoom_inset_(0),
+ device_scale_factor_(1.f) {
DCHECK_EQ(type_, COLOR_MATRIX);
memcpy(matrix_, matrix, sizeof(matrix_));
}
@@ -76,7 +80,8 @@ FilterOperation::FilterOperation(FilterType type, float amount, int inset)
outer_threshold_(0),
drop_shadow_offset_(0, 0),
drop_shadow_color_(0),
- zoom_inset_(inset) {
+ zoom_inset_(inset),
+ device_scale_factor_(1.f) {
DCHECK_EQ(type_, ZOOM);
memset(matrix_, 0, sizeof(matrix_));
}
@@ -90,13 +95,15 @@ FilterOperation::FilterOperation(
drop_shadow_offset_(0, 0),
drop_shadow_color_(0),
image_filter_(image_filter),
- zoom_inset_(0) {
+ zoom_inset_(0),
+ device_scale_factor_(1.f) {
DCHECK_EQ(type_, REFERENCE);
memset(matrix_, 0, sizeof(matrix_));
}
FilterOperation::FilterOperation(FilterType type,
const SkRegion& region,
+ float device_scale_factor,
float inner_threshold,
float outer_threshold)
: type_(type),
@@ -105,7 +112,8 @@ FilterOperation::FilterOperation(FilterType type,
drop_shadow_offset_(0, 0),
drop_shadow_color_(0),
zoom_inset_(0),
- region_(region) {
+ region_(region),
+ device_scale_factor_(device_scale_factor) {
DCHECK_EQ(type_, ALPHA_THRESHOLD);
memset(matrix_, 0, sizeof(matrix_));
}
@@ -118,7 +126,8 @@ FilterOperation::FilterOperation(const FilterOperation& other)
drop_shadow_color_(other.drop_shadow_color_),
image_filter_(other.image_filter_),
zoom_inset_(other.zoom_inset_),
- region_(other.region_) {
+ region_(other.region_),
+ device_scale_factor_(other.device_scale_factor_) {
memcpy(matrix_, other.matrix_, sizeof(matrix_));
}
@@ -162,7 +171,8 @@ static FilterOperation CreateNoOpFilter(FilterOperation::FilterType type) {
return FilterOperation::CreateReferenceFilter(
skia::RefPtr<SkImageFilter>());
case FilterOperation::ALPHA_THRESHOLD:
- return FilterOperation::CreateAlphaThresholdFilter(SkRegion(), 1.f, 0.f);
+ return FilterOperation::CreateAlphaThresholdFilter(
+ SkRegion(), 1.f, 1.f, 0.f);
}
NOTREACHED();
return FilterOperation::CreateEmptyFilter();
@@ -249,7 +259,9 @@ FilterOperation FilterOperation::Blend(const FilterOperation* from,
from_op.outer_threshold(),
to_op.outer_threshold()),
to_op.type()));
- blended_filter.set_region(to_op.region());
+ const FilterOperation& copy_op = progress > 0.5 ? to_op : from_op;
+ blended_filter.set_region(copy_op.region());
+ blended_filter.set_device_scale_factor(copy_op.device_scale_factor());
}
return blended_filter;
@@ -310,6 +322,7 @@ scoped_ptr<base::Value> FilterOperation::AsValue() const {
region_value->AppendInteger(it.rect().height());
}
value->Set("region", region_value.release());
+ value->SetDouble("device_scale_factor", device_scale_factor_);
}
break;
}

Powered by Google App Engine
This is Rietveld 408576698