Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: skia/ext/lazy_pixel_ref_utils_unittest.cc

Issue 31613002: Update unit tests after SkFlattenable::getFactory const-ification. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/skia_common.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "cc/test/geometry_test_utils.h" 7 #include "cc/test/geometry_test_utils.h"
8 #include "skia/ext/lazy_pixel_ref.h" 8 #include "skia/ext/lazy_pixel_ref.h"
9 #include "skia/ext/lazy_pixel_ref_utils.h" 9 #include "skia/ext/lazy_pixel_ref_utils.h"
10 #include "skia/ext/refptr.h" 10 #include "skia/ext/refptr.h"
(...skipping 11 matching lines...) Expand all
22 22
23 namespace { 23 namespace {
24 24
25 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap); 25 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap);
26 26
27 class TestPixelRef : public SkPixelRef { 27 class TestPixelRef : public SkPixelRef {
28 public: 28 public:
29 TestPixelRef(int width, int height); 29 TestPixelRef(int width, int height);
30 virtual ~TestPixelRef(); 30 virtual ~TestPixelRef();
31 31
32 virtual SkFlattenable::Factory getFactory() OVERRIDE; 32 virtual SkFlattenable::Factory getFactory() const OVERRIDE;
33 virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE; 33 virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE;
34 virtual void onUnlockPixels() OVERRIDE {} 34 virtual void onUnlockPixels() OVERRIDE {}
35 virtual SkPixelRef* deepCopy(SkBitmap::Config config, const SkIRect* subset) 35 virtual SkPixelRef* deepCopy(SkBitmap::Config config, const SkIRect* subset)
36 OVERRIDE; 36 OVERRIDE;
37 37
38 private: 38 private:
39 scoped_ptr<char[]> pixels_; 39 scoped_ptr<char[]> pixels_;
40 }; 40 };
41 41
42 class TestLazyPixelRef : public skia::LazyPixelRef { 42 class TestLazyPixelRef : public skia::LazyPixelRef {
43 public: 43 public:
44 TestLazyPixelRef(int width, int height); 44 TestLazyPixelRef(int width, int height);
45 virtual ~TestLazyPixelRef(); 45 virtual ~TestLazyPixelRef();
46 46
47 virtual SkFlattenable::Factory getFactory() OVERRIDE; 47 virtual SkFlattenable::Factory getFactory() const OVERRIDE;
48 virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE; 48 virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE;
49 virtual void onUnlockPixels() OVERRIDE {} 49 virtual void onUnlockPixels() OVERRIDE {}
50 virtual bool PrepareToDecode(const PrepareParams& params) OVERRIDE; 50 virtual bool PrepareToDecode(const PrepareParams& params) OVERRIDE;
51 virtual bool MaybeDecoded() OVERRIDE; 51 virtual bool MaybeDecoded() OVERRIDE;
52 virtual SkPixelRef* deepCopy(SkBitmap::Config config, const SkIRect* subset) 52 virtual SkPixelRef* deepCopy(SkBitmap::Config config, const SkIRect* subset)
53 OVERRIDE; 53 OVERRIDE;
54 virtual void Decode() OVERRIDE {} 54 virtual void Decode() OVERRIDE {}
55 55
56 private: 56 private:
57 scoped_ptr<char[]> pixels_; 57 scoped_ptr<char[]> pixels_;
(...skipping 29 matching lines...) Expand all
87 87
88 private: 88 private:
89 SkBitmap bitmap_; 89 SkBitmap bitmap_;
90 }; 90 };
91 91
92 TestPixelRef::TestPixelRef(int width, int height) 92 TestPixelRef::TestPixelRef(int width, int height)
93 : pixels_(new char[4 * width * height]) {} 93 : pixels_(new char[4 * width * height]) {}
94 94
95 TestPixelRef::~TestPixelRef() {} 95 TestPixelRef::~TestPixelRef() {}
96 96
97 SkFlattenable::Factory TestPixelRef::getFactory() { return NULL; } 97 SkFlattenable::Factory TestPixelRef::getFactory() const { return NULL; }
98 98
99 void* TestPixelRef::onLockPixels(SkColorTable** color_table) { 99 void* TestPixelRef::onLockPixels(SkColorTable** color_table) {
100 return pixels_.get(); 100 return pixels_.get();
101 } 101 }
102 102
103 SkPixelRef* TestPixelRef::deepCopy(SkBitmap::Config config, 103 SkPixelRef* TestPixelRef::deepCopy(SkBitmap::Config config,
104 const SkIRect* subset) { 104 const SkIRect* subset) {
105 this->ref(); 105 this->ref();
106 return this; 106 return this;
107 } 107 }
108 108
109 TestLazyPixelRef::TestLazyPixelRef(int width, int height) 109 TestLazyPixelRef::TestLazyPixelRef(int width, int height)
110 : pixels_(new char[4 * width * height]) {} 110 : pixels_(new char[4 * width * height]) {}
111 111
112 TestLazyPixelRef::~TestLazyPixelRef() {} 112 TestLazyPixelRef::~TestLazyPixelRef() {}
113 113
114 SkFlattenable::Factory TestLazyPixelRef::getFactory() { return NULL; } 114 SkFlattenable::Factory TestLazyPixelRef::getFactory() const { return NULL; }
115 115
116 void* TestLazyPixelRef::onLockPixels(SkColorTable** color_table) { 116 void* TestLazyPixelRef::onLockPixels(SkColorTable** color_table) {
117 return pixels_.get(); 117 return pixels_.get();
118 } 118 }
119 119
120 bool TestLazyPixelRef::PrepareToDecode(const PrepareParams& params) { 120 bool TestLazyPixelRef::PrepareToDecode(const PrepareParams& params) {
121 return true; 121 return true;
122 } 122 }
123 123
124 bool TestLazyPixelRef::MaybeDecoded() { 124 bool TestLazyPixelRef::MaybeDecoded() {
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 EXPECT_EQ(3u, pixel_refs.size()); 727 EXPECT_EQ(3u, pixel_refs.size());
728 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90), 728 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90),
729 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect)); 729 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect));
730 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40), 730 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40),
731 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect)); 731 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect));
732 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145), 732 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145),
733 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect)); 733 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect));
734 } 734 }
735 735
736 } // namespace skia 736 } // namespace skia
OLDNEW
« no previous file with comments | « cc/test/skia_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698