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

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

Issue 10701063: Cleanup gfx::Canvas now that 10562027 has landed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 gfx::Canvas canvas(web_canvas, 491 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling(
492 ui::GetScaleFactorFromScale(device_scale_factor_), scale_content_); 492 web_canvas, ui::GetScaleFactorFromScale(device_scale_factor_)));
493
494 if (scale_content_) {
495 canvas->Save();
496 canvas->sk_canvas()->scale(SkFloatToScalar(device_scale_factor_),
497 SkFloatToScalar(device_scale_factor_));
498 }
493 499
494 if (delegate_) 500 if (delegate_)
495 delegate_->OnPaintLayer(&canvas); 501 delegate_->OnPaintLayer(canvas.get());
502 if (scale_content_)
503 canvas->Restore();
496 } 504 }
497 505
498 unsigned Layer::prepareTexture(WebKit::WebTextureUpdater& /* updater */) { 506 unsigned Layer::prepareTexture(WebKit::WebTextureUpdater& /* updater */) {
499 DCHECK(layer_updated_externally_); 507 DCHECK(layer_updated_externally_);
500 return texture_->texture_id(); 508 return texture_->texture_id();
501 } 509 }
502 510
503 WebKit::WebGraphicsContext3D* Layer::context() { 511 WebKit::WebGraphicsContext3D* Layer::context() {
504 DCHECK(layer_updated_externally_); 512 DCHECK(layer_updated_externally_);
505 return texture_->HostContext3D(); 513 return texture_->HostContext3D();
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 return; 765 return;
758 unsigned int color = 0xFF000000; 766 unsigned int color = 0xFF000000;
759 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; 767 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000;
760 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); 768 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f);
761 if (!opaque) 769 if (!opaque)
762 color |= 0xFF; 770 color |= 0xFF;
763 web_layer_.setDebugBorderColor(color); 771 web_layer_.setDebugBorderColor(color);
764 } 772 }
765 773
766 } // namespace ui 774 } // 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