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

Side by Side Diff: Source/core/platform/graphics/Image.cpp

Issue 15466003: Remove image decoder down sampling (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove virtual setSize() from GIF decoder Created 7 years, 7 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
« no previous file with comments | « Source/core/platform/graphics/Image.h ('k') | Source/core/platform/graphics/ImageSource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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 }
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/Image.h ('k') | Source/core/platform/graphics/ImageSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698