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

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

Issue 10790128: Revert 147915 - Cleanup gfx::Canvas now that 10562027 has landed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/native_theme/native_theme_base.cc ('k') | ui/compositor/layer_unittest.cc » ('j') | 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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 } 481 }
482 482
483 void Layer::paintContents(WebKit::WebCanvas* web_canvas, 483 void Layer::paintContents(WebKit::WebCanvas* web_canvas,
484 const WebKit::WebRect& clip, 484 const WebKit::WebRect& clip,
485 #if defined(WEBCONTENTLAYERCLIENT_FLOAT_OPAQUE_RECT) 485 #if defined(WEBCONTENTLAYERCLIENT_FLOAT_OPAQUE_RECT)
486 WebKit::WebFloatRect& opaque) { 486 WebKit::WebFloatRect& opaque) {
487 #else 487 #else
488 WebKit::WebRect& opaque) { 488 WebKit::WebRect& opaque) {
489 #endif 489 #endif
490 TRACE_EVENT0("ui", "Layer::paintContents"); 490 TRACE_EVENT0("ui", "Layer::paintContents");
491 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling( 491 gfx::Canvas canvas(web_canvas,
492 web_canvas, ui::GetScaleFactorFromScale(device_scale_factor_))); 492 ui::GetScaleFactorFromScale(device_scale_factor_), scale_content_);
493
494 if (scale_content_) {
495 canvas->Save();
496 canvas->sk_canvas()->scale(SkFloatToScalar(device_scale_factor_),
497 SkFloatToScalar(device_scale_factor_));
498 }
499 493
500 if (delegate_) 494 if (delegate_)
501 delegate_->OnPaintLayer(canvas.get()); 495 delegate_->OnPaintLayer(&canvas);
502 if (scale_content_)
503 canvas->Restore();
504 } 496 }
505 497
506 unsigned Layer::prepareTexture(WebKit::WebTextureUpdater& /* updater */) { 498 unsigned Layer::prepareTexture(WebKit::WebTextureUpdater& /* updater */) {
507 DCHECK(layer_updated_externally_); 499 DCHECK(layer_updated_externally_);
508 return texture_->texture_id(); 500 return texture_->texture_id();
509 } 501 }
510 502
511 WebKit::WebGraphicsContext3D* Layer::context() { 503 WebKit::WebGraphicsContext3D* Layer::context() {
512 DCHECK(layer_updated_externally_); 504 DCHECK(layer_updated_externally_);
513 return texture_->HostContext3D(); 505 return texture_->HostContext3D();
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 return; 757 return;
766 unsigned int color = 0xFF000000; 758 unsigned int color = 0xFF000000;
767 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; 759 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000;
768 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); 760 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f);
769 if (!opaque) 761 if (!opaque)
770 color |= 0xFF; 762 color |= 0xFF;
771 web_layer_.setDebugBorderColor(color); 763 web_layer_.setDebugBorderColor(color);
772 } 764 }
773 765
774 } // namespace ui 766 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/native_theme/native_theme_base.cc ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698