ash: Add missing include to test from r236852.
[chromium-blink-merge.git] / cc / resources / resource_update.cc
blob5760ddf4a0dde663b3fdb6bb336d66638c1dc37d
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
3 // found in the LICENSE file.
5 #include "cc/resources/resource_update.h"
7 #include "base/logging.h"
8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "third_party/skia/include/core/SkDevice.h"
11 namespace cc {
13 ResourceUpdate ResourceUpdate::Create(PrioritizedResource* texture,
14 const SkBitmap* bitmap,
15 gfx::Rect content_rect,
16 gfx::Rect source_rect,
17 gfx::Vector2d dest_offset) {
18 CHECK(content_rect.Contains(source_rect));
19 ResourceUpdate update;
20 update.texture = texture;
21 update.bitmap = bitmap;
22 update.content_rect = content_rect;
23 update.source_rect = source_rect;
24 update.dest_offset = dest_offset;
25 return update;
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;
45 ResourceUpdate::ResourceUpdate()
46 : texture(NULL),
47 bitmap(NULL) {}
49 ResourceUpdate::~ResourceUpdate() {}
51 } // namespace cc