#include "base/auto_reset.h"
#include "base/basictypes.h"
#include "build/build_config.h"
+#include "cc/base/simple_enclosed_region.h"
#include "cc/layers/layer_impl.h"
#include "cc/layers/tiled_layer_impl.h"
#include "cc/resources/layer_updater.h"
i,
j,
tile->managed_resource()->resource_id(),
- tile->opaque_rect(),
tile->managed_resource()->contents_swizzled());
}
for (std::vector<UpdatableTile*>::const_iterator iter = invalid_tiles.begin();
gfx::Rect visible_tile_rect = gfx::IntersectRects(
tiler_->tile_bounds(i, j), visible_content_rect());
if (!draw_transform_is_animating() && occlusion &&
- occlusion->Occluded(
- render_target(), visible_tile_rect, draw_transform())) {
+ occlusion->GetCurrentOcclusionForLayer(draw_transform())
+ .IsOccluded(visible_tile_rect)) {
tile->occluded = true;
occluded_tile_count++;
} else {
const OcclusionTracker<Layer>* occlusion) {
// The update_rect should be in layer space. So we have to convert the
// paint_rect from content space to layer space.
- float width_scale =
- paint_properties().bounds.width() /
- static_cast<float>(content_bounds().width());
- float height_scale =
- paint_properties().bounds.height() /
- static_cast<float>(content_bounds().height());
+ float width_scale = 1 / draw_properties().contents_scale_x;
+ float height_scale = 1 / draw_properties().contents_scale_y;
update_rect_ = gfx::ScaleRect(update_rect, width_scale, height_scale);
// Calling PrepareToUpdate() calls into WebKit to paint, which may have the
// the SkCanvas until the paint finishes, so we grab a local reference here to
// hold the updater alive until the paint completes.
scoped_refptr<LayerUpdater> protector(Updater());
- gfx::Rect painted_opaque_rect;
- Updater()->PrepareToUpdate(paint_rect,
+ Updater()->PrepareToUpdate(content_bounds(),
+ paint_rect,
tiler_->tile_size(),
1.f / width_scale,
- 1.f / height_scale,
- &painted_opaque_rect);
+ 1.f / height_scale);
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
if (dirty_rect.IsEmpty())
continue;
- // Save what was painted opaque in the tile. Keep the old area if the
- // paint didn't touch it, and didn't paint some other part of the tile
- // opaque.
- gfx::Rect tile_painted_rect = gfx::IntersectRects(tile_rect, paint_rect);
- gfx::Rect tile_painted_opaque_rect =
- gfx::IntersectRects(tile_rect, painted_opaque_rect);
- if (!tile_painted_rect.IsEmpty()) {
- gfx::Rect paint_inside_tile_opaque_rect =
- gfx::IntersectRects(tile->opaque_rect(), tile_painted_rect);
- bool paint_inside_tile_opaque_rect_is_non_opaque =
- !paint_inside_tile_opaque_rect.IsEmpty() &&
- !tile_painted_opaque_rect.Contains(paint_inside_tile_opaque_rect);
- bool opaque_paint_not_inside_tile_opaque_rect =
- !tile_painted_opaque_rect.IsEmpty() &&
- !tile->opaque_rect().Contains(tile_painted_opaque_rect);
-
- if (paint_inside_tile_opaque_rect_is_non_opaque ||
- opaque_paint_not_inside_tile_opaque_rect)
- tile->set_opaque_rect(tile_painted_opaque_rect);
- }
-
// source_rect starts as a full-sized tile with border texels included.
gfx::Rect source_rect = tiler_->TileRect(tile);
source_rect.Intersect(dirty_rect);
}
}
-Region TiledLayer::VisibleContentOpaqueRegion() const {
+SimpleEnclosedRegion TiledLayer::VisibleContentOpaqueRegion() const {
if (skips_draw_)
- return Region();
- if (contents_opaque())
- return visible_content_rect();
- return tiler_->OpaqueRegionInContentRect(visible_content_rect());
+ return SimpleEnclosedRegion();
+ return Layer::VisibleContentOpaqueRegion();
}
void TiledLayer::ResetUpdateState() {