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

Side by Side Diff: cc/resources/bitmap_content_layer_updater.cc

Issue 556463002: Revert of tryAllocPixels returns bool, allocPixels requires success (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/resources/bitmap_content_layer_updater.h" 5 #include "cc/resources/bitmap_content_layer_updater.h"
6 6
7 #include "cc/debug/devtools_instrumentation.h" 7 #include "cc/debug/devtools_instrumentation.h"
8 #include "cc/debug/rendering_stats_instrumentation.h" 8 #include "cc/debug/rendering_stats_instrumentation.h"
9 #include "cc/resources/layer_painter.h" 9 #include "cc/resources/layer_painter.h"
10 #include "cc/resources/prioritized_resource.h" 10 #include "cc/resources/prioritized_resource.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 void BitmapContentLayerUpdater::PrepareToUpdate( 57 void BitmapContentLayerUpdater::PrepareToUpdate(
58 const gfx::Rect& content_rect, 58 const gfx::Rect& content_rect,
59 const gfx::Size& tile_size, 59 const gfx::Size& tile_size,
60 float contents_width_scale, 60 float contents_width_scale,
61 float contents_height_scale, 61 float contents_height_scale,
62 gfx::Rect* resulting_opaque_rect) { 62 gfx::Rect* resulting_opaque_rect) {
63 if (canvas_size_ != content_rect.size()) { 63 if (canvas_size_ != content_rect.size()) {
64 devtools_instrumentation::ScopedLayerTask paint_setup( 64 devtools_instrumentation::ScopedLayerTask paint_setup(
65 devtools_instrumentation::kPaintSetup, layer_id_); 65 devtools_instrumentation::kPaintSetup, layer_id_);
66 canvas_size_ = content_rect.size(); 66 canvas_size_ = content_rect.size();
67 bitmap_backing_.allocN32Pixels( 67 bool alloc = bitmap_backing_.allocN32Pixels(
68 canvas_size_.width(), canvas_size_.height(), layer_is_opaque_); 68 canvas_size_.width(), canvas_size_.height(), layer_is_opaque_);
69 // TODO(danak): Remove when skia does the check for us: crbug.com/360384 69 // TODO(danak): Remove when skia does the check for us: crbug.com/360384
70 CHECK(alloc);
70 canvas_ = skia::AdoptRef(new SkCanvas(bitmap_backing_)); 71 canvas_ = skia::AdoptRef(new SkCanvas(bitmap_backing_));
71 DCHECK_EQ(content_rect.width(), canvas_->getBaseLayerSize().width()); 72 DCHECK_EQ(content_rect.width(), canvas_->getBaseLayerSize().width());
72 DCHECK_EQ(content_rect.height(), canvas_->getBaseLayerSize().height()); 73 DCHECK_EQ(content_rect.height(), canvas_->getBaseLayerSize().height());
73 } 74 }
74 75
75 base::TimeTicks start_time = 76 base::TimeTicks start_time =
76 rendering_stats_instrumentation_->StartRecording(); 77 rendering_stats_instrumentation_->StartRecording();
77 PaintContents(canvas_.get(), 78 PaintContents(canvas_.get(),
78 content_rect, 79 content_rect,
79 contents_width_scale, 80 contents_width_scale,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void BitmapContentLayerUpdater::SetOpaque(bool opaque) { 112 void BitmapContentLayerUpdater::SetOpaque(bool opaque) {
112 if (opaque != layer_is_opaque_) { 113 if (opaque != layer_is_opaque_) {
113 canvas_.clear(); 114 canvas_.clear();
114 canvas_size_ = gfx::Size(); 115 canvas_size_ = gfx::Size();
115 } 116 }
116 117
117 ContentLayerUpdater::SetOpaque(opaque); 118 ContentLayerUpdater::SetOpaque(opaque);
118 } 119 }
119 120
120 } // namespace cc 121 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/software_renderer.cc ('k') | chrome/browser/notifications/notification_conversion_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698