| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "platform/image-decoders/bmp/BMPImageDecoder.h" | 35 #include "platform/image-decoders/bmp/BMPImageDecoder.h" |
| 36 #include "platform/image-decoders/ico/ICOImageDecoder.h" | 36 #include "platform/image-decoders/ico/ICOImageDecoder.h" |
| 37 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 38 #include "public/platform/WebData.h" | 38 #include "public/platform/WebData.h" |
| 39 #include "public/platform/WebImage.h" | 39 #include "public/platform/WebImage.h" |
| 40 #include "public/platform/WebSize.h" | 40 #include "public/platform/WebSize.h" |
| 41 #include "wtf/OwnPtr.h" | 41 #include "wtf/OwnPtr.h" |
| 42 #include "wtf/PassOwnPtr.h" | 42 #include "wtf/PassOwnPtr.h" |
| 43 #include "wtf/PassRefPtr.h" | 43 #include "wtf/PassRefPtr.h" |
| 44 | 44 |
| 45 using namespace blink; | |
| 46 | |
| 47 namespace blink { | 45 namespace blink { |
| 48 | 46 |
| 49 void WebImageDecoder::reset() | 47 void WebImageDecoder::reset() |
| 50 { | 48 { |
| 51 delete m_private; | 49 delete m_private; |
| 52 } | 50 } |
| 53 | 51 |
| 54 void WebImageDecoder::init(Type type) | 52 void WebImageDecoder::init(Type type) |
| 55 { | 53 { |
| 56 size_t maxDecodedBytes = blink::Platform::current()->maxDecodedImageBytes(); | 54 size_t maxDecodedBytes = Platform::current()->maxDecodedImageBytes(); |
| 57 | 55 |
| 58 switch (type) { | 56 switch (type) { |
| 59 case TypeBMP: | 57 case TypeBMP: |
| 60 m_private = new BMPImageDecoder(ImageSource::AlphaPremultiplied, ImageSo
urce::GammaAndColorProfileApplied, maxDecodedBytes); | 58 m_private = new BMPImageDecoder(ImageSource::AlphaPremultiplied, ImageSo
urce::GammaAndColorProfileApplied, maxDecodedBytes); |
| 61 break; | 59 break; |
| 62 case TypeICO: | 60 case TypeICO: |
| 63 m_private = new ICOImageDecoder(ImageSource::AlphaPremultiplied, ImageSo
urce::GammaAndColorProfileApplied, maxDecodedBytes); | 61 m_private = new ICOImageDecoder(ImageSource::AlphaPremultiplied, ImageSo
urce::GammaAndColorProfileApplied, maxDecodedBytes); |
| 64 break; | 62 break; |
| 65 } | 63 } |
| 66 } | 64 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 { | 106 { |
| 109 ASSERT(m_private); | 107 ASSERT(m_private); |
| 110 ImageFrame* const frameBuffer = m_private->frameBufferAtIndex(index); | 108 ImageFrame* const frameBuffer = m_private->frameBufferAtIndex(index); |
| 111 if (!frameBuffer) | 109 if (!frameBuffer) |
| 112 return WebImage(); | 110 return WebImage(); |
| 113 RefPtr<NativeImageSkia> image = frameBuffer->asNewNativeImage(); | 111 RefPtr<NativeImageSkia> image = frameBuffer->asNewNativeImage(); |
| 114 return WebImage(image->bitmap()); | 112 return WebImage(image->bitmap()); |
| 115 } | 113 } |
| 116 | 114 |
| 117 } // namespace blink | 115 } // namespace blink |
| OLD | NEW |