| Index: cc/image_layer.cc
|
| diff --git a/cc/image_layer.cc b/cc/image_layer.cc
|
| index f3819faf3dd236f478f694bd9f64f3a8211d4cd6..26dee60f8a4c7703d983186c05fe437120d4af9b 100644
|
| --- a/cc/image_layer.cc
|
| +++ b/cc/image_layer.cc
|
| @@ -36,6 +36,7 @@ void ImageLayer::setBitmap(const SkBitmap& bitmap)
|
| return;
|
|
|
| m_bitmap = bitmap;
|
| + didUpdateBounds();
|
| setNeedsDisplay();
|
| }
|
|
|
| @@ -74,9 +75,12 @@ LayerUpdater* ImageLayer::updater() const
|
| return m_updater.get();
|
| }
|
|
|
| -gfx::Size ImageLayer::contentBounds() const
|
| +void ImageLayer::setIdealContentsScale(float ideal_contents_scale)
|
| {
|
| - return gfx::Size(m_bitmap.width(), m_bitmap.height());
|
| + m_drawProperties.ideal_contents_scale = ideal_contents_scale;
|
| + m_drawProperties.contents_scale_x = contentsScaleX();
|
| + m_drawProperties.contents_scale_y = contentsScaleY();
|
| + m_drawProperties.content_bounds = gfx::Size(m_bitmap.width(), m_bitmap.height());
|
| }
|
|
|
| bool ImageLayer::drawsContent() const
|
| @@ -86,14 +90,14 @@ bool ImageLayer::drawsContent() const
|
|
|
| float ImageLayer::contentsScaleX() const
|
| {
|
| - if (bounds().IsEmpty() || contentBounds().IsEmpty())
|
| + if (bounds().IsEmpty() || m_bitmap.width() == 0)
|
| return 1;
|
| return static_cast<float>(m_bitmap.width()) / bounds().width();
|
| }
|
|
|
| float ImageLayer::contentsScaleY() const
|
| {
|
| - if (bounds().IsEmpty() || contentBounds().IsEmpty())
|
| + if (bounds().IsEmpty() || m_bitmap.height() == 0)
|
| return 1;
|
| return static_cast<float>(m_bitmap.height()) / bounds().height();
|
| }
|
|
|