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

Side by Side Diff: cc/test/fake_content_layer_client.cc

Issue 14230007: cc: Do GatherPixelRefs from skia at record time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compile fix Created 7 years, 8 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
« no previous file with comments | « cc/test/fake_content_layer_client.h ('k') | cc/test/fake_picture_pile_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cc/test/fake_content_layer_client.h" 5 #include "cc/test/fake_content_layer_client.h"
6 6
7 #include "third_party/skia/include/core/SkCanvas.h" 7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "ui/gfx/skia_util.h"
8 9
9 namespace cc { 10 namespace cc {
10 11
11 FakeContentLayerClient::FakeContentLayerClient() 12 FakeContentLayerClient::FakeContentLayerClient()
12 : paint_all_opaque_(false) { 13 : paint_all_opaque_(false) {
13 } 14 }
14 15
15 FakeContentLayerClient::~FakeContentLayerClient() { 16 FakeContentLayerClient::~FakeContentLayerClient() {
16 } 17 }
17 18
18 void FakeContentLayerClient::PaintContents(SkCanvas* canvas, 19 void FakeContentLayerClient::PaintContents(SkCanvas* canvas,
19 gfx::Rect rect, gfx::RectF* opaque_rect) { 20 gfx::Rect rect, gfx::RectF* opaque_rect) {
20 if (paint_all_opaque_) 21 if (paint_all_opaque_)
21 *opaque_rect = rect; 22 *opaque_rect = rect;
22 23
24 canvas->clipRect(gfx::RectToSkRect(rect));
23 for (RectPaintVector::const_iterator it = draw_rects_.begin(); 25 for (RectPaintVector::const_iterator it = draw_rects_.begin();
24 it < draw_rects_.end(); ++it) { 26 it != draw_rects_.end(); ++it) {
25 gfx::Rect rect = it->first; 27 gfx::Rect rect = it->first;
26 SkPaint paint = it->second; 28 const SkPaint& paint = it->second;
27 SkRect draw_rect = SkRect::MakeXYWH( 29 SkRect draw_rect = SkRect::MakeXYWH(
28 rect.x(), 30 rect.x(),
29 rect.y(), 31 rect.y(),
30 rect.width(), 32 rect.width(),
31 rect.height()); 33 rect.height());
32 canvas->drawRect(draw_rect, paint); 34 canvas->drawRect(draw_rect, paint);
33 } 35 }
36
37 for (BitmapVector::const_iterator it = draw_bitmaps_.begin();
38 it != draw_bitmaps_.end(); ++it) {
39 canvas->drawBitmap(it->first, it->second.x(), it->second.y());
40 }
34 } 41 }
35 42
36 } // namespace cc 43 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_content_layer_client.h ('k') | cc/test/fake_picture_pile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698