summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorvmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-14 04:57:59 +0000
committervmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-14 04:57:59 +0000
commiteabd1732d9b306cfe229bdbde08907c0a70c25a1 (patch)
tree007d0d27033439947ec6f275fcfb84830c3a58ff /cc
parent36986daae4fb3e5875adc7cddca2fb704b9057dd (diff)
downloadchromium_src-eabd1732d9b306cfe229bdbde08907c0a70c25a1.zip
chromium_src-eabd1732d9b306cfe229bdbde08907c0a70c25a1.tar.gz
chromium_src-eabd1732d9b306cfe229bdbde08907c0a70c25a1.tar.bz2
cc: Don't consider padding for analysis.
Currently we analyze exactly what we raster. However, there are cases like edge tiles on a layer that are padded, so that the shader samples non-garbage values when it's interpolating the texture values. However, for analysis we don't need this padding, we can analyze just the integer canvas, which allows us to properly detect solid layer-edge tiles. Review URL: https://chromiumcodereview.appspot.com/14690020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/resources/picture_pile_impl.cc12
-rw-r--r--cc/resources/tile_manager.cc9
2 files changed, 14 insertions, 7 deletions
diff --git a/cc/resources/picture_pile_impl.cc b/cc/resources/picture_pile_impl.cc
index 8f2ef54..7cd06a8 100644
--- a/cc/resources/picture_pile_impl.cc
+++ b/cc/resources/picture_pile_impl.cc
@@ -246,17 +246,19 @@ void PicturePileImpl::AnalyzeInRect(gfx::Rect content_rect,
DCHECK(analysis);
TRACE_EVENT0("cc", "PicturePileImpl::AnalyzeInRect");
- content_rect.Intersect(gfx::Rect(gfx::ToCeiledSize(
- gfx::ScaleSize(tiling_.total_size(), contents_scale))));
+ gfx::Rect layer_rect = gfx::ToEnclosingRect(
+ gfx::ScaleRect(content_rect, 1.0f / contents_scale));
+
+ layer_rect.Intersect(gfx::Rect(tiling_.total_size()));
SkBitmap empty_bitmap;
empty_bitmap.setConfig(SkBitmap::kNo_Config,
- content_rect.width(),
- content_rect.height());
+ layer_rect.width(),
+ layer_rect.height());
skia::AnalysisDevice device(empty_bitmap);
skia::AnalysisCanvas canvas(&device);
- Raster(&canvas, content_rect, contents_scale, NULL);
+ Raster(&canvas, layer_rect, 1.0f, NULL);
analysis->is_solid_color = canvas.getColorIfSolid(&analysis->solid_color);
analysis->has_text = canvas.hasText();
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index bfa0a69..6a068a1 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -18,6 +18,7 @@
#include "cc/resources/resource_pool.h"
#include "cc/resources/tile.h"
#include "third_party/skia/include/core/SkDevice.h"
+#include "ui/gfx/rect_conversions.h"
namespace cc {
@@ -853,9 +854,13 @@ void TileManager::RunAnalyzeTask(
analysis->is_solid_color &= use_color_estimator;
if (metadata.prediction_benchmarking) {
- SkDevice device(SkBitmap::kARGB_8888_Config, rect.width(), rect.height());
+ gfx::Rect layer_rect = gfx::ToEnclosingRect(
+ gfx::ScaleRect(rect, 1.0f / contents_scale));
+
+ SkDevice device(
+ SkBitmap::kARGB_8888_Config, layer_rect.width(), layer_rect.height());
SkCanvas canvas(&device);
- picture_pile->Raster(&canvas, rect, contents_scale, NULL);
+ picture_pile->Raster(&canvas, layer_rect, 1.0f, NULL);
const SkBitmap bitmap = device.accessBitmap(false);
DCHECK_EQ(bitmap.rowBytes(),