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

Side by Side Diff: Source/platform/graphics/GraphicsContext.h

Issue 303613002: Avoid redundant initialization of GraphicsContextState. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: pass reference to copy functions Created 6 years, 7 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, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008-2009 Torch Mobile, Inc. 3 * Copyright (C) 2008-2009 Torch Mobile, Inc.
4 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 455
456 // Apply deferred paint state saves 456 // Apply deferred paint state saves
457 void realizePaintSave() 457 void realizePaintSave()
458 { 458 {
459 if (contextDisabled()) 459 if (contextDisabled())
460 return; 460 return;
461 461
462 if (m_paintState->saveCount()) { 462 if (m_paintState->saveCount()) {
463 m_paintState->decrementSaveCount(); 463 m_paintState->decrementSaveCount();
464 ++m_paintStateIndex; 464 ++m_paintStateIndex;
465 if (m_paintStateStack.size() == m_paintStateIndex) 465 if (m_paintStateStack.size() == m_paintStateIndex) {
466 m_paintStateStack.append(GraphicsContextState::create()); 466 m_paintStateStack.append(GraphicsContextState::createAndCopy(*m_ paintState));
467 GraphicsContextState* priorPaintState = m_paintState; 467 m_paintState = m_paintStateStack[m_paintStateIndex].get();
468 m_paintState = m_paintStateStack[m_paintStateIndex].get(); 468 } else {
469 m_paintState->copy(priorPaintState); 469 GraphicsContextState* priorPaintState = m_paintState;
470 m_paintState = m_paintStateStack[m_paintStateIndex].get();
471 m_paintState->copy(*priorPaintState);
472 }
470 } 473 }
471 } 474 }
472 475
473 // Apply deferred canvas state saves 476 // Apply deferred canvas state saves
474 void realizeCanvasSave() 477 void realizeCanvasSave()
475 { 478 {
476 if (!m_pendingCanvasSave || contextDisabled()) 479 if (!m_pendingCanvasSave || contextDisabled())
477 return; 480 return;
478 481
479 m_canvas->save(); 482 m_canvas->save();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 bool m_updatingControlTints : 1; 535 bool m_updatingControlTints : 1;
533 bool m_accelerated : 1; 536 bool m_accelerated : 1;
534 bool m_isCertainlyOpaque : 1; 537 bool m_isCertainlyOpaque : 1;
535 bool m_printing : 1; 538 bool m_printing : 1;
536 bool m_antialiasHairlineImages : 1; 539 bool m_antialiasHairlineImages : 1;
537 }; 540 };
538 541
539 } // namespace WebCore 542 } // namespace WebCore
540 543
541 #endif // GraphicsContext_h 544 #endif // GraphicsContext_h
OLDNEW
« no previous file with comments | « no previous file | Source/platform/graphics/GraphicsContextState.h » ('j') | Source/platform/graphics/GraphicsContextState.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698