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

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

Issue 127053004: [cc] Unify static create method of ResourceUpdate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more cleanup Created 6 years, 11 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/resource_update.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/resources/resource_update.h" 5 #include "cc/resources/resource_update.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "third_party/skia/include/core/SkDevice.h"
10 8
11 namespace cc { 9 namespace cc {
12 10
13 ResourceUpdate ResourceUpdate::Create(PrioritizedResource* texture, 11 ResourceUpdate ResourceUpdate::Create(PrioritizedResource* resource,
14 const SkBitmap* bitmap, 12 const SkBitmap* bitmap,
15 gfx::Rect content_rect, 13 gfx::Rect content_rect,
16 gfx::Rect source_rect, 14 gfx::Rect source_rect,
17 gfx::Vector2d dest_offset) { 15 gfx::Vector2d dest_offset) {
18 CHECK(content_rect.Contains(source_rect)); 16 CHECK(content_rect.Contains(source_rect));
19 ResourceUpdate update; 17 ResourceUpdate update;
20 update.texture = texture; 18 update.texture = resource;
21 update.bitmap = bitmap; 19 update.bitmap = bitmap;
22 update.content_rect = content_rect; 20 update.content_rect = content_rect;
23 update.source_rect = source_rect; 21 update.source_rect = source_rect;
24 update.dest_offset = dest_offset; 22 update.dest_offset = dest_offset;
25 return update;
26 }
27
28 ResourceUpdate ResourceUpdate::CreateFromCanvas(
29 PrioritizedResource* resource,
30 const skia::RefPtr<SkCanvas>& canvas,
31 gfx::Rect content_rect,
32 gfx::Rect source_rect,
33 gfx::Vector2d dest_offset) {
34 CHECK(content_rect.Contains(source_rect));
35 ResourceUpdate update;
36 update.texture = resource;
37 update.canvas = canvas;
38 update.bitmap = &canvas->getDevice()->accessBitmap(false);
39 update.content_rect = content_rect;
40 update.source_rect = source_rect;
41 update.dest_offset = dest_offset;
42 return update; 23 return update;
43 } 24 }
44 25
45 ResourceUpdate::ResourceUpdate() 26 ResourceUpdate::ResourceUpdate()
46 : texture(NULL), 27 : texture(NULL),
47 bitmap(NULL) {} 28 bitmap(NULL) {}
48 29
49 ResourceUpdate::~ResourceUpdate() {} 30 ResourceUpdate::~ResourceUpdate() {}
50 31
51 } // namespace cc 32 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_update.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698