| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 void ContentLayerDelegate::paintContents( | 70 void ContentLayerDelegate::paintContents( |
| 71 WebDisplayItemList* webDisplayItemList, const WebRect& clip, bool canPaintLC
DText, | 71 WebDisplayItemList* webDisplayItemList, const WebRect& clip, bool canPaintLC
DText, |
| 72 WebContentLayerClient::GraphicsContextStatus contextStatus) | 72 WebContentLayerClient::GraphicsContextStatus contextStatus) |
| 73 { | 73 { |
| 74 // Once Slimming Paint is fully implemented, this method will no longer | 74 // Once Slimming Paint is fully implemented, this method will no longer |
| 75 // be needed since Blink will be in charge of creating the display list | 75 // be needed since Blink will be in charge of creating the display list |
| 76 // during the document lifecylcle. | 76 // during the document lifecylcle. |
| 77 | 77 |
| 78 m_painter->displayItemList()->beginNewPaints(); |
| 79 |
| 78 // Some layers don't yet produce display lists. To handle such layers, we | 80 // Some layers don't yet produce display lists. To handle such layers, we |
| 79 // create a canvas backed by an SkPicture, and manually insert this | 81 // create a canvas backed by an SkPicture, and manually insert this |
| 80 // SkPicture into the WebDisplayItemList when the layer's display list is | 82 // SkPicture into the WebDisplayItemList when the layer's display list is |
| 81 // empty. | 83 // empty. |
| 82 SkPictureRecorder recorder; | 84 SkPictureRecorder recorder; |
| 83 RefPtr<SkPicture> picture; | 85 RefPtr<SkPicture> picture; |
| 84 SkCanvas* canvas = recorder.beginRecording(clip.width, clip.height); | 86 SkCanvas* canvas = recorder.beginRecording(clip.width, clip.height); |
| 85 canvas->save(); | 87 canvas->save(); |
| 86 canvas->translate(-clip.x, -clip.y); | 88 canvas->translate(-clip.x, -clip.y); |
| 87 canvas->clipRect(SkRect::MakeXYWH(clip.x, clip.y, clip.width, clip.height)); | 89 canvas->clipRect(SkRect::MakeXYWH(clip.x, clip.y, clip.width, clip.height)); |
| 88 paintContents(canvas, clip, canPaintLCDText, contextStatus); | 90 paintContents(canvas, clip, canPaintLCDText, contextStatus); |
| 89 canvas->restore(); | 91 canvas->restore(); |
| 90 picture = adoptRef(recorder.endRecording()); | 92 picture = adoptRef(recorder.endRecording()); |
| 91 | 93 |
| 92 ASSERT(m_painter->displayItemList()); | 94 m_painter->displayItemList()->endNewPaints(); |
| 93 | 95 |
| 94 const PaintList& paintList = m_painter->displayItemList()->paintList(); | 96 const PaintList& paintList = m_painter->displayItemList()->paintList(); |
| 95 for (PaintList::const_iterator it = paintList.begin(); it != paintList.end()
; ++it) | 97 for (PaintList::const_iterator it = paintList.begin(); it != paintList.end()
; ++it) |
| 96 (*it)->appendToWebDisplayItemList(webDisplayItemList); | 98 (*it)->appendToWebDisplayItemList(webDisplayItemList); |
| 97 } | 99 } |
| 98 | 100 |
| 99 } // namespace blink | 101 } // namespace blink |
| OLD | NEW |