| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/platform/graphics/BitmapImage.h" | 28 #include "core/platform/graphics/BitmapImage.h" |
| 29 | 29 |
| 30 #include "core/platform/PlatformMemoryInstrumentation.h" | 30 #include "core/platform/PlatformMemoryInstrumentation.h" |
| 31 #include "core/platform/Timer.h" | 31 #include "core/platform/Timer.h" |
| 32 #include "core/platform/graphics/FloatRect.h" | 32 #include "core/platform/graphics/FloatRect.h" |
| 33 #include "core/platform/graphics/GraphicsContextStateSaver.h" | 33 #include "core/platform/graphics/GraphicsContextStateSaver.h" |
| 34 #include "core/platform/graphics/ImageObserver.h" | 34 #include "core/platform/graphics/ImageObserver.h" |
| 35 #include "core/platform/graphics/skia/SkiaUtils.h" | 35 #include "core/platform/graphics/skia/SkiaUtils.h" |
| 36 #include <wtf/CurrentTime.h> | 36 #include "wtf/CurrentTime.h" |
| 37 #include <wtf/MemoryInstrumentationVector.h> | 37 #include "wtf/MemoryInstrumentationVector.h" |
| 38 #include <wtf/MemoryObjectInfo.h> | 38 #include "wtf/MemoryObjectInfo.h" |
| 39 #include <wtf/text/WTFString.h> | 39 #include "wtf/Vector.h" |
| 40 #include <wtf/Vector.h> | 40 #include "wtf/text/WTFString.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 BitmapImage::BitmapImage(ImageObserver* observer) | 44 BitmapImage::BitmapImage(ImageObserver* observer) |
| 45 : Image(observer) | 45 : Image(observer) |
| 46 , m_currentFrame(0) | 46 , m_currentFrame(0) |
| 47 , m_frames(0) | 47 , m_frames(0) |
| 48 , m_frameTimer(0) | 48 , m_frameTimer(0) |
| 49 , m_repetitionCount(cAnimationNone) | 49 , m_repetitionCount(cAnimationNone) |
| 50 , m_repetitionCountStatus(Unknown) | 50 , m_repetitionCountStatus(Unknown) |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 m_haveFrameCount = false; | 279 m_haveFrameCount = false; |
| 280 m_hasUniformFrameSize = true; | 280 m_hasUniformFrameSize = true; |
| 281 return isSizeAvailable(); | 281 return isSizeAvailable(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 String BitmapImage::filenameExtension() const | 284 String BitmapImage::filenameExtension() const |
| 285 { | 285 { |
| 286 return m_source.filenameExtension(); | 286 return m_source.filenameExtension(); |
| 287 } | 287 } |
| 288 | 288 |
| 289 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl
oatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp, BlendMod
e blendMode) | 289 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl
oatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode) |
| 290 { | 290 { |
| 291 draw(ctxt, dstRect, srcRect, colorSpace, compositeOp, blendMode, DoNotRespec
tImageOrientation); | 291 draw(ctxt, dstRect, srcRect, compositeOp, blendMode, DoNotRespectImageOrient
ation); |
| 292 } | 292 } |
| 293 | 293 |
| 294 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl
oatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp, BlendMod
e blendMode, RespectImageOrientationEnum shouldRespectImageOrientation) | 294 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const Fl
oatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, RespectIma
geOrientationEnum shouldRespectImageOrientation) |
| 295 { | 295 { |
| 296 // Spin the animation to the correct frame before we try to draw it, so we | 296 // Spin the animation to the correct frame before we try to draw it, so we |
| 297 // don't draw an old frame and then immediately need to draw a newer one, | 297 // don't draw an old frame and then immediately need to draw a newer one, |
| 298 // causing flicker and wasting CPU. | 298 // causing flicker and wasting CPU. |
| 299 startAnimation(); | 299 startAnimation(); |
| 300 | 300 |
| 301 RefPtr<NativeImageSkia> bm = nativeImageForCurrentFrame(); | 301 RefPtr<NativeImageSkia> bm = nativeImageForCurrentFrame(); |
| 302 if (!bm) | 302 if (!bm) |
| 303 return; // It's too early and we don't have an image yet. | 303 return; // It's too early and we don't have an image yet. |
| 304 | 304 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 } | 669 } |
| 670 | 670 |
| 671 void FrameData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | 671 void FrameData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const |
| 672 { | 672 { |
| 673 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); | 673 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); |
| 674 memoryObjectInfo->setClassName("FrameData"); | 674 memoryObjectInfo->setClassName("FrameData"); |
| 675 info.addMember(m_frame, "frame", WTF::RetainingPointer); | 675 info.addMember(m_frame, "frame", WTF::RetainingPointer); |
| 676 } | 676 } |
| 677 | 677 |
| 678 } | 678 } |
| OLD | NEW |