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

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

Issue 8422009: ui/gfx: Convert CreateCanvas to use gfx::Size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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/gfx/canvas_skia.cc ('k') | ui/gfx/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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gfx/compositor/layer.h" 5 #include "ui/gfx/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // setting its canvas directly with SetCanvas(). 405 // setting its canvas directly with SetCanvas().
406 if (!delegate_ || layer_updated_externally_) 406 if (!delegate_ || layer_updated_externally_)
407 return; 407 return;
408 gfx::Rect local_bounds = gfx::Rect(gfx::Point(), bounds_.size()); 408 gfx::Rect local_bounds = gfx::Rect(gfx::Point(), bounds_.size());
409 gfx::Rect draw_rect = texture_.get() ? invalid_rect_.Intersect(local_bounds) : 409 gfx::Rect draw_rect = texture_.get() ? invalid_rect_.Intersect(local_bounds) :
410 local_bounds; 410 local_bounds;
411 if (draw_rect.IsEmpty()) { 411 if (draw_rect.IsEmpty()) {
412 invalid_rect_ = gfx::Rect(); 412 invalid_rect_ = gfx::Rect();
413 return; 413 return;
414 } 414 }
415 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvas( 415 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvas(draw_rect.size(),
416 draw_rect.width(), draw_rect.height(), false)); 416 false));
417 canvas->Translate(gfx::Point().Subtract(draw_rect.origin())); 417 canvas->Translate(gfx::Point().Subtract(draw_rect.origin()));
418 delegate_->OnPaintLayer(canvas.get()); 418 delegate_->OnPaintLayer(canvas.get());
419 SetCanvas(*canvas->GetSkCanvas(), draw_rect.origin()); 419 SetCanvas(*canvas->GetSkCanvas(), draw_rect.origin());
420 #endif 420 #endif
421 } 421 }
422 422
423 void Layer::SetNeedsToRecomputeHole() { 423 void Layer::SetNeedsToRecomputeHole() {
424 Layer* root_layer = this; 424 Layer* root_layer = this;
425 while (root_layer->parent_) 425 while (root_layer->parent_)
426 root_layer = root_layer->parent_; 426 root_layer = root_layer->parent_;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 #else 684 #else
685 unsigned int texture_id = 0; 685 unsigned int texture_id = 0;
686 #endif 686 #endif
687 web_layer_.to<WebKit::WebExternalTextureLayer>().setTextureId( 687 web_layer_.to<WebKit::WebExternalTextureLayer>().setTextureId(
688 should_draw ? texture_id : 0); 688 should_draw ? texture_id : 0);
689 } 689 }
690 } 690 }
691 #endif 691 #endif
692 692
693 } // namespace ui 693 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | ui/gfx/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698