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

Unified Diff: cc/picture_image_layer_impl.cc

Issue 12326022: Efficiently handle image layer scaling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle sublayerTransform and anchor point Created 7 years, 10 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/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..73b48e7d40a32aaaf80e05e3a64e6022f57a48b0
--- /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.
+ if (ideal_contents_scale_ >
enne (OOO) 2013/02/22 00:10:49 I don't understand this math. If the ideal conten
Xianzhu 2013/02/22 00:53:30 Actually I meant 'ideal_contents_scale_ != minimum
enne (OOO) 2013/02/22 01:18:18 Ok. Maybe there's more work to be done here befor
Xianzhu 2013/02/22 23:24:38 Added std::max in the 'if' block, but still kept t
+ layerTreeImpl()->settings().minimumContentsScale) {
+ *raster_contents_scale = 1.f;
+ }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

Powered by Google App Engine
This is Rietveld 408576698