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

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

Issue 16069004: cc: Remove legacy accelerated painting path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unused variable warning Created 7 years, 6 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 | « cc/resources/skpicture_content_layer_updater.h ('k') | cc/trees/layer_tree_host.h » ('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 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/skpicture_content_layer_updater.h" 5 #include "cc/resources/skpicture_content_layer_updater.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/debug/rendering_stats.h" 8 #include "cc/debug/rendering_stats.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/SkCanvas.h" 12 #include "third_party/skia/include/core/SkCanvas.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 SkPictureContentLayerUpdater::Resource::Resource(
17 SkPictureContentLayerUpdater* updater,
18 scoped_ptr<PrioritizedResource> texture)
19 : LayerUpdater::Resource(texture.Pass()), updater_(updater) {}
20
21 SkPictureContentLayerUpdater::Resource::~Resource() {}
22
23 void SkPictureContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue,
24 gfx::Rect source_rect,
25 gfx::Vector2d dest_offset,
26 bool partial_update,
27 RenderingStats*) {
28 updater_->UpdateTexture(
29 queue, texture(), source_rect, dest_offset, partial_update);
30 }
31
32 SkPictureContentLayerUpdater::SkPictureContentLayerUpdater( 16 SkPictureContentLayerUpdater::SkPictureContentLayerUpdater(
33 scoped_ptr<LayerPainter> painter, 17 scoped_ptr<LayerPainter> painter,
34 RenderingStatsInstrumentation* stats_instrumentation, 18 RenderingStatsInstrumentation* stats_instrumentation,
35 int layer_id) 19 int layer_id)
36 : ContentLayerUpdater(painter.Pass(), stats_instrumentation, layer_id), 20 : ContentLayerUpdater(painter.Pass(), stats_instrumentation, layer_id),
37 layer_is_opaque_(false) {} 21 layer_is_opaque_(false) {}
38 22
39 SkPictureContentLayerUpdater::~SkPictureContentLayerUpdater() {} 23 SkPictureContentLayerUpdater::~SkPictureContentLayerUpdater() {}
40 24
41 scoped_refptr<SkPictureContentLayerUpdater>
42 SkPictureContentLayerUpdater::Create(
43 scoped_ptr<LayerPainter> painter,
44 RenderingStatsInstrumentation* stats_instrumentation,
45 int layer_id) {
46 return make_scoped_refptr(
47 new SkPictureContentLayerUpdater(painter.Pass(),
48 stats_instrumentation,
49 layer_id));
50 }
51
52 scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::CreateResource(
53 PrioritizedResourceManager* manager) {
54 return scoped_ptr<LayerUpdater::Resource>(
55 new Resource(this, PrioritizedResource::Create(manager)));
56 }
57
58 void SkPictureContentLayerUpdater::PrepareToUpdate( 25 void SkPictureContentLayerUpdater::PrepareToUpdate(
59 gfx::Rect content_rect, 26 gfx::Rect content_rect,
60 gfx::Size, 27 gfx::Size,
61 float contents_width_scale, 28 float contents_width_scale,
62 float contents_height_scale, 29 float contents_height_scale,
63 gfx::Rect* resulting_opaque_rect, 30 gfx::Rect* resulting_opaque_rect,
64 RenderingStats* stats) { 31 RenderingStats* stats) {
65 SkCanvas* canvas = 32 SkCanvas* canvas =
66 picture_.beginRecording(content_rect.width(), content_rect.height()); 33 picture_.beginRecording(content_rect.width(), content_rect.height());
67 base::TimeTicks record_start_time; 34 base::TimeTicks record_start_time;
(...skipping 12 matching lines...) Expand all
80 content_rect.width() * content_rect.height(); 47 content_rect.width() * content_rect.height();
81 } 48 }
82 picture_.endRecording(); 49 picture_.endRecording();
83 } 50 }
84 51
85 void SkPictureContentLayerUpdater::DrawPicture(SkCanvas* canvas) { 52 void SkPictureContentLayerUpdater::DrawPicture(SkCanvas* canvas) {
86 TRACE_EVENT0("cc", "SkPictureContentLayerUpdater::DrawPicture"); 53 TRACE_EVENT0("cc", "SkPictureContentLayerUpdater::DrawPicture");
87 canvas->drawPicture(picture_); 54 canvas->drawPicture(picture_);
88 } 55 }
89 56
90 void SkPictureContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue,
91 PrioritizedResource* texture,
92 gfx::Rect source_rect,
93 gfx::Vector2d dest_offset,
94 bool partial_update) {
95 ResourceUpdate upload = ResourceUpdate::CreateFromPicture(
96 texture, &picture_, content_rect(), source_rect, dest_offset);
97 if (partial_update)
98 queue->AppendPartialUpload(upload);
99 else
100 queue->AppendFullUpload(upload);
101 }
102
103 void SkPictureContentLayerUpdater::SetOpaque(bool opaque) { 57 void SkPictureContentLayerUpdater::SetOpaque(bool opaque) {
104 layer_is_opaque_ = opaque; 58 layer_is_opaque_ = opaque;
105 } 59 }
106 60
107 } // namespace cc 61 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/skpicture_content_layer_updater.h ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698