| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 if (src.alphaType() == kOpaque_SkAlphaType && dst.alphaType() == kPremul_SkA
lphaType) { | 46 if (src.alphaType() == kOpaque_SkAlphaType && dst.alphaType() == kPremul_SkA
lphaType) { |
| 47 const SkImageInfo& tmp = src.makeAlphaType(kPremul_SkAlphaType); | 47 const SkImageInfo& tmp = src.makeAlphaType(kPremul_SkAlphaType); |
| 48 return tmp == dst; | 48 return tmp == dst; |
| 49 } | 49 } |
| 50 | 50 |
| 51 return false; | 51 return false; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Creates a SkPixelRef such that the memory for pixels is given by an external
body. | 54 // Creates a SkPixelRef such that the memory for pixels is given by an external
body. |
| 55 // This is used to write directly to the memory given by Skia during decoding. | 55 // This is used to write directly to the memory given by Skia during decoding. |
| 56 class ImageFrameGenerator::ExternalMemoryAllocator : public SkBitmap::Allocator
{ | 56 class ImageFrameGenerator::ExternalMemoryAllocator final : public SkBitmap::Allo
cator { |
| 57 USING_FAST_MALLOC(ExternalMemoryAllocator); |
| 58 WTF_MAKE_NONCOPYABLE(ExternalMemoryAllocator); |
| 57 public: | 59 public: |
| 58 ExternalMemoryAllocator(const SkImageInfo& info, void* pixels, size_t rowByt
es) | 60 ExternalMemoryAllocator(const SkImageInfo& info, void* pixels, size_t rowByt
es) |
| 59 : m_info(info) | 61 : m_info(info) |
| 60 , m_pixels(pixels) | 62 , m_pixels(pixels) |
| 61 , m_rowBytes(rowBytes) | 63 , m_rowBytes(rowBytes) |
| 62 { | 64 { |
| 63 } | 65 } |
| 64 | 66 |
| 65 bool allocPixelRef(SkBitmap* dst, SkColorTable* ctable) override | 67 bool allocPixelRef(SkBitmap* dst, SkColorTable* ctable) override |
| 66 { | 68 { |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 375 |
| 374 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. | 376 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. |
| 375 decoder->setData(data, allDataReceived); | 377 decoder->setData(data, allDataReceived); |
| 376 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); | 378 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); |
| 377 decoder->setImagePlanes(dummyImagePlanes.release()); | 379 decoder->setImagePlanes(dummyImagePlanes.release()); |
| 378 | 380 |
| 379 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::
SizeForMemoryAllocation); | 381 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::
SizeForMemoryAllocation); |
| 380 } | 382 } |
| 381 | 383 |
| 382 } // namespace blink | 384 } // namespace blink |
| OLD | NEW |