| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 { | 55 { |
| 56 } | 56 } |
| 57 | 57 |
| 58 Image* Image::nullImage() | 58 Image* Image::nullImage() |
| 59 { | 59 { |
| 60 ASSERT(isMainThread()); | 60 ASSERT(isMainThread()); |
| 61 DEFINE_STATIC_REF(Image, nullImage, (BitmapImage::create())); | 61 DEFINE_STATIC_REF(Image, nullImage, (BitmapImage::create())); |
| 62 return nullImage; | 62 return nullImage; |
| 63 } | 63 } |
| 64 | 64 |
| 65 PassRefPtr<Image> Image::loadPlatformResource(const char *name) | |
| 66 { | |
| 67 const WebData& resource = Platform::current()->loadResource(name); | |
| 68 if (resource.isEmpty()) | |
| 69 return Image::nullImage(); | |
| 70 | |
| 71 RefPtr<Image> image = BitmapImage::create(); | |
| 72 image->setData(resource, true); | |
| 73 return image.release(); | |
| 74 } | |
| 75 | |
| 76 bool Image::setData(PassRefPtr<SharedBuffer> data, bool allDataReceived) | 65 bool Image::setData(PassRefPtr<SharedBuffer> data, bool allDataReceived) |
| 77 { | 66 { |
| 78 m_encodedImageData = data; | 67 m_encodedImageData = data; |
| 79 if (!m_encodedImageData.get()) | 68 if (!m_encodedImageData.get()) |
| 80 return true; | 69 return true; |
| 81 | 70 |
| 82 int length = m_encodedImageData->size(); | 71 int length = m_encodedImageData->size(); |
| 83 if (!length) | 72 if (!length) |
| 84 return true; | 73 return true; |
| 85 | 74 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 } | 222 } |
| 234 | 223 |
| 235 PassRefPtr<Image> Image::imageForDefaultFrame() | 224 PassRefPtr<Image> Image::imageForDefaultFrame() |
| 236 { | 225 { |
| 237 RefPtr<Image> image(this); | 226 RefPtr<Image> image(this); |
| 238 | 227 |
| 239 return image.release(); | 228 return image.release(); |
| 240 } | 229 } |
| 241 | 230 |
| 242 } // namespace blink | 231 } // namespace blink |
| OLD | NEW |