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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include <tuple> | 49 #include <tuple> |
50 | 50 |
51 namespace blink { | 51 namespace blink { |
52 | 52 |
53 Image::Image(ImageObserver* observer) | 53 Image::Image(ImageObserver* observer) |
54 : image_observer_(observer), image_observer_disabled_(false) {} | 54 : image_observer_(observer), image_observer_disabled_(false) {} |
55 | 55 |
56 Image::~Image() {} | 56 Image::~Image() {} |
57 | 57 |
58 Image* Image::NullImage() { | 58 Image* Image::NullImage() { |
59 ASSERT(IsMainThread()); | 59 DCHECK(IsMainThread()); |
60 DEFINE_STATIC_REF(Image, null_image, (BitmapImage::Create())); | 60 DEFINE_STATIC_REF(Image, null_image, (BitmapImage::Create())); |
61 return null_image; | 61 return null_image; |
62 } | 62 } |
63 | 63 |
64 PassRefPtr<Image> Image::LoadPlatformResource(const char* name) { | 64 PassRefPtr<Image> Image::LoadPlatformResource(const char* name) { |
65 const WebData& resource = Platform::Current()->LoadResource(name); | 65 const WebData& resource = Platform::Current()->LoadResource(name); |
66 if (resource.IsEmpty()) | 66 if (resource.IsEmpty()) |
67 return Image::NullImage(); | 67 return Image::NullImage(); |
68 | 68 |
69 RefPtr<Image> image = BitmapImage::Create(); | 69 RefPtr<Image> image = BitmapImage::Create(); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 FloatRect subset = dest; | 380 FloatRect subset = dest; |
381 subset.SetX((dest.X() - tile.X()) / scale.Width()); | 381 subset.SetX((dest.X() - tile.X()) / scale.Width()); |
382 subset.SetY((dest.Y() - tile.Y()) / scale.Height()); | 382 subset.SetY((dest.Y() - tile.Y()) / scale.Height()); |
383 subset.SetWidth(dest.Width() / scale.Width()); | 383 subset.SetWidth(dest.Width() / scale.Width()); |
384 subset.SetHeight(dest.Height() / scale.Height()); | 384 subset.SetHeight(dest.Height() / scale.Height()); |
385 | 385 |
386 return subset; | 386 return subset; |
387 } | 387 } |
388 | 388 |
389 } // namespace blink | 389 } // namespace blink |
OLD | NEW |