OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 EXPECT_FALSE(image->bitmap().isNull()); | 214 EXPECT_FALSE(image->bitmap().isNull()); |
215 EXPECT_TRUE(image->bitmap().isImmutable()); | 215 EXPECT_TRUE(image->bitmap().isImmutable()); |
216 | 216 |
217 SkPictureRecorder recorder; | 217 SkPictureRecorder recorder; |
218 SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0); | 218 SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0); |
219 tempCanvas->drawBitmap(image->bitmap(), 0, 0); | 219 tempCanvas->drawBitmap(image->bitmap(), 0, 0); |
220 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); | 220 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); |
221 EXPECT_EQ(0, m_frameBufferRequestCount); | 221 EXPECT_EQ(0, m_frameBufferRequestCount); |
222 | 222 |
223 // Create a thread to rasterize SkPicture. | 223 // Create a thread to rasterize SkPicture. |
224 OwnPtr<blink::WebThread> thread = adoptPtr(blink::Platform::current()->creat
eThread("RasterThread")); | 224 OwnPtr<WebThread> thread = adoptPtr(Platform::current()->createThread("Raste
rThread")); |
225 thread->postTask(new Task(WTF::bind(&rasterizeMain, m_canvas.get(), picture.
get()))); | 225 thread->postTask(new Task(WTF::bind(&rasterizeMain, m_canvas.get(), picture.
get()))); |
226 thread.clear(); | 226 thread.clear(); |
227 EXPECT_EQ(0, m_frameBufferRequestCount); | 227 EXPECT_EQ(0, m_frameBufferRequestCount); |
228 | 228 |
229 SkBitmap canvasBitmap; | 229 SkBitmap canvasBitmap; |
230 ASSERT_TRUE(canvasBitmap.allocN32Pixels(100, 100)); | 230 ASSERT_TRUE(canvasBitmap.allocN32Pixels(100, 100)); |
231 ASSERT_TRUE(m_canvas->readPixels(&canvasBitmap, 0, 0)); | 231 ASSERT_TRUE(m_canvas->readPixels(&canvasBitmap, 0, 0)); |
232 SkAutoLockPixels autoLock(canvasBitmap); | 232 SkAutoLockPixels autoLock(canvasBitmap); |
233 EXPECT_EQ(SkColorSetARGB(255, 255, 255, 255), canvasBitmap.getColor(0, 0)); | 233 EXPECT_EQ(SkColorSetARGB(255, 255, 255, 255), canvasBitmap.getColor(0, 0)); |
234 } | 234 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); | 336 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); |
337 m_frameCount = 2; | 337 m_frameCount = 2; |
338 m_lazyDecoder->setData(*m_data, false); | 338 m_lazyDecoder->setData(*m_data, false); |
339 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); | 339 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); |
340 m_frameCount = 0; | 340 m_frameCount = 0; |
341 m_lazyDecoder->setData(*m_data, true); | 341 m_lazyDecoder->setData(*m_data, true); |
342 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); | 342 EXPECT_EQ(m_frameCount, m_lazyDecoder->frameCount()); |
343 } | 343 } |
344 | 344 |
345 } // namespace blink | 345 } // namespace blink |
OLD | NEW |