| 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, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 bool BitmapImage::hasColorProfile() const | 228 bool BitmapImage::hasColorProfile() const |
| 229 { | 229 { |
| 230 return m_source.hasColorProfile(); | 230 return m_source.hasColorProfile(); |
| 231 } | 231 } |
| 232 | 232 |
| 233 String BitmapImage::filenameExtension() const | 233 String BitmapImage::filenameExtension() const |
| 234 { | 234 { |
| 235 return m_source.filenameExtension(); | 235 return m_source.filenameExtension(); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void BitmapImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect&
dstRect, const FloatRect& srcRect, RespectImageOrientationEnum shouldRespectImag
eOrientation, ImageClampingMode clampMode) | 238 void BitmapImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect&
dstRect, const FloatRect& srcRect, bool imageSmoothingEnabled, RespectImageOrien
tationEnum shouldRespectImageOrientation, ImageClampingMode clampMode) |
| 239 { | 239 { |
| 240 TRACE_EVENT0("skia", "BitmapImage::draw"); | 240 TRACE_EVENT0("skia", "BitmapImage::draw"); |
| 241 | 241 |
| 242 RefPtr<SkImage> image = imageForCurrentFrame(); | 242 RefPtr<SkImage> image = imageForCurrentFrame(); |
| 243 if (!image) | 243 if (!image) |
| 244 return; // It's too early and we don't have an image yet. | 244 return; // It's too early and we don't have an image yet. |
| 245 | 245 |
| 246 FloatRect adjustedSrcRect = srcRect; | 246 FloatRect adjustedSrcRect = srcRect; |
| 247 adjustedSrcRect.intersect(SkRect::Make(image->bounds())); | 247 adjustedSrcRect.intersect(SkRect::Make(image->bounds())); |
| 248 | 248 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 264 | 264 |
| 265 canvas->concat(affineTransformToSkMatrix(orientation.transformFromDefaul
t(adjustedDstRect.size()))); | 265 canvas->concat(affineTransformToSkMatrix(orientation.transformFromDefaul
t(adjustedDstRect.size()))); |
| 266 | 266 |
| 267 if (orientation.usesWidthAsHeight()) { | 267 if (orientation.usesWidthAsHeight()) { |
| 268 // The destination rect will have it's width and height already reve
rsed for the orientation of | 268 // The destination rect will have it's width and height already reve
rsed for the orientation of |
| 269 // the image, as it was needed for page layout, so we need to revers
e it back here. | 269 // the image, as it was needed for page layout, so we need to revers
e it back here. |
| 270 adjustedDstRect = FloatRect(adjustedDstRect.x(), adjustedDstRect.y()
, adjustedDstRect.height(), adjustedDstRect.width()); | 270 adjustedDstRect = FloatRect(adjustedDstRect.x(), adjustedDstRect.y()
, adjustedDstRect.height(), adjustedDstRect.width()); |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 | 273 |
| 274 canvas->drawImageRect(image.get(), adjustedSrcRect, adjustedDstRect, &paint, | 274 SkPaint adjustedPaint = paint; |
| 275 if (!imageSmoothingEnabled && Image::isDrawScalingDown(adjustedSrcRect, adju
stedDstRect)) |
| 276 adjustedPaint.setFilterQuality(kLow_SkFilterQuality); |
| 277 |
| 278 canvas->drawImageRect(image.get(), adjustedSrcRect, adjustedDstRect, &adjust
edPaint, |
| 275 WebCoreClampingModeToSkiaRectConstraint(clampMode)); | 279 WebCoreClampingModeToSkiaRectConstraint(clampMode)); |
| 276 | 280 |
| 277 if (image->isLazyGenerated()) | 281 if (image->isLazyGenerated()) |
| 278 PlatformInstrumentation::didDrawLazyPixelRef(image->uniqueID()); | 282 PlatformInstrumentation::didDrawLazyPixelRef(image->uniqueID()); |
| 279 | 283 |
| 280 if (ImageObserver* observer = getImageObserver()) | 284 if (ImageObserver* observer = getImageObserver()) |
| 281 observer->didDraw(this); | 285 observer->didDraw(this); |
| 282 | 286 |
| 283 startAnimation(); | 287 startAnimation(); |
| 284 } | 288 } |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 | 594 |
| 591 // We need to draw this frame if we advanced to it while not skipping, or if | 595 // We need to draw this frame if we advanced to it while not skipping, or if |
| 592 // while trying to skip frames we hit the last frame and thus had to stop. | 596 // while trying to skip frames we hit the last frame and thus had to stop. |
| 593 if (skippingFrames != advancedAnimation) | 597 if (skippingFrames != advancedAnimation) |
| 594 getImageObserver()->animationAdvanced(this); | 598 getImageObserver()->animationAdvanced(this); |
| 595 | 599 |
| 596 return advancedAnimation; | 600 return advancedAnimation; |
| 597 } | 601 } |
| 598 | 602 |
| 599 } // namespace blink | 603 } // namespace blink |
| OLD | NEW |