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

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

Issue 1456813002: Calculate Background Image Geometries using sub-pixel values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: MOAR expectations Created 5 years 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Image.h ('k') | no next file » | 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 if (!m_encodedImageData.get()) 89 if (!m_encodedImageData.get())
90 return true; 90 return true;
91 91
92 int length = m_encodedImageData->size(); 92 int length = m_encodedImageData->size();
93 if (!length) 93 if (!length)
94 return true; 94 return true;
95 95
96 return dataChanged(allDataReceived); 96 return dataChanged(allDataReceived);
97 } 97 }
98 98
99 void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl oatPoint& srcPoint, const FloatSize& scaledTileSize, SkXfermode::Mode op, const IntSize& repeatSpacing) 99 void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl oatPoint& srcPoint, const FloatSize& scaledTileSize, SkXfermode::Mode op, const FloatSize& repeatSpacing)
100 { 100 {
101 FloatSize intrinsicTileSize = FloatSize(size()); 101 FloatSize intrinsicTileSize = FloatSize(size());
102 if (hasRelativeWidth()) 102 if (hasRelativeWidth())
103 intrinsicTileSize.setWidth(scaledTileSize.width()); 103 intrinsicTileSize.setWidth(scaledTileSize.width());
104 if (hasRelativeHeight()) 104 if (hasRelativeHeight())
105 intrinsicTileSize.setHeight(scaledTileSize.height()); 105 intrinsicTileSize.setHeight(scaledTileSize.height());
106 106
107 FloatSize scale(scaledTileSize.width() / intrinsicTileSize.width(), 107 FloatSize scale(scaledTileSize.width() / intrinsicTileSize.width(),
108 scaledTileSize.height() / intrinsicTileSize.height()); 108 scaledTileSize.height() / intrinsicTileSize.height());
109 109
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 canvas->drawImage(image, 0, 0, &paint); 203 canvas->drawImage(image, 0, 0, &paint);
204 RefPtr<const SkPicture> picture = adoptRef(recorder.endRecordingAsPicture()) ; 204 RefPtr<const SkPicture> picture = adoptRef(recorder.endRecordingAsPicture()) ;
205 205
206 return adoptRef(SkShader::CreatePictureShader( 206 return adoptRef(SkShader::CreatePictureShader(
207 picture.get(), SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, & shaderMatrix, nullptr)); 207 picture.get(), SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, & shaderMatrix, nullptr));
208 } 208 }
209 209
210 } // anonymous namespace 210 } // anonymous namespace
211 211
212 void Image::drawPattern(GraphicsContext* context, const FloatRect& floatSrcRect, const FloatSize& scale, 212 void Image::drawPattern(GraphicsContext* context, const FloatRect& floatSrcRect, const FloatSize& scale,
213 const FloatPoint& phase, SkXfermode::Mode compositeOp, const FloatRect& dest Rect, const IntSize& repeatSpacing) 213 const FloatPoint& phase, SkXfermode::Mode compositeOp, const FloatRect& dest Rect, const FloatSize& repeatSpacing)
214 { 214 {
215 TRACE_EVENT0("skia", "Image::drawPattern"); 215 TRACE_EVENT0("skia", "Image::drawPattern");
216 216
217 RefPtr<SkImage> image = imageForCurrentFrame(); 217 RefPtr<SkImage> image = imageForCurrentFrame();
218 if (!image) 218 if (!image)
219 return; 219 return;
220 220
221 FloatRect normSrcRect = floatSrcRect; 221 FloatRect normSrcRect = floatSrcRect;
222 222
223 normSrcRect.intersect(FloatRect(0, 0, image->width(), image->height())); 223 normSrcRect.intersect(FloatRect(0, 0, image->width(), image->height()));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 273
274 return image.release(); 274 return image.release();
275 } 275 }
276 276
277 bool Image::isTextureBacked() 277 bool Image::isTextureBacked()
278 { 278 {
279 return imageForCurrentFrame()->isTextureBacked(); 279 return imageForCurrentFrame()->isTextureBacked();
280 } 280 }
281 281
282 } // namespace blink 282 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Image.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698