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

Side by Side Diff: cc/skpicture_content_layer_updater.cc

Issue 12471007: Part 8 of cc/ directory shuffles: resources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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/skpicture_content_layer_updater.h ('k') | cc/test/fake_content_layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/skpicture_content_layer_updater.h"
6
7 #include "base/debug/trace_event.h"
8 #include "cc/layer_painter.h"
9 #include "cc/prioritized_resource.h"
10 #include "cc/resource_update_queue.h"
11 #include "third_party/skia/include/core/SkCanvas.h"
12
13 namespace cc {
14
15 SkPictureContentLayerUpdater::Resource::Resource(
16 SkPictureContentLayerUpdater* updater,
17 scoped_ptr<PrioritizedResource> texture)
18 : LayerUpdater::Resource(texture.Pass()), updater_(updater) {}
19
20 SkPictureContentLayerUpdater::Resource::~Resource() {}
21
22 void SkPictureContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue,
23 gfx::Rect source_rect,
24 gfx::Vector2d dest_offset,
25 bool partial_update,
26 RenderingStats*) {
27 updater_->UpdateTexture(
28 queue, texture(), source_rect, dest_offset, partial_update);
29 }
30
31 SkPictureContentLayerUpdater::SkPictureContentLayerUpdater(
32 scoped_ptr<LayerPainter> painter)
33 : ContentLayerUpdater(painter.Pass()), layer_is_opaque_(false) {}
34
35 SkPictureContentLayerUpdater::~SkPictureContentLayerUpdater() {}
36
37 scoped_refptr<SkPictureContentLayerUpdater>
38 SkPictureContentLayerUpdater::Create(scoped_ptr<LayerPainter> painter) {
39 return make_scoped_refptr(new SkPictureContentLayerUpdater(painter.Pass()));
40 }
41
42 scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::CreateResource(
43 PrioritizedResourceManager* manager) {
44 return scoped_ptr<LayerUpdater::Resource>(
45 new Resource(this, PrioritizedResource::create(manager)));
46 }
47
48 void SkPictureContentLayerUpdater::PrepareToUpdate(
49 gfx::Rect content_rect,
50 gfx::Size,
51 float contentsWidthScale,
52 float contents_height_scale,
53 gfx::Rect* resultingOpaqueRect,
54 RenderingStats* stats) {
55 SkCanvas* canvas =
56 picture_.beginRecording(content_rect.width(), content_rect.height());
57 PaintContents(canvas,
58 content_rect,
59 contentsWidthScale,
60 contents_height_scale,
61 resultingOpaqueRect,
62 stats);
63 picture_.endRecording();
64 }
65
66 void SkPictureContentLayerUpdater::DrawPicture(SkCanvas* canvas) {
67 TRACE_EVENT0("cc", "SkPictureContentLayerUpdater::drawPicture");
68 canvas->drawPicture(picture_);
69 }
70
71 void SkPictureContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue,
72 PrioritizedResource* texture,
73 gfx::Rect source_rect,
74 gfx::Vector2d dest_offset,
75 bool partial_update) {
76 ResourceUpdate upload = ResourceUpdate::CreateFromPicture(
77 texture, &picture_, content_rect(), source_rect, dest_offset);
78 if (partial_update)
79 queue->appendPartialUpload(upload);
80 else
81 queue->appendFullUpload(upload);
82 }
83
84 void SkPictureContentLayerUpdater::SetOpaque(bool opaque) {
85 layer_is_opaque_ = opaque;
86 }
87
88 } // namespace cc
OLDNEW
« no previous file with comments | « cc/skpicture_content_layer_updater.h ('k') | cc/test/fake_content_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698