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 12 matching lines...) Expand all Loading... |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "platform/DragImage.h" | 31 #include "platform/DragImage.h" |
32 | 32 |
| 33 #include <memory> |
33 #include "platform/fonts/FontDescription.h" | 34 #include "platform/fonts/FontDescription.h" |
34 #include "platform/fonts/FontTraits.h" | 35 #include "platform/fonts/FontTraits.h" |
35 #include "platform/geometry/IntSize.h" | 36 #include "platform/geometry/IntSize.h" |
36 #include "platform/graphics/BitmapImage.h" | 37 #include "platform/graphics/BitmapImage.h" |
37 #include "platform/graphics/Image.h" | 38 #include "platform/graphics/Image.h" |
38 #include "platform/graphics/skia/SkiaUtils.h" | 39 #include "platform/graphics/skia/SkiaUtils.h" |
39 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
40 #include "testing/gtest/include/gtest/gtest.h" | 41 #include "testing/gtest/include/gtest/gtest.h" |
41 #include "third_party/skia/include/core/SkCanvas.h" | 42 #include "third_party/skia/include/core/SkCanvas.h" |
42 #include "third_party/skia/include/core/SkColor.h" | 43 #include "third_party/skia/include/core/SkColor.h" |
43 #include "third_party/skia/include/core/SkImage.h" | 44 #include "third_party/skia/include/core/SkImage.h" |
44 #include "third_party/skia/include/core/SkPixelRef.h" | 45 #include "third_party/skia/include/core/SkPixelRef.h" |
45 #include "third_party/skia/include/core/SkSurface.h" | 46 #include "third_party/skia/include/core/SkSurface.h" |
46 #include "wtf/PassRefPtr.h" | 47 #include "wtf/PassRefPtr.h" |
47 #include "wtf/RefPtr.h" | 48 #include "wtf/RefPtr.h" |
48 #include <memory> | |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
52 class TestImage : public Image { | 52 class TestImage : public Image { |
53 public: | 53 public: |
54 static PassRefPtr<TestImage> create(sk_sp<SkImage> image) { | 54 static PassRefPtr<TestImage> create(sk_sp<SkImage> image) { |
55 return adoptRef(new TestImage(image)); | 55 return adoptRef(new TestImage(image)); |
56 } | 56 } |
57 | 57 |
58 static PassRefPtr<TestImage> create(const IntSize& size) { | 58 static PassRefPtr<TestImage> create(const IntSize& size) { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 { | 222 { |
223 SkAutoLockPixels lock1(dragBitmap); | 223 SkAutoLockPixels lock1(dragBitmap); |
224 SkAutoLockPixels lock2(expectedBitmap); | 224 SkAutoLockPixels lock2(expectedBitmap); |
225 for (int x = 0; x < dragBitmap.width(); ++x) | 225 for (int x = 0; x < dragBitmap.width(); ++x) |
226 for (int y = 0; y < dragBitmap.height(); ++y) | 226 for (int y = 0; y < dragBitmap.height(); ++y) |
227 EXPECT_EQ(expectedBitmap.getColor(x, y), dragBitmap.getColor(x, y)); | 227 EXPECT_EQ(expectedBitmap.getColor(x, y), dragBitmap.getColor(x, y)); |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 } // namespace blink | 231 } // namespace blink |
OLD | NEW |