Index: cc/picture_image_layer_impl.cc |
diff --git a/cc/picture_image_layer_impl.cc b/cc/picture_image_layer_impl.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..15d3b25552ebd13454b667aaab78901f42364028 |
--- /dev/null |
+++ b/cc/picture_image_layer_impl.cc |
@@ -0,0 +1,52 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "cc/picture_image_layer_impl.h" |
+ |
+#include "cc/debug_colors.h" |
+#include "cc/layer_tree_impl.h" |
+ |
+namespace cc { |
+ |
+PictureImageLayerImpl::PictureImageLayerImpl(LayerTreeImpl* treeImpl, int id) |
+ : PictureLayerImpl(treeImpl, id) { |
+} |
+ |
+PictureImageLayerImpl::~PictureImageLayerImpl() { |
+} |
+ |
+const char* PictureImageLayerImpl::layerTypeAsString() const { |
+ return "PictureImageLayer"; |
+} |
+ |
+scoped_ptr<LayerImpl> PictureImageLayerImpl::createLayerImpl( |
+ LayerTreeImpl* treeImpl) { |
+ return PictureImageLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>(); |
+} |
+ |
+void PictureImageLayerImpl::getDebugBorderProperties( |
+ SkColor* color, float* width) const { |
+ *color = DebugColors::ImageLayerBorderColor(); |
+ *width = DebugColors::ImageLayerBorderWidth(layerTreeImpl()); |
+} |
+ |
+void PictureImageLayerImpl::CalculateRasterContentsScale( |
+ bool animating_transform_to_screen, |
+ float* raster_contents_scale, |
+ float* low_res_raster_contents_scale) { |
+ // Don't scale images during rastering to ensure image quality, save memory |
+ // and avoid frequent re-rastering on change of scale. |
+ float min_contents_scale = layerTreeImpl()->settings().minimumContentsScale; |
+ if (ideal_contents_scale_ != min_contents_scale) { |
enne (OOO)
2013/02/22 23:53:32
No, I think this is still wrong.
min_contents_sca
Xianzhu
2013/02/23 00:05:20
Yes, this is the case in the 'if' block (normally
enne (OOO)
2013/02/23 01:10:55
You convinced me in comment #13 that having low re
Xianzhu
2013/02/23 01:17:19
Done :)
|
+ *raster_contents_scale = std::max(1.f, min_contents_scale); |
+ } else { |
+ // ... except that the contents scale is very small, to save memory. |
+ *raster_contents_scale = ideal_contents_scale_; |
+ } |
+ |
+ // We don't need low res tiles. |
+ *low_res_raster_contents_scale = *raster_contents_scale; |
+} |
+ |
+} // namespace cc |