| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 hPhase -= (dstRect.width() - scaledTileWidth) / 2; | 162 hPhase -= (dstRect.width() - scaledTileWidth) / 2; |
| 163 if (vRule == Image::RepeatTile) | 163 if (vRule == Image::RepeatTile) |
| 164 vPhase -= (dstRect.height() - scaledTileHeight) / 2; | 164 vPhase -= (dstRect.height() - scaledTileHeight) / 2; |
| 165 FloatPoint patternPhase(dstRect.x() - hPhase, dstRect.y() - vPhase); | 165 FloatPoint patternPhase(dstRect.x() - hPhase, dstRect.y() - vPhase); |
| 166 | 166 |
| 167 drawPattern(ctxt, srcRect, patternTransform, patternPhase, styleColorSpace,
op, dstRect); | 167 drawPattern(ctxt, srcRect, patternTransform, patternPhase, styleColorSpace,
op, dstRect); |
| 168 | 168 |
| 169 startAnimation(); | 169 startAnimation(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) | |
| 173 FloatRect Image::adjustSourceRectForDownSampling(const FloatRect& srcRect, const
IntSize& scaledSize) const | |
| 174 { | |
| 175 const IntSize unscaledSize = size(); | |
| 176 if (unscaledSize == scaledSize) | |
| 177 return srcRect; | |
| 178 | |
| 179 // Image has been down-sampled. | |
| 180 float xscale = static_cast<float>(scaledSize.width()) / unscaledSize.width()
; | |
| 181 float yscale = static_cast<float>(scaledSize.height()) / unscaledSize.height
(); | |
| 182 FloatRect scaledSrcRect = srcRect; | |
| 183 scaledSrcRect.scale(xscale, yscale); | |
| 184 | |
| 185 return scaledSrcRect; | |
| 186 } | |
| 187 #endif | |
| 188 | |
| 189 void Image::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsic
Height, FloatSize& intrinsicRatio) | 172 void Image::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsic
Height, FloatSize& intrinsicRatio) |
| 190 { | 173 { |
| 191 intrinsicRatio = size(); | 174 intrinsicRatio = size(); |
| 192 intrinsicWidth = Length(intrinsicRatio.width(), Fixed); | 175 intrinsicWidth = Length(intrinsicRatio.width(), Fixed); |
| 193 intrinsicHeight = Length(intrinsicRatio.height(), Fixed); | 176 intrinsicHeight = Length(intrinsicRatio.height(), Fixed); |
| 194 } | 177 } |
| 195 | 178 |
| 196 void Image::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | 179 void Image::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const |
| 197 { | 180 { |
| 198 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); | 181 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); |
| 199 memoryObjectInfo->setClassName("Image"); | 182 memoryObjectInfo->setClassName("Image"); |
| 200 info.addMember(m_encodedImageData, "encodedImageData"); | 183 info.addMember(m_encodedImageData, "encodedImageData"); |
| 201 info.addWeakPointer(m_imageObserver); | 184 info.addWeakPointer(m_imageObserver); |
| 202 } | 185 } |
| 203 | 186 |
| 204 } | 187 } |
| OLD | NEW |