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

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: some missed intstuff Created 8 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 side-by-side diff with in-line comments
Download patch
Index: cc/scrollbar_layer.cc
diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc
index 50eadb7a279892bdb8b167f196edeecf79a19738..61ba98901b79b4caf468b93c4744422a26d5f6dd 100644
--- a/cc/scrollbar_layer.cc
+++ b/cc/scrollbar_layer.cc
@@ -12,6 +12,7 @@
#include "cc/layer_tree_host.h"
#include "cc/scrollbar_layer_impl.h"
#include "cc/texture_update_queue.h"
+#include "ui/gfx/size_conversions.h"
#include <public/WebRect.h>
using WebKit::WebRect;
@@ -135,9 +136,9 @@ bool ScrollbarLayer::needsContentsScale() const
return true;
}
-IntSize ScrollbarLayer::contentBounds() const
+gfx::Size ScrollbarLayer::contentBounds() const
{
- return IntSize(lroundf(bounds().width() * contentsScale()), lroundf(bounds().height() * contentsScale()));
+ return gfx::ToRoundedSize(bounds().Scale(contentsScale()));
}
class ScrollbarThumbPainter : public LayerPainter {
@@ -208,13 +209,13 @@ void ScrollbarLayer::createUpdaterIfNeeded()
m_thumb = m_thumbUpdater->createResource(layerTreeHost()->contentsTextureManager());
}
-void ScrollbarLayer::updatePart(CachingBitmapCanvasLayerUpdater* painter, LayerUpdater::Resource* texture, const IntRect& rect, TextureUpdateQueue& queue, RenderingStats& stats)
+void ScrollbarLayer::updatePart(CachingBitmapCanvasLayerUpdater* painter, LayerUpdater::Resource* texture, const gfx::Rect& rect, TextureUpdateQueue& 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.
@@ -239,7 +240,7 @@ void ScrollbarLayer::updatePart(CachingBitmapCanvasLayerUpdater* painter, LayerU
void ScrollbarLayer::setTexturePriorities(const PriorityCalculator&)
{
- if (contentBounds().isEmpty())
+ if (contentBounds().IsEmpty())
return;
createUpdaterIfNeeded();
@@ -254,7 +255,7 @@ void ScrollbarLayer::setTexturePriorities(const PriorityCalculator&)
m_foreTrack->texture()->setRequestPriority(PriorityCalculator::uiPriority(drawsToRoot));
}
if (m_thumb) {
- IntSize thumbSize = layerRectToContentRect(m_geometry->thumbRect(m_scrollbar.get())).size();
+ gfx::Size thumbSize = layerRectToContentRect(m_geometry->thumbRect(m_scrollbar.get())).size();
m_thumb->texture()->setDimensions(thumbSize, m_textureFormat);
m_thumb->texture()->setRequestPriority(PriorityCalculator::uiPriority(drawsToRoot));
}
@@ -262,21 +263,21 @@ void ScrollbarLayer::setTexturePriorities(const PriorityCalculator&)
void ScrollbarLayer::update(TextureUpdateQueue& queue, const OcclusionTracker*, RenderingStats& stats)
{
- if (contentBounds().isEmpty())
+ if (contentBounds().IsEmpty())
return;
createUpdaterIfNeeded();
- IntPoint scrollbarOrigin(m_scrollbar->location().x, m_scrollbar->location().y);
- IntRect contentRect = layerRectToContentRect(WebKit::WebRect(scrollbarOrigin.x(), scrollbarOrigin.y(), bounds().width(), bounds().height()));
+ gfx::Point scrollbarOrigin(m_scrollbar->location());
+ gfx::Rect contentRect = layerRectToContentRect(gfx::Rect(scrollbarOrigin, 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 = layerRectToContentRect(WebKit::WebRect(0, 0, thumbRect.width, thumbRect.height));
- if (!originThumbRect.isEmpty())
+ gfx::Rect originThumbRect = layerRectToContentRect(gfx::Rect(0, 0, thumbRect.width, thumbRect.height));
+ if (!originThumbRect.IsEmpty())
updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue, stats);
}
« cc/layer_tiling_data.cc ('K') | « 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