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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Image.cpp

Issue 1732563007: [NOT FOR COMMIT] Pass defaultObjectSize to get image size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 int length = m_encodedImageData->size(); 91 int length = m_encodedImageData->size();
92 if (!length) 92 if (!length)
93 return true; 93 return true;
94 94
95 return dataChanged(allDataReceived); 95 return dataChanged(allDataReceived);
96 } 96 }
97 97
98 void Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRect, const Fl oatPoint& srcPoint, const FloatSize& scaledTileSize, SkXfermode::Mode op, const FloatSize& repeatSpacing) 98 void Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRect, const Fl oatPoint& srcPoint, const FloatSize& scaledTileSize, SkXfermode::Mode op, const FloatSize& repeatSpacing)
99 { 99 {
100 FloatSize intrinsicTileSize = FloatSize(size()); 100 FloatSize intrinsicTileSize = FloatSize(defaultConcreteObjectSize());
101 if (hasRelativeSize()) { 101 if (hasRelativeSize()) {
102 intrinsicTileSize.setWidth(scaledTileSize.width()); 102 intrinsicTileSize.setWidth(scaledTileSize.width());
103 intrinsicTileSize.setHeight(scaledTileSize.height()); 103 intrinsicTileSize.setHeight(scaledTileSize.height());
104 } 104 }
105 105
106 FloatSize scale(scaledTileSize.width() / intrinsicTileSize.width(), 106 FloatSize scale(scaledTileSize.width() / intrinsicTileSize.width(),
107 scaledTileSize.height() / intrinsicTileSize.height()); 107 scaledTileSize.height() / intrinsicTileSize.height());
108 108
109 FloatSize actualTileSize(scaledTileSize.width() + repeatSpacing.width(), sca ledTileSize.height() + repeatSpacing.height()); 109 FloatSize actualTileSize(scaledTileSize.width() + repeatSpacing.width(), sca ledTileSize.height() + repeatSpacing.height());
110 FloatRect oneTileRect; 110 FloatRect oneTileRect;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 paint.setShader(shader.get()); 254 paint.setShader(shader.get());
255 context.drawRect(destRect, paint); 255 context.drawRect(destRect, paint);
256 } 256 }
257 257
258 if (currentFrameIsLazyDecoded()) 258 if (currentFrameIsLazyDecoded())
259 PlatformInstrumentation::didDrawLazyPixelRef(imageID); 259 PlatformInstrumentation::didDrawLazyPixelRef(imageID);
260 } 260 }
261 261
262 void Image::computeIntrinsicDimensions(FloatSize& intrinsicSize, FloatSize& intr insicRatio) 262 void Image::computeIntrinsicDimensions(FloatSize& intrinsicSize, FloatSize& intr insicRatio)
263 { 263 {
264 intrinsicSize = intrinsicRatio = FloatSize(size()); 264 intrinsicSize = intrinsicRatio = FloatSize(defaultConcreteObjectSize());
265 } 265 }
266 266
267 PassRefPtr<Image> Image::imageForDefaultFrame() 267 PassRefPtr<Image> Image::imageForDefaultFrame()
268 { 268 {
269 RefPtr<Image> image(this); 269 RefPtr<Image> image(this);
270 270
271 return image.release(); 271 return image.release();
272 } 272 }
273 273
274 bool Image::isTextureBacked() 274 bool Image::isTextureBacked()
275 { 275 {
276 RefPtr<SkImage> image = imageForCurrentFrame(); 276 RefPtr<SkImage> image = imageForCurrentFrame();
277 return image ? image->isTextureBacked() : false; 277 return image ? image->isTextureBacked() : false;
278 } 278 }
279 279
280 } // namespace blink 280 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Image.h ('k') | third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698