| 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 SkBitmap bitmap; | 293 SkBitmap bitmap; |
| 294 if (!bitmapForCurrentFrame(&bitmap)) | 294 if (!bitmapForCurrentFrame(&bitmap)) |
| 295 return false; | 295 return false; |
| 296 return bitmap.isImmutable(); | 296 return bitmap.isImmutable(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 void BitmapImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect&
dstRect, const FloatRect& srcRect, RespectImageOrientationEnum shouldRespectImag
eOrientation, ImageClampingMode clampMode) | 299 void BitmapImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect&
dstRect, const FloatRect& srcRect, RespectImageOrientationEnum shouldRespectImag
eOrientation, ImageClampingMode clampMode) |
| 300 { | 300 { |
| 301 TRACE_EVENT0("skia", "BitmapImage::draw"); | 301 TRACE_EVENT0("skia", "BitmapImage::draw"); |
| 302 | 302 |
| 303 ASSERT(dstRect.width() >= 0 && dstRect.height() >= 0); | |
| 304 ASSERT(srcRect.width() >= 0 && srcRect.height() >= 0); | |
| 305 SkBitmap bitmap; | 303 SkBitmap bitmap; |
| 306 if (!bitmapForCurrentFrame(&bitmap)) | 304 if (!bitmapForCurrentFrame(&bitmap)) |
| 307 return; // It's too early and we don't have an image yet. | 305 return; // It's too early and we don't have an image yet. |
| 308 | 306 |
| 309 FloatRect adjustedSrcRect = srcRect; | 307 FloatRect adjustedSrcRect = srcRect; |
| 310 adjustedSrcRect.intersect(FloatRect(0, 0, bitmap.width(), bitmap.height())); | 308 adjustedSrcRect.intersect(FloatRect(0, 0, bitmap.width(), bitmap.height())); |
| 311 | 309 |
| 312 if (adjustedSrcRect.isEmpty() || dstRect.isEmpty()) | 310 if (adjustedSrcRect.isEmpty() || dstRect.isEmpty()) |
| 313 return; // Nothing to draw. | 311 return; // Nothing to draw. |
| 314 | 312 |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 | 689 |
| 692 return m_isSolidColor && !m_currentFrame; | 690 return m_isSolidColor && !m_currentFrame; |
| 693 } | 691 } |
| 694 | 692 |
| 695 Color BitmapImage::solidColor() const | 693 Color BitmapImage::solidColor() const |
| 696 { | 694 { |
| 697 return m_solidColor; | 695 return m_solidColor; |
| 698 } | 696 } |
| 699 | 697 |
| 700 } // namespace blink | 698 } // namespace blink |
| OLD | NEW |