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

Side by Side Diff: cc/picture.cc

Issue 12316084: cc: Consolidate the analysis_canvas operations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: changed analysis location Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "base/debug/trace_event.h" 5 #include "base/debug/trace_event.h"
6 #include "cc/content_layer_client.h" 6 #include "cc/content_layer_client.h"
7 #include "cc/picture.h" 7 #include "cc/picture.h"
8 #include "cc/rendering_stats.h" 8 #include "cc/rendering_stats.h"
9 #include "skia/ext/analysis_canvas.h" 9 #include "skia/ext/analysis_canvas.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 DCHECK(picture_); 107 DCHECK(picture_);
108 108
109 canvas->save(); 109 canvas->save();
110 canvas->clipRect(gfx::RectToSkRect(content_rect)); 110 canvas->clipRect(gfx::RectToSkRect(content_rect));
111 canvas->scale(contents_scale, contents_scale); 111 canvas->scale(contents_scale, contents_scale);
112 canvas->translate(layer_rect_.x(), layer_rect_.y()); 112 canvas->translate(layer_rect_.x(), layer_rect_.y());
113 canvas->drawPicture(*picture_); 113 canvas->drawPicture(*picture_);
114 canvas->restore(); 114 canvas->restore();
115 } 115 }
116 116
117 bool Picture::IsCheapInRect(const gfx::Rect& layer_rect) const { 117 void Picture::AnalyzeInRect(skia::AnalysisCanvas* canvas,
118 TRACE_EVENT0("cc", "Picture::IsCheapInRect"); 118 const gfx::Rect& content_rect,
119 119 float contents_scale) {
120 SkBitmap emptyBitmap; 120 canvas->save();
121 emptyBitmap.setConfig(SkBitmap::kNo_Config, layer_rect.width(), 121 canvas->clipRect(gfx::RectToSkRect(content_rect));
122 layer_rect.height()); 122 canvas->scale(contents_scale, contents_scale);
123 skia::AnalysisDevice device(emptyBitmap); 123 canvas->translate(layer_rect_.x(), layer_rect_.y());
124 skia::AnalysisCanvas canvas(&device); 124 canvas->drawPicture(*picture_);
125 125 canvas->restore();
126 canvas.drawPicture(*picture_);
127 return canvas.isCheap();
128 } 126 }
129 127
130 void Picture::GatherPixelRefs(const gfx::Rect& layer_rect, 128 void Picture::GatherPixelRefs(const gfx::Rect& layer_rect,
131 std::list<skia::LazyPixelRef*>& pixel_ref_list) { 129 std::list<skia::LazyPixelRef*>& pixel_ref_list) {
132 DCHECK(picture_); 130 DCHECK(picture_);
133 SkData* pixel_refs = SkPictureUtils::GatherPixelRefs( 131 SkData* pixel_refs = SkPictureUtils::GatherPixelRefs(
134 picture_.get(), SkRect::MakeXYWH(layer_rect.x(), 132 picture_.get(), SkRect::MakeXYWH(layer_rect.x(),
135 layer_rect.y(), 133 layer_rect.y(),
136 layer_rect.width(), 134 layer_rect.width(),
137 layer_rect.height())); 135 layer_rect.height()));
(...skipping 11 matching lines...) Expand all
149 if (*refs && (*refs)->getURI() && !strncmp( 147 if (*refs && (*refs)->getURI() && !strncmp(
150 (*refs)->getURI(), labelLazyDecoded, 4)) { 148 (*refs)->getURI(), labelLazyDecoded, 4)) {
151 pixel_ref_list.push_back(static_cast<skia::LazyPixelRef*>(*refs)); 149 pixel_ref_list.push_back(static_cast<skia::LazyPixelRef*>(*refs));
152 } 150 }
153 refs++; 151 refs++;
154 } 152 }
155 pixel_refs->unref(); 153 pixel_refs->unref();
156 } 154 }
157 155
158 } // namespace cc 156 } // namespace cc
OLDNEW
« no previous file with comments | « cc/picture.h ('k') | cc/picture_layer_impl.cc » ('j') | cc/picture_pile_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698