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 30 matching lines...) Expand all Loading... |
41 // This is used to write directly to the memory given by Skia during decoding. | 41 // This is used to write directly to the memory given by Skia during decoding. |
42 class ImageFrameGenerator::ExternalMemoryAllocator : public SkBitmap::Allocator
{ | 42 class ImageFrameGenerator::ExternalMemoryAllocator : public SkBitmap::Allocator
{ |
43 public: | 43 public: |
44 ExternalMemoryAllocator(const SkImageInfo& info, void* pixels, size_t rowByt
es) | 44 ExternalMemoryAllocator(const SkImageInfo& info, void* pixels, size_t rowByt
es) |
45 : m_info(info) | 45 : m_info(info) |
46 , m_pixels(pixels) | 46 , m_pixels(pixels) |
47 , m_rowBytes(rowBytes) | 47 , m_rowBytes(rowBytes) |
48 { | 48 { |
49 } | 49 } |
50 | 50 |
51 virtual bool allocPixelRef(SkBitmap* dst, SkColorTable* ctable) OVERRIDE | 51 virtual bool allocPixelRef(SkBitmap* dst, SkColorTable* ctable) override |
52 { | 52 { |
53 const SkImageInfo& info = dst->info(); | 53 const SkImageInfo& info = dst->info(); |
54 if (kUnknown_SkColorType == info.colorType()) | 54 if (kUnknown_SkColorType == info.colorType()) |
55 return false; | 55 return false; |
56 | 56 |
57 if (info != m_info || m_rowBytes != dst->rowBytes()) | 57 if (info != m_info || m_rowBytes != dst->rowBytes()) |
58 return false; | 58 return false; |
59 | 59 |
60 if (!dst->installPixels(m_info, m_pixels, m_rowBytes)) | 60 if (!dst->installPixels(m_info, m_pixels, m_rowBytes)) |
61 return false; | 61 return false; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 331 |
332 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. | 332 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. |
333 decoder->setData(data, allDataReceived); | 333 decoder->setData(data, allDataReceived); |
334 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); | 334 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); |
335 decoder->setImagePlanes(dummyImagePlanes.release()); | 335 decoder->setImagePlanes(dummyImagePlanes.release()); |
336 | 336 |
337 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::
SizeForMemoryAllocation); | 337 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::
SizeForMemoryAllocation); |
338 } | 338 } |
339 | 339 |
340 } // namespace blink | 340 } // namespace blink |
OLD | NEW |