OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 explicit TestImage(const IntSize& size) | 63 explicit TestImage(const IntSize& size) |
64 : Image(0) | 64 : Image(0) |
65 , m_size(size) | 65 , m_size(size) |
66 { | 66 { |
67 m_bitmap.allocN32Pixels(size.width(), size.height()); | 67 m_bitmap.allocN32Pixels(size.width(), size.height()); |
68 m_bitmap.eraseColor(SK_ColorTRANSPARENT); | 68 m_bitmap.eraseColor(SK_ColorTRANSPARENT); |
69 } | 69 } |
70 | 70 |
71 virtual IntSize size() const override | 71 IntSize size() const override |
72 { | 72 { |
73 return m_size; | 73 return m_size; |
74 } | 74 } |
75 | 75 |
76 virtual bool bitmapForCurrentFrame(SkBitmap* bitmap) override | 76 bool bitmapForCurrentFrame(SkBitmap* bitmap) override |
77 { | 77 { |
78 if (m_size.isZero()) | 78 if (m_size.isZero()) |
79 return false; | 79 return false; |
80 | 80 |
81 *bitmap = m_bitmap; | 81 *bitmap = m_bitmap; |
82 return true; | 82 return true; |
83 } | 83 } |
84 | 84 |
85 // Stub implementations of pure virtual Image functions. | 85 // Stub implementations of pure virtual Image functions. |
86 virtual void destroyDecodedData(bool) override | 86 void destroyDecodedData(bool) override |
87 { | 87 { |
88 } | 88 } |
89 | 89 |
90 virtual bool currentFrameKnownToBeOpaque() override | 90 bool currentFrameKnownToBeOpaque() override |
91 { | 91 { |
92 return false; | 92 return false; |
93 } | 93 } |
94 | 94 |
95 void draw(GraphicsContext*, const FloatRect&, const FloatRect&, SkXfermode::
Mode, RespectImageOrientationEnum) override | 95 void draw(SkCanvas*, const SkPaint&, const FloatRect&, const FloatRect&, Res
pectImageOrientationEnum) override |
96 { | 96 { |
97 } | 97 } |
98 | 98 |
99 private: | 99 private: |
100 | 100 |
101 IntSize m_size; | 101 IntSize m_size; |
102 | 102 |
103 SkBitmap m_bitmap; | 103 SkBitmap m_bitmap; |
104 }; | 104 }; |
105 | 105 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 { | 240 { |
241 SkAutoLockPixels lock1(dragBitmap); | 241 SkAutoLockPixels lock1(dragBitmap); |
242 SkAutoLockPixels lock2(expectedBitmap); | 242 SkAutoLockPixels lock2(expectedBitmap); |
243 for (int x = 0; x < dragBitmap.width(); ++x) | 243 for (int x = 0; x < dragBitmap.width(); ++x) |
244 for (int y = 0; y < dragBitmap.height(); ++y) | 244 for (int y = 0; y < dragBitmap.height(); ++y) |
245 EXPECT_EQ(expectedBitmap.getColor(x, y), dragBitmap.getColor(x,
y)); | 245 EXPECT_EQ(expectedBitmap.getColor(x, y), dragBitmap.getColor(x,
y)); |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
249 } // anonymous namespace | 249 } // anonymous namespace |
OLD | NEW |