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

Unified Diff: cc/scrollbar_layer.cc

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScaleAsVector 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/scrollbar_layer.h ('k') | cc/scrollbar_layer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scrollbar_layer.cc
diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc
index 87b9e6b95e71bbe6230693d010a9b1e0c34f4ad3..cb648c861c1fc1ad1a4d6b7fc1ac36282995fb99 100644
--- a/cc/scrollbar_layer.cc
+++ b/cc/scrollbar_layer.cc
@@ -12,6 +12,7 @@
#include "cc/layer_tree_host.h"
#include "cc/resource_update_queue.h"
#include "cc/scrollbar_layer_impl.h"
+#include "ui/gfx/rect_conversions.h"
#include <public/WebRect.h>
using WebKit::WebRect;
@@ -198,13 +199,13 @@ void ScrollbarLayer::createUpdaterIfNeeded()
m_thumb = m_thumbUpdater->createResource(layerTreeHost()->contentsTextureManager());
}
-void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, LayerUpdater::Resource* texture, const IntRect& rect, ResourceUpdateQueue& queue, RenderingStats& stats)
+void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, LayerUpdater::Resource* texture, const gfx::Rect& rect, ResourceUpdateQueue& queue, RenderingStats& stats)
{
// Skip painting and uploading if there are no invalidations and
// we already have valid texture data.
if (texture->texture()->haveBackingTexture()
&& texture->texture()->size() == rect.size()
- && m_updateRect.isEmpty())
+ && m_updateRect.IsEmpty())
return;
// We should always have enough memory for UI.
@@ -224,18 +225,17 @@ void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, Layer
texture->update(queue, rect, destOffset, false, stats);
}
-IntRect ScrollbarLayer::scrollbarLayerRectToContentRect(const WebRect& layerRect) const
+gfx::Rect ScrollbarLayer::scrollbarLayerRectToContentRect(const gfx::Rect& layerRect) const
{
// Don't intersect with the bounds as in layerRectToContentRect() because
// layerRect here might be in coordinates of the containing layer.
- FloatRect contentRect(layerRect.x, layerRect.y, layerRect.width, layerRect.height);
- contentRect.scale(contentsScaleX(), contentsScaleY());
- return enclosingIntRect(contentRect);
+ gfx::RectF contentRect = gfx::ScaleRect(layerRect, contentsScaleX(), contentsScaleY());
+ return gfx::ToEnclosingRect(contentRect);
}
void ScrollbarLayer::setTexturePriorities(const PriorityCalculator&)
{
- if (contentBounds().isEmpty())
+ if (contentBounds().IsEmpty())
return;
createUpdaterIfNeeded();
@@ -250,7 +250,7 @@ void ScrollbarLayer::setTexturePriorities(const PriorityCalculator&)
m_foreTrack->texture()->setRequestPriority(PriorityCalculator::uiPriority(drawsToRoot));
}
if (m_thumb) {
- IntSize thumbSize = scrollbarLayerRectToContentRect(m_geometry->thumbRect(m_scrollbar.get())).size();
+ gfx::Size thumbSize = scrollbarLayerRectToContentRect(m_geometry->thumbRect(m_scrollbar.get())).size();
m_thumb->texture()->setDimensions(thumbSize, m_textureFormat);
m_thumb->texture()->setRequestPriority(PriorityCalculator::uiPriority(drawsToRoot));
}
@@ -258,20 +258,20 @@ void ScrollbarLayer::setTexturePriorities(const PriorityCalculator&)
void ScrollbarLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker*, RenderingStats& stats)
{
- if (contentBounds().isEmpty())
+ if (contentBounds().IsEmpty())
return;
createUpdaterIfNeeded();
- IntRect contentRect = scrollbarLayerRectToContentRect(WebRect(m_scrollbar->location().x, m_scrollbar->location().y, bounds().width(), bounds().height()));
+ gfx::Rect contentRect = scrollbarLayerRectToContentRect(gfx::Rect(m_scrollbar->location(), bounds()));
updatePart(m_backTrackUpdater.get(), m_backTrack.get(), contentRect, queue, stats);
if (m_foreTrack && m_foreTrackUpdater)
updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, queue, stats);
// Consider the thumb to be at the origin when painting.
WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get());
- IntRect originThumbRect = scrollbarLayerRectToContentRect(WebRect(0, 0, thumbRect.width, thumbRect.height));
- if (!originThumbRect.isEmpty())
+ gfx::Rect originThumbRect = scrollbarLayerRectToContentRect(gfx::Rect(0, 0, thumbRect.width, thumbRect.height));
+ if (!originThumbRect.IsEmpty())
updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue, stats);
}
« no previous file with comments | « cc/scrollbar_layer.h ('k') | cc/scrollbar_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698