| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 namespace blink { | 52 namespace blink { |
| 53 | 53 |
| 54 Image::Image(ImageObserver* observer) | 54 Image::Image(ImageObserver* observer) |
| 55 : image_observer_(observer), image_observer_disabled_(false) {} | 55 : image_observer_(observer), image_observer_disabled_(false) {} |
| 56 | 56 |
| 57 Image::~Image() {} | 57 Image::~Image() {} |
| 58 | 58 |
| 59 Image* Image::NullImage() { | 59 Image* Image::NullImage() { |
| 60 DCHECK(IsMainThread()); | 60 DCHECK(IsMainThread()); |
| 61 DEFINE_STATIC_REF(Image, null_image, (BitmapImage::Create())); | 61 DEFINE_STATIC_REF(Image, null_image, (BitmapImage::CreateGlobal())); |
| 62 return null_image; | 62 return null_image; |
| 63 } | 63 } |
| 64 | 64 |
| 65 PassRefPtr<Image> Image::LoadPlatformResource(const char* name) { | 65 PassRefPtr<Image> Image::LoadPlatformResource(const char* name) { |
| 66 const WebData& resource = Platform::Current()->LoadResource(name); | 66 const WebData& resource = Platform::Current()->LoadResource(name); |
| 67 if (resource.IsEmpty()) | 67 if (resource.IsEmpty()) |
| 68 return Image::NullImage(); | 68 return Image::NullImage(); |
| 69 | 69 |
| 70 RefPtr<Image> image = BitmapImage::Create(); | 70 RefPtr<Image> image = BitmapImage::CreateGlobal(); |
| 71 image->SetData(resource, true); | 71 image->SetData(resource, true); |
| 72 return image.Release(); | 72 return image.Release(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool Image::SupportsType(const String& type) { | 75 bool Image::SupportsType(const String& type) { |
| 76 return MIMETypeRegistry::IsSupportedImageResourceMIMEType(type); | 76 return MIMETypeRegistry::IsSupportedImageResourceMIMEType(type); |
| 77 } | 77 } |
| 78 | 78 |
| 79 Image::SizeAvailability Image::SetData(PassRefPtr<SharedBuffer> data, | 79 Image::SizeAvailability Image::SetData(PassRefPtr<SharedBuffer> data, |
| 80 bool all_data_received) { | 80 bool all_data_received) { |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 FloatRect subset = dest; | 390 FloatRect subset = dest; |
| 391 subset.SetX((dest.X() - tile.X()) / scale.Width()); | 391 subset.SetX((dest.X() - tile.X()) / scale.Width()); |
| 392 subset.SetY((dest.Y() - tile.Y()) / scale.Height()); | 392 subset.SetY((dest.Y() - tile.Y()) / scale.Height()); |
| 393 subset.SetWidth(dest.Width() / scale.Width()); | 393 subset.SetWidth(dest.Width() / scale.Width()); |
| 394 subset.SetHeight(dest.Height() / scale.Height()); | 394 subset.SetHeight(dest.Height() / scale.Height()); |
| 395 | 395 |
| 396 return subset; | 396 return subset; |
| 397 } | 397 } |
| 398 | 398 |
| 399 } // namespace blink | 399 } // namespace blink |
| OLD | NEW |