• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef CC_RESOURCES_RESOURCE_UPDATE_H_
6 #define CC_RESOURCES_RESOURCE_UPDATE_H_
7 
8 #include "base/memory/ref_counted.h"
9 #include "cc/base/cc_export.h"
10 #include "skia/ext/refptr.h"
11 #include "ui/gfx/rect.h"
12 #include "ui/gfx/vector2d.h"
13 
14 class SkBitmap;
15 class SkCanvas;
16 
17 namespace cc {
18 
19 class PrioritizedResource;
20 
21 struct CC_EXPORT ResourceUpdate {
22   static ResourceUpdate Create(PrioritizedResource* resource,
23                                const SkBitmap* bitmap,
24                                gfx::Rect content_rect,
25                                gfx::Rect source_rect,
26                                gfx::Vector2d dest_offset);
27   static ResourceUpdate CreateFromCanvas(PrioritizedResource* resource,
28                                          const skia::RefPtr<SkCanvas>& canvas,
29                                          gfx::Rect content_rect,
30                                          gfx::Rect source_rect,
31                                          gfx::Vector2d dest_offset);
32 
33   ResourceUpdate();
34   virtual ~ResourceUpdate();
35 
36   PrioritizedResource* texture;
37   const SkBitmap* bitmap;
38   skia::RefPtr<SkCanvas> canvas;
39   gfx::Rect content_rect;
40   gfx::Rect source_rect;
41   gfx::Vector2d dest_offset;
42 };
43 
44 }  // namespace cc
45 
46 #endif  // CC_RESOURCES_RESOURCE_UPDATE_H_
47