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

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

Issue 1379883003: Create PaintChunk and begin writing code to build paint chunks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enable RuntimeEnabledFeature for PaintChunkerTest Created 5 years, 2 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "platform/graphics/paint/PaintChunker.h"
7
8 #include "platform/RuntimeEnabledFeatures.h"
9
10 namespace blink {
11
12 PaintChunker::PaintChunker()
13 {
14 }
15
16 PaintChunker::~PaintChunker()
17 {
18 }
19
20 void PaintChunker::updateCurrentPaintProperties(const PaintProperties& propertie s)
21 {
22 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
23
24 m_currentProperties = properties;
25 }
26
27 void PaintChunker::incrementDisplayItemIndex()
28 {
29 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
30
31 if (m_chunks.isEmpty()) {
32 PaintChunk newChunk(0, 1, m_currentProperties);
33 m_chunks.append(newChunk);
34 return;
35 }
36
37 auto& lastChunk = m_chunks.last();
38 if (m_currentProperties == lastChunk.properties) {
39 lastChunk.endIndex++;
40 return;
41 }
42
43 PaintChunk newChunk(lastChunk.endIndex, lastChunk.endIndex + 1, m_currentPro perties);
44 m_chunks.append(newChunk);
45 }
46
47 void PaintChunker::decrementDisplayItemIndex()
48 {
49 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
50 ASSERT(!m_chunks.isEmpty());
51
52 auto& lastChunk = m_chunks.last();
53 if ((lastChunk.endIndex - lastChunk.beginIndex) > 1)
54 lastChunk.endIndex--;
55 else
56 m_chunks.removeLast();
57 }
58
59 Vector<PaintChunk> PaintChunker::releasePaintChunks()
60 {
61 Vector<PaintChunk> chunks;
62 chunks.swap(m_chunks);
63 m_currentProperties = PaintProperties();
64 return chunks;
65 }
66
67 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698