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 #ifndef CC_TEST_SKIA_COMMON_H_ | 5 #ifndef CC_TEST_SKIA_COMMON_H_ |
6 #define CC_TEST_SKIA_COMMON_H_ | 6 #define CC_TEST_SKIA_COMMON_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "skia/ext/lazy_pixel_ref.h" | 10 #include "skia/ext/lazy_pixel_ref.h" |
11 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
12 #include "third_party/skia/include/core/SkFlattenable.h" | 12 #include "third_party/skia/include/core/SkFlattenable.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 class Rect; | 15 class Rect; |
16 class Size; | 16 class Size; |
17 } | 17 } |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 class Picture; | 20 class Picture; |
21 | 21 |
22 class TestPixelRef : public SkPixelRef { | 22 class TestPixelRef : public SkPixelRef { |
23 public: | 23 public: |
24 TestPixelRef(int width, int height); | 24 TestPixelRef(int width, int height); |
25 virtual ~TestPixelRef(); | 25 virtual ~TestPixelRef(); |
26 | 26 |
27 virtual SkFlattenable::Factory getFactory() OVERRIDE; | 27 virtual SkFlattenable::Factory getFactory() const OVERRIDE; |
28 virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE; | 28 virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE; |
29 virtual void onUnlockPixels() OVERRIDE {} | 29 virtual void onUnlockPixels() OVERRIDE {} |
30 virtual SkPixelRef* deepCopy( | 30 virtual SkPixelRef* deepCopy( |
31 SkBitmap::Config config, | 31 SkBitmap::Config config, |
32 const SkIRect* subset) OVERRIDE; | 32 const SkIRect* subset) OVERRIDE; |
33 private: | 33 private: |
34 scoped_ptr<char[]> pixels_; | 34 scoped_ptr<char[]> pixels_; |
35 }; | 35 }; |
36 | 36 |
37 class TestLazyPixelRef : public skia::LazyPixelRef { | 37 class TestLazyPixelRef : public skia::LazyPixelRef { |
38 public: | 38 public: |
39 TestLazyPixelRef(int width, int height); | 39 TestLazyPixelRef(int width, int height); |
40 virtual ~TestLazyPixelRef(); | 40 virtual ~TestLazyPixelRef(); |
41 | 41 |
42 virtual SkFlattenable::Factory getFactory() OVERRIDE; | 42 virtual SkFlattenable::Factory getFactory() const OVERRIDE; |
43 virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE; | 43 virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE; |
44 virtual void onUnlockPixels() OVERRIDE {} | 44 virtual void onUnlockPixels() OVERRIDE {} |
45 virtual bool PrepareToDecode(const PrepareParams& params) OVERRIDE; | 45 virtual bool PrepareToDecode(const PrepareParams& params) OVERRIDE; |
46 virtual bool MaybeDecoded() OVERRIDE; | 46 virtual bool MaybeDecoded() OVERRIDE; |
47 virtual SkPixelRef* deepCopy( | 47 virtual SkPixelRef* deepCopy( |
48 SkBitmap::Config config, | 48 SkBitmap::Config config, |
49 const SkIRect* subset) OVERRIDE; | 49 const SkIRect* subset) OVERRIDE; |
50 virtual void Decode() OVERRIDE {} | 50 virtual void Decode() OVERRIDE {} |
51 private: | 51 private: |
52 scoped_ptr<char[]> pixels_; | 52 scoped_ptr<char[]> pixels_; |
53 }; | 53 }; |
54 | 54 |
55 void DrawPicture(unsigned char* buffer, | 55 void DrawPicture(unsigned char* buffer, |
56 gfx::Rect layer_rect, | 56 gfx::Rect layer_rect, |
57 scoped_refptr<Picture> picture); | 57 scoped_refptr<Picture> picture); |
58 | 58 |
59 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap); | 59 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap); |
60 | 60 |
61 } // namespace cc | 61 } // namespace cc |
62 | 62 |
63 #endif // CC_TEST_SKIA_COMMON_H_ | 63 #endif // CC_TEST_SKIA_COMMON_H_ |
OLD | NEW |