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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 TRACE_EVENT1("blink", "ImageFrameGenerator::decodeAndScale", "frame index",
static_cast<int>(index)); | 125 TRACE_EVENT1("blink", "ImageFrameGenerator::decodeAndScale", "frame index",
static_cast<int>(index)); |
126 | 126 |
127 RefPtr<ExternalMemoryAllocator> externalAllocator = adoptRef(new ExternalMem
oryAllocator(info, pixels, rowBytes)); | 127 RefPtr<ExternalMemoryAllocator> externalAllocator = adoptRef(new ExternalMem
oryAllocator(info, pixels, rowBytes)); |
128 | 128 |
129 // This implementation does not support scaling so check the requested size. | 129 // This implementation does not support scaling so check the requested size. |
130 SkISize scaledSize = SkISize::Make(info.width(), info.height()); | 130 SkISize scaledSize = SkISize::Make(info.width(), info.height()); |
131 ASSERT(m_fullSize == scaledSize); | 131 ASSERT(m_fullSize == scaledSize); |
132 | 132 |
133 // TODO (scroggo): Convert tryToResumeDecode() and decode() to take a | 133 // TODO (scroggo): Convert tryToResumeDecode() and decode() to take a |
134 // PassRefPtr<SkBitmap::Allocator> instead of a bare pointer. | 134 // sk_sp<SkBitmap::Allocator> instead of a bare pointer. |
135 SkBitmap bitmap = tryToResumeDecode(data, allDataReceived, index, scaledSize
, externalAllocator.get()); | 135 SkBitmap bitmap = tryToResumeDecode(data, allDataReceived, index, scaledSize
, externalAllocator.get()); |
136 if (bitmap.isNull()) | 136 if (bitmap.isNull()) |
137 return false; | 137 return false; |
138 | 138 |
139 // Check to see if the decoder has written directly to the pixel memory | 139 // Check to see if the decoder has written directly to the pixel memory |
140 // provided. If not, make a copy. | 140 // provided. If not, make a copy. |
141 ASSERT(bitmap.width() == scaledSize.width()); | 141 ASSERT(bitmap.width() == scaledSize.width()); |
142 ASSERT(bitmap.height() == scaledSize.height()); | 142 ASSERT(bitmap.height() == scaledSize.height()); |
143 SkAutoLockPixels bitmapLock(bitmap); | 143 SkAutoLockPixels bitmapLock(bitmap); |
144 if (bitmap.getPixels() != pixels) | 144 if (bitmap.getPixels() != pixels) |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 return false; | 337 return false; |
338 | 338 |
339 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. | 339 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. |
340 std::unique_ptr<ImagePlanes> dummyImagePlanes = wrapUnique(new ImagePlanes); | 340 std::unique_ptr<ImagePlanes> dummyImagePlanes = wrapUnique(new ImagePlanes); |
341 decoder->setImagePlanes(std::move(dummyImagePlanes)); | 341 decoder->setImagePlanes(std::move(dummyImagePlanes)); |
342 | 342 |
343 return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, sizeInfo->fW
idthBytes); | 343 return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, sizeInfo->fW
idthBytes); |
344 } | 344 } |
345 | 345 |
346 } // namespace blink | 346 } // namespace blink |
OLD | NEW |