OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 { | 69 { |
70 if (!image) | 70 if (!image) |
71 return nullptr; | 71 return nullptr; |
72 | 72 |
73 RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame(); | 73 RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame(); |
74 if (!bitmap) | 74 if (!bitmap) |
75 return nullptr; | 75 return nullptr; |
76 | 76 |
77 if (image->isBitmapImage()) { | 77 if (image->isBitmapImage()) { |
78 ImageOrientation orientation = DefaultImageOrientation; | 78 ImageOrientation orientation = DefaultImageOrientation; |
79 BitmapImage* bitmapImage = static_cast<BitmapImage*>(image); | 79 BitmapImage* bitmapImage = toBitmapImage(image); |
80 IntSize sizeRespectingOrientation = bitmapImage->sizeRespectingOrientati
on(); | 80 IntSize sizeRespectingOrientation = bitmapImage->sizeRespectingOrientati
on(); |
81 | 81 |
82 if (shouldRespectImageOrientation == RespectImageOrientation) | 82 if (shouldRespectImageOrientation == RespectImageOrientation) |
83 orientation = bitmapImage->currentFrameOrientation(); | 83 orientation = bitmapImage->currentFrameOrientation(); |
84 | 84 |
85 if (orientation != DefaultImageOrientation) { | 85 if (orientation != DefaultImageOrientation) { |
86 FloatRect destRect(FloatPoint(), sizeRespectingOrientation); | 86 FloatRect destRect(FloatPoint(), sizeRespectingOrientation); |
87 if (orientation.usesWidthAsHeight()) | 87 if (orientation.usesWidthAsHeight()) |
88 destRect = destRect.transposedRect(); | 88 destRect = destRect.transposedRect(); |
89 | 89 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 *pixel = SkPreMultiplyARGB( | 257 *pixel = SkPreMultiplyARGB( |
258 SkColorGetA(*pixel) * fraction, | 258 SkColorGetA(*pixel) * fraction, |
259 SkColorGetR(*pixel), | 259 SkColorGetR(*pixel), |
260 SkColorGetG(*pixel), | 260 SkColorGetG(*pixel), |
261 SkColorGetB(*pixel)); | 261 SkColorGetB(*pixel)); |
262 } | 262 } |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 } // namespace WebCore | 266 } // namespace WebCore |
OLD | NEW |