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

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

Issue 2889653002: Remove cullRect() from PaintOpBuffer. (Closed)
Patch Set: movecullrect2 rebase-once-and-for-all Created 3 years, 6 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // Arbitrary tiling is currently only supported for SkPictureShader, so we use 239 // Arbitrary tiling is currently only supported for SkPictureShader, so we use
240 // that instead of a plain bitmap shader to implement spacing. 240 // that instead of a plain bitmap shader to implement spacing.
241 const SkRect tile_rect = 241 const SkRect tile_rect =
242 SkRect::MakeWH(image.sk_image()->width() + spacing.Width(), 242 SkRect::MakeWH(image.sk_image()->width() + spacing.Width(),
243 image.sk_image()->height() + spacing.Height()); 243 image.sk_image()->height() + spacing.Height());
244 244
245 PaintRecorder recorder; 245 PaintRecorder recorder;
246 PaintCanvas* canvas = recorder.beginRecording(tile_rect); 246 PaintCanvas* canvas = recorder.beginRecording(tile_rect);
247 canvas->drawImage(image, 0, 0, &paint); 247 canvas->drawImage(image, 0, 0, &paint);
248 248
249 return MakePaintShaderRecord(recorder.finishRecordingAsPicture(), tmx, tmy, 249 return MakePaintShaderRecord(recorder.finishRecordingAsPicture(), tile_rect,
250 &shader_matrix, nullptr); 250 tmx, tmy, &shader_matrix);
251 } 251 }
252 252
253 SkShader::TileMode ComputeTileMode(float left, 253 SkShader::TileMode ComputeTileMode(float left,
254 float right, 254 float right,
255 float min, 255 float min,
256 float max) { 256 float max) {
257 DCHECK(left < right); 257 DCHECK(left < right);
258 return left >= min && right <= max ? SkShader::kClamp_TileMode 258 return left >= min && right <= max ? SkShader::kClamp_TileMode
259 : SkShader::kRepeat_TileMode; 259 : SkShader::kRepeat_TileMode;
260 } 260 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 FloatRect subset = dest; 398 FloatRect subset = dest;
399 subset.SetX((dest.X() - tile.X()) / scale.Width()); 399 subset.SetX((dest.X() - tile.X()) / scale.Width());
400 subset.SetY((dest.Y() - tile.Y()) / scale.Height()); 400 subset.SetY((dest.Y() - tile.Y()) / scale.Height());
401 subset.SetWidth(dest.Width() / scale.Width()); 401 subset.SetWidth(dest.Width() / scale.Width());
402 subset.SetHeight(dest.Height() / scale.Height()); 402 subset.SetHeight(dest.Height() / scale.Height());
403 403
404 return subset; 404 return subset;
405 } 405 }
406 406
407 } // namespace blink 407 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698