OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "third_party/skia/include/core/SkImage.h" | 46 #include "third_party/skia/include/core/SkImage.h" |
47 #include "third_party/skia/include/core/SkSurface.h" | 47 #include "third_party/skia/include/core/SkSurface.h" |
48 #include "wtf/OwnPtr.h" | 48 #include "wtf/OwnPtr.h" |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
52 class ImageBitmapTest : public ::testing::Test { | 52 class ImageBitmapTest : public ::testing::Test { |
53 protected: | 53 protected: |
54 virtual void SetUp() | 54 virtual void SetUp() |
55 { | 55 { |
56 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterN32Premul(10, 1
0)); | 56 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(10, 10); |
57 surface->getCanvas()->clear(0xFFFFFFFF); | 57 surface->getCanvas()->clear(0xFFFFFFFF); |
58 m_image = adoptRef(surface->newImageSnapshot()); | 58 m_image = adoptRef(surface->newImageSnapshot()); |
59 | 59 |
60 RefPtr<SkSurface> surface2 = adoptRef(SkSurface::NewRasterN32Premul(5, 5
)); | 60 sk_sp<SkSurface> surface2 = SkSurface::MakeRasterN32Premul(5, 5); |
61 surface2->getCanvas()->clear(0xAAAAAAAA); | 61 surface2->getCanvas()->clear(0xAAAAAAAA); |
62 m_image2 = adoptRef(surface2->newImageSnapshot()); | 62 m_image2 = adoptRef(surface2->newImageSnapshot()); |
63 | 63 |
64 // Save the global memory cache to restore it upon teardown. | 64 // Save the global memory cache to restore it upon teardown. |
65 m_globalMemoryCache = replaceMemoryCacheForTesting(MemoryCache::create()
); | 65 m_globalMemoryCache = replaceMemoryCacheForTesting(MemoryCache::create()
); |
66 } | 66 } |
67 virtual void TearDown() | 67 virtual void TearDown() |
68 { | 68 { |
69 // Garbage collection is required prior to switching out the | 69 // Garbage collection is required prior to switching out the |
70 // test's memory cache; image resources are released, evicting | 70 // test's memory cache; image resources are released, evicting |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 ASSERT_NE(imageBitmap->bitmapImage()->imageForCurrentFrame(), newImageRe
source->getImage()->imageForCurrentFrame()); | 138 ASSERT_NE(imageBitmap->bitmapImage()->imageForCurrentFrame(), newImageRe
source->getImage()->imageForCurrentFrame()); |
139 SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get
(); | 139 SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get
(); |
140 ASSERT_NE(image1, nullptr); | 140 ASSERT_NE(image1, nullptr); |
141 SkImage* image2 = newImageResource->getImage()->imageForCurrentFrame().g
et(); | 141 SkImage* image2 = newImageResource->getImage()->imageForCurrentFrame().g
et(); |
142 ASSERT_NE(image2, nullptr); | 142 ASSERT_NE(image2, nullptr); |
143 ASSERT_NE(image1, image2); | 143 ASSERT_NE(image1, image2); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 } // namespace blink | 147 } // namespace blink |
OLD | NEW |