Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: Source/core/platform/DragImage.cpp

Issue 106193004: Introduce DEFINE_IMAGE_TYPE_CASTS, and use it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/fetch/ImageResource.cpp ('k') | Source/core/svg/graphics/SVGImage.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/core/fetch/ImageResource.cpp ('k') | Source/core/svg/graphics/SVGImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698