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

Side by Side Diff: cc/CCTiledLayerImpl.cpp

Issue 10962042: [cc] Color evicted vs. invalidated checkerboard tiles differently (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #if USE(ACCELERATED_COMPOSITING) 7 #if USE(ACCELERATED_COMPOSITING)
8 8
9 #include "CCTiledLayerImpl.h" 9 #include "CCTiledLayerImpl.h"
10 10
(...skipping 17 matching lines...) Expand all
28 28
29 static const int debugTileBorderWidth = 1; 29 static const int debugTileBorderWidth = 1;
30 static const int debugTileBorderAlpha = 100; 30 static const int debugTileBorderAlpha = 100;
31 static const int debugTileBorderColorRed = 80; 31 static const int debugTileBorderColorRed = 80;
32 static const int debugTileBorderColorGreen = 200; 32 static const int debugTileBorderColorGreen = 200;
33 static const int debugTileBorderColorBlue = 200; 33 static const int debugTileBorderColorBlue = 200;
34 static const int debugTileBorderMissingTileColorRed = 255; 34 static const int debugTileBorderMissingTileColorRed = 255;
35 static const int debugTileBorderMissingTileColorGreen = 0; 35 static const int debugTileBorderMissingTileColorGreen = 0;
36 static const int debugTileBorderMissingTileColorBlue = 0; 36 static const int debugTileBorderMissingTileColorBlue = 0;
37 37
38 static const int defaultCheckerboardColorRed = 241;
39 static const int defaultCheckerboardColorGreen = 241;
40 static const int defaultCheckerboardColorBlue = 241;
41 static const int debugTileEvictedCheckerboardColorRed = 255;
42 static const int debugTileEvictedCheckerboardColorGreen = 200;
43 static const int debugTileEvictedCheckerboardColorBlue = 200;
44 static const int debugTileInvalidatedCheckerboardColorRed = 128;
45 static const int debugTileInvalidatedCheckerboardColorGreen = 200;
46 static const int debugTileInvalidatedCheckerboardColorBlue = 245;
47
38 class DrawableTile : public CCLayerTilingData::Tile { 48 class DrawableTile : public CCLayerTilingData::Tile {
39 WTF_MAKE_NONCOPYABLE(DrawableTile); 49 WTF_MAKE_NONCOPYABLE(DrawableTile);
40 public: 50 public:
41 static PassOwnPtr<DrawableTile> create() { return adoptPtr(new DrawableTile( )); } 51 static PassOwnPtr<DrawableTile> create() { return adoptPtr(new DrawableTile( )); }
42 52
43 CCResourceProvider::ResourceId resourceId() const { return m_resourceId; } 53 CCResourceProvider::ResourceId resourceId() const { return m_resourceId; }
44 void setResourceId(CCResourceProvider::ResourceId resourceId) { m_resourceId = resourceId; } 54 void setResourceId(CCResourceProvider::ResourceId resourceId) { m_resourceId = resourceId; }
45 55
46 private: 56 private:
47 DrawableTile() : m_resourceId(0) { } 57 DrawableTile() : m_resourceId(0) { }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 DrawableTile* tile = tileAt(i, j); 151 DrawableTile* tile = tileAt(i, j);
142 IntRect tileRect = m_tiler->tileBounds(i, j); 152 IntRect tileRect = m_tiler->tileBounds(i, j);
143 IntRect displayRect = tileRect; 153 IntRect displayRect = tileRect;
144 tileRect.intersect(contentRect); 154 tileRect.intersect(contentRect);
145 155
146 // Skip empty tiles. 156 // Skip empty tiles.
147 if (tileRect.isEmpty()) 157 if (tileRect.isEmpty())
148 continue; 158 continue;
149 159
150 if (!tile || !tile->resourceId()) { 160 if (!tile || !tile->resourceId()) {
151 if (drawCheckerboardForMissingTiles()) 161 if (drawCheckerboardForMissingTiles()) {
152 appendQuadsData.hadMissingTiles |= quadSink.append(CCChecker boardDrawQuad::create(sharedQuadState, tileRect), appendQuadsData); 162 SkColor defaultColor = SkColorSetARGB(255, defaultCheckerboa rdColorRed, defaultCheckerboardColorGreen, defaultCheckerboardColorBlue);
jamesr 2012/09/21 22:28:08 SkColorSetRGB() is shorter if you don't have trans
153 else 163 SkColor evictedColor = SkColorSetARGB(255, debugTileEvictedC heckerboardColorRed, debugTileEvictedCheckerboardColorGreen, debugTileEvictedChe ckerboardColorBlue);
164 SkColor invalidatedColor = SkColorSetARGB(255, debugTileInva lidatedCheckerboardColorRed, debugTileEvictedCheckerboardColorGreen, debugTileEv ictedCheckerboardColorBlue);
165
166 SkColor checkerColor;
167 if (hasDebugBorders())
168 checkerColor = !tile ? evictedColor : invalidatedColor;
jamesr 2012/09/21 22:28:08 Hmm, I find ternaries on inverted bools a bit hard
169 else
170 checkerColor = defaultColor;
171
172 appendQuadsData.hadMissingTiles |= quadSink.append(CCChecker boardDrawQuad::create(sharedQuadState, tileRect, checkerColor), appendQuadsData) ;
173 } else
154 appendQuadsData.hadMissingTiles |= quadSink.append(CCSolidCo lorDrawQuad::create(sharedQuadState, tileRect, backgroundColor()), appendQuadsDa ta); 174 appendQuadsData.hadMissingTiles |= quadSink.append(CCSolidCo lorDrawQuad::create(sharedQuadState, tileRect, backgroundColor()), appendQuadsDa ta);
155 continue; 175 continue;
156 } 176 }
157 177
158 IntRect tileOpaqueRect = tile->opaqueRect(); 178 IntRect tileOpaqueRect = tile->opaqueRect();
159 tileOpaqueRect.intersect(contentRect); 179 tileOpaqueRect.intersect(contentRect);
160 180
161 // Keep track of how the top left has moved, so the texture can be 181 // Keep track of how the top left has moved, so the texture can be
162 // offset the same amount. 182 // offset the same amount.
163 IntSize displayOffset = tileRect.minXMinYCorner() - displayRect.minX MinYCorner(); 183 IntSize displayOffset = tileRect.minXMinYCorner() - displayRect.minX MinYCorner();
(...skipping 29 matching lines...) Expand all
193 213
194 void CCTiledLayerImpl::pushTileProperties(int i, int j, CCResourceProvider::Reso urceId resourceId, const IntRect& opaqueRect) 214 void CCTiledLayerImpl::pushTileProperties(int i, int j, CCResourceProvider::Reso urceId resourceId, const IntRect& opaqueRect)
195 { 215 {
196 DrawableTile* tile = tileAt(i, j); 216 DrawableTile* tile = tileAt(i, j);
197 if (!tile) 217 if (!tile)
198 tile = createTile(i, j); 218 tile = createTile(i, j);
199 tile->setResourceId(resourceId); 219 tile->setResourceId(resourceId);
200 tile->setOpaqueRect(opaqueRect); 220 tile->setOpaqueRect(opaqueRect);
201 } 221 }
202 222
223 void CCTiledLayerImpl::pushInvalidTile(int i, int j)
224 {
225 DrawableTile* tile = tileAt(i, j);
226 if (!tile)
227 tile = createTile(i, j);
228 tile->setResourceId(0);
229 tile->setOpaqueRect(IntRect());
230 }
231
203 Region CCTiledLayerImpl::visibleContentOpaqueRegion() const 232 Region CCTiledLayerImpl::visibleContentOpaqueRegion() const
204 { 233 {
205 if (m_skipsDraw) 234 if (m_skipsDraw)
206 return Region(); 235 return Region();
207 if (opaque()) 236 if (opaque())
208 return visibleContentRect(); 237 return visibleContentRect();
209 return m_tiler->opaqueRegionInContentRect(visibleContentRect()); 238 return m_tiler->opaqueRegionInContentRect(visibleContentRect());
210 } 239 }
211 240
212 void CCTiledLayerImpl::didLoseContext() 241 void CCTiledLayerImpl::didLoseContext()
213 { 242 {
214 m_tiler->reset(); 243 m_tiler->reset();
215 } 244 }
216 245
217 const char* CCTiledLayerImpl::layerTypeAsString() const 246 const char* CCTiledLayerImpl::layerTypeAsString() const
218 { 247 {
219 return "ContentLayer"; 248 return "ContentLayer";
220 } 249 }
221 250
222 } // namespace cc 251 } // namespace cc
223 252
224 #endif // USE(ACCELERATED_COMPOSITING) 253 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« cc/CCRendererGL.cpp ('K') | « cc/CCTiledLayerImpl.h ('k') | cc/ShaderChromium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698