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

Unified Diff: cc/resources/bitmap_content_layer_updater.cc

Issue 24486002: BitmapContentLayerUpdater shouldn't reallocate bitmap smaller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | cc/resources/content_layer_updater.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/bitmap_content_layer_updater.cc
diff --git a/cc/resources/bitmap_content_layer_updater.cc b/cc/resources/bitmap_content_layer_updater.cc
index 75b99c54b81fedb7dfe94355634acbc05706002a..26aee92cbfcd45a559dfd811bbdd207164a643c6 100644
--- a/cc/resources/bitmap_content_layer_updater.cc
+++ b/cc/resources/bitmap_content_layer_updater.cc
@@ -61,7 +61,8 @@ void BitmapContentLayerUpdater::PrepareToUpdate(
gfx::Rect* resulting_opaque_rect) {
devtools_instrumentation::ScopedLayerTask paint_layer(
devtools_instrumentation::kPaintLayer, layer_id_);
- if (canvas_size_ != content_rect.size()) {
+ if (canvas_size_.width() < content_rect.size().width() ||
+ canvas_size_.height() < content_rect.size().height()) {
devtools_instrumentation::ScopedLayerTask paint_setup(
devtools_instrumentation::kPaintSetup, layer_id_);
canvas_size_ = content_rect.size();
@@ -72,7 +73,7 @@ void BitmapContentLayerUpdater::PrepareToUpdate(
base::TimeTicks start_time =
rendering_stats_instrumentation_->StartRecording();
PaintContents(canvas_.get(),
- content_rect.origin(),
+ content_rect,
contents_width_scale,
contents_height_scale,
resulting_opaque_rect);
@@ -89,12 +90,10 @@ void BitmapContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue,
gfx::Vector2d dest_offset,
bool partial_update) {
CHECK(canvas_);
- ResourceUpdate upload =
- ResourceUpdate::CreateFromCanvas(texture,
- canvas_,
- content_rect(),
- source_rect,
- dest_offset);
+ gfx::Rect canvas_rect = content_rect();
+ canvas_rect.set_size(canvas_size_);
+ ResourceUpdate upload = ResourceUpdate::CreateFromCanvas(
+ texture, canvas_, canvas_rect, source_rect, dest_offset);
if (partial_update)
queue->AppendPartialUpload(upload);
else
« no previous file with comments | « no previous file | cc/resources/content_layer_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698