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

Unified Diff: ui/compositor/layer.cc

Issue 10915140: Add the partial screen magnifier to Chrome OS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Code review fixes Created 8 years, 3 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
« ui/compositor/layer.h ('K') | « ui/compositor/layer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer.cc
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index 7e7964900876cb70a32b835c53a83ef05d51e087..1e781a823c9f896842ec1605c83bcc4c35cc2adc 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -62,6 +62,9 @@ Layer::Layer()
layer_inverted_(false),
layer_mask_(NULL),
layer_mask_back_link_(NULL),
+ zoom_x_offset_(0),
+ zoom_y_offset_(0),
+ zoom_(1),
delegate_(NULL),
web_layer_(NULL),
scale_content_(true),
@@ -85,6 +88,9 @@ Layer::Layer(LayerType type)
layer_inverted_(false),
layer_mask_(NULL),
layer_mask_back_link_(NULL),
+ zoom_x_offset_(0),
+ zoom_y_offset_(0),
+ zoom_(1),
delegate_(NULL),
scale_content_(true),
device_scale_factor_(1.0f) {
@@ -232,12 +238,7 @@ float Layer::GetCombinedOpacity() const {
void Layer::SetBackgroundBlur(int blur_radius) {
background_blur_radius_ = blur_radius;
- WebKit::WebFilterOperations filters;
- if (background_blur_radius_) {
- filters.append(WebKit::WebFilterOperation::createBlurFilter(
- background_blur_radius_));
- }
- web_layer_->setBackgroundFilters(filters);
+ SetLayerBackgroundFilters();
}
void Layer::SetLayerSaturation(float saturation) {
@@ -296,6 +297,16 @@ void Layer::SetMaskLayer(Layer* layer_mask) {
layer_mask->layer_mask_back_link_ = this;
}
+void Layer::SetBackgroundZoom(float x_offset, float y_offset, float zoom,
+ int inset) {
+ zoom_x_offset_ = x_offset;
+ zoom_y_offset_ = y_offset;
+ zoom_ = zoom;
+ zoom_inset_ = inset;
+
+ SetLayerBackgroundFilters();
+}
+
void Layer::SetLayerFilters() {
WebKit::WebFilterOperations filters;
if (layer_saturation_) {
@@ -319,6 +330,24 @@ void Layer::SetLayerFilters() {
web_layer_->setFilters(filters);
}
+void Layer::SetLayerBackgroundFilters() {
+ WebKit::WebFilterOperations filters;
+ if (zoom_ != 1) {
+ filters.append(WebKit::WebFilterOperation::createZoomFilter(
+ WebKit::WebRect(zoom_x_offset_, zoom_y_offset_,
+ (GetTargetBounds().width() / zoom_),
+ (GetTargetBounds().height() / zoom_)),
+ zoom_inset_));
+ }
+
+ if (background_blur_radius_) {
+ filters.append(WebKit::WebFilterOperation::createBlurFilter(
+ background_blur_radius_));
+ }
+
+ web_layer_->setBackgroundFilters(filters);
+}
+
float Layer::GetTargetOpacity() const {
if (animator_.get() && animator_->IsAnimatingProperty(
LayerAnimationElement::OPACITY))
« ui/compositor/layer.h ('K') | « ui/compositor/layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698