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

Side by Side Diff: Source/platform/graphics/BitmapImage.cpp

Issue 1026823002: [S.P.] Don't draw frames of animated images that are offscreen (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months 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 | Annotate | Revision Log
OLDNEW
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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 } 268 }
269 269
270 String BitmapImage::filenameExtension() const 270 String BitmapImage::filenameExtension() const
271 { 271 {
272 return m_source.filenameExtension(); 272 return m_source.filenameExtension();
273 } 273 }
274 274
275 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl oatRect& srcRect, SkXfermode::Mode compositeOp, RespectImageOrientationEnum shou ldRespectImageOrientation) 275 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl oatRect& srcRect, SkXfermode::Mode compositeOp, RespectImageOrientationEnum shou ldRespectImageOrientation)
276 { 276 {
277 TRACE_EVENT0("skia", "BitmapImage::draw"); 277 TRACE_EVENT0("skia", "BitmapImage::draw");
278
279 SkBitmap bitmap; 278 SkBitmap bitmap;
280 if (!bitmapForCurrentFrame(&bitmap)) 279 if (!bitmapForCurrentFrame(&bitmap))
281 return; // It's too early and we don't have an image yet. 280 return; // It's too early and we don't have an image yet.
282 281
283 FloatRect normDstRect = adjustForNegativeSize(dstRect); 282 FloatRect normDstRect = adjustForNegativeSize(dstRect);
284 FloatRect normSrcRect = adjustForNegativeSize(srcRect); 283 FloatRect normSrcRect = adjustForNegativeSize(srcRect);
285 normSrcRect.intersect(FloatRect(0, 0, bitmap.width(), bitmap.height())); 284 normSrcRect.intersect(FloatRect(0, 0, bitmap.width(), bitmap.height()));
286 285
287 if (normSrcRect.isEmpty() || normDstRect.isEmpty()) 286 if (normSrcRect.isEmpty() || normDstRect.isEmpty())
288 return; // Nothing to draw. 287 return; // Nothing to draw.
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 665
667 return m_isSolidColor && !m_currentFrame; 666 return m_isSolidColor && !m_currentFrame;
668 } 667 }
669 668
670 Color BitmapImage::solidColor() const 669 Color BitmapImage::solidColor() const
671 { 670 {
672 return m_solidColor; 671 return m_solidColor;
673 } 672 }
674 673
675 } // namespace blink 674 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGModelObject.cpp ('k') | Source/platform/graphics/PaintInvalidationReason.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698