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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsContext.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) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 return empty_paint_record; 291 return empty_paint_record;
292 } 292 }
293 293
294 sk_sp<PaintRecord> record = paint_recorder_.finishRecordingAsPicture(); 294 sk_sp<PaintRecord> record = paint_recorder_.finishRecordingAsPicture();
295 canvas_ = nullptr; 295 canvas_ = nullptr;
296 DCHECK(record); 296 DCHECK(record);
297 return record; 297 return record;
298 } 298 }
299 299
300 void GraphicsContext::DrawRecord(sk_sp<const PaintRecord> record) { 300 void GraphicsContext::DrawRecord(sk_sp<const PaintRecord> record) {
301 if (ContextDisabled() || !record || record->cullRect().isEmpty()) 301 if (ContextDisabled() || !record || !record->size())
302 return; 302 return;
303 303
304 DCHECK(canvas_); 304 DCHECK(canvas_);
305 canvas_->drawPicture(std::move(record)); 305 canvas_->drawPicture(std::move(record));
306 } 306 }
307 307
308 void GraphicsContext::CompositeRecord(sk_sp<PaintRecord> record, 308 void GraphicsContext::CompositeRecord(sk_sp<PaintRecord> record,
309 const FloatRect& dest, 309 const FloatRect& dest,
310 const FloatRect& src, 310 const FloatRect& src,
311 SkBlendMode op) { 311 SkBlendMode op) {
312 if (ContextDisabled() || !record) 312 if (ContextDisabled() || !record)
313 return; 313 return;
314 DCHECK(canvas_); 314 DCHECK(canvas_);
315 315
316 PaintFlags flags; 316 PaintFlags flags;
317 flags.setBlendMode(op); 317 flags.setBlendMode(op);
318 canvas_->save(); 318 canvas_->save();
319 SkRect source_bounds = src; 319 SkRect source_bounds = src;
320 SkRect sk_bounds = dest; 320 SkRect sk_bounds = dest;
321 SkMatrix transform; 321 SkMatrix transform;
322 transform.setRectToRect(source_bounds, sk_bounds, SkMatrix::kFill_ScaleToFit); 322 transform.setRectToRect(source_bounds, sk_bounds, SkMatrix::kFill_ScaleToFit);
323 canvas_->concat(transform); 323 canvas_->concat(transform);
324 flags.setImageFilter(SkPictureImageFilter::MakeForLocalSpace( 324 flags.setImageFilter(SkPictureImageFilter::MakeForLocalSpace(
325 ToSkPicture(record), source_bounds, 325 ToSkPicture(record, source_bounds), source_bounds,
326 static_cast<SkFilterQuality>(ImageInterpolationQuality()))); 326 static_cast<SkFilterQuality>(ImageInterpolationQuality())));
327 canvas_->saveLayer(&source_bounds, &flags); 327 canvas_->saveLayer(&source_bounds, &flags);
328 canvas_->restore(); 328 canvas_->restore();
329 canvas_->restore(); 329 canvas_->restore();
330 } 330 }
331 331
332 namespace { 332 namespace {
333 333
334 int AdjustedFocusRingOffset(int offset) { 334 int AdjustedFocusRingOffset(int offset) {
335 #if OS(MACOSX) 335 #if OS(MACOSX)
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 break; 1271 break;
1272 default: 1272 default:
1273 NOTREACHED(); 1273 NOTREACHED();
1274 break; 1274 break;
1275 } 1275 }
1276 1276
1277 return nullptr; 1277 return nullptr;
1278 } 1278 }
1279 1279
1280 } // namespace blink 1280 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698