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

Side by Side Diff: cc/resources/bitmap_skpicture_content_layer_updater.cc

Issue 132163009: [#6]Pass gfx structs by const ref (gfx::Vector2d) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on TOT Created 6 years, 10 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/resources/bitmap_skpicture_content_layer_updater.h" 5 #include "cc/resources/bitmap_skpicture_content_layer_updater.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "cc/debug/rendering_stats_instrumentation.h" 8 #include "cc/debug/rendering_stats_instrumentation.h"
9 #include "cc/resources/layer_painter.h" 9 #include "cc/resources/layer_painter.h"
10 #include "cc/resources/prioritized_resource.h" 10 #include "cc/resources/prioritized_resource.h"
11 #include "cc/resources/resource_update_queue.h" 11 #include "cc/resources/resource_update_queue.h"
12 #include "third_party/skia/include/core/SkBitmapDevice.h" 12 #include "third_party/skia/include/core/SkBitmapDevice.h"
13 #include "third_party/skia/include/core/SkCanvas.h" 13 #include "third_party/skia/include/core/SkCanvas.h"
14 14
15 namespace cc { 15 namespace cc {
16 16
17 BitmapSkPictureContentLayerUpdater::Resource::Resource( 17 BitmapSkPictureContentLayerUpdater::Resource::Resource(
18 BitmapSkPictureContentLayerUpdater* updater, 18 BitmapSkPictureContentLayerUpdater* updater,
19 scoped_ptr<PrioritizedResource> texture) 19 scoped_ptr<PrioritizedResource> texture)
20 : ContentLayerUpdater::Resource(texture.Pass()), updater_(updater) {} 20 : ContentLayerUpdater::Resource(texture.Pass()), updater_(updater) {}
21 21
22 void BitmapSkPictureContentLayerUpdater::Resource::Update( 22 void BitmapSkPictureContentLayerUpdater::Resource::Update(
23 ResourceUpdateQueue* queue, 23 ResourceUpdateQueue* queue,
24 const gfx::Rect& source_rect, 24 const gfx::Rect& source_rect,
25 gfx::Vector2d dest_offset, 25 const gfx::Vector2d& dest_offset,
26 bool partial_update) { 26 bool partial_update) {
27 bitmap_.setConfig( 27 bitmap_.setConfig(
28 SkBitmap::kARGB_8888_Config, source_rect.width(), source_rect.height(), 0, 28 SkBitmap::kARGB_8888_Config, source_rect.width(), source_rect.height(), 0,
29 updater_->layer_is_opaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType); 29 updater_->layer_is_opaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
30 bitmap_.allocPixels(); 30 bitmap_.allocPixels();
31 SkBitmapDevice device(bitmap_); 31 SkBitmapDevice device(bitmap_);
32 SkCanvas canvas(&device); 32 SkCanvas canvas(&device);
33 updater_->PaintContentsRect(&canvas, source_rect); 33 updater_->PaintContentsRect(&canvas, source_rect);
34 34
35 ResourceUpdate upload = ResourceUpdate::Create( 35 ResourceUpdate upload = ResourceUpdate::Create(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 rendering_stats_instrumentation_->StartRecording(); 78 rendering_stats_instrumentation_->StartRecording();
79 DrawPicture(canvas); 79 DrawPicture(canvas);
80 base::TimeDelta duration = 80 base::TimeDelta duration =
81 rendering_stats_instrumentation_->EndRecording(start_time); 81 rendering_stats_instrumentation_->EndRecording(start_time);
82 rendering_stats_instrumentation_->AddRaster( 82 rendering_stats_instrumentation_->AddRaster(
83 duration, 83 duration,
84 source_rect.width() * source_rect.height()); 84 source_rect.width() * source_rect.height());
85 } 85 }
86 86
87 } // namespace cc 87 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/bitmap_skpicture_content_layer_updater.h ('k') | cc/resources/image_layer_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698