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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 EXPECT_EQ(1, image->height()); | 219 EXPECT_EQ(1, image->height()); |
220 | 220 |
221 SkPictureRecorder recorder; | 221 SkPictureRecorder recorder; |
222 SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0); | 222 SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0); |
223 tempCanvas->drawImage(image.get(), 0, 0); | 223 tempCanvas->drawImage(image.get(), 0, 0); |
224 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); | 224 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); |
225 EXPECT_EQ(0, m_decodeRequestCount); | 225 EXPECT_EQ(0, m_decodeRequestCount); |
226 | 226 |
227 // Create a thread to rasterize SkPicture. | 227 // Create a thread to rasterize SkPicture. |
228 OwnPtr<WebThread> thread = adoptPtr(Platform::current()->createThread("Raste
rThread")); | 228 OwnPtr<WebThread> thread = adoptPtr(Platform::current()->createThread("Raste
rThread")); |
229 thread->postTask(FROM_HERE, new Task(threadSafeBind(&rasterizeMain, AllowCro
ssThreadAccess(m_surface->getCanvas()), AllowCrossThreadAccess(picture.get()))))
; | 229 thread->taskRunner()->postTask(FROM_HERE, new Task(threadSafeBind(&rasterize
Main, AllowCrossThreadAccess(m_surface->getCanvas()), AllowCrossThreadAccess(pic
ture.get())))); |
230 thread.clear(); | 230 thread.clear(); |
231 EXPECT_EQ(0, m_decodeRequestCount); | 231 EXPECT_EQ(0, m_decodeRequestCount); |
232 | 232 |
233 SkBitmap canvasBitmap; | 233 SkBitmap canvasBitmap; |
234 canvasBitmap.allocN32Pixels(100, 100); | 234 canvasBitmap.allocN32Pixels(100, 100); |
235 ASSERT_TRUE(m_surface->getCanvas()->readPixels(&canvasBitmap, 0, 0)); | 235 ASSERT_TRUE(m_surface->getCanvas()->readPixels(&canvasBitmap, 0, 0)); |
236 SkAutoLockPixels autoLock(canvasBitmap); | 236 SkAutoLockPixels autoLock(canvasBitmap); |
237 EXPECT_EQ(SkColorSetARGB(255, 255, 255, 255), canvasBitmap.getColor(0, 0)); | 237 EXPECT_EQ(SkColorSetARGB(255, 255, 255, 255), canvasBitmap.getColor(0, 0)); |
238 } | 238 } |
239 | 239 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 // After decoding, the frame is known to be opaque. | 360 // After decoding, the frame is known to be opaque. |
361 frame = decoder->createFrameAtIndex(0); | 361 frame = decoder->createFrameAtIndex(0); |
362 ASSERT_TRUE(frame); | 362 ASSERT_TRUE(frame); |
363 EXPECT_TRUE(frame->isOpaque()); | 363 EXPECT_TRUE(frame->isOpaque()); |
364 | 364 |
365 // Re-generating the opaque-marked frame should not fail. | 365 // Re-generating the opaque-marked frame should not fail. |
366 EXPECT_TRUE(frame->readPixels(pixels, 0, 0)); | 366 EXPECT_TRUE(frame->readPixels(pixels, 0, 0)); |
367 } | 367 } |
368 | 368 |
369 } // namespace blink | 369 } // namespace blink |
OLD | NEW |