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

Side by Side Diff: trunk/src/cc/resources/content_layer_updater.cc

Issue 100923002: Revert 225751 "BitmapContentLayerUpdater shouldn't reallocate bi..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
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/content_layer_updater.h" 5 #include "cc/resources/content_layer_updater.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "cc/debug/rendering_stats_instrumentation.h" 9 #include "cc/debug/rendering_stats_instrumentation.h"
10 #include "cc/resources/layer_painter.h" 10 #include "cc/resources/layer_painter.h"
(...skipping 17 matching lines...) Expand all
28 layer_is_opaque_(false) {} 28 layer_is_opaque_(false) {}
29 29
30 ContentLayerUpdater::~ContentLayerUpdater() {} 30 ContentLayerUpdater::~ContentLayerUpdater() {}
31 31
32 void ContentLayerUpdater::set_rendering_stats_instrumentation( 32 void ContentLayerUpdater::set_rendering_stats_instrumentation(
33 RenderingStatsInstrumentation* rsi) { 33 RenderingStatsInstrumentation* rsi) {
34 rendering_stats_instrumentation_ = rsi; 34 rendering_stats_instrumentation_ = rsi;
35 } 35 }
36 36
37 void ContentLayerUpdater::PaintContents(SkCanvas* canvas, 37 void ContentLayerUpdater::PaintContents(SkCanvas* canvas,
38 gfx::Rect content_rect, 38 gfx::Point origin,
39 float contents_width_scale, 39 float contents_width_scale,
40 float contents_height_scale, 40 float contents_height_scale,
41 gfx::Rect* resulting_opaque_rect) { 41 gfx::Rect* resulting_opaque_rect) {
42 TRACE_EVENT2("cc", 42 TRACE_EVENT0("cc", "ContentLayerUpdater::PaintContents");
43 "ContentLayerUpdater::PaintContents",
44 "width",
45 content_rect.width(),
46 "height",
47 content_rect.height());
48 gfx::Point origin = content_rect.origin();
49 canvas->save(); 43 canvas->save();
50 canvas->translate(SkFloatToScalar(-origin.x()), 44 canvas->translate(SkFloatToScalar(-origin.x()),
51 SkFloatToScalar(-origin.y())); 45 SkFloatToScalar(-origin.y()));
52 46
47 SkBaseDevice* device = canvas->getDevice();
48 gfx::Rect content_rect(origin, gfx::Size(device->width(), device->height()));
49
53 gfx::Rect layer_rect = content_rect; 50 gfx::Rect layer_rect = content_rect;
51
54 if (contents_width_scale != 1.f || contents_height_scale != 1.f) { 52 if (contents_width_scale != 1.f || contents_height_scale != 1.f) {
55 canvas->scale(SkFloatToScalar(contents_width_scale), 53 canvas->scale(SkFloatToScalar(contents_width_scale),
56 SkFloatToScalar(contents_height_scale)); 54 SkFloatToScalar(contents_height_scale));
57 55
58 layer_rect = gfx::ScaleToEnclosingRect( 56 layer_rect = gfx::ScaleToEnclosingRect(
59 content_rect, 1.f / contents_width_scale, 1.f / contents_height_scale); 57 content_rect, 1.f / contents_width_scale, 1.f / contents_height_scale);
60 } 58 }
61 59
62 SkRect layer_sk_rect = SkRect::MakeXYWH( 60 SkRect layer_sk_rect = SkRect::MakeXYWH(
63 layer_rect.x(), layer_rect.y(), layer_rect.width(), layer_rect.height()); 61 layer_rect.x(), layer_rect.y(), layer_rect.width(), layer_rect.height());
(...skipping 16 matching lines...) Expand all
80 *resulting_opaque_rect = opaque_content_rect; 78 *resulting_opaque_rect = opaque_content_rect;
81 79
82 content_rect_ = content_rect; 80 content_rect_ = content_rect;
83 } 81 }
84 82
85 void ContentLayerUpdater::SetOpaque(bool opaque) { 83 void ContentLayerUpdater::SetOpaque(bool opaque) {
86 layer_is_opaque_ = opaque; 84 layer_is_opaque_ = opaque;
87 } 85 }
88 86
89 } // namespace cc 87 } // namespace cc
OLDNEW
« no previous file with comments | « trunk/src/cc/resources/content_layer_updater.h ('k') | trunk/src/cc/resources/skpicture_content_layer_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698