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

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

Issue 2653963002: [Experimental] Supporting OOPIF printing
Patch Set: Rename service, fix for webview, and connect to DiscardableMemoryManager Created 3 years, 8 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 (createEmptyPaintRecord())); 293 (createEmptyPaintRecord()));
294 return emptyPaintRecord; 294 return emptyPaintRecord;
295 } 295 }
296 296
297 sk_sp<PaintRecord> record = m_paintRecorder.finishRecordingAsPicture(); 297 sk_sp<PaintRecord> record = m_paintRecorder.finishRecordingAsPicture();
298 m_canvas = nullptr; 298 m_canvas = nullptr;
299 DCHECK(record); 299 DCHECK(record);
300 return record; 300 return record;
301 } 301 }
302 302
303 sk_sp<SkDrawable> GraphicsContext::endRecordingAsDrawable() {
304 if (contextDisabled()) {
305 return nullptr;
306 }
307
308 sk_sp<SkDrawable> drawable = m_paintRecorder.finishRecordingAsDrawable();
309 m_canvas = nullptr;
310 DCHECK(drawable);
311 return drawable;
312 }
313
303 void GraphicsContext::drawRecord(const PaintRecord* record) { 314 void GraphicsContext::drawRecord(const PaintRecord* record) {
304 if (contextDisabled() || !record || record->cullRect().isEmpty()) 315 if (contextDisabled() || !record || record->cullRect().isEmpty())
305 return; 316 return;
306 317
307 DCHECK(m_canvas); 318 DCHECK(m_canvas);
308 m_canvas->drawPicture(record); 319 m_canvas->drawPicture(record);
309 } 320 }
310 321
322 void GraphicsContext::drawDrawable(const SkDrawable* drawable) {
323 if (contextDisabled() || !drawable)
324 return;
325
326 DCHECK(m_canvas);
327 m_canvas->drawDrawable((SkDrawable*)drawable, nullptr);
328 }
329
311 void GraphicsContext::compositeRecord(sk_sp<PaintRecord> record, 330 void GraphicsContext::compositeRecord(sk_sp<PaintRecord> record,
312 const FloatRect& dest, 331 const FloatRect& dest,
313 const FloatRect& src, 332 const FloatRect& src,
314 SkBlendMode op) { 333 SkBlendMode op) {
315 if (contextDisabled() || !record) 334 if (contextDisabled() || !record)
316 return; 335 return;
317 DCHECK(m_canvas); 336 DCHECK(m_canvas);
318 337
319 PaintFlags flags; 338 PaintFlags flags;
320 flags.setBlendMode(op); 339 flags.setBlendMode(op);
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 break; 1358 break;
1340 default: 1359 default:
1341 NOTREACHED(); 1360 NOTREACHED();
1342 break; 1361 break;
1343 } 1362 }
1344 1363
1345 return nullptr; 1364 return nullptr;
1346 } 1365 }
1347 1366
1348 } // namespace blink 1367 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698