OLD | NEW |
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 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
11 ResourceUpdate ResourceUpdate::Create(PrioritizedResource* texture, | 11 ResourceUpdate ResourceUpdate::Create(PrioritizedResource* texture, |
12 const SkBitmap* bitmap, | 12 const SkBitmap* bitmap, |
13 gfx::Rect content_rect, | 13 gfx::Rect content_rect, |
14 gfx::Rect source_rect, | 14 gfx::Rect source_rect, |
15 gfx::Vector2d dest_offset) { | 15 gfx::Vector2d dest_offset) { |
16 CHECK(content_rect.Contains(source_rect)); | 16 CHECK(content_rect.Contains(source_rect)); |
17 ResourceUpdate update; | 17 ResourceUpdate update; |
18 update.texture = texture; | 18 update.texture = texture; |
19 update.bitmap = bitmap; | 19 update.bitmap = bitmap; |
20 update.content_rect = content_rect; | 20 update.content_rect = content_rect; |
21 update.source_rect = source_rect; | 21 update.source_rect = source_rect; |
22 update.dest_offset = dest_offset; | 22 update.dest_offset = dest_offset; |
23 return update; | 23 return update; |
24 } | 24 } |
25 | 25 |
26 ResourceUpdate ResourceUpdate::CreateFromPicture(PrioritizedResource* texture, | 26 ResourceUpdate ResourceUpdate::CreateFromPicture(PrioritizedResource* texture, |
27 SkPicture* picture, | 27 SkPicture* picture, |
28 gfx::Rect content_rect, | 28 gfx::Rect content_rect, |
29 gfx::Rect source_rect, | 29 gfx::Rect source_rect, |
30 gfx::Vector2d dest_offset) { | 30 gfx::Vector2d dest_offset) { |
31 CHECK(content_rect.Contains(source_rect)); | 31 CHECK(content_rect.Contains(source_rect)); |
32 ResourceUpdate update; | 32 ResourceUpdate update; |
33 update.texture = texture; | 33 update.texture = texture; |
34 update.picture = picture; | 34 update.picture = picture; |
35 update.content_rect = content_rect; | 35 update.content_rect = content_rect; |
36 update.source_rect = source_rect; | 36 update.source_rect = source_rect; |
37 update.dest_offset = dest_offset; | 37 update.dest_offset = dest_offset; |
38 return update; | 38 return update; |
39 } | 39 } |
40 | 40 |
41 ResourceUpdate::ResourceUpdate() | 41 ResourceUpdate::ResourceUpdate() |
42 : texture(NULL), | 42 : texture(NULL), |
43 bitmap(NULL), | 43 bitmap(NULL), |
44 picture(NULL) { | 44 picture(NULL) {} |
45 } | |
46 | 45 |
47 ResourceUpdate::~ResourceUpdate() { | 46 ResourceUpdate::~ResourceUpdate() {} |
48 } | |
49 | 47 |
50 } // namespace cc | 48 } // namespace cc |
OLD | NEW |