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

Side by Side Diff: ui/compositor/layer.cc

Issue 10332077: Zoom the web contents 2x such that they are blurry in High DPI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nicer diff Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 if (!web_layer_is_accelerated_) { 571 if (!web_layer_is_accelerated_) {
572 if (type_ != LAYER_SOLID_COLOR) 572 if (type_ != LAYER_SOLID_COLOR)
573 web_layer_.to<WebKit::WebContentLayer>().setDrawsContent(should_draw); 573 web_layer_.to<WebKit::WebContentLayer>().setDrawsContent(should_draw);
574 web_layer_.setBounds(ConvertSizeToPixel(this, bounds_.size())); 574 web_layer_.setBounds(ConvertSizeToPixel(this, bounds_.size()));
575 } else { 575 } else {
576 DCHECK(texture_); 576 DCHECK(texture_);
577 unsigned int texture_id = texture_->texture_id(); 577 unsigned int texture_id = texture_->texture_id();
578 WebKit::WebExternalTextureLayer texture_layer = 578 WebKit::WebExternalTextureLayer texture_layer =
579 web_layer_.to<WebKit::WebExternalTextureLayer>(); 579 web_layer_.to<WebKit::WebExternalTextureLayer>();
580 texture_layer.setTextureId(should_draw ? texture_id : 0); 580 texture_layer.setTextureId(should_draw ? texture_id : 0);
581 gfx::Rect bounds_in_pixel = ConvertRectToPixel(this, bounds());
582 gfx::Size texture_size = texture_->size(); 581 gfx::Size texture_size = texture_->size();
583 gfx::Size size(std::min(bounds_in_pixel.width(), texture_size.width()), 582
584 std::min(bounds_in_pixel.height(), texture_size.height())); 583 // As WebKit does not support DIP, WebKit is told of coordinates in DIP
584 // as if they were pixel coordinates. The texture is scaled here via
585 // the setBounds call.
586 // TODO(pkotwicz): Fix this code to take in account textures with pixel
587 // sizes once WebKit understands DIP. http://crbug.com/127455
piman 2012/05/09 23:31:03 Note: once you want to provide support for that, i
588 gfx::Size size(std::min(bounds().width(), texture_size.width()),
589 std::min(bounds().height(), texture_size.height()));
585 WebKit::WebFloatRect rect( 590 WebKit::WebFloatRect rect(
586 0, 591 0,
587 0, 592 0,
588 static_cast<float>(size.width())/texture_size.width(), 593 static_cast<float>(size.width())/texture_size.width(),
589 static_cast<float>(size.height())/texture_size.height()); 594 static_cast<float>(size.height())/texture_size.height());
590 texture_layer.setUVRect(rect); 595 texture_layer.setUVRect(rect);
591 web_layer_.setBounds(size); 596
597 gfx::Size size_in_pixel = ConvertSizeToPixel(this, bounds().size());
598 web_layer_.setBounds(size_in_pixel);
592 } 599 }
593 } 600 }
594 601
595 void Layer::RecomputeDebugBorderColor() { 602 void Layer::RecomputeDebugBorderColor() {
596 if (!show_debug_borders_) 603 if (!show_debug_borders_)
597 return; 604 return;
598 unsigned int color = 0xFF000000; 605 unsigned int color = 0xFF000000;
599 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; 606 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000;
600 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); 607 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f);
601 if (!opaque) 608 if (!opaque)
602 color |= 0xFF; 609 color |= 0xFF;
603 web_layer_.setDebugBorderColor(color); 610 web_layer_.setDebugBorderColor(color);
604 } 611 }
605 612
606 } // namespace ui 613 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698