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 Apple Computer, Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 hPhase -= (dstRect.width() - scaledTileWidth) / 2; | 176 hPhase -= (dstRect.width() - scaledTileWidth) / 2; |
177 if (vRule == Image::RepeatTile) | 177 if (vRule == Image::RepeatTile) |
178 vPhase -= (dstRect.height() - scaledTileHeight) / 2; | 178 vPhase -= (dstRect.height() - scaledTileHeight) / 2; |
179 FloatPoint patternPhase(dstRect.x() - hPhase, dstRect.y() - vPhase); | 179 FloatPoint patternPhase(dstRect.x() - hPhase, dstRect.y() - vPhase); |
180 | 180 |
181 drawPattern(ctxt, srcRect, patternTransform, patternPhase, styleColorSpace,
op, dstRect); | 181 drawPattern(ctxt, srcRect, patternTransform, patternPhase, styleColorSpace,
op, dstRect); |
182 | 182 |
183 startAnimation(); | 183 startAnimation(); |
184 } | 184 } |
185 | 185 |
186 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) | |
187 FloatRect Image::adjustSourceRectForDownSampling(const FloatRect& srcRect, const
IntSize& scaledSize) const | |
188 { | |
189 const IntSize unscaledSize = size(); | |
190 if (unscaledSize == scaledSize) | |
191 return srcRect; | |
192 | |
193 // Image has been down-sampled. | |
194 float xscale = static_cast<float>(scaledSize.width()) / unscaledSize.width()
; | |
195 float yscale = static_cast<float>(scaledSize.height()) / unscaledSize.height
(); | |
196 FloatRect scaledSrcRect = srcRect; | |
197 scaledSrcRect.scale(xscale, yscale); | |
198 | |
199 return scaledSrcRect; | |
200 } | |
201 #endif | |
202 | |
203 void Image::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsic
Height, FloatSize& intrinsicRatio) | 186 void Image::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsic
Height, FloatSize& intrinsicRatio) |
204 { | 187 { |
205 intrinsicRatio = size(); | 188 intrinsicRatio = size(); |
206 intrinsicWidth = Length(intrinsicRatio.width(), Fixed); | 189 intrinsicWidth = Length(intrinsicRatio.width(), Fixed); |
207 intrinsicHeight = Length(intrinsicRatio.height(), Fixed); | 190 intrinsicHeight = Length(intrinsicRatio.height(), Fixed); |
208 } | 191 } |
209 | 192 |
210 void Image::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | 193 void Image::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const |
211 { | 194 { |
212 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); | 195 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); |
213 memoryObjectInfo->setClassName("Image"); | 196 memoryObjectInfo->setClassName("Image"); |
214 info.addMember(m_encodedImageData, "encodedImageData"); | 197 info.addMember(m_encodedImageData, "encodedImageData"); |
215 info.addWeakPointer(m_imageObserver); | 198 info.addWeakPointer(m_imageObserver); |
216 } | 199 } |
217 | 200 |
218 } | 201 } |
OLD | NEW |