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

Unified Diff: cc/picture_pile_impl.cc

Issue 11466032: cc: Fix impl-side painting rasterization at >1 contents scales (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
« no previous file with comments | « cc/picture_pile_impl.h ('k') | cc/tile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture_pile_impl.cc
diff --git a/cc/picture_pile_impl.cc b/cc/picture_pile_impl.cc
index f8e56cc1083c31ded307e223609941075d5c0e64..ff136e513840048698269c0df7aaa050138b31b1 100644
--- a/cc/picture_pile_impl.cc
+++ b/cc/picture_pile_impl.cc
@@ -7,6 +7,7 @@
#include "cc/rendering_stats.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkSize.h"
+#include "ui/gfx/rect_conversions.h"
namespace cc {
@@ -45,21 +46,27 @@ scoped_refptr<PicturePileImpl> PicturePileImpl::CloneForDrawing() const {
void PicturePileImpl::Raster(
SkCanvas* canvas,
- gfx::Rect rect,
+ gfx::Rect content_rect,
float contents_scale,
RenderingStats* stats) {
base::TimeTicks rasterizeBeginTime = base::TimeTicks::Now();
// TODO(enne): do this more efficiently, i.e. top down with Skia clips
canvas->save();
- canvas->translate(-rect.x(), -rect.y());
- SkRect layer_skrect = SkRect::MakeXYWH(rect.x(), rect.y(),
- rect.width(), rect.height());
+ canvas->translate(-content_rect.x(), -content_rect.y());
+ SkRect layer_skrect = SkRect::MakeXYWH(
+ content_rect.x(),
+ content_rect.y(),
+ content_rect.width(),
+ content_rect.height());
canvas->clipRect(layer_skrect);
canvas->scale(contents_scale, contents_scale);
+
+ gfx::Rect layer_rect = gfx::ToEnclosedRect(gfx::ScaleRect(gfx::RectF(content_rect), 1 / contents_scale));
+
for (PicturePile::Pile::const_iterator i = pile_.begin();
i != pile_.end(); ++i) {
- if (!(*i)->LayerRect().Intersects(rect))
+ if (!(*i)->LayerRect().Intersects(layer_rect))
continue;
(*i)->Raster(canvas);
« no previous file with comments | « cc/picture_pile_impl.h ('k') | cc/tile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698