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 27 matching lines...) Expand all Loading... |
38 // This is used to write directly to the memory given by Skia during decoding. | 38 // This is used to write directly to the memory given by Skia during decoding. |
39 class ImageFrameGenerator::ExternalMemoryAllocator : public SkBitmap::Allocator
{ | 39 class ImageFrameGenerator::ExternalMemoryAllocator : public SkBitmap::Allocator
{ |
40 public: | 40 public: |
41 ExternalMemoryAllocator(const SkImageInfo& info, void* pixels, size_t rowByt
es) | 41 ExternalMemoryAllocator(const SkImageInfo& info, void* pixels, size_t rowByt
es) |
42 : m_info(info) | 42 : m_info(info) |
43 , m_pixels(pixels) | 43 , m_pixels(pixels) |
44 , m_rowBytes(rowBytes) | 44 , m_rowBytes(rowBytes) |
45 { | 45 { |
46 } | 46 } |
47 | 47 |
48 virtual bool allocPixelRef(SkBitmap* dst, SkColorTable* ctable) override | 48 bool allocPixelRef(SkBitmap* dst, SkColorTable* ctable) override |
49 { | 49 { |
50 const SkImageInfo& info = dst->info(); | 50 const SkImageInfo& info = dst->info(); |
51 if (kUnknown_SkColorType == info.colorType()) | 51 if (kUnknown_SkColorType == info.colorType()) |
52 return false; | 52 return false; |
53 | 53 |
54 if (info != m_info || m_rowBytes != dst->rowBytes()) | 54 if (info != m_info || m_rowBytes != dst->rowBytes()) |
55 return false; | 55 return false; |
56 | 56 |
57 if (!dst->installPixels(m_info, m_pixels, m_rowBytes)) | 57 if (!dst->installPixels(m_info, m_pixels, m_rowBytes)) |
58 return false; | 58 return false; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 356 |
357 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. | 357 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. |
358 decoder->setData(data, allDataReceived); | 358 decoder->setData(data, allDataReceived); |
359 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); | 359 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); |
360 decoder->setImagePlanes(dummyImagePlanes.release()); | 360 decoder->setImagePlanes(dummyImagePlanes.release()); |
361 | 361 |
362 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::
SizeForMemoryAllocation); | 362 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::
SizeForMemoryAllocation); |
363 } | 363 } |
364 | 364 |
365 } // namespace blink | 365 } // namespace blink |
OLD | NEW |