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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 EXPECT_EQ(1, image->height()); | 207 EXPECT_EQ(1, image->height()); |
208 | 208 |
209 SkPictureRecorder recorder; | 209 SkPictureRecorder recorder; |
210 SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0); | 210 SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0); |
211 tempCanvas->drawImage(image.get(), 0, 0); | 211 tempCanvas->drawImage(image.get(), 0, 0); |
212 sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture(); | 212 sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture(); |
213 EXPECT_EQ(0, m_decodeRequestCount); | 213 EXPECT_EQ(0, m_decodeRequestCount); |
214 | 214 |
215 // Create a thread to rasterize SkPicture. | 215 // Create a thread to rasterize SkPicture. |
216 std::unique_ptr<WebThread> thread = | 216 std::unique_ptr<WebThread> thread = |
217 wrapUnique(Platform::current()->createThread("RasterThread")); | 217 WTF::wrapUnique(Platform::current()->createThread("RasterThread")); |
218 thread->getWebTaskRunner()->postTask( | 218 thread->getWebTaskRunner()->postTask( |
219 BLINK_FROM_HERE, | 219 BLINK_FROM_HERE, |
220 crossThreadBind(&rasterizeMain, | 220 crossThreadBind(&rasterizeMain, |
221 crossThreadUnretained(m_surface->getCanvas()), | 221 crossThreadUnretained(m_surface->getCanvas()), |
222 crossThreadUnretained(picture.get()))); | 222 crossThreadUnretained(picture.get()))); |
223 thread.reset(); | 223 thread.reset(); |
224 EXPECT_EQ(0, m_decodeRequestCount); | 224 EXPECT_EQ(0, m_decodeRequestCount); |
225 | 225 |
226 SkBitmap canvasBitmap; | 226 SkBitmap canvasBitmap; |
227 canvasBitmap.allocN32Pixels(100, 100); | 227 canvasBitmap.allocN32Pixels(100, 100); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 SharedBuffer::create(m_data->data(), m_data->size()); | 380 SharedBuffer::create(m_data->data(), m_data->size()); |
381 EXPECT_EQ(originalData->size(), m_data->size()); | 381 EXPECT_EQ(originalData->size(), m_data->size()); |
382 m_lazyDecoder->setData(originalData, false); | 382 m_lazyDecoder->setData(originalData, false); |
383 RefPtr<SharedBuffer> newData = m_lazyDecoder->data(); | 383 RefPtr<SharedBuffer> newData = m_lazyDecoder->data(); |
384 EXPECT_EQ(originalData->size(), newData->size()); | 384 EXPECT_EQ(originalData->size(), newData->size()); |
385 EXPECT_EQ( | 385 EXPECT_EQ( |
386 0, std::memcmp(originalData->data(), newData->data(), newData->size())); | 386 0, std::memcmp(originalData->data(), newData->data(), newData->size())); |
387 } | 387 } |
388 | 388 |
389 } // namespace blink | 389 } // namespace blink |
OLD | NEW |