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 #include "skia/ext/platform_canvas.h" | 8 #include "third_party/skia/include/core/SkCanvas.h" |
| 9 #include "third_party/skia/include/core/SkDevice.h" |
9 | 10 |
10 namespace cc { | 11 namespace cc { |
11 | 12 |
12 ResourceUpdate ResourceUpdate::Create(PrioritizedResource* texture, | 13 ResourceUpdate ResourceUpdate::Create(PrioritizedResource* texture, |
13 const SkBitmap* bitmap, | 14 const SkBitmap* bitmap, |
14 gfx::Rect content_rect, | 15 gfx::Rect content_rect, |
15 gfx::Rect source_rect, | 16 gfx::Rect source_rect, |
16 gfx::Vector2d dest_offset) { | 17 gfx::Vector2d dest_offset) { |
17 CHECK(content_rect.Contains(source_rect)); | 18 CHECK(content_rect.Contains(source_rect)); |
18 ResourceUpdate update; | 19 ResourceUpdate update; |
(...skipping 15 matching lines...) Expand all Loading... |
34 ResourceUpdate update; | 35 ResourceUpdate update; |
35 update.texture = resource; | 36 update.texture = resource; |
36 update.canvas = canvas; | 37 update.canvas = canvas; |
37 update.bitmap = &canvas->getDevice()->accessBitmap(false); | 38 update.bitmap = &canvas->getDevice()->accessBitmap(false); |
38 update.content_rect = content_rect; | 39 update.content_rect = content_rect; |
39 update.source_rect = source_rect; | 40 update.source_rect = source_rect; |
40 update.dest_offset = dest_offset; | 41 update.dest_offset = dest_offset; |
41 return update; | 42 return update; |
42 } | 43 } |
43 | 44 |
44 ResourceUpdate ResourceUpdate::CreateFromPicture(PrioritizedResource* texture, | |
45 SkPicture* picture, | |
46 gfx::Rect content_rect, | |
47 gfx::Rect source_rect, | |
48 gfx::Vector2d dest_offset) { | |
49 CHECK(content_rect.Contains(source_rect)); | |
50 ResourceUpdate update; | |
51 update.texture = texture; | |
52 update.picture = picture; | |
53 update.content_rect = content_rect; | |
54 update.source_rect = source_rect; | |
55 update.dest_offset = dest_offset; | |
56 return update; | |
57 } | |
58 | |
59 ResourceUpdate::ResourceUpdate() | 45 ResourceUpdate::ResourceUpdate() |
60 : texture(NULL), | 46 : texture(NULL), |
61 bitmap(NULL), | 47 bitmap(NULL) {} |
62 picture(NULL) {} | |
63 | 48 |
64 ResourceUpdate::~ResourceUpdate() {} | 49 ResourceUpdate::~ResourceUpdate() {} |
65 | 50 |
66 } // namespace cc | 51 } // namespace cc |
OLD | NEW |