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

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, 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
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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 421 }
422 422
423 void Layer::paintContents(WebKit::WebCanvas* web_canvas, 423 void Layer::paintContents(WebKit::WebCanvas* web_canvas,
424 const WebKit::WebRect& clip, 424 const WebKit::WebRect& clip,
425 #if defined(WEBCONTENTLAYERCLIENT_FLOAT_OPAQUE_RECT) 425 #if defined(WEBCONTENTLAYERCLIENT_FLOAT_OPAQUE_RECT)
426 WebKit::WebFloatRect& opaque) { 426 WebKit::WebFloatRect& opaque) {
427 #else 427 #else
428 WebKit::WebRect& opaque) { 428 WebKit::WebRect& opaque) {
429 #endif 429 #endif
430 TRACE_EVENT0("ui", "Layer::paintContents"); 430 TRACE_EVENT0("ui", "Layer::paintContents");
431 gfx::Canvas canvas(web_canvas, 431 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling(
432 ui::GetScaleFactorFromScale(device_scale_factor_), scale_content_); 432 web_canvas, ui::GetScaleFactorFromScale(device_scale_factor_)));
433
434 bool scale_content = scale_content_;
sky 2012/07/16 14:26:51 Why do you need scale_content here?
pkotwicz 2012/07/17 17:19:52 Done.
435 if (scale_content) {
436 canvas->Save();
437 canvas->sk_canvas()->scale(SkFloatToScalar(device_scale_factor_),
438 SkFloatToScalar(device_scale_factor_));
439 }
433 440
434 if (delegate_) 441 if (delegate_)
435 delegate_->OnPaintLayer(&canvas); 442 delegate_->OnPaintLayer(canvas.get());
443 if (scale_content)
444 canvas->Restore();
436 } 445 }
437 446
438 void Layer::SetForceRenderSurface(bool force) { 447 void Layer::SetForceRenderSurface(bool force) {
439 if (force_render_surface_ == force) 448 if (force_render_surface_ == force)
440 return; 449 return;
441 450
442 force_render_surface_ = force; 451 force_render_surface_ = force;
443 web_layer_.setForceRenderSurface(force_render_surface_); 452 web_layer_.setForceRenderSurface(force_render_surface_);
444 } 453 }
445 454
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 return; 673 return;
665 unsigned int color = 0xFF000000; 674 unsigned int color = 0xFF000000;
666 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; 675 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000;
667 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); 676 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f);
668 if (!opaque) 677 if (!opaque)
669 color |= 0xFF; 678 color |= 0xFF;
670 web_layer_.setDebugBorderColor(color); 679 web_layer_.setDebugBorderColor(color);
671 } 680 }
672 681
673 } // namespace ui 682 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698