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

Side by Side Diff: cc/tiled_layer.cc

Issue 11410021: Remove WTF and WebCore from cc/ and webkit/compositor_bindings/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix content_browsertests Created 8 years, 1 month 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
« no previous file with comments | « cc/tile_draw_quad.cc ('k') | cc/tiled_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
6
7 #include "cc/tiled_layer.h" 5 #include "cc/tiled_layer.h"
8 6
9 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "build/build_config.h"
10 #include "cc/geometry.h" 9 #include "cc/geometry.h"
11 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
12 #include "cc/layer_tree_host.h" 11 #include "cc/layer_tree_host.h"
13 #include "cc/overdraw_metrics.h" 12 #include "cc/overdraw_metrics.h"
14 #include "cc/tiled_layer_impl.h" 13 #include "cc/tiled_layer_impl.h"
15 #include "third_party/khronos/GLES2/gl2.h" 14 #include "third_party/khronos/GLES2/gl2.h"
16 #include "ui/gfx/rect_conversions.h" 15 #include "ui/gfx/rect_conversions.h"
17 16
18 using namespace std; 17 using namespace std;
19 using WebKit::WebTransformationMatrix; 18 using WebKit::WebTransformationMatrix;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 253
255 scoped_ptr<UpdatableTile> tile(UpdatableTile::create(updater()->createResour ce(resourceManager()))); 254 scoped_ptr<UpdatableTile> tile(UpdatableTile::create(updater()->createResour ce(resourceManager())));
256 tile->managedResource()->setDimensions(m_tiler->tileSize(), m_textureFormat) ; 255 tile->managedResource()->setDimensions(m_tiler->tileSize(), m_textureFormat) ;
257 256
258 UpdatableTile* addedTile = tile.get(); 257 UpdatableTile* addedTile = tile.get();
259 m_tiler->addTile(tile.PassAs<LayerTilingData::Tile>(), i, j); 258 m_tiler->addTile(tile.PassAs<LayerTilingData::Tile>(), i, j);
260 259
261 addedTile->dirtyRect = m_tiler->tileRect(addedTile); 260 addedTile->dirtyRect = m_tiler->tileRect(addedTile);
262 261
263 // Temporary diagnostic crash. 262 // Temporary diagnostic crash.
264 if (!addedTile) 263 CHECK(addedTile);
265 CRASH(); 264 CHECK(tileAt(i, j));
266 if (!tileAt(i, j))
267 CRASH();
268 265
269 return addedTile; 266 return addedTile;
270 } 267 }
271 268
272 void TiledLayer::setNeedsDisplayRect(const gfx::RectF& dirtyRect) 269 void TiledLayer::setNeedsDisplayRect(const gfx::RectF& dirtyRect)
273 { 270 {
274 invalidateContentRect(layerRectToContentRect(dirtyRect)); 271 invalidateContentRect(layerRectToContentRect(dirtyRect));
275 ContentsScalingLayer::setNeedsDisplayRect(dirtyRect); 272 ContentsScalingLayer::setNeedsDisplayRect(dirtyRect);
276 } 273 }
277 274
278 void TiledLayer::setUseLCDText(bool useLCDText) 275 void TiledLayer::setUseLCDText(bool useLCDText)
279 { 276 {
280 ContentsScalingLayer::setUseLCDText(useLCDText); 277 ContentsScalingLayer::setUseLCDText(useLCDText);
281 278
282 LayerTilingData::BorderTexelOption borderTexelOption; 279 LayerTilingData::BorderTexelOption borderTexelOption;
283 #if OS(ANDROID) 280 #if defined(OS_ANDROID)
284 // Always want border texels and GL_LINEAR due to pinch zoom. 281 // Always want border texels and GL_LINEAR due to pinch zoom.
285 borderTexelOption = LayerTilingData::HasBorderTexels; 282 borderTexelOption = LayerTilingData::HasBorderTexels;
286 #else 283 #else
287 borderTexelOption = useLCDText ? LayerTilingData::NoBorderTexels : LayerTili ngData::HasBorderTexels; 284 borderTexelOption = useLCDText ? LayerTilingData::NoBorderTexels : LayerTili ngData::HasBorderTexels;
288 #endif 285 #endif
289 setBorderTexelOption(borderTexelOption); 286 setBorderTexelOption(borderTexelOption);
290 } 287 }
291 288
292 void TiledLayer::invalidateContentRect(const gfx::Rect& contentRect) 289 void TiledLayer::invalidateContentRect(const gfx::Rect& contentRect)
293 { 290 {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 480
484 tile->updateRect = sourceRect; 481 tile->updateRect = sourceRect;
485 482
486 if (sourceRect.IsEmpty()) 483 if (sourceRect.IsEmpty())
487 continue; 484 continue;
488 485
489 const gfx::Point anchor = m_tiler->tileRect(tile).origin(); 486 const gfx::Point anchor = m_tiler->tileRect(tile).origin();
490 487
491 // Calculate tile-space rectangle to upload into. 488 // Calculate tile-space rectangle to upload into.
492 gfx::Vector2d destOffset = sourceRect.origin() - anchor; 489 gfx::Vector2d destOffset = sourceRect.origin() - anchor;
493 if (destOffset.x() < 0) 490 CHECK(destOffset.x() >= 0);
494 CRASH(); 491 CHECK(destOffset.y() >= 0);
495 if (destOffset.y() < 0)
496 CRASH();
497 492
498 // Offset from paint rectangle to this tile's dirty rectangle. 493 // Offset from paint rectangle to this tile's dirty rectangle.
499 gfx::Vector2d paintOffset = sourceRect.origin() - paintRect.origin() ; 494 gfx::Vector2d paintOffset = sourceRect.origin() - paintRect.origin() ;
500 if (paintOffset.x() < 0) 495 CHECK(paintOffset.x() >= 0);
501 CRASH(); 496 CHECK(paintOffset.y() >= 0);
502 if (paintOffset.y() < 0) 497 CHECK(paintOffset.x() + sourceRect.width() <= paintRect.width());
503 CRASH(); 498 CHECK(paintOffset.y() + sourceRect.height() <= paintRect.height());
504 if (paintOffset.x() + sourceRect.width() > paintRect.width())
505 CRASH();
506 if (paintOffset.y() + sourceRect.height() > paintRect.height())
507 CRASH();
508 499
509 tile->updaterResource()->update(queue, sourceRect, destOffset, tile- >partialUpdate, stats); 500 tile->updaterResource()->update(queue, sourceRect, destOffset, tile- >partialUpdate, stats);
510 if (occlusion) 501 if (occlusion)
511 occlusion->overdrawMetrics().didUpload(WebTransformationMatrix() , sourceRect, tile->opaqueRect()); 502 occlusion->overdrawMetrics().didUpload(WebTransformationMatrix() , sourceRect, tile->opaqueRect());
512 503
513 } 504 }
514 } 505 }
515 } 506 }
516 507
517 namespace { 508 namespace {
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 gfx::Rect prepaintRect = visibleContentRect(); 767 gfx::Rect prepaintRect = visibleContentRect();
777 prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns, 768 prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns,
778 -m_tiler->tileSize().height() * prepaintRows); 769 -m_tiler->tileSize().height() * prepaintRows);
779 gfx::Rect contentRect(gfx::Point(), contentBounds()); 770 gfx::Rect contentRect(gfx::Point(), contentBounds());
780 prepaintRect.Intersect(contentRect); 771 prepaintRect.Intersect(contentRect);
781 772
782 return prepaintRect; 773 return prepaintRect;
783 } 774 }
784 775
785 } // namespace cc 776 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tile_draw_quad.cc ('k') | cc/tiled_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698