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

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

Issue 2712083002: color: Remove blink pre-conversion code (Closed)
Patch Set: Rebase Created 3 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 void Image::drawPattern(GraphicsContext& context, 258 void Image::drawPattern(GraphicsContext& context,
259 const FloatRect& floatSrcRect, 259 const FloatRect& floatSrcRect,
260 const FloatSize& scale, 260 const FloatSize& scale,
261 const FloatPoint& phase, 261 const FloatPoint& phase,
262 SkBlendMode compositeOp, 262 SkBlendMode compositeOp,
263 const FloatRect& destRect, 263 const FloatRect& destRect,
264 const FloatSize& repeatSpacing) { 264 const FloatSize& repeatSpacing) {
265 TRACE_EVENT0("skia", "Image::drawPattern"); 265 TRACE_EVENT0("skia", "Image::drawPattern");
266 266
267 sk_sp<SkImage> image = imageForCurrentFrame(context.getColorBehavior()); 267 sk_sp<SkImage> image =
268 imageForCurrentFrame(ColorBehavior::transformToGlobalTarget());
268 if (!image) 269 if (!image)
269 return; 270 return;
270 271
271 FloatRect normSrcRect = floatSrcRect; 272 FloatRect normSrcRect = floatSrcRect;
272 273
273 normSrcRect.intersect(FloatRect(0, 0, image->width(), image->height())); 274 normSrcRect.intersect(FloatRect(0, 0, image->width(), image->height()));
274 if (destRect.isEmpty() || normSrcRect.isEmpty()) 275 if (destRect.isEmpty() || normSrcRect.isEmpty())
275 return; // nothing to draw 276 return; // nothing to draw
276 277
277 SkMatrix localMatrix; 278 SkMatrix localMatrix;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 if (currentFrameIsLazyDecoded()) 326 if (currentFrameIsLazyDecoded())
326 PlatformInstrumentation::didDrawLazyPixelRef(imageID); 327 PlatformInstrumentation::didDrawLazyPixelRef(imageID);
327 } 328 }
328 329
329 PassRefPtr<Image> Image::imageForDefaultFrame() { 330 PassRefPtr<Image> Image::imageForDefaultFrame() {
330 RefPtr<Image> image(this); 331 RefPtr<Image> image(this);
331 332
332 return image.release(); 333 return image.release();
333 } 334 }
334 335
335 bool Image::applyShader(PaintFlags& flags, 336 bool Image::applyShader(PaintFlags& flags, const SkMatrix& localMatrix) {
336 const SkMatrix& localMatrix,
337 const ColorBehavior& colorBehavior) {
338 // Default shader impl: attempt to build a shader based on the current frame 337 // Default shader impl: attempt to build a shader based on the current frame
339 // SkImage. 338 // SkImage.
340 sk_sp<SkImage> image = imageForCurrentFrame(colorBehavior); 339 sk_sp<SkImage> image =
340 imageForCurrentFrame(ColorBehavior::transformToGlobalTarget());
341 if (!image) 341 if (!image)
342 return false; 342 return false;
343 343
344 flags.setShader(image->makeShader(SkShader::kRepeat_TileMode, 344 flags.setShader(image->makeShader(SkShader::kRepeat_TileMode,
345 SkShader::kRepeat_TileMode, &localMatrix)); 345 SkShader::kRepeat_TileMode, &localMatrix));
346 if (!flags.getShader()) 346 if (!flags.getShader())
347 return false; 347 return false;
348 348
349 // Animation is normally refreshed in draw() impls, which we don't call when 349 // Animation is normally refreshed in draw() impls, which we don't call when
350 // painting via shaders. 350 // painting via shaders.
(...skipping 29 matching lines...) Expand all
380 FloatRect subset = dest; 380 FloatRect subset = dest;
381 subset.setX((dest.x() - tile.x()) / scale.width()); 381 subset.setX((dest.x() - tile.x()) / scale.width());
382 subset.setY((dest.y() - tile.y()) / scale.height()); 382 subset.setY((dest.y() - tile.y()) / scale.height());
383 subset.setWidth(dest.width() / scale.width()); 383 subset.setWidth(dest.width() / scale.width());
384 subset.setHeight(dest.height() / scale.height()); 384 subset.setHeight(dest.height() / scale.height());
385 385
386 return subset; 386 return subset;
387 } 387 }
388 388
389 } // namespace blink 389 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698